[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

simon.fraser at apple.com simon.fraser at apple.com
Wed Dec 22 15:34:59 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 8a7f8012603e58822e44076171207cb0456a4a8b
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Nov 8 19:47:51 2010 +0000

    2010-11-08  Simon Fraser  <simon.fraser at apple.com>
    
            Reviewed by Dan Bernstein.
    
            Media objects in nested iframes showing above everything else in TinyMCE
            https://bugs.webkit.org/show_bug.cgi?id=44877
    
            Tests: compositing/iframes/become-composited-nested-iframes.html
                   compositing/iframes/overlapped-nested-iframes.html
    
            The overlap testing logic that connects compositing across iframe boundaries
            needed to be educated about nestd iframes, for platforms (i.e. Mac) where iframes
            are allowed to be independently composited.
    
            Also fix a bug that could cause iframes (and possibly other elements) that share
            style to fail to become composited.
    
            * css/CSSStyleSelector.cpp:
            (WebCore::CSSStyleSelector::canShareStyleWithElement): Disable style sharing for elements
            that force synethetic style updates in order to gain RenderLayers, so they can become
            composited. This is tested by become-composited-nested-iframes.html, though it is very
            timing-dependent.
    
            * page/FrameView.h:
            * page/FrameView.cpp:
            (WebCore::FrameView::hasCompositedContentIncludingDescendants): New method that
            is a "deep" version of hasCompositedContent() on platforms where that is necessary to ask.
    
            (WebCore::FrameView::hasCompositingAncestor): New method.
            (WebCore::FrameView::setIsOverlapped): If we can have independently composited iframes,
            we need to force all descendant iframes to update so that compositing gets hooked up across
            nested iframes.
    
            (WebCore::FrameView::isOverlappedIncludingAncestors): New method, only called on platforms
            where allowsIndependentlyCompositedIFrames() is true.
    
            * rendering/RenderLayerCompositor.h:
            * rendering/RenderLayerCompositor.cpp:
            (WebCore::RenderLayerCompositor::allowsIndependentlyCompositedIFrames): Utility method that
            returns true if an iframe can be a compositing root.
    
            (WebCore::RenderLayerCompositor::shouldPropagateCompositingToEnclosingIFrame): Make use of
            allowsIndependentlyCompositedIFrames().
    
            (WebCore::RenderLayerCompositor::notifyIFramesOfCompositingChange): We need to notify all
            descendant frames, not just children.
    
            * rendering/RenderObject.cpp:
            (WebCore::RenderObject::setStyle): Add assert to ensure that we don't do style sharing
            for elements that play tricks with synthetic style changes.
    
            * rendering/RenderWidget.cpp:
            (WebCore::RenderWidget::paint): Run overlap testing if a frame has any composited
            descendants.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71553 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 3257190..cd33eeb 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,18 @@
+2010-11-08  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        Media objects in nested iframes showing above everything else in TinyMCE
+        https://bugs.webkit.org/show_bug.cgi?id=44877
+        
+        Tests with nested, compositing iframes.
+
+        * compositing/iframes/become-composited-nested-iframes-expected.txt: Added.
+        * compositing/iframes/become-composited-nested-iframes.html: Added.
+        * compositing/iframes/overlapped-nested-iframes-expected.txt: Added.
+        * compositing/iframes/overlapped-nested-iframes.html: Added.
+        * compositing/iframes/resources/intermediate-frame.html: Added.
+
 2010-11-08  Tony Chang  <tony at chromium.org>
 
         Unreviewed, adding qt results for new test (only console line number
diff --git a/LayoutTests/compositing/iframes/become-composited-nested-iframes-expected.txt b/LayoutTests/compositing/iframes/become-composited-nested-iframes-expected.txt
new file mode 100644
index 0000000..dda0d8c
--- /dev/null
+++ b/LayoutTests/compositing/iframes/become-composited-nested-iframes-expected.txt
@@ -0,0 +1,138 @@
+
+(GraphicsLayer
+  (bounds 785.00 1500.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 785.00 1500.00)
+      (children 3
+        (GraphicsLayer
+          (position 20.00 120.00)
+          (bounds 284.00 204.00)
+          (drawsContent 1)
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (bounds 280.00 200.00)
+              (children 1
+                (GraphicsLayer
+                  (children 1
+                    (GraphicsLayer
+                      (bounds 280.00 200.00)
+                      (children 1
+                        (GraphicsLayer
+                          (bounds 280.00 200.00)
+                          (drawsContent 1)
+                          (children 1
+                            (GraphicsLayer
+                              (position 8.00 8.00)
+                              (bounds 252.00 172.00)
+                              (drawsContent 1)
+                              (children 1
+                                (GraphicsLayer
+                                  (position 1.00 1.00)
+                                  (bounds 250.00 170.00)
+                                  (children 1
+                                    (GraphicsLayer
+                                      (children 1
+                                        (GraphicsLayer
+                                          (bounds 250.00 230.00)
+                                          (children 1
+                                            (GraphicsLayer
+                                              (bounds 250.00 230.00)
+                                              (drawsContent 1)
+                                              (children 1
+                                                (GraphicsLayer
+                                                  (position 18.00 10.00)
+                                                  (bounds 210.00 210.00)
+                                                  (drawsContent 1)
+                                                )
+                                              )
+                                            )
+                                          )
+                                        )
+                                      )
+                                    )
+                                  )
+                                )
+                              )
+                            )
+                          )
+                        )
+                      )
+                    )
+                  )
+                )
+              )
+            )
+          )
+        )
+        (GraphicsLayer
+          (position 20.00 344.00)
+          (bounds 284.00 204.00)
+          (drawsContent 1)
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (bounds 280.00 200.00)
+              (children 1
+                (GraphicsLayer
+                  (children 1
+                    (GraphicsLayer
+                      (bounds 280.00 200.00)
+                      (children 1
+                        (GraphicsLayer
+                          (bounds 280.00 200.00)
+                          (drawsContent 1)
+                          (children 1
+                            (GraphicsLayer
+                              (position 8.00 8.00)
+                              (bounds 252.00 172.00)
+                              (drawsContent 1)
+                              (children 1
+                                (GraphicsLayer
+                                  (position 1.00 1.00)
+                                  (bounds 250.00 170.00)
+                                  (children 1
+                                    (GraphicsLayer
+                                      (children 1
+                                        (GraphicsLayer
+                                          (bounds 250.00 230.00)
+                                          (children 1
+                                            (GraphicsLayer
+                                              (bounds 250.00 230.00)
+                                              (drawsContent 1)
+                                              (children 1
+                                                (GraphicsLayer
+                                                  (position 18.00 10.00)
+                                                  (bounds 210.00 210.00)
+                                                  (drawsContent 1)
+                                                )
+                                              )
+                                            )
+                                          )
+                                        )
+                                      )
+                                    )
+                                  )
+                                )
+                              )
+                            )
+                          )
+                        )
+                      )
+                    )
+                  )
+                )
+              )
+            )
+          )
+        )
+        (GraphicsLayer
+          (bounds 100.00 100.00)
+          (drawsContent 1)
+        )
+      )
+    )
+  )
+)
+
diff --git a/LayoutTests/compositing/iframes/become-composited-nested-iframes.html b/LayoutTests/compositing/iframes/become-composited-nested-iframes.html
new file mode 100644
index 0000000..39f7600
--- /dev/null
+++ b/LayoutTests/compositing/iframes/become-composited-nested-iframes.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+  <style type="text/css" media="screen">
+    body {
+        height: 1500px;
+        margin: 0;
+    }
+    
+    #box {
+        height: 100px;
+        width: 100px;
+        background-color: blue;
+    }
+    
+    .composited {
+        -webkit-transform: translateZ(0);
+    }
+   
+    iframe {
+        display: block;
+        margin: 20px;
+        height: 200px;
+        width: 280px;
+    }
+  </style>
+  <script type="text/javascript" charset="utf-8">
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+        layoutTestController.waitUntilDone();
+    }
+
+    function doTest()
+    {
+        // For some reason this delay is required for AppKit to not short-circuit the display.
+        window.setTimeout(function() {
+          document.getElementById('box').className = 'composited';
+          if (window.layoutTestController) {
+              layoutTestController.display();
+              document.getElementById('layers').innerHTML = layoutTestController.layerTreeAsText();
+              layoutTestController.notifyDone();
+          }
+        }, 20);
+    }
+
+    window.addEventListener('load', doTest, false);
+  </script>
+</head>
+<body>
+    <div id="box"></div>
+
+    <!-- Tests that when the main document becomes composited, all iframes containing
+        any composited content become composited -->
+    <iframe src="resources/intermediate-frame.html"></iframe>
+    <iframe src="resources/intermediate-frame.html"></iframe>
+
+    <pre id="layers">Layer tree appears here in DRT.</pre>
+</body>
+</html>
diff --git a/LayoutTests/compositing/iframes/overlapped-nested-iframes-expected.txt b/LayoutTests/compositing/iframes/overlapped-nested-iframes-expected.txt
new file mode 100644
index 0000000..17b3682
--- /dev/null
+++ b/LayoutTests/compositing/iframes/overlapped-nested-iframes-expected.txt
@@ -0,0 +1,139 @@
+
+(GraphicsLayer
+  (bounds 785.00 1650.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 785.00 1650.00)
+      (children 3
+        (GraphicsLayer
+          (position 20.00 150.00)
+          (bounds 284.00 204.00)
+          (drawsContent 1)
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (bounds 280.00 200.00)
+              (children 1
+                (GraphicsLayer
+                  (children 1
+                    (GraphicsLayer
+                      (bounds 280.00 200.00)
+                      (children 1
+                        (GraphicsLayer
+                          (bounds 280.00 200.00)
+                          (drawsContent 1)
+                          (children 1
+                            (GraphicsLayer
+                              (position 8.00 8.00)
+                              (bounds 252.00 172.00)
+                              (drawsContent 1)
+                              (children 1
+                                (GraphicsLayer
+                                  (position 1.00 1.00)
+                                  (bounds 250.00 170.00)
+                                  (children 1
+                                    (GraphicsLayer
+                                      (children 1
+                                        (GraphicsLayer
+                                          (bounds 250.00 230.00)
+                                          (children 1
+                                            (GraphicsLayer
+                                              (bounds 250.00 230.00)
+                                              (drawsContent 1)
+                                              (children 1
+                                                (GraphicsLayer
+                                                  (position 18.00 10.00)
+                                                  (bounds 210.00 210.00)
+                                                  (drawsContent 1)
+                                                )
+                                              )
+                                            )
+                                          )
+                                        )
+                                      )
+                                    )
+                                  )
+                                )
+                              )
+                            )
+                          )
+                        )
+                      )
+                    )
+                  )
+                )
+              )
+            )
+          )
+        )
+        (GraphicsLayer
+          (position 20.00 374.00)
+          (bounds 284.00 204.00)
+          (drawsContent 1)
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (bounds 280.00 200.00)
+              (children 1
+                (GraphicsLayer
+                  (children 1
+                    (GraphicsLayer
+                      (bounds 280.00 200.00)
+                      (children 1
+                        (GraphicsLayer
+                          (bounds 280.00 200.00)
+                          (drawsContent 1)
+                          (children 1
+                            (GraphicsLayer
+                              (position 8.00 8.00)
+                              (bounds 252.00 172.00)
+                              (drawsContent 1)
+                              (children 1
+                                (GraphicsLayer
+                                  (position 1.00 1.00)
+                                  (bounds 250.00 170.00)
+                                  (children 1
+                                    (GraphicsLayer
+                                      (children 1
+                                        (GraphicsLayer
+                                          (bounds 250.00 230.00)
+                                          (children 1
+                                            (GraphicsLayer
+                                              (bounds 250.00 230.00)
+                                              (drawsContent 1)
+                                              (children 1
+                                                (GraphicsLayer
+                                                  (position 18.00 10.00)
+                                                  (bounds 210.00 210.00)
+                                                  (drawsContent 1)
+                                                )
+                                              )
+                                            )
+                                          )
+                                        )
+                                      )
+                                    )
+                                  )
+                                )
+                              )
+                            )
+                          )
+                        )
+                      )
+                    )
+                  )
+                )
+              )
+            )
+          )
+        )
+        (GraphicsLayer
+          (position 0.00 100.00)
+          (bounds 785.00 120.00)
+          (drawsContent 1)
+        )
+      )
+    )
+  )
+)
+
diff --git a/LayoutTests/compositing/iframes/overlapped-nested-iframes.html b/LayoutTests/compositing/iframes/overlapped-nested-iframes.html
new file mode 100644
index 0000000..50406ec
--- /dev/null
+++ b/LayoutTests/compositing/iframes/overlapped-nested-iframes.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+  <style type="text/css" media="screen">
+    body {
+        height: 1500px;
+        margin: 0;
+    }
+    #banner {
+        position: fixed;
+        top: 0;
+        width: 100%;
+        height: 120px;
+        background-color: rgba(0, 0, 0, 0.5);
+    }
+    iframe {
+        display: block;
+        margin: 20px;
+        height: 200px;
+        width: 280px;
+    }
+  </style>
+  <script type="text/javascript" charset="utf-8">
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+        layoutTestController.waitUntilDone();
+    }
+
+    function doTest()
+    {
+        // For some reason this delay is required for AppKit to not short-circuit the display.
+        window.setTimeout(function() {
+          window.scrollTo(0, 100);
+          // Force a paint, and give layers a chance to update.
+          if (window.layoutTestController)
+            layoutTestController.display();
+          window.setTimeout(function() {
+            if (window.layoutTestController) {
+                document.getElementById('layers').innerHTML = layoutTestController.layerTreeAsText();
+                layoutTestController.notifyDone();
+            }
+          }, 0);
+        }, 0);
+    }
+
+    window.addEventListener('load', doTest, false);
+  </script>
+</head>
+<body>
+    <div id="banner"></div>
+
+    <!-- Tests that when scrolled so that one iframe is overlapped, both iframes
+        and their contents become composited. -->
+    <iframe style="margin-top: 150px;" src="resources/intermediate-frame.html"></iframe>
+    <iframe src="resources/intermediate-frame.html"></iframe>
+
+    <pre id="layers">Layer tree appears here in DRT.</pre>
+</body>
+</html>
diff --git a/LayoutTests/compositing/iframes/resources/intermediate-frame.html b/LayoutTests/compositing/iframes/resources/intermediate-frame.html
new file mode 100644
index 0000000..78e2ff4
--- /dev/null
+++ b/LayoutTests/compositing/iframes/resources/intermediate-frame.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+  <style type="text/css" media="screen">
+    iframe {
+        height: 170px;
+        width: 250px;
+        border: 1px solid black;
+    }
+  </style>
+</head>
+<body>
+
+    <iframe src="composited-subframe.html" scrolling="no"></iframe>
+    
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 1d173c7..46e1246 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,58 @@
+2010-11-08  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        Media objects in nested iframes showing above everything else in TinyMCE
+        https://bugs.webkit.org/show_bug.cgi?id=44877
+
+        Tests: compositing/iframes/become-composited-nested-iframes.html
+               compositing/iframes/overlapped-nested-iframes.html
+        
+        The overlap testing logic that connects compositing across iframe boundaries
+        needed to be educated about nestd iframes, for platforms (i.e. Mac) where iframes
+        are allowed to be independently composited.
+        
+        Also fix a bug that could cause iframes (and possibly other elements) that share
+        style to fail to become composited.
+
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::canShareStyleWithElement): Disable style sharing for elements
+        that force synethetic style updates in order to gain RenderLayers, so they can become
+        composited. This is tested by become-composited-nested-iframes.html, though it is very
+        timing-dependent.
+        
+        * page/FrameView.h:
+        * page/FrameView.cpp:
+        (WebCore::FrameView::hasCompositedContentIncludingDescendants): New method that
+        is a "deep" version of hasCompositedContent() on platforms where that is necessary to ask.
+        
+        (WebCore::FrameView::hasCompositingAncestor): New method.
+        (WebCore::FrameView::setIsOverlapped): If we can have independently composited iframes,
+        we need to force all descendant iframes to update so that compositing gets hooked up across
+        nested iframes.
+        
+        (WebCore::FrameView::isOverlappedIncludingAncestors): New method, only called on platforms
+        where allowsIndependentlyCompositedIFrames() is true.
+
+        * rendering/RenderLayerCompositor.h:
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::allowsIndependentlyCompositedIFrames): Utility method that
+        returns true if an iframe can be a compositing root.
+        
+        (WebCore::RenderLayerCompositor::shouldPropagateCompositingToEnclosingIFrame): Make use of
+        allowsIndependentlyCompositedIFrames().
+        
+        (WebCore::RenderLayerCompositor::notifyIFramesOfCompositingChange): We need to notify all
+        descendant frames, not just children.
+        
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::setStyle): Add assert to ensure that we don't do style sharing
+        for elements that play tricks with synthetic style changes.
+
+        * rendering/RenderWidget.cpp:
+        (WebCore::RenderWidget::paint): Run overlap testing if a frame has any composited
+        descendants.
+
 2010-11-08  Darin Adler  <darin at apple.com>
 
         Reviewed by Alexey Proskuryakov.
diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp
index 317fc7e..24f0ee1 100644
--- a/WebCore/css/CSSStyleSelector.cpp
+++ b/WebCore/css/CSSStyleSelector.cpp
@@ -1034,6 +1034,13 @@ bool CSSStyleSelector::canShareStyleWithElement(Node* n)
             if (style->transitions() || style->animations())
                 return false;
 
+#if USE(ACCELERATED_COMPOSITING)
+            // Turn off style sharing for elements that can gain layers for reasons outside of the style system.
+            // See comments in RenderObject::setStyle().
+            if (s->hasTagName(iframeTag) || s->hasTagName(embedTag) || s->hasTagName(objectTag) || s->hasTagName(appletTag))
+                return false;
+#endif
+
             bool classesMatch = true;
             if (s->hasClass()) {
                 const AtomicString& class1 = m_element->fastGetAttribute(classAttr);
diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp
index b54cfa0..f4b9b9f 100644
--- a/WebCore/page/FrameView.cpp
+++ b/WebCore/page/FrameView.cpp
@@ -567,6 +567,37 @@ bool FrameView::hasCompositedContent() const
     return false;
 }
 
+bool FrameView::hasCompositedContentIncludingDescendants() const
+{
+#if USE(ACCELERATED_COMPOSITING)
+    for (Frame* frame = m_frame.get(); frame; frame = frame->tree()->traverseNext(m_frame.get())) {
+        RenderView* renderView = frame->contentRenderer();
+        RenderLayerCompositor* compositor = renderView ? renderView->compositor() : 0;
+        if (compositor) {
+            if (compositor->inCompositingMode())
+                return true;
+
+            if (!RenderLayerCompositor::allowsIndependentlyCompositedIFrames(this))
+                break;
+        }
+    }
+#endif
+    return false;
+}
+
+bool FrameView::hasCompositingAncestor() const
+{
+#if USE(ACCELERATED_COMPOSITING)
+    for (Frame* frame = m_frame->tree()->parent(); frame; frame = frame->tree()->parent()) {
+        if (FrameView* view = frame->view()) {
+            if (view->hasCompositedContent())
+                return true;
+        }
+    }
+#endif
+    return false;
+}
+
 // Sometimes (for plug-ins) we need to eagerly go into compositing mode.
 void FrameView::enterCompositingMode()
 {
@@ -1073,9 +1104,9 @@ void FrameView::setIsOverlapped(bool isOverlapped)
     updateCanBlitOnScrollRecursively();
     
 #if USE(ACCELERATED_COMPOSITING)
-    // Overlap can affect compositing tests, so if it changes, we need to trigger
-    // a layer update in the parent document.
-    if (hasCompositedContent()) {
+    if (hasCompositedContentIncludingDescendants()) {
+        // Overlap can affect compositing tests, so if it changes, we need to trigger
+        // a layer update in the parent document.
         if (Frame* parentFrame = m_frame->tree()->parent()) {
             if (RenderView* parentView = parentFrame->contentRenderer()) {
                 RenderLayerCompositor* compositor = parentView->compositor();
@@ -1083,8 +1114,35 @@ void FrameView::setIsOverlapped(bool isOverlapped)
                 compositor->scheduleCompositingLayerUpdate();
             }
         }
+
+        if (RenderLayerCompositor::allowsIndependentlyCompositedIFrames(this)) {
+            // We also need to trigger reevaluation for this and all descendant frames,
+            // since a frame uses compositing if any ancestor is compositing.
+            for (Frame* frame = m_frame.get(); frame; frame = frame->tree()->traverseNext(m_frame.get())) {
+                if (RenderView* view = frame->contentRenderer()) {
+                    RenderLayerCompositor* compositor = view->compositor();
+                    compositor->setCompositingLayersNeedRebuild();
+                    compositor->scheduleCompositingLayerUpdate();
+                }
+            }
+        }
     }
-#endif    
+#endif
+}
+
+bool FrameView::isOverlappedIncludingAncestors() const
+{
+    if (isOverlapped())
+        return true;
+
+    if (Frame* parentFrame = m_frame->tree()->parent()) {
+        if (FrameView* parentView = parentFrame->view()) {
+            if (parentView->isOverlapped())
+                return true;
+        }
+    }
+
+    return false;
 }
 
 void FrameView::setContentIsOpaque(bool contentIsOpaque)
diff --git a/WebCore/page/FrameView.h b/WebCore/page/FrameView.h
index 79020d0..8a1a071 100644
--- a/WebCore/page/FrameView.h
+++ b/WebCore/page/FrameView.h
@@ -107,6 +107,8 @@ public:
 #endif
 
     bool hasCompositedContent() const;
+    bool hasCompositedContentIncludingDescendants() const;
+    bool hasCompositingAncestor() const;
     void enterCompositingMode();
     bool isEnclosedInCompositingLayer() const;
 
@@ -154,6 +156,7 @@ public:
     void setUseSlowRepaints();
     void setIsOverlapped(bool);
     bool isOverlapped() const { return m_isOverlapped; }
+    bool isOverlappedIncludingAncestors() const;
     void setContentIsOpaque(bool);
 
     void addSlowRepaintObject();
diff --git a/WebCore/rendering/RenderLayerCompositor.cpp b/WebCore/rendering/RenderLayerCompositor.cpp
index a538857..2ea1aa9 100644
--- a/WebCore/rendering/RenderLayerCompositor.cpp
+++ b/WebCore/rendering/RenderLayerCompositor.cpp
@@ -1059,6 +1059,15 @@ bool RenderLayerCompositor::has3DContent() const
     return layerHas3DContent(rootRenderLayer());
 }
 
+bool RenderLayerCompositor::allowsIndependentlyCompositedIFrames(const FrameView* view)
+{
+#if PLATFORM(MAC)
+    // iframes are only independently composited in Mac pre-WebKit2.
+    return view->platformWidget();
+#endif
+    return false;
+}
+
 bool RenderLayerCompositor::shouldPropagateCompositingToEnclosingIFrame() const
 {
     // Parent document content needs to be able to render on top of a composited iframe, so correct behavior
@@ -1069,12 +1078,7 @@ bool RenderLayerCompositor::shouldPropagateCompositingToEnclosingIFrame() const
     if (!renderer || !renderer->isRenderIFrame())
         return false;
 
-#if !PLATFORM(MAC)
-    // On non-Mac platforms, let compositing propagate for all iframes.
-    return true;
-#else
-    // If we're viewless (i.e. WebKit2), we always propagate compositing.
-    if (!m_renderView->frameView()->platformWidget())
+    if (!allowsIndependentlyCompositedIFrames(m_renderView->frameView()))
         return true;
 
     // On Mac, only propagate compositing if the iframe is overlapped in the parent
@@ -1083,17 +1087,11 @@ bool RenderLayerCompositor::shouldPropagateCompositingToEnclosingIFrame() const
     if (iframeRenderer->widget()) {
         ASSERT(iframeRenderer->widget()->isFrameView());
         FrameView* view = static_cast<FrameView*>(iframeRenderer->widget());
-        if (view->isOverlapped())
+        if (view->isOverlappedIncludingAncestors() || view->hasCompositingAncestor())
             return true;
-        
-        if (RenderView* view = iframeRenderer->view()) {
-            if (view->compositor()->inCompositingMode())
-                return true;
-        }
     }
 
     return false;
-#endif
 }
 
 HTMLFrameOwnerElement* RenderLayerCompositor::enclosingIFrameElement() const
@@ -1474,7 +1472,7 @@ void RenderLayerCompositor::notifyIFramesOfCompositingChange()
     if (!frame)
         return;
 
-    for (Frame* child = frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) {
+    for (Frame* child = frame->tree()->firstChild(); child; child = child->tree()->traverseNext(frame)) {
         if (child->document() && child->document()->ownerElement())
             scheduleNeedsStyleRecalc(child->document()->ownerElement());
     }
diff --git a/WebCore/rendering/RenderLayerCompositor.h b/WebCore/rendering/RenderLayerCompositor.h
index 910e883..ab4ac24 100644
--- a/WebCore/rendering/RenderLayerCompositor.h
+++ b/WebCore/rendering/RenderLayerCompositor.h
@@ -151,8 +151,9 @@ public:
     // to know if there is non-affine content, e.g. for drawing into an image.
     bool has3DContent() const;
     
-    // Some platforms may wish to connect compositing layer trees between iframes and
-    // their parent document.
+    // Most platforms connect compositing layer trees between iframes and their parent document.
+    // Some (currently just Mac) allow iframes to do their own compositing.
+    static bool allowsIndependentlyCompositedIFrames(const FrameView*);
     bool shouldPropagateCompositingToEnclosingIFrame() const;
 
     // FIXME: This should be a RenderIFrame*
diff --git a/WebCore/rendering/RenderObject.cpp b/WebCore/rendering/RenderObject.cpp
index 1941d31..d53c7ce 100644
--- a/WebCore/rendering/RenderObject.cpp
+++ b/WebCore/rendering/RenderObject.cpp
@@ -1731,8 +1731,14 @@ StyleDifference RenderObject::adjustStyleDifference(StyleDifference diff, unsign
 
 void RenderObject::setStyle(PassRefPtr<RenderStyle> style)
 {
-    if (m_style == style)
+    if (m_style == style) {
+#if USE(ACCELERATED_COMPOSITING)
+        // We need to run through adjustStyleDifference() for iframes and plugins, so
+        // style sharing is disabled for them. That should ensure that we never hit this code path.
+        ASSERT(!isRenderIFrame() && !isEmbeddedObject() &&!isApplet());
+#endif
         return;
+    }
 
     StyleDifference diff = StyleDifferenceEqual;
     unsigned contextSensitiveProperties = ContextSensitivePropertyNone;
diff --git a/WebCore/rendering/RenderWidget.cpp b/WebCore/rendering/RenderWidget.cpp
index 1a49199..6ea620f 100644
--- a/WebCore/rendering/RenderWidget.cpp
+++ b/WebCore/rendering/RenderWidget.cpp
@@ -300,7 +300,7 @@ void RenderWidget::paint(PaintInfo& paintInfo, int tx, int ty)
 
         if (m_widget->isFrameView()) {
             FrameView* frameView = static_cast<FrameView*>(m_widget.get());
-            bool runOverlapTests = !frameView->useSlowRepaintsIfNotOverlapped() || frameView->hasCompositedContent();
+            bool runOverlapTests = !frameView->useSlowRepaintsIfNotOverlapped() || frameView->hasCompositedContentIncludingDescendants();
             if (paintInfo.overlapTestRequests && runOverlapTests) {
                 ASSERT(!paintInfo.overlapTestRequests->contains(this));
                 paintInfo.overlapTestRequests->set(this, m_widget->frameRect());

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list