Title: [92874] trunk
Revision
92874
Author
[email protected]
Date
2011-08-11 13:43:18 -0700 (Thu, 11 Aug 2011)

Log Message

Enable fast path scrolling for composited iframes
https://bugs.webkit.org/show_bug.cgi?id=65056

Reviewed by James Robinson.

Source/WebCore:

iframes with composited layers for content should be able to do fast
path scrolling because they draw into their own backing. To enable
this, useSlowRepaints is modified to return true only for the cases
that apply to composited layers. The fast path scrolling function is
modified to send the invalidation to the backing itself rather than to
the window.

Renamed a number of "slow repaint" functions to be the more accurate
"cannot blit to window" as it will not always force slow path
scrolling.

* page/FrameView.cpp:
(WebCore::FrameView::reset):
(WebCore::FrameView::useSlowRepaints):
(WebCore::FrameView::useSlowRepaintsIfNotOverlapped):
(WebCore::FrameView::contentsInCompositedLayer):
(WebCore::FrameView::setCannotBlitToWindow):
(WebCore::FrameView::scrollContentsFastPath):
(WebCore::FrameView::scrollContentsSlowPath):
* page/FrameView.h:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::cannotBlitToWindow):
* rendering/RenderLayer.h:
* rendering/RenderView.cpp:
(WebCore::RenderView::paintBoxDecorations):

LayoutTests:

Added test of iframe overlapping another iframe.  Mac gets its own
incorrect expectations due to bug 63282.

* compositing/iframes/overlapped-iframe-iframe-expected.txt: Added.
* compositing/iframes/overlapped-iframe-iframe.html: Added.
* platform/chromium-gpu/compositing/iframes/overlapped-iframe-iframe-expected.txt: Added.
* platform/mac/compositing/iframes/overlapped-iframe-iframe-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (92873 => 92874)


--- trunk/LayoutTests/ChangeLog	2011-08-11 19:44:45 UTC (rev 92873)
+++ trunk/LayoutTests/ChangeLog	2011-08-11 20:43:18 UTC (rev 92874)
@@ -1,3 +1,18 @@
+2011-08-01  Adrienne Walker  <[email protected]>
+
+        Enable fast path scrolling for composited iframes
+        https://bugs.webkit.org/show_bug.cgi?id=65056
+
+        Reviewed by James Robinson.
+
+        Added test of iframe overlapping another iframe.  Mac gets its own
+        incorrect expectations due to bug 63282.
+
+        * compositing/iframes/overlapped-iframe-iframe-expected.txt: Added.
+        * compositing/iframes/overlapped-iframe-iframe.html: Added.
+        * platform/chromium-gpu/compositing/iframes/overlapped-iframe-iframe-expected.txt: Added.
+        * platform/mac/compositing/iframes/overlapped-iframe-iframe-expected.txt: Added.
+
 2011-08-10  Adrienne Walker  <[email protected]>
 
         Support creating compositing layers for scrollable frames and iframes

Added: trunk/LayoutTests/compositing/iframes/overlapped-iframe-iframe-expected.txt (0 => 92874)


--- trunk/LayoutTests/compositing/iframes/overlapped-iframe-iframe-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/iframes/overlapped-iframe-iframe-expected.txt	2011-08-11 20:43:18 UTC (rev 92874)
@@ -0,0 +1,52 @@
+(GraphicsLayer
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (children 2
+        (GraphicsLayer
+          (bounds 304.00 304.00)
+          (drawsContent 1)
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (children 1
+                (GraphicsLayer
+                  (bounds 300.00 300.00)
+                  (children 1
+                    (GraphicsLayer
+                      (children 1
+                        (GraphicsLayer
+                          (bounds 300.00 300.00)
+                          (children 1
+                            (GraphicsLayer
+                              (bounds 300.00 300.00)
+                              (drawsContent 1)
+                              (children 1
+                                (GraphicsLayer
+                                  (position 18.00 10.00)
+                                  (bounds 210.00 210.00)
+                                  (drawsContent 1)
+                                )
+                              )
+                            )
+                          )
+                        )
+                      )
+                    )
+                  )
+                )
+              )
+            )
+          )
+        )
+        (GraphicsLayer
+          (position 250.00 0.00)
+          (bounds 304.00 304.00)
+          (drawsContent 1)
+        )
+      )
+    )
+  )
+)
+
Property changes on: trunk/LayoutTests/compositing/iframes/overlapped-iframe-iframe-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/compositing/iframes/overlapped-iframe-iframe.html (0 => 92874)


--- trunk/LayoutTests/compositing/iframes/overlapped-iframe-iframe.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/iframes/overlapped-iframe-iframe.html	2011-08-11 20:43:18 UTC (rev 92874)
@@ -0,0 +1,49 @@
+<html>
+<head>
+  <style type="text/css" media="screen">
+    body {
+        overflow: hidden;
+    }
+
+    iframe {
+        position: absolute;
+        top: 0px;
+        left: 0px;
+        height: 300px;
+        width: 300px;
+    }
+
+    #overlap {
+        left: 250px;
+    }
+
+    pre {
+        position: absolute;
+        bottom: 2000px;
+        left: 0px;
+    }
+  </style>
+  <script>
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+    }
+
+    function doTest()
+    {
+        if (window.layoutTestController) {
+            document.getElementById('layers').innerHTML = layoutTestController.layerTreeAsText();
+        }
+    }
+
+    window.addEventListener('load', doTest, false);
+  </script>
+</head>
+<body>
+
+    <iframe src=""
+    <!-- this iframe should become composited because it overlaps the other iframe -->
+    <iframe id="overlap" src=""
+
+    <pre id="layers">Layer tree appears here in DRT.</pre>
+</body>
+</html>
Property changes on: trunk/LayoutTests/compositing/iframes/overlapped-iframe-iframe.html
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/platform/chromium-gpu/compositing/iframes/overlapped-iframe-iframe-expected.txt (0 => 92874)


--- trunk/LayoutTests/platform/chromium-gpu/compositing/iframes/overlapped-iframe-iframe-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium-gpu/compositing/iframes/overlapped-iframe-iframe-expected.txt	2011-08-11 20:43:18 UTC (rev 92874)
@@ -0,0 +1,52 @@
+(GraphicsLayer
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (children 2
+        (GraphicsLayer
+          (bounds 304.00 304.00)
+          (drawsContent 1)
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (children 1
+                (GraphicsLayer
+                  (bounds 300.00 300.00)
+                  (children 1
+                    (GraphicsLayer
+                      (children 1
+                        (GraphicsLayer
+                          (bounds 300.00 300.00)
+                          (children 1
+                            (GraphicsLayer
+                              (bounds 300.00 300.00)
+                              (drawsContent 1)
+                              (children 1
+                                (GraphicsLayer
+                                  (position 18.00 10.00)
+                                  (bounds 210.00 210.00)
+                                  (drawsContent 1)
+                                )
+                              )
+                            )
+                          )
+                        )
+                      )
+                    )
+                  )
+                )
+              )
+            )
+          )
+        )
+        (GraphicsLayer
+          (position 250.00 0.00)
+          (bounds 304.00 304.00)
+          (drawsContent 1)
+        )
+      )
+    )
+  )
+)
+
Property changes on: trunk/LayoutTests/platform/chromium-gpu/compositing/iframes/overlapped-iframe-iframe-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/platform/mac/compositing/iframes/overlapped-iframe-iframe-expected.txt (0 => 92874)


--- trunk/LayoutTests/platform/mac/compositing/iframes/overlapped-iframe-iframe-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/compositing/iframes/overlapped-iframe-iframe-expected.txt	2011-08-11 20:43:18 UTC (rev 92874)
@@ -0,0 +1 @@
+
Property changes on: trunk/LayoutTests/platform/mac/compositing/iframes/overlapped-iframe-iframe-expected.txt
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (92873 => 92874)


--- trunk/Source/WebCore/ChangeLog	2011-08-11 19:44:45 UTC (rev 92873)
+++ trunk/Source/WebCore/ChangeLog	2011-08-11 20:43:18 UTC (rev 92874)
@@ -1,3 +1,36 @@
+2011-08-01  Adrienne Walker  <[email protected]>
+
+        Enable fast path scrolling for composited iframes
+        https://bugs.webkit.org/show_bug.cgi?id=65056
+
+        Reviewed by James Robinson.
+
+        iframes with composited layers for content should be able to do fast
+        path scrolling because they draw into their own backing. To enable
+        this, useSlowRepaints is modified to return true only for the cases
+        that apply to composited layers. The fast path scrolling function is
+        modified to send the invalidation to the backing itself rather than to
+        the window.
+
+        Renamed a number of "slow repaint" functions to be the more accurate
+        "cannot blit to window" as it will not always force slow path
+        scrolling.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::reset):
+        (WebCore::FrameView::useSlowRepaints):
+        (WebCore::FrameView::useSlowRepaintsIfNotOverlapped):
+        (WebCore::FrameView::contentsInCompositedLayer):
+        (WebCore::FrameView::setCannotBlitToWindow):
+        (WebCore::FrameView::scrollContentsFastPath):
+        (WebCore::FrameView::scrollContentsSlowPath):
+        * page/FrameView.h:
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::cannotBlitToWindow):
+        * rendering/RenderLayer.h:
+        * rendering/RenderView.cpp:
+        (WebCore::RenderView::paintBoxDecorations):
+
 2011-08-10  Adrienne Walker  <[email protected]>
 
         Support creating compositing layers for scrollable frames and iframes

Modified: trunk/Source/WebCore/page/FrameView.cpp (92873 => 92874)


--- trunk/Source/WebCore/page/FrameView.cpp	2011-08-11 19:44:45 UTC (rev 92873)
+++ trunk/Source/WebCore/page/FrameView.cpp	2011-08-11 20:43:18 UTC (rev 92874)
@@ -199,7 +199,7 @@
 
 void FrameView::reset()
 {
-    m_useSlowRepaints = false;
+    m_cannotBlitToWindow = false;
     m_isOverlapped = false;
     m_contentIsOpaque = false;
     m_borderX = 30;
@@ -1195,11 +1195,13 @@
     }
 }
 
-bool FrameView::useSlowRepaints() const
+bool FrameView::useSlowRepaints(bool considerOverlap) const
 {
-    if (m_useSlowRepaints || m_slowRepaintObjectCount > 0 || (platformWidget() && m_fixedObjectCount > 0) || m_isOverlapped || !m_contentIsOpaque)
-        return true;
+    bool mustBeSlow = m_slowRepaintObjectCount > 0 || (platformWidget() && m_fixedObjectCount > 0);
 
+    if (contentsInCompositedLayer())
+        return mustBeSlow;
+
 #if PLATFORM(CHROMIUM)
     // The chromium compositor does not support scrolling a non-composited frame within a composited page through
     // the fast scrolling path, so force slow scrolling in that case.
@@ -1207,21 +1209,20 @@
         return true;
 #endif
 
+    bool isOverlapped = m_isOverlapped && considerOverlap;
+
+    if (mustBeSlow || m_cannotBlitToWindow || isOverlapped || !m_contentIsOpaque)
+        return true;
+
     if (FrameView* parentView = parentFrameView())
-        return parentView->useSlowRepaints();
+        return parentView->useSlowRepaints(considerOverlap);
 
     return false;
 }
 
 bool FrameView::useSlowRepaintsIfNotOverlapped() const
 {
-    if (m_useSlowRepaints || m_slowRepaintObjectCount > 0 || (platformWidget() && m_fixedObjectCount > 0) || !m_contentIsOpaque)
-        return true;
-
-    if (FrameView* parentView = parentFrameView())
-        return parentView->useSlowRepaintsIfNotOverlapped();
-
-    return false;
+    return useSlowRepaints(false);
 }
 
 void FrameView::updateCanBlitOnScrollRecursively()
@@ -1232,9 +1233,22 @@
     }
 }
 
-void FrameView::setUseSlowRepaints()
+bool FrameView::contentsInCompositedLayer() const
 {
-    m_useSlowRepaints = true;
+#if USE(ACCELERATED_COMPOSITING)
+    RenderView* root = m_frame->contentRenderer();
+    if (root && root->layer()->isComposited()) {
+        GraphicsLayer* layer = root->layer()->backing()->graphicsLayer();
+        if (layer && layer->drawsContent())
+            return true;
+    }
+#endif
+    return false;
+}
+
+void FrameView::setCannotBlitToWindow()
+{
+    m_cannotBlitToWindow = true;
     updateCanBlitOnScrollRecursively();
 }
 
@@ -1357,6 +1371,8 @@
         return true;
     }
 
+    const bool isCompositedContentLayer = contentsInCompositedLayer();
+
     // Get the rects of the fixed objects visible in the rectToScroll
     Vector<IntRect, fixedObjectThreshold> subRectToUpdate;
     bool updateInvalidatedSubRect = true;
@@ -1367,7 +1383,7 @@
             continue;
         IntRect updateRect = renderBox->layer()->repaintRectIncludingDescendants();
         updateRect = contentsToWindow(updateRect);
-        if (clipsRepaints())
+        if (!isCompositedContentLayer && clipsRepaints())
             updateRect.intersect(rectToScroll);
         if (!updateRect.isEmpty()) {
             if (subRectToUpdate.size() >= fixedObjectThreshold) {
@@ -1390,6 +1406,15 @@
             IntRect scrolledRect = updateRect;
             scrolledRect.move(scrollDelta);
             updateRect.unite(scrolledRect);
+#if USE(ACCELERATED_COMPOSITING)
+            if (isCompositedContentLayer) {
+                updateRect = windowToContents(updateRect);
+                RenderView* root = m_frame->contentRenderer();
+                ASSERT(root);
+                root->layer()->setBackingNeedsRepaintInRect(updateRect);
+                continue;
+            }
+#endif
             if (clipsRepaints())
                 updateRect.intersect(rectToScroll);
             hostWindow()->invalidateContentsAndWindow(updateRect, false);
@@ -1404,13 +1429,10 @@
 void FrameView::scrollContentsSlowPath(const IntRect& updateRect)
 {
 #if USE(ACCELERATED_COMPOSITING)
-    RenderView* root = m_frame->contentRenderer();
-    if (root && root->layer()->isComposited()) {
-        GraphicsLayer* layer = root->layer()->backing()->graphicsLayer();
-        if (layer && layer->drawsContent()) {
-            root->layer()->setBackingNeedsRepaintInRect(visibleContentRect());
-            return;
-        }
+    if (contentsInCompositedLayer()) {
+        RenderView* root = m_frame->contentRenderer();
+        ASSERT(root);
+        root->layer()->setBackingNeedsRepaintInRect(visibleContentRect());
     }
     if (RenderPart* frameRenderer = m_frame->ownerRenderer()) {
         if (frameRenderer->containerForRepaint()) {

Modified: trunk/Source/WebCore/page/FrameView.h (92873 => 92874)


--- trunk/Source/WebCore/page/FrameView.h	2011-08-11 19:44:45 UTC (rev 92873)
+++ trunk/Source/WebCore/page/FrameView.h	2011-08-11 20:43:18 UTC (rev 92874)
@@ -172,7 +172,7 @@
     void setMediaType(const String&);
     void adjustMediaTypeForPrinting(bool printing);
 
-    void setUseSlowRepaints();
+    void setCannotBlitToWindow();
     void setIsOverlapped(bool);
     bool isOverlapped() const { return m_isOverlapped; }
     bool isOverlappedIncludingAncestors() const;
@@ -306,9 +306,10 @@
     virtual bool isFrameView() const;
 
     friend class RenderWidget;
-    bool useSlowRepaints() const;
+    bool useSlowRepaints(bool considerOverlap = true) const;
     bool useSlowRepaintsIfNotOverlapped() const;
     void updateCanBlitOnScrollRecursively();
+    bool contentsInCompositedLayer() const;
 
     bool hasFixedObjects() const { return m_fixedObjectCount > 0; }
 
@@ -385,7 +386,7 @@
     bool m_doFullRepaint;
     
     bool m_canHaveScrollbars;
-    bool m_useSlowRepaints;
+    bool m_cannotBlitToWindow;
     bool m_isOverlapped;
     bool m_contentIsOpaque;
     unsigned m_slowRepaintObjectCount;

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (92873 => 92874)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2011-08-11 19:44:45 UTC (rev 92873)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2011-08-11 20:43:18 UTC (rev 92874)
@@ -854,13 +854,13 @@
     return roundedIntPoint(renderer()->absoluteToLocal(absolutePoint, false, true));
 }
 
-bool RenderLayer::requiresSlowRepaints() const
+bool RenderLayer::cannotBlitToWindow() const
 {
     if (isTransparent() || hasReflection() || hasTransform())
         return true;
     if (!parent())
         return false;
-    return parent()->requiresSlowRepaints();
+    return parent()->cannotBlitToWindow();
 }
 
 bool RenderLayer::isTransparent() const

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (92873 => 92874)


--- trunk/Source/WebCore/rendering/RenderLayer.h	2011-08-11 19:44:45 UTC (rev 92873)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2011-08-11 20:43:18 UTC (rev 92874)
@@ -192,7 +192,7 @@
     bool isNormalFlowOnly() const { return m_isNormalFlowOnly; }
     bool isSelfPaintingLayer() const;
 
-    bool requiresSlowRepaints() const;
+    bool cannotBlitToWindow() const;
 
     bool isTransparent() const;
     RenderLayer* transparentPaintingAncestor();

Modified: trunk/Source/WebCore/rendering/RenderView.cpp (92873 => 92874)


--- trunk/Source/WebCore/rendering/RenderView.cpp	2011-08-11 19:44:45 UTC (rev 92873)
+++ trunk/Source/WebCore/rendering/RenderView.cpp	2011-08-11 20:43:18 UTC (rev 92874)
@@ -196,15 +196,15 @@
     Element* elt;
     for (elt = document()->ownerElement(); view() && elt && elt->renderer(); elt = elt->document()->ownerElement()) {
         RenderLayer* layer = elt->renderer()->enclosingLayer();
-        if (layer->requiresSlowRepaints()) {
-            frameView()->setUseSlowRepaints();
+        if (layer->cannotBlitToWindow()) {
+            frameView()->setCannotBlitToWindow();
             break;
         }
 
 #if USE(ACCELERATED_COMPOSITING)
         if (RenderLayer* compositingLayer = layer->enclosingCompositingLayer()) {
             if (!compositingLayer->backing()->paintingGoesToWindow()) {
-                frameView()->setUseSlowRepaints();
+                frameView()->setCannotBlitToWindow();
                 break;
             }
         }
@@ -235,7 +235,7 @@
     // Only fill with the base background color (typically white) if we're the root document, 
     // since iframes/frames with no background in the child document should show the parent's background.
     if (frameView()->isTransparent()) // FIXME: This needs to be dynamic.  We should be able to go back to blitting if we ever stop being transparent.
-        frameView()->setUseSlowRepaints(); // The parent must show behind the child.
+        frameView()->setCannotBlitToWindow(); // The parent must show behind the child.
     else {
         Color baseColor = frameView()->baseBackgroundColor();
         if (baseColor.alpha() > 0) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to