Title: [113461] trunk
Revision
113461
Author
[email protected]
Date
2012-04-06 11:17:50 -0700 (Fri, 06 Apr 2012)

Log Message

Should disable preserves3D() for things that enforce flattening, like overflow and filters
https://bugs.webkit.org/show_bug.cgi?id=83337

Source/WebCore:

Reviewed by Dean Jackson.

The CSS3 Transforms spec says that some properties should cause flattening
of things with transform-style: preserve-3d. We currently do this as a side
effect of the GraphicsLayer structure, but we should really do it at the
RenderStyle level, as we do for other things like stacking context creation.

Test: compositing/overflow-trumps-transform-style.html

* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::collectMatchingRulesForList):

LayoutTests:

Reviewed by Dean Jackson.

Test for computed style and layer structure combining transform-style
with overflow.

* compositing/overflow-trumps-transform-style-expected.txt: Added.
* compositing/overflow-trumps-transform-style.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (113460 => 113461)


--- trunk/LayoutTests/ChangeLog	2012-04-06 18:07:10 UTC (rev 113460)
+++ trunk/LayoutTests/ChangeLog	2012-04-06 18:17:50 UTC (rev 113461)
@@ -1,3 +1,16 @@
+2012-04-05  Simon Fraser  <[email protected]>
+
+        Should disable preserves3D() for things that enforce flattening, like overflow and filters
+        https://bugs.webkit.org/show_bug.cgi?id=83337
+
+        Reviewed by Dean Jackson.
+        
+        Test for computed style and layer structure combining transform-style
+        with overflow.
+
+        * compositing/overflow-trumps-transform-style-expected.txt: Added.
+        * compositing/overflow-trumps-transform-style.html: Added.
+
 2012-04-06  Stephen Chenney  <[email protected]>
 
         [chromium] Rounding issue on some RenderSVGPath values

Added: trunk/LayoutTests/compositing/overflow-trumps-transform-style-expected.txt (0 => 113461)


--- trunk/LayoutTests/compositing/overflow-trumps-transform-style-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/overflow-trumps-transform-style-expected.txt	2012-04-06 18:17:50 UTC (rev 113461)
@@ -0,0 +1,26 @@
+preserve-3d
+flat
+(GraphicsLayer
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (children 2
+        (GraphicsLayer
+          (position 18.00 10.00)
+          (bounds 100.00 100.00)
+          (preserves3D 1)
+          (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 0.00 1.00 1.00])
+        )
+        (GraphicsLayer
+          (position 18.00 120.00)
+          (bounds 100.00 100.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 0.00 1.00 1.00])
+        )
+      )
+    )
+  )
+)
+
Property changes on: trunk/LayoutTests/compositing/overflow-trumps-transform-style-expected.txt
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/compositing/overflow-trumps-transform-style.html (0 => 113461)


--- trunk/LayoutTests/compositing/overflow-trumps-transform-style.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/overflow-trumps-transform-style.html	2012-04-06 18:17:50 UTC (rev 113461)
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+  <style>
+    .box {
+      height: 100px;
+      width: 100px;
+      margin: 10px;
+      background-color: blue;
+    }
+  </style>
+  <script>
+    if (window.layoutTestController)
+      layoutTestController.dumpAsText();
+
+    function dumpResults()
+    {
+      var results = document.getElementById('layers');
+      
+      // Check the computed value.
+      results.innerText = window.getComputedStyle(document.getElementById('box1')).webkitTransformStyle + '\n';
+      results.innerText += window.getComputedStyle(document.getElementById('box2')).webkitTransformStyle + '\n';
+      
+      if (window.layoutTestController)
+        results.innerText += layoutTestController.layerTreeAsText();
+    }
+    window.addEventListener('load', dumpResults, false);
+  </script>
+</head>
+<body>
+<div class="box" id="box1" style="-webkit-transform: translateZ(1px); -webkit-transform-style: preserve-3d"></div>
+<div class="box" id="box2" style="-webkit-transform: translateZ(1px); -webkit-transform-style: preserve-3d; overflow: hidden"></div>
+<pre id="layers">Layer tree goes here in DRT</pre>
+</body>
+</html>
Property changes on: trunk/LayoutTests/compositing/overflow-trumps-transform-style.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (113460 => 113461)


--- trunk/Source/WebCore/ChangeLog	2012-04-06 18:07:10 UTC (rev 113460)
+++ trunk/Source/WebCore/ChangeLog	2012-04-06 18:17:50 UTC (rev 113461)
@@ -1,3 +1,20 @@
+2012-04-05  Simon Fraser  <[email protected]>
+
+        Should disable preserves3D() for things that enforce flattening, like overflow and filters
+        https://bugs.webkit.org/show_bug.cgi?id=83337
+
+        Reviewed by Dean Jackson.
+        
+        The CSS3 Transforms spec says that some properties should cause flattening
+        of things with transform-style: preserve-3d. We currently do this as a side
+        effect of the GraphicsLayer structure, but we should really do it at the
+        RenderStyle level, as we do for other things like stacking context creation.
+
+        Test: compositing/overflow-trumps-transform-style.html
+
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::collectMatchingRulesForList):
+
 2012-04-06  Tommy Widenflycht  <[email protected]>
 
         MediaStream API: MediaStreams stops proper cleanup to take place during a page reload.

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (113460 => 113461)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2012-04-06 18:07:10 UTC (rev 113460)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2012-04-06 18:17:50 UTC (rev 113461)
@@ -2072,6 +2072,12 @@
     if (style->hasPseudoStyle(FIRST_LETTER))
         style->setUnique();
 
+    // FIXME: when dropping the -webkit prefix on transform-style, we should also have opacity < 1 cause flattening.
+    if (style->preserves3D() && (style->overflowX() != OVISIBLE
+        || style->overflowY() != OVISIBLE
+        || style->hasFilter()))
+        style->setTransformStyle3D(TransformStyle3DFlat);
+
 #if ENABLE(SVG)
     if (e && e->isSVGElement()) {
         // Spec: http://www.w3.org/TR/SVG/masking.html#OverflowProperty
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to