Changeset 64054 in webkit


Ignore:
Timestamp:
Jul 26, 2010 10:48:13 AM (14 years ago)
Author:
Simon Fraser
Message:

2010-07-26 Simon Fraser <Simon Fraser>

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.
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r64051 r64054  
     12010-07-26  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        Composited layers don't scroll in WebKit2
     6        https://bugs.webkit.org/show_bug.cgi?id=42771
     7
     8        Rename two methods on RenderLayerCompositor to make their use more clear, and call them
     9        when the FrameView gets resized and scrolled.
     10
     11        * page/FrameView.h:
     12        * page/FrameView.cpp:
     13        (WebCore::FrameView::setFrameRect): override so we know when the size of the FrameView changes, so that the
     14        RenderLayerCompositor can update its clipping layer.
     15        (WebCore::FrameView::scrollPositionChanged): Call compositor()->frameViewDidScroll().
     16
     17        * rendering/RenderLayerBacking.cpp:
     18        (WebCore::RenderLayerBacking::updateAfterWidgetResize): updateContentLayerOffset() was renamed.
     19
     20        * rendering/RenderLayerCompositor.h:
     21        * rendering/RenderLayerCompositor.cpp:
     22        (WebCore::RenderLayerCompositor::frameViewDidChangeSize): Renamed from updateContentLayerOffset().
     23        (WebCore::RenderLayerCompositor::frameViewDidScroll): Renamed from updateContentLayerScrollPosition().
     24        (WebCore::RenderLayerCompositor::shouldPropagateCompositingToEnclosingIFrame): Propagate compositing on Mac
     25        for any FrameView that doesn't have a native widget, which is the case with WebKit2.
     26        (WebCore::RenderLayerCompositor::requiresScrollLayer): New method to tell us whether we need to handle
     27        scrolling (and clipping) ourselves.
     28        (WebCore::RenderLayerCompositor::ensureRootPlatformLayer): Do geometry flipping on the root platform
     29        layer only if we're not doing our own scrolling, and use the new requiresScrollLayer() method.
     30        (WebCore::RenderLayerCompositor::attachRootPlatformLayer): Send out the rootPlatformLayer(),
     31        so that it returns the clipping layer if we have one.
     32
    1332010-07-26  Tony Gentilcore  <tonyg@chromium.org>
    234
  • trunk/WebCore/page/FrameView.cpp

    r63907 r64054  
    329329}
    330330
     331void FrameView::setFrameRect(const IntRect& newRect)
     332{
     333    IntRect oldRect = frameRect();
     334    if (newRect == oldRect)
     335        return;
     336
     337    ScrollView::setFrameRect(newRect);
     338
     339#if USE(ACCELERATED_COMPOSITING)
     340    if (RenderView* root = m_frame->contentRenderer()) {
     341        if (root->usesCompositing())
     342            root->compositor()->frameViewDidChangeSize();
     343    }
     344#endif
     345}
     346
    331347void FrameView::setMarginWidth(int w)
    332348{
     
    11161132    if (RenderView* root = m_frame->contentRenderer()) {
    11171133        if (root->usesCompositing())
    1118             root->compositor()->updateContentLayerScrollPosition(scrollPosition());
     1134            root->compositor()->frameViewDidScroll(scrollPosition());
    11191135    }
    11201136#endif
  • trunk/WebCore/page/FrameView.h

    r63907 r64054  
    6464   
    6565    virtual void invalidateRect(const IntRect&);
     66    virtual void setFrameRect(const IntRect&);
    6667
    6768    Frame* frame() const { return m_frame.get(); }
  • trunk/WebCore/rendering/RenderLayerBacking.cpp

    r63820 r64054  
    212212    if (renderer()->isRenderIFrame()) {
    213213        if (RenderLayerCompositor* innerCompositor = RenderLayerCompositor::iframeContentsCompositor(toRenderIFrame(renderer())))
    214             innerCompositor->updateContentLayerOffset(contentsBox().location());
     214            innerCompositor->frameViewDidChangeSize(contentsBox().location());
    215215    }
    216216}
  • trunk/WebCore/rendering/RenderLayerCompositor.cpp

    r63576 r64054  
    784784}
    785785
    786 void RenderLayerCompositor::updateContentLayerOffset(const IntPoint& contentsOffset)
     786void RenderLayerCompositor::frameViewDidChangeSize(const IntPoint& contentsOffset)
    787787{
    788788    if (m_clipLayer) {
     
    796796}
    797797
    798 void RenderLayerCompositor::updateContentLayerScrollPosition(const IntPoint& scrollPosition)
     798void RenderLayerCompositor::frameViewDidScroll(const IntPoint& scrollPosition)
    799799{
    800800    if (m_scrollLayer)
     
    10401040    return true;
    10411041#else
     1042    // If we're viewless (i.e. WebKit2), we always propagate compositing.
     1043    if (!m_renderView->frameView()->platformWidget())
     1044        return true;
     1045
    10421046    // On Mac, only propagate compositing if the iframe is overlapped in the parent
    10431047    // document, or the parent is already compositing.
     
    12601264}
    12611265
     1266bool RenderLayerCompositor::requiresScrollLayer(RootLayerAttachment attachment) const
     1267{
     1268    if (attachment == RootLayerAttachedViaEnclosingIframe)
     1269        return true;
     1270
     1271#if PLATFORM(MAC)
     1272    // If we're viewless (i.e. WebKit2), we need to scroll ourselves.
     1273    // FIXME: eventually we should do this on other platforms too.
     1274    if (!m_renderView->frameView()->platformWidget())
     1275        return true;
     1276#endif
     1277    return false;
     1278}
     1279
    12621280void RenderLayerCompositor::ensureRootPlatformLayer()
    12631281{
     
    12781296    }
    12791297
    1280     // The root layer does flipping if we need it on this platform.
    1281     m_rootPlatformLayer->setGeometryOrientation(expectedAttachment == RootLayerAttachedViaEnclosingIframe ? GraphicsLayer::CompositingCoordinatesTopDown : GraphicsLayer::compositingCoordinatesOrientation());
    1282    
    1283     if (expectedAttachment == RootLayerAttachedViaEnclosingIframe) {
     1298    if (requiresScrollLayer(expectedAttachment)) {
    12841299        if (!m_clipLayer) {
    12851300            ASSERT(!m_scrollLayer);
     
    12991314            m_scrollLayer->addChild(m_rootPlatformLayer.get());
    13001315           
    1301             updateContentLayerScrollPosition(m_renderView->frameView()->scrollPosition());
    1302         }
    1303     } else if (m_clipLayer) {
    1304         m_clipLayer->removeAllChildren();
    1305         m_clipLayer->removeFromParent();
    1306         m_clipLayer = 0;
    1307        
    1308         m_scrollLayer->removeAllChildren();
    1309         m_scrollLayer = 0;
     1316            frameViewDidChangeSize();
     1317            frameViewDidScroll(m_renderView->frameView()->scrollPosition());
     1318        }
     1319    } else {
     1320        if (m_clipLayer) {
     1321            m_clipLayer->removeAllChildren();
     1322            m_clipLayer->removeFromParent();
     1323            m_clipLayer = 0;
     1324           
     1325            m_scrollLayer->removeAllChildren();
     1326            m_scrollLayer = 0;
     1327        }
     1328
     1329        // The root layer does geometry flipping if we need it.
     1330        m_rootPlatformLayer->setGeometryOrientation(expectedAttachment == RootLayerAttachedViaEnclosingIframe
     1331            ? GraphicsLayer::CompositingCoordinatesTopDown : GraphicsLayer::compositingCoordinatesOrientation());
    13101332    }
    13111333
     
    13491371                return;
    13501372
    1351             page->chrome()->client()->attachRootGraphicsLayer(frame, m_rootPlatformLayer.get());
     1373            page->chrome()->client()->attachRootGraphicsLayer(frame, rootPlatformLayer());
    13521374            break;
    13531375        }
  • trunk/WebCore/rendering/RenderLayerCompositor.h

    r63149 r64054  
    159159
    160160    // Update the geometry of the layers used for clipping and scrolling in frames.
    161     void updateContentLayerOffset(const IntPoint& contentsOffset);
    162     void updateContentLayerScrollPosition(const IntPoint&);
     161    void frameViewDidChangeSize(const IntPoint& contentsOffset = IntPoint());
     162    void frameViewDidScroll(const IntPoint& = IntPoint());
    163163
    164164private:
     
    215215    bool requiresCompositingWhenDescendantsAreCompositing(RenderObject*) const;
    216216
     217    bool requiresScrollLayer(RootLayerAttachment) const;
     218   
    217219private:
    218220    RenderView* m_renderView;
  • trunk/WebKit2/ChangeLog

    r64050 r64054  
     12010-07-26  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        Composited layers don't scroll in WebKit2
     6        https://bugs.webkit.org/show_bug.cgi?id=42771
     7       
     8        In WebKit2, do the compositing layer geometry flipping on the drawing area's main
     9        backing layer. This both avoids us having to flip the layer contents, and also avoids issues
     10        with the positioning of the root platform layer, which we want top-left. Doing the flipping
     11        lower down would require that the root platform layer know where the scrollbar is.
     12
     13        * WebProcess/WebPage/LayerBackedDrawingArea.cpp:
     14        (WebKit::LayerBackedDrawingArea::LayerBackedDrawingArea):
     15
    1162010-07-26  Anders Carlsson  <andersca@apple.com>
    217
  • trunk/WebKit2/WebProcess/WebPage/LayerBackedDrawingArea.cpp

    r63843 r64054  
    5555#endif
    5656    m_backingLayer->syncCompositingStateForThisLayerOnly();
    57     m_backingLayer->setContentsOrientation(GraphicsLayer::CompositingCoordinatesBottomUp);
     57   
     58    // Do geometry flipping on this layer.
     59    m_backingLayer->setGeometryOrientation(GraphicsLayer::CompositingCoordinatesBottomUp);
    5860   
    5961    platformInit();
Note: See TracChangeset for help on using the changeset viewer.