Title: [118957] trunk
Revision
118957
Author
[email protected]
Date
2012-05-30 12:51:38 -0700 (Wed, 30 May 2012)

Log Message

Transformed fixed position layers have an incorrect overlap map entry
https://bugs.webkit.org/show_bug.cgi?id=64201

Reviewed by Darin Adler.

Source/WebCore:

Previously, layers that both had a transform and were fixed position
were not considered as being fixed position in RenderGeometryMap or in
RenderBox::mapLocalToContainer (although this case is not incorrect in
the case of painting, so an external caller likely adjusts for this).

Tests: compositing/layer-creation/fixed-position-and-transform.html
       compositing/layer-creation/fixed-position-under-transform.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::mapLocalToContainer):
* rendering/RenderGeometryMap.cpp:
(WebCore::RenderGeometryMap::mapToAbsolute):

LayoutTests:

Add a test for a layer with both fixed position and a transform to
verify that this is considered as fixed position with respect to the
root.

Also, add a test with a child layer with fixed position and a parent
with a transform to verify that the child is not considered as fixed
position with respect to the root.

* compositing/layer-creation/fixed-position-and-transform-expected.png: Added.
* compositing/layer-creation/fixed-position-and-transform-expected.txt: Added.
* compositing/layer-creation/fixed-position-and-transform.html: Added.
* compositing/layer-creation/fixed-position-under-transform-expected.png: Added.
* compositing/layer-creation/fixed-position-under-transform-expected.txt: Added.
* compositing/layer-creation/fixed-position-under-transform.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (118956 => 118957)


--- trunk/LayoutTests/ChangeLog	2012-05-30 19:45:20 UTC (rev 118956)
+++ trunk/LayoutTests/ChangeLog	2012-05-30 19:51:38 UTC (rev 118957)
@@ -1,3 +1,25 @@
+2012-05-29  Adrienne Walker  <[email protected]>
+
+        Transformed fixed position layers have an incorrect overlap map entry
+        https://bugs.webkit.org/show_bug.cgi?id=64201
+
+        Reviewed by Darin Adler.
+
+        Add a test for a layer with both fixed position and a transform to
+        verify that this is considered as fixed position with respect to the
+        root.
+
+        Also, add a test with a child layer with fixed position and a parent
+        with a transform to verify that the child is not considered as fixed
+        position with respect to the root.
+
+        * compositing/layer-creation/fixed-position-and-transform-expected.png: Added.
+        * compositing/layer-creation/fixed-position-and-transform-expected.txt: Added.
+        * compositing/layer-creation/fixed-position-and-transform.html: Added.
+        * compositing/layer-creation/fixed-position-under-transform-expected.png: Added.
+        * compositing/layer-creation/fixed-position-under-transform-expected.txt: Added.
+        * compositing/layer-creation/fixed-position-under-transform.html: Added.
+
 2012-05-30  Oliver Hunt  <[email protected]>
 
         DFG does not correctly handle exceptions caught in the LLInt

Added: trunk/LayoutTests/compositing/layer-creation/fixed-position-and-transform-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/compositing/layer-creation/fixed-position-and-transform-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/compositing/layer-creation/fixed-position-and-transform-expected.txt (0 => 118957)


--- trunk/LayoutTests/compositing/layer-creation/fixed-position-and-transform-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/layer-creation/fixed-position-and-transform-expected.txt	2012-05-30 19:51:38 UTC (rev 118957)
@@ -0,0 +1,21 @@
+(GraphicsLayer
+  (bounds 785.00 5021.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 785.00 5021.00)
+      (children 2
+        (GraphicsLayer
+          (position 100.00 1100.00)
+          (bounds 256.00 256.00)
+          (drawsContent 1)
+        )
+        (GraphicsLayer
+          (position 0.00 1000.00)
+          (bounds 500.00 500.00)
+          (drawsContent 1)
+        )
+      )
+    )
+  )
+)
+
Property changes on: trunk/LayoutTests/compositing/layer-creation/fixed-position-and-transform-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/compositing/layer-creation/fixed-position-and-transform.html (0 => 118957)


--- trunk/LayoutTests/compositing/layer-creation/fixed-position-and-transform.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/layer-creation/fixed-position-and-transform.html	2012-05-30 19:51:38 UTC (rev 118957)
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+    body {
+        height: 5000px;
+    }
+
+    #indicator {
+        width: 256px;
+        height: 256px;
+        background-color: red;
+        position: fixed;
+        left: 100px;
+        top: 100px;
+        -webkit-transform:translateZ(0);
+    }
+
+    #overlap {
+        width: 500px;
+        height: 500px;
+        background-color: green;
+        position: fixed;
+        left: 0px;
+        top: 0px;
+    }
+</style>
+<script>
+    function doTest() {
+        window.scrollTo(0, 1000);
+        if (window.layoutTestController) {
+            document.getElementById('layertree').innerText = layoutTestController.layerTreeAsText();
+            layoutTestController.dumpAsText(true);
+        }
+    }
+    window.addEventListener("load", doTest, false);
+</script>
+</head>
+<body>
+    <!-- the red indicator should be covered by the green overlap element -->
+    <div id="indicator"></div>
+    <div id="overlap"></div>
+
+    <pre id="layertree"></pre>
+</body>
+</html>
Property changes on: trunk/LayoutTests/compositing/layer-creation/fixed-position-and-transform.html
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/compositing/layer-creation/fixed-position-under-transform-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/compositing/layer-creation/fixed-position-under-transform-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/compositing/layer-creation/fixed-position-under-transform-expected.txt (0 => 118957)


--- trunk/LayoutTests/compositing/layer-creation/fixed-position-under-transform-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/layer-creation/fixed-position-under-transform-expected.txt	2012-05-30 19:51:38 UTC (rev 118957)
@@ -0,0 +1,23 @@
+(GraphicsLayer
+  (bounds 785.00 5021.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 785.00 5021.00)
+      (children 2
+        (GraphicsLayer
+          (position 108.00 113.00)
+          (anchor 1.11 -0.39)
+          (bounds 256.00 256.00)
+          (drawsContent 1)
+          (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 1000.00 0.00 1.00])
+        )
+        (GraphicsLayer
+          (position 0.00 1000.00)
+          (bounds 500.00 500.00)
+          (drawsContent 1)
+        )
+      )
+    )
+  )
+)
+
Property changes on: trunk/LayoutTests/compositing/layer-creation/fixed-position-under-transform-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/compositing/layer-creation/fixed-position-under-transform.html (0 => 118957)


--- trunk/LayoutTests/compositing/layer-creation/fixed-position-under-transform.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/layer-creation/fixed-position-under-transform.html	2012-05-30 19:51:38 UTC (rev 118957)
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+    body {
+        height: 5000px;
+        overflow-x: hidden;
+    }
+
+    #transform {
+        z-index: 0;
+        /* transform establishes a fixed pos container, so translate to make up for scroll offset so indicator is still underneath overlap */
+        -webkit-transform:translate3d(0px, 1000px, 0px);
+    }
+
+    #indicator {
+        width: 256px;
+        height: 256px;
+        background-color: red;
+        position: fixed;
+        left: 100px;
+        top: 100px;
+    }
+
+    #overlap {
+        width: 500px;
+        height: 500px;
+        background-color: green;
+        position: fixed;
+        left: 0px;
+        top: 0px;
+    }
+</style>
+<script>
+    function doTest() {
+        window.scrollTo(0, 1000);
+        if (window.layoutTestController) {
+            document.getElementById('layertree').innerText = layoutTestController.layerTreeAsText();
+            layoutTestController.dumpAsText(true);
+        }
+    }
+    window.addEventListener("load", doTest, false);
+</script>
+</head>
+<body>
+    <!-- the red indicator should be covered by the green overlap element -->
+    <div id="transform">
+        <div id="indicator"></div>
+    </div>
+    <div id="overlap"></div>
+
+    <pre id="layertree"></pre>
+</body>
+</html>
Property changes on: trunk/LayoutTests/compositing/layer-creation/fixed-position-under-transform.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (118956 => 118957)


--- trunk/Source/WebCore/ChangeLog	2012-05-30 19:45:20 UTC (rev 118956)
+++ trunk/Source/WebCore/ChangeLog	2012-05-30 19:51:38 UTC (rev 118957)
@@ -1,3 +1,23 @@
+2012-05-29  Adrienne Walker  <[email protected]>
+
+        Transformed fixed position layers have an incorrect overlap map entry
+        https://bugs.webkit.org/show_bug.cgi?id=64201
+
+        Reviewed by Darin Adler.
+
+        Previously, layers that both had a transform and were fixed position
+        were not considered as being fixed position in RenderGeometryMap or in
+        RenderBox::mapLocalToContainer (although this case is not incorrect in
+        the case of painting, so an external caller likely adjusts for this).
+
+        Tests: compositing/layer-creation/fixed-position-and-transform.html
+               compositing/layer-creation/fixed-position-under-transform.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::mapLocalToContainer):
+        * rendering/RenderGeometryMap.cpp:
+        (WebCore::RenderGeometryMap::mapToAbsolute):
+
 2012-05-30  Ulan Degenbaev  <[email protected]>
 
         [v8] Crash after redefining setter on typed array to a number

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (118956 => 118957)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2012-05-30 19:45:20 UTC (rev 118956)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2012-05-30 19:51:38 UTC (rev 118957)
@@ -1279,12 +1279,13 @@
 
     bool isFixedPos = style()->position() == FixedPosition;
     bool hasTransform = hasLayer() && layer()->transform();
-    if (hasTransform) {
-        // If this box has a transform, it acts as a fixed position container for fixed descendants,
-        // and may itself also be fixed position. So propagate 'fixed' up only if this box is fixed position.
-        fixed &= isFixedPos;
-    } else
-        fixed |= isFixedPos;
+    // If this box has a transform, it acts as a fixed position container for fixed descendants,
+    // and may itself also be fixed position. So propagate 'fixed' up only if this box is fixed position.
+    if (hasTransform && !isFixedPos)
+        fixed = false;
+    else if (isFixedPos)
+        fixed = true;
+
     if (wasFixed)
         *wasFixed = fixed;
     

Modified: trunk/Source/WebCore/rendering/RenderGeometryMap.cpp (118956 => 118957)


--- trunk/Source/WebCore/rendering/RenderGeometryMap.cpp	2012-05-30 19:45:20 UTC (rev 118956)
+++ trunk/Source/WebCore/rendering/RenderGeometryMap.cpp	2012-05-30 19:51:38 UTC (rev 118957)
@@ -143,12 +143,13 @@
     for (int i = m_mapping.size() - 1; i >= 0; --i) {
         const RenderGeometryMapStep* currStep = m_mapping[i].get();
 
-        if (currStep->m_hasTransform) {
-            // If this box has a transform, it acts as a fixed position container for fixed descendants,
-            // and may itself also be fixed position. So propagate 'fixed' up only if this box is fixed position.
-            inFixed &= currStep->m_isFixedPosition;
-        } else
-            inFixed |= currStep->m_isFixedPosition;
+        // If this box has a transform, it acts as a fixed position container
+        // for fixed descendants, which prevents the propagation of 'fixed'
+        // unless the layer itself is also fixed position.
+        if (currStep->m_hasTransform && !currStep->m_isFixedPosition)
+            inFixed = false;
+        else if (currStep->m_isFixedPosition)
+            inFixed = true;
 
         if (!i) {
             if (currStep->m_transform)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to