2010-05-05 Chris Marrin <cmarrin@apple.com>
authorcmarrin@apple.com <cmarrin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 May 2010 00:02:27 +0000 (00:02 +0000)
committercmarrin@apple.com <cmarrin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 May 2010 00:02:27 +0000 (00:02 +0000)
        Reviewed by Simon Fraser.

        Got composited iframes showing up on Mac again
        https://bugs.webkit.org/show_bug.cgi?id=38565

        This was broken by http://trac.webkit.org/changeset/58798. That
        change connected iframes through the parent document to the root
        of the layer tree. That is correct for Windows, but not for Mac.
        So the places where the linkage is made were wrapped in
        shouldPropagateCompositingToIFrameParent() calls, which is
        always false for Mac.

        Test: compositing/iframes/composited-iframe-alignment.html

        * rendering/RenderLayerCompositor.cpp:Avoid doing composited iframe linkage on Mac
        (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree):
        (WebCore::RenderLayerCompositor::didMoveOnscreen):
        (WebCore::RenderLayerCompositor::willMoveOffscreen):
        (WebCore::RenderLayerCompositor::ensureRootPlatformLayer):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@58845 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/compositing/iframes/composited-iframe-alignment.html [new file with mode: 0644]
LayoutTests/platform/mac/compositing/iframes/composited-iframe-alignment-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/compositing/iframes/composited-iframe-alignment-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/compositing/iframes/composited-iframe-alignment-expected.txt [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/RenderLayerCompositor.cpp

index 51aa5a0..2bd0224 100644 (file)
@@ -1,3 +1,17 @@
+2010-05-05  Chris Marrin  <cmarrin@apple.com>
+
+        Reviewed by Simon Fraser.
+
+        Got composited iframes showing up on Mac again
+        https://bugs.webkit.org/show_bug.cgi?id=38565
+
+        This is a pixel test to verify that the iframe is rendering correctly
+
+        * compositing/iframes/composited-iframe-alignment.html: Added.
+        * platform/mac/compositing/iframes/composited-iframe-alignment-expected.checksum: Added.
+        * platform/mac/compositing/iframes/composited-iframe-alignment-expected.png: Added.
+        * platform/mac/compositing/iframes/composited-iframe-alignment-expected.txt: Added.
+
 2010-05-05  Alexey Proskuryakov  <ap@apple.com>
 
         Reviewed by Darin Adler.
diff --git a/LayoutTests/compositing/iframes/composited-iframe-alignment.html b/LayoutTests/compositing/iframes/composited-iframe-alignment.html
new file mode 100644 (file)
index 0000000..58419e6
--- /dev/null
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <title>Composited iframe test</title>
+  <style type="text/css" media="screen">
+    iframe {
+        position: absolute;
+        left:100px;
+        top:100px;
+        border: 20px solid black;
+        padding: 0;
+        height: 300px;
+        width: 400px;
+        -webkit-box-shadow: 0 0 20px black;
+    }
+  </style>
+</head>
+<body>
+    Simple test of composited iframe content. There should be a blue box with a gray background
+    inside the black border. The gray background should fit perfectly within the block border
+    with no gaps.
+    <br><br>
+    <iframe id="parent-iframe" src="resources/composited-subframe.html"></iframe>
+</body>
+</html>
diff --git a/LayoutTests/platform/mac/compositing/iframes/composited-iframe-alignment-expected.checksum b/LayoutTests/platform/mac/compositing/iframes/composited-iframe-alignment-expected.checksum
new file mode 100644 (file)
index 0000000..549b901
--- /dev/null
@@ -0,0 +1 @@
+10f9edb32e15829f610ac3adaa0d18bf
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/compositing/iframes/composited-iframe-alignment-expected.png b/LayoutTests/platform/mac/compositing/iframes/composited-iframe-alignment-expected.png
new file mode 100644 (file)
index 0000000..09e0fa2
Binary files /dev/null and b/LayoutTests/platform/mac/compositing/iframes/composited-iframe-alignment-expected.png differ
diff --git a/LayoutTests/platform/mac/compositing/iframes/composited-iframe-alignment-expected.txt b/LayoutTests/platform/mac/compositing/iframes/composited-iframe-alignment-expected.txt
new file mode 100644 (file)
index 0000000..ca88c94
--- /dev/null
@@ -0,0 +1,24 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x70
+  RenderBlock {HTML} at (0,0) size 800x70
+    RenderBody {BODY} at (8,8) size 784x54
+      RenderText {#text} at (0,0) size 770x36
+        text run at (0,0) width 594: "Simple test of composited iframe content. There should be a blue box with a gray background "
+        text run at (594,0) width 176: "inside the black border. The"
+        text run at (0,18) width 384: "gray background should fit perfectly within the block border "
+        text run at (384,18) width 89: "with no gaps. "
+      RenderBR {BR} at (0,0) size 0x0
+      RenderBR {BR} at (0,36) size 0x18
+      RenderText {#text} at (0,0) size 0x0
+      RenderText {#text} at (0,0) size 0x0
+      RenderText {#text} at (0,0) size 0x0
+layer at (100,100) size 440x340
+  RenderPartObject {IFRAME} at (100,100) size 440x340 [border: (20px solid #000000)]
+    layer at (0,0) size 400x300
+      RenderView at (0,0) size 400x300
+    layer at (0,0) size 400x230
+      RenderBlock {HTML} at (0,0) size 400x230
+        RenderBody {BODY} at (8,10) size 384x210 [bgcolor=#C0C0C0]
+    layer at (18,10) size 210x210
+      RenderBlock {DIV} at (10,0) size 210x210 [bgcolor=#0000FF]
index 545e500..3b83da7 100644 (file)
@@ -1,3 +1,25 @@
+2010-05-05  Chris Marrin  <cmarrin@apple.com>
+
+        Reviewed by Simon Fraser.
+
+        Got composited iframes showing up on Mac again
+        https://bugs.webkit.org/show_bug.cgi?id=38565
+
+        This was broken by http://trac.webkit.org/changeset/58798. That
+        change connected iframes through the parent document to the root
+        of the layer tree. That is correct for Windows, but not for Mac.
+        So the places where the linkage is made were wrapped in 
+        shouldPropagateCompositingToIFrameParent() calls, which is 
+        always false for Mac.
+
+        Test: compositing/iframes/composited-iframe-alignment.html
+
+        * rendering/RenderLayerCompositor.cpp:Avoid doing composited iframe linkage on Mac
+        (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree):
+        (WebCore::RenderLayerCompositor::didMoveOnscreen):
+        (WebCore::RenderLayerCompositor::willMoveOffscreen):
+        (WebCore::RenderLayerCompositor::ensureRootPlatformLayer):
+
 2010-05-05  Alexey Proskuryakov  <ap@apple.com>
 
         Reviewed by Darin Adler.
index f36204c..452bfe1 100644 (file)
@@ -752,7 +752,7 @@ void RenderLayerCompositor::rebuildCompositingLayerTree(RenderLayer* layer, cons
     }
     
     if (layerBacking) {
-        if (layer->renderer()->isRenderIFrame()) {
+        if (shouldPropagateCompositingToIFrameParent() && layer->renderer()->isRenderIFrame()) {
             // This is an iframe parent. Make it the parent of the iframe document's root
             layerBacking->parentForSublayers()->removeAllChildren();
 
@@ -938,14 +938,15 @@ void RenderLayerCompositor::didMoveOnscreen()
         return;
 
     bool attached = false;
-    Element* ownerElement = m_renderView->document()->ownerElement();
-    if (ownerElement) {
-        RenderObject* renderer = ownerElement->renderer();
-        if (renderer && renderer->isRenderIFrame()) {
-            // The layer will get hooked up via RenderLayerBacking::updateGraphicsLayerConfiguration()
-            // for the iframe's renderer in the parent document.
-            ownerElement->setNeedsStyleRecalc(SyntheticStyleChange);
-            attached = true;
+    if (shouldPropagateCompositingToIFrameParent()) {
+        if (Element* ownerElement = m_renderView->document()->ownerElement()) {
+            RenderObject* renderer = ownerElement->renderer();
+            if (renderer && renderer->isRenderIFrame()) {
+                // The layer will get hooked up via RenderLayerBacking::updateGraphicsLayerConfiguration()
+                // for the iframe's renderer in the parent document.
+                ownerElement->setNeedsStyleRecalc(SyntheticStyleChange);
+                attached = true;
+            }
         }
     }
 
@@ -966,14 +967,15 @@ void RenderLayerCompositor::willMoveOffscreen()
         return;
 
     bool detached = false;
-    Element* ownerElement = m_renderView->document()->ownerElement();
-    if (ownerElement) {
-        RenderObject* renderer = ownerElement->renderer();
-        if (renderer->isRenderIFrame()) {
-            // The layer will get hooked up via RenderLayerBacking::updateGraphicsLayerConfiguration()
-            // for the iframe's renderer in the parent document.
-            ownerElement->setNeedsStyleRecalc(SyntheticStyleChange);
-            detached = true;
+    if (shouldPropagateCompositingToIFrameParent()) {
+        if (Element* ownerElement = m_renderView->document()->ownerElement()) {
+            RenderObject* renderer = ownerElement->renderer();
+            if (renderer->isRenderIFrame()) {
+                // The layer will get hooked up via RenderLayerBacking::updateGraphicsLayerConfiguration()
+                // for the iframe's renderer in the parent document.
+                ownerElement->setNeedsStyleRecalc(SyntheticStyleChange);
+                detached = true;
+            }
         }
     }
 
@@ -1206,19 +1208,20 @@ void RenderLayerCompositor::ensureRootPlatformLayer()
     // Need to clip to prevent transformed content showing outside this frame
     m_rootPlatformLayer->setMasksToBounds(true);
     
+    if (shouldPropagateCompositingToIFrameParent()) {
     // Create a clipping layer if this is an iframe
-    Element* ownerElement = m_renderView->document()->ownerElement();
-    if (ownerElement) {
-        RenderObject* renderer = ownerElement->renderer();
-        if (renderer && renderer->isRenderIFrame()) {
-            m_clippingLayer = GraphicsLayer::create(0);
-            m_clippingLayer->setGeometryOrientation(GraphicsLayer::compositingCoordinatesOrientation());
+        if (Element* ownerElement = m_renderView->document()->ownerElement()) {
+            RenderObject* renderer = ownerElement->renderer();
+            if (renderer && renderer->isRenderIFrame()) {
+                m_clippingLayer = GraphicsLayer::create(0);
+                m_clippingLayer->setGeometryOrientation(GraphicsLayer::compositingCoordinatesOrientation());
 #ifndef NDEBUG
-            m_clippingLayer->setName("iframe Clipping");
+                m_clippingLayer->setName("iframe Clipping");
 #endif
-            m_clippingLayer->setMasksToBounds(true);
-            m_clippingLayer->setAnchorPoint(FloatPoint());
-            m_clippingLayer->addChild(m_rootPlatformLayer.get());
+                m_clippingLayer->setMasksToBounds(true);
+                m_clippingLayer->setAnchorPoint(FloatPoint());
+                m_clippingLayer->addChild(m_rootPlatformLayer.get());
+            }
         }
     }