[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 11:28:06 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 31b329f5cb42dfbbba49d54c4f7291d8c2e4aee2
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Jul 26 17:48:13 2010 +0000

    2010-07-26  Simon Fraser  <simon.fraser at apple.com>
    
            Reviewed by Anders Carlsson.
    
            Composited layers don't scroll in WebKit2
            https://bugs.webkit.org/show_bug.cgi?id=42771
    
            Rename two methods on RenderLayerCompositor to make their use more clear, and call them
            when the FrameView gets resized and scrolled.
    
            * page/FrameView.h:
            * page/FrameView.cpp:
            (WebCore::FrameView::setFrameRect): override so we know when the size of the FrameView changes, so that the
            RenderLayerCompositor can update its clipping layer.
            (WebCore::FrameView::scrollPositionChanged): Call compositor()->frameViewDidScroll().
    
            * rendering/RenderLayerBacking.cpp:
            (WebCore::RenderLayerBacking::updateAfterWidgetResize): updateContentLayerOffset() was renamed.
    
            * rendering/RenderLayerCompositor.h:
            * rendering/RenderLayerCompositor.cpp:
            (WebCore::RenderLayerCompositor::frameViewDidChangeSize): Renamed from updateContentLayerOffset().
            (WebCore::RenderLayerCompositor::frameViewDidScroll): Renamed from updateContentLayerScrollPosition().
            (WebCore::RenderLayerCompositor::shouldPropagateCompositingToEnclosingIFrame): Propagate compositing on Mac
            for any FrameView that doesn't have a native widget, which is the case with WebKit2.
            (WebCore::RenderLayerCompositor::requiresScrollLayer): New method to tell us whether we need to handle
            scrolling (and clipping) ourselves.
            (WebCore::RenderLayerCompositor::ensureRootPlatformLayer): Do geometry flipping on the root platform
            layer only if we're not doing our own scrolling, and use the new requiresScrollLayer() method.
            (WebCore::RenderLayerCompositor::attachRootPlatformLayer): Send out the rootPlatformLayer(),
            so that it returns the clipping layer if we have one.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64054 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 846f7fa..35208bb 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,35 @@
+2010-07-26  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Anders Carlsson.
+
+        Composited layers don't scroll in WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=42771
+
+        Rename two methods on RenderLayerCompositor to make their use more clear, and call them
+        when the FrameView gets resized and scrolled.
+
+        * page/FrameView.h:
+        * page/FrameView.cpp:
+        (WebCore::FrameView::setFrameRect): override so we know when the size of the FrameView changes, so that the
+        RenderLayerCompositor can update its clipping layer.
+        (WebCore::FrameView::scrollPositionChanged): Call compositor()->frameViewDidScroll().
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateAfterWidgetResize): updateContentLayerOffset() was renamed.
+
+        * rendering/RenderLayerCompositor.h:
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::frameViewDidChangeSize): Renamed from updateContentLayerOffset().
+        (WebCore::RenderLayerCompositor::frameViewDidScroll): Renamed from updateContentLayerScrollPosition().
+        (WebCore::RenderLayerCompositor::shouldPropagateCompositingToEnclosingIFrame): Propagate compositing on Mac
+        for any FrameView that doesn't have a native widget, which is the case with WebKit2.
+        (WebCore::RenderLayerCompositor::requiresScrollLayer): New method to tell us whether we need to handle
+        scrolling (and clipping) ourselves.
+        (WebCore::RenderLayerCompositor::ensureRootPlatformLayer): Do geometry flipping on the root platform
+        layer only if we're not doing our own scrolling, and use the new requiresScrollLayer() method.
+        (WebCore::RenderLayerCompositor::attachRootPlatformLayer): Send out the rootPlatformLayer(),
+        so that it returns the clipping layer if we have one.
+
 2010-07-26  Tony Gentilcore  <tonyg at chromium.org>
 
         Reviewed by Darin Fisher.
diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp
index acd22f0..98ca8f9 100644
--- a/WebCore/page/FrameView.cpp
+++ b/WebCore/page/FrameView.cpp
@@ -328,6 +328,22 @@ void FrameView::invalidateRect(const IntRect& rect)
     renderer->repaintRectangle(repaintRect);
 }
 
+void FrameView::setFrameRect(const IntRect& newRect)
+{
+    IntRect oldRect = frameRect();
+    if (newRect == oldRect)
+        return;
+
+    ScrollView::setFrameRect(newRect);
+
+#if USE(ACCELERATED_COMPOSITING)
+    if (RenderView* root = m_frame->contentRenderer()) {
+        if (root->usesCompositing())
+            root->compositor()->frameViewDidChangeSize();
+    }
+#endif
+}
+
 void FrameView::setMarginWidth(int w)
 {
     // make it update the rendering area when set
@@ -1115,7 +1131,7 @@ void FrameView::scrollPositionChanged()
 #if USE(ACCELERATED_COMPOSITING)
     if (RenderView* root = m_frame->contentRenderer()) {
         if (root->usesCompositing())
-            root->compositor()->updateContentLayerScrollPosition(scrollPosition());
+            root->compositor()->frameViewDidScroll(scrollPosition());
     }
 #endif
 }
diff --git a/WebCore/page/FrameView.h b/WebCore/page/FrameView.h
index b05b078..718b793 100644
--- a/WebCore/page/FrameView.h
+++ b/WebCore/page/FrameView.h
@@ -63,6 +63,7 @@ public:
     virtual HostWindow* hostWindow() const;
     
     virtual void invalidateRect(const IntRect&);
+    virtual void setFrameRect(const IntRect&);
 
     Frame* frame() const { return m_frame.get(); }
     void clearFrame();
diff --git a/WebCore/rendering/RenderLayerBacking.cpp b/WebCore/rendering/RenderLayerBacking.cpp
index e96c947..888fe32 100644
--- a/WebCore/rendering/RenderLayerBacking.cpp
+++ b/WebCore/rendering/RenderLayerBacking.cpp
@@ -211,7 +211,7 @@ void RenderLayerBacking::updateAfterWidgetResize()
 {
     if (renderer()->isRenderIFrame()) {
         if (RenderLayerCompositor* innerCompositor = RenderLayerCompositor::iframeContentsCompositor(toRenderIFrame(renderer())))
-            innerCompositor->updateContentLayerOffset(contentsBox().location());
+            innerCompositor->frameViewDidChangeSize(contentsBox().location());
     }
 }
 
diff --git a/WebCore/rendering/RenderLayerCompositor.cpp b/WebCore/rendering/RenderLayerCompositor.cpp
index 234ad7f..f536a66 100644
--- a/WebCore/rendering/RenderLayerCompositor.cpp
+++ b/WebCore/rendering/RenderLayerCompositor.cpp
@@ -783,7 +783,7 @@ void RenderLayerCompositor::rebuildCompositingLayerTree(RenderLayer* layer, cons
     }
 }
 
-void RenderLayerCompositor::updateContentLayerOffset(const IntPoint& contentsOffset)
+void RenderLayerCompositor::frameViewDidChangeSize(const IntPoint& contentsOffset)
 {
     if (m_clipLayer) {
         FrameView* frameView = m_renderView->frameView();
@@ -795,7 +795,7 @@ void RenderLayerCompositor::updateContentLayerOffset(const IntPoint& contentsOff
     }
 }
 
-void RenderLayerCompositor::updateContentLayerScrollPosition(const IntPoint& scrollPosition)
+void RenderLayerCompositor::frameViewDidScroll(const IntPoint& scrollPosition)
 {
     if (m_scrollLayer)
         m_scrollLayer->setPosition(FloatPoint(-scrollPosition.x(), -scrollPosition.y()));
@@ -1039,6 +1039,10 @@ bool RenderLayerCompositor::shouldPropagateCompositingToEnclosingIFrame() const
     // 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())
+        return true;
+
     // On Mac, only propagate compositing if the iframe is overlapped in the parent
     // document, or the parent is already compositing.
     RenderIFrame* iframeRenderer = toRenderIFrame(renderer);
@@ -1259,6 +1263,20 @@ bool RenderLayerCompositor::needsContentsCompositingLayer(const RenderLayer* lay
     return (layer->m_negZOrderList && layer->m_negZOrderList->size() > 0);
 }
 
+bool RenderLayerCompositor::requiresScrollLayer(RootLayerAttachment attachment) const
+{
+    if (attachment == RootLayerAttachedViaEnclosingIframe)
+        return true;
+
+#if PLATFORM(MAC)
+    // If we're viewless (i.e. WebKit2), we need to scroll ourselves.
+    // FIXME: eventually we should do this on other platforms too.
+    if (!m_renderView->frameView()->platformWidget())
+        return true;
+#endif
+    return false;
+}
+
 void RenderLayerCompositor::ensureRootPlatformLayer()
 {
     RootLayerAttachment expectedAttachment = shouldPropagateCompositingToEnclosingIFrame() ? RootLayerAttachedViaEnclosingIframe : RootLayerAttachedViaChromeClient;
@@ -1277,10 +1295,7 @@ void RenderLayerCompositor::ensureRootPlatformLayer()
         m_rootPlatformLayer->setMasksToBounds(true);
     }
 
-    // The root layer does flipping if we need it on this platform.
-    m_rootPlatformLayer->setGeometryOrientation(expectedAttachment == RootLayerAttachedViaEnclosingIframe ? GraphicsLayer::CompositingCoordinatesTopDown : GraphicsLayer::compositingCoordinatesOrientation());
-    
-    if (expectedAttachment == RootLayerAttachedViaEnclosingIframe) {
+    if (requiresScrollLayer(expectedAttachment)) {
         if (!m_clipLayer) {
             ASSERT(!m_scrollLayer);
             // Create a clipping layer if this is an iframe
@@ -1298,15 +1313,22 @@ void RenderLayerCompositor::ensureRootPlatformLayer()
             m_clipLayer->addChild(m_scrollLayer.get());
             m_scrollLayer->addChild(m_rootPlatformLayer.get());
             
-            updateContentLayerScrollPosition(m_renderView->frameView()->scrollPosition());
+            frameViewDidChangeSize();
+            frameViewDidScroll(m_renderView->frameView()->scrollPosition());
         }
-    } else if (m_clipLayer) {
-        m_clipLayer->removeAllChildren();
-        m_clipLayer->removeFromParent();
-        m_clipLayer = 0;
-        
-        m_scrollLayer->removeAllChildren();
-        m_scrollLayer = 0;
+    } else {
+        if (m_clipLayer) {
+            m_clipLayer->removeAllChildren();
+            m_clipLayer->removeFromParent();
+            m_clipLayer = 0;
+            
+            m_scrollLayer->removeAllChildren();
+            m_scrollLayer = 0;
+        }
+
+        // The root layer does geometry flipping if we need it.
+        m_rootPlatformLayer->setGeometryOrientation(expectedAttachment == RootLayerAttachedViaEnclosingIframe
+            ? GraphicsLayer::CompositingCoordinatesTopDown : GraphicsLayer::compositingCoordinatesOrientation());
     }
 
     // Check to see if we have to change the attachment
@@ -1348,7 +1370,7 @@ void RenderLayerCompositor::attachRootPlatformLayer(RootLayerAttachment attachme
             if (!page)
                 return;
 
-            page->chrome()->client()->attachRootGraphicsLayer(frame, m_rootPlatformLayer.get());
+            page->chrome()->client()->attachRootGraphicsLayer(frame, rootPlatformLayer());
             break;
         }
         case RootLayerAttachedViaEnclosingIframe: {
diff --git a/WebCore/rendering/RenderLayerCompositor.h b/WebCore/rendering/RenderLayerCompositor.h
index 633ecd1..0ce80a9 100644
--- a/WebCore/rendering/RenderLayerCompositor.h
+++ b/WebCore/rendering/RenderLayerCompositor.h
@@ -158,8 +158,8 @@ public:
     static bool parentIFrameContentLayers(RenderIFrame*);
 
     // Update the geometry of the layers used for clipping and scrolling in frames.
-    void updateContentLayerOffset(const IntPoint& contentsOffset);
-    void updateContentLayerScrollPosition(const IntPoint&);
+    void frameViewDidChangeSize(const IntPoint& contentsOffset = IntPoint());
+    void frameViewDidScroll(const IntPoint& = IntPoint());
 
 private:
     // Whether the given RL needs a compositing layer.
@@ -214,6 +214,8 @@ private:
     bool requiresCompositingForIFrame(RenderObject*) const;
     bool requiresCompositingWhenDescendantsAreCompositing(RenderObject*) const;
 
+    bool requiresScrollLayer(RootLayerAttachment) const;
+    
 private:
     RenderView* m_renderView;
     OwnPtr<GraphicsLayer> m_rootPlatformLayer;
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 72133a3..30c18ae 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,18 @@
+2010-07-26  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Anders Carlsson.
+
+        Composited layers don't scroll in WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=42771
+        
+        In WebKit2, do the compositing layer geometry flipping on the drawing area's main 
+        backing layer. This both avoids us having to flip the layer contents, and also avoids issues
+        with the positioning of the root platform layer, which we want top-left. Doing the flipping
+        lower down would require that the root platform layer know where the scrollbar is.
+
+        * WebProcess/WebPage/LayerBackedDrawingArea.cpp:
+        (WebKit::LayerBackedDrawingArea::LayerBackedDrawingArea):
+
 2010-07-26  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp b/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp
index f3fcdda..cca1cdf 100644
--- a/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp
+++ b/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp
@@ -54,7 +54,9 @@ LayerBackedDrawingArea::LayerBackedDrawingArea(WebPage* webPage)
     m_backingLayer->setName("DrawingArea backing layer");
 #endif
     m_backingLayer->syncCompositingStateForThisLayerOnly();
-    m_backingLayer->setContentsOrientation(GraphicsLayer::CompositingCoordinatesBottomUp);
+    
+    // Do geometry flipping on this layer.
+    m_backingLayer->setGeometryOrientation(GraphicsLayer::CompositingCoordinatesBottomUp);
     
     platformInit();
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list