Title: [154430] trunk
Revision
154430
Author
[email protected]
Date
2013-08-21 17:15:08 -0700 (Wed, 21 Aug 2013)

Log Message

Setting -webkit-filter: in :active selector causes failure to redraw
https://bugs.webkit.org/show_bug.cgi?id=120135

Source/WebCore:

Reviewed by Jer Noble.

When removing a filter on an inline child of a compositing layer,
the inline loses its RenderLayer and compositing layer, but we fail to
repaint the compositing layer that the inline is now painting into.

This worked correctly for opacity, because opacity toggles cause
layouts (which then paint the correct layer), so do the same for filters.

Test: css3/filters/remove-filter-repaint.html

* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::changeRequiresLayout): Return true if we toggled
between having filters and not. Drive-by cleanup, making use of new convenience
function for hasOpacity().
* rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::hasFilters): Returns true if we have any
filters.
* rendering/style/StyleRareNonInheritedData.h:
(WebCore::StyleRareNonInheritedData::hasOpacity): Convenience function that
returns true if opacity is < 1.

LayoutTests:

Reviewed by Jer Noble.

Ref test for removing a filter on an inline.

* css3/filters/remove-filter-repaint-expected.html: Added.
* css3/filters/remove-filter-repaint.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (154429 => 154430)


--- trunk/LayoutTests/ChangeLog	2013-08-21 23:34:39 UTC (rev 154429)
+++ trunk/LayoutTests/ChangeLog	2013-08-22 00:15:08 UTC (rev 154430)
@@ -1,3 +1,15 @@
+2013-08-21  Simon Fraser  <[email protected]>
+
+        Setting -webkit-filter: in :active selector causes failure to redraw
+        https://bugs.webkit.org/show_bug.cgi?id=120135
+
+        Reviewed by Jer Noble.
+        
+        Ref test for removing a filter on an inline.
+
+        * css3/filters/remove-filter-repaint-expected.html: Added.
+        * css3/filters/remove-filter-repaint.html: Added.
+
 2013-08-21  Yi Shen  <[email protected]>
 
         https://bugs.webkit.org/show_bug.cgi?id=119900

Added: trunk/LayoutTests/css3/filters/remove-filter-repaint-expected.html (0 => 154430)


--- trunk/LayoutTests/css3/filters/remove-filter-repaint-expected.html	                        (rev 0)
+++ trunk/LayoutTests/css3/filters/remove-filter-repaint-expected.html	2013-08-22 00:15:08 UTC (rev 154430)
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>filter-bug</title>
+    <style>
+    .backdrop {
+        position: absolute;
+        top: 0;
+        left: 0;
+        height: 100px;
+        width: 100px;
+        background-color: silver;
+    }
+
+    .overlay {
+        position: absolute;
+        top: 50px;
+        left: 50px;
+        width: 400px;
+        height: 100px;
+        background: gray;
+        box-shadow: 0 0 4px black;
+    }
+    
+    .play {
+        font-size: 36pt;
+        background-color: navy;
+        color: white;
+    }
+    .composited {
+        -webkit-transform: translateZ(0);
+    }
+    </style>
+</head>
+<body>
+    <div class="composited backdrop"></div>
+    <div class="overlay">
+        <span id="play" class="play changed">this should be visible</span>
+    </div>
+</body>
+</html>
\ No newline at end of file
Property changes on: trunk/LayoutTests/css3/filters/remove-filter-repaint-expected.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/css3/filters/remove-filter-repaint.html (0 => 154430)


--- trunk/LayoutTests/css3/filters/remove-filter-repaint.html	                        (rev 0)
+++ trunk/LayoutTests/css3/filters/remove-filter-repaint.html	2013-08-22 00:15:08 UTC (rev 154430)
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>filter-bug</title>
+    <style>
+    .backdrop {
+        position: absolute;
+        top: 0;
+        left: 0;
+        height: 100px;
+        width: 100px;
+        background-color: silver;
+    }
+
+    .overlay {
+        position: absolute;
+        top: 50px;
+        left: 50px;
+        width: 400px;
+        height: 100px;
+        background: gray;
+        box-shadow: 0 0 4px black;
+    }
+    
+    .play {
+        font-size: 36pt;
+        background-color: navy;
+        color: white;
+    }
+    .play.changed {
+        -webkit-filter: drop-shadow(black 0 0 5px);
+    }
+    .composited {
+        -webkit-transform: translateZ(0);
+    }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.waitUntilDone();
+        function doTest()
+        {
+            window.setTimeout(function() {
+                document.getElementById('play').classList.remove('changed');
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            }, 0);
+        }
+        window.addEventListener('load', doTest, false);
+    </script>
+</head>
+<body>
+    <div class="composited backdrop"></div>
+    <div class="overlay">
+        <span id="play" class="play changed">this should be visible</span>
+    </div>
+</body>
+</html>
\ No newline at end of file
Property changes on: trunk/LayoutTests/css3/filters/remove-filter-repaint.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (154429 => 154430)


--- trunk/Source/WebCore/ChangeLog	2013-08-21 23:34:39 UTC (rev 154429)
+++ trunk/Source/WebCore/ChangeLog	2013-08-22 00:15:08 UTC (rev 154430)
@@ -1,3 +1,30 @@
+2013-08-21  Simon Fraser  <[email protected]>
+
+        Setting -webkit-filter: in :active selector causes failure to redraw
+        https://bugs.webkit.org/show_bug.cgi?id=120135
+
+        Reviewed by Jer Noble.
+        
+        When removing a filter on an inline child of a compositing layer,
+        the inline loses its RenderLayer and compositing layer, but we fail to
+        repaint the compositing layer that the inline is now painting into.
+        
+        This worked correctly for opacity, because opacity toggles cause
+        layouts (which then paint the correct layer), so do the same for filters.
+
+        Test: css3/filters/remove-filter-repaint.html
+
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::changeRequiresLayout): Return true if we toggled
+        between having filters and not. Drive-by cleanup, making use of new convenience
+        function for hasOpacity().
+        * rendering/style/StyleRareNonInheritedData.cpp:
+        (WebCore::StyleRareNonInheritedData::hasFilters): Returns true if we have any
+        filters.
+        * rendering/style/StyleRareNonInheritedData.h:
+        (WebCore::StyleRareNonInheritedData::hasOpacity): Convenience function that
+        returns true if opacity is < 1.
+
 2013-08-21  Gavin Barraclough  <[email protected]>
 
         https://bugs.webkit.org/show_bug.cgi?id=120139

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (154429 => 154430)


--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2013-08-21 23:34:39 UTC (rev 154429)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2013-08-22 00:15:08 UTC (rev 154430)
@@ -597,8 +597,7 @@
     if ((visibility() == COLLAPSE) != (other->visibility() == COLLAPSE))
         return true;
 
-    if ((rareNonInheritedData->opacity == 1 && other->rareNonInheritedData->opacity < 1)
-        || (rareNonInheritedData->opacity < 1 && other->rareNonInheritedData->opacity == 1)) {
+    if (rareNonInheritedData->hasOpacity() != other->rareNonInheritedData->hasOpacity()) {
         // FIXME: We would like to use SimplifiedLayout here, but we can't quite do that yet.
         // We need to make sure SimplifiedLayout can operate correctly on RenderInlines (we will need
         // to add a selfNeedsSimplifiedLayout bit in order to not get confused and taint every line).
@@ -607,6 +606,11 @@
         return true;
     }
 
+#if ENABLE(CSS_FILTERS)
+    if (rareNonInheritedData->hasFilters() != other->rareNonInheritedData->hasFilters())
+        return true;
+#endif
+
     const QuotesData* quotesDataA = rareInheritedData->quotes.get();
     const QuotesData* quotesDataB = other->rareInheritedData->quotes.get();
     if (!(quotesDataA == quotesDataB || (quotesDataA && quotesDataB && *quotesDataA == *quotesDataB)))

Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp (154429 => 154430)


--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp	2013-08-21 23:34:39 UTC (rev 154429)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp	2013-08-22 00:15:08 UTC (rev 154430)
@@ -326,4 +326,9 @@
     return true;
 }
 
+bool StyleRareNonInheritedData::hasFilters() const
+{
+    return m_filter.get() && !m_filter->m_operations.isEmpty();
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h (154429 => 154430)


--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h	2013-08-21 23:34:39 UTC (rev 154429)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h	2013-08-22 00:15:08 UTC (rev 154430)
@@ -90,8 +90,10 @@
     bool reflectionDataEquivalent(const StyleRareNonInheritedData&) const;
     bool animationDataEquivalent(const StyleRareNonInheritedData&) const;
     bool transitionDataEquivalent(const StyleRareNonInheritedData&) const;
+    bool hasFilters() const;
+    bool hasOpacity() const { return opacity < 1; }
 
-    float opacity; // Whether or not we're transparent.
+    float opacity;
 
     float m_aspectRatioDenominator;
     float m_aspectRatioNumerator;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to