Changeset 167316 in webkit


Ignore:
Timestamp:
Apr 15, 2014, 10:53:23 AM (11 years ago)
Author:
Simon Fraser
Message:

[iOS WK2] Pages often blank on first load if page loaded by typing the URL
https://bugs.webkit.org/show_bug.cgi?id=131665

Reviewed by Tim Horton.

The document overlay-related code in RemoteLayerTreeDrawingArea::setRootCompositingLayer()
was triggering a compositing layer flush when called with a null rootLayer, which happens
for pages going into the page cache. This would trigger a layer flush that would clobber
the root layer for the visible page, resulting in missing content.

Also, rebuildCompositingLayerTree() is called recursively and the m_documentOverlayRootLayer
was being added to (and then removed from) every single compositing layers.

Fix both these by changing to a pull model, where RenderLayerCompositor requests
the overlay layer via ChromeClient, and gets it at the end of every flush,
adding to the children of the root layer.

Source/WebCore:

  • WebCore.exp.in:
  • page/ChromeClient.h:

(WebCore::ChromeClient::documentOverlayLayerForFrame):

  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::RenderLayerCompositor):
(WebCore::RenderLayerCompositor::flushPendingLayerChanges): Put visibleRect
into a variable for ease of debugging.
(WebCore::RenderLayerCompositor::updateCompositingLayers): Asser
that we're not in the page cache (this would have caught the bug).
(WebCore::RenderLayerCompositor::appendOverlayLayers):
(WebCore::RenderLayerCompositor::rebuildCompositingLayerTree):
(WebCore::RenderLayerCompositor::setDocumentOverlayRootLayer): Deleted.

  • rendering/RenderLayerCompositor.h:

Source/WebKit2:

  • WebProcess/WebCoreSupport/WebChromeClient.cpp:

(WebKit::WebChromeClient::documentOverlayLayerForFrame):

  • WebProcess/WebCoreSupport/WebChromeClient.h:
  • WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:

(WebKit::RemoteLayerTreeDrawingArea::setRootCompositingLayer):

Location:
trunk/Source
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r167313 r167316  
     12014-04-15  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS WK2] Pages often blank on first load if page loaded by typing the URL
     4        https://bugs.webkit.org/show_bug.cgi?id=131665
     5
     6        Reviewed by Tim Horton.
     7
     8        The document overlay-related code in RemoteLayerTreeDrawingArea::setRootCompositingLayer()
     9        was triggering a compositing layer flush when called with a null rootLayer, which happens
     10        for pages going into the page cache. This would trigger a layer flush that would clobber
     11        the root layer for the visible page, resulting in missing content.
     12       
     13        Also, rebuildCompositingLayerTree() is called recursively and the m_documentOverlayRootLayer
     14        was being added to (and then removed from) every single compositing layers.
     15       
     16        Fix both these by changing to a pull model, where RenderLayerCompositor requests
     17        the overlay layer via ChromeClient, and gets it at the end of every flush,
     18        adding to the children of the root layer.
     19
     20        * WebCore.exp.in:
     21        * page/ChromeClient.h:
     22        (WebCore::ChromeClient::documentOverlayLayerForFrame):
     23        * rendering/RenderLayerCompositor.cpp:
     24        (WebCore::RenderLayerCompositor::RenderLayerCompositor):
     25        (WebCore::RenderLayerCompositor::flushPendingLayerChanges): Put visibleRect
     26        into a variable for ease of debugging.
     27        (WebCore::RenderLayerCompositor::updateCompositingLayers): Asser
     28        that we're not in the page cache (this would have caught the bug).
     29        (WebCore::RenderLayerCompositor::appendOverlayLayers):
     30        (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree):
     31        (WebCore::RenderLayerCompositor::setDocumentOverlayRootLayer): Deleted.
     32        * rendering/RenderLayerCompositor.h:
     33
    1342014-04-15  Commit Queue  <commit-queue@webkit.org>
    235
  • trunk/Source/WebCore/WebCore.exp.in

    r167303 r167316  
    872872__ZN7WebCore21PlatformKeyboardEvent24disambiguateKeyDownEventENS_13PlatformEvent4TypeEb
    873873__ZN7WebCore21RemoteCommandListener6createERNS_27RemoteCommandListenerClientE
    874 __ZN7WebCore21RenderLayerCompositor27setDocumentOverlayRootLayerEPNS_13GraphicsLayerE
    875874__ZN7WebCore21ResourceLoadScheduler20servePendingRequestsENS_20ResourceLoadPriorityE
    876875__ZN7WebCore21ResourceLoadScheduler20servePendingRequestsEPNS0_15HostInformationENS_20ResourceLoadPriorityE
  • trunk/Source/WebCore/page/ChromeClient.h

    r167303 r167316  
    291291    // regardless of the settings.
    292292    virtual bool allowsAcceleratedCompositing() const { return true; }
     293    // Supply a layer that will added as an overlay over other document layers (scrolling with the document).
     294    virtual GraphicsLayer* documentOverlayLayerForFrame(Frame&) { return nullptr; }
    293295
    294296    enum CompositingTrigger {
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r167303 r167316  
    256256    , m_layersWithTiledBackingCount(0)
    257257    , m_rootLayerAttachment(RootLayerUnattached)
    258     , m_documentOverlayRootLayer(nullptr)
    259258    , m_layerFlushTimer(this, &RenderLayerCompositor::layerFlushTimerFired)
    260259    , m_layerFlushThrottlingEnabled(page() && page()->progress().isMainLoadProgressing())
     
    431430        double horizontalMargin = defaultTileWidth / pageScaleFactor();
    432431        double verticalMargin = defaultTileHeight / pageScaleFactor();
    433         rootLayer->flushCompositingState(frameView.computeCoverageRect(horizontalMargin, verticalMargin));
     432        FloatRect visibleRect = frameView.computeCoverageRect(horizontalMargin, verticalMargin);
     433        rootLayer->flushCompositingState(visibleRect);
    434434#else
    435435        // Having a m_clipLayer indicates that we're doing scrolling via GraphicsLayers.
     
    598598{
    599599    m_updateCompositingLayersTimer.stop();
     600
     601    ASSERT(!m_renderView.document().inPageCache());
    600602   
    601603    // Compositing layers will be updated in Document::implicitClose() if suppressed here.
     
    690692        // Host the document layer in the RenderView's root layer.
    691693        if (isFullUpdate) {
     694            appendOverlayLayers(childList);
    692695            // Even when childList is empty, don't drop out of compositing mode if there are
    693696            // composited layers that we didn't hit in our traversal (e.g. because of visibility:hidden).
    694697            if (childList.isEmpty() && !hasAnyAdditionalCompositedLayers(*updateRoot))
    695698                destroyRootLayer();
    696             else
     699            else if (m_rootContentLayer)
    697700                m_rootContentLayer->setChildren(childList);
    698701        }
     
    720723    // Inform the inspector that the layer tree has changed.
    721724    InspectorInstrumentation::layerTreeDidChange(page());
     725}
     726
     727void RenderLayerCompositor::appendOverlayLayers(Vector<GraphicsLayer*>& childList)
     728{
     729    Frame& frame = m_renderView.frameView().frame();
     730    Page* page = frame.page();
     731    if (!page)
     732        return;
     733
     734    if (GraphicsLayer* overlayLayer = page->chrome().client().documentOverlayLayerForFrame(frame))
     735        childList.append(overlayLayer);
    722736}
    723737
     
    14621476        childLayersOfEnclosingLayer.append(layerBacking->childForSuperlayers());
    14631477    }
    1464 
    1465     if (m_documentOverlayRootLayer)
    1466         childLayersOfEnclosingLayer.append(m_documentOverlayRootLayer);
    14671478}
    14681479
     
    38203831}
    38213832
    3822 void RenderLayerCompositor::setDocumentOverlayRootLayer(GraphicsLayer* documentOverlayRootLayer)
    3823 {
    3824     if (m_documentOverlayRootLayer)
    3825         m_documentOverlayRootLayer->removeFromParent();
    3826     m_documentOverlayRootLayer = documentOverlayRootLayer;
    3827     setCompositingLayersNeedRebuild(true);
    3828     scheduleCompositingLayerUpdate();
    3829 }
    3830 
    38313833} // namespace WebCore
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.h

    r167303 r167316  
    305305    Color rootExtendedBackgroundColor() const { return m_rootExtendedBackgroundColor; }
    306306
    307     void setDocumentOverlayRootLayer(GraphicsLayer*);
    308 
    309307private:
    310308    class OverlapMap;
     
    367365    bool isRunningAcceleratedTransformAnimation(RenderLayerModelObject&) const;
    368366
     367    void appendOverlayLayers(Vector<GraphicsLayer*>&);
    369368    bool hasAnyAdditionalCompositedLayers(const RenderLayer& rootLayer) const;
    370369
     
    509508#endif
    510509
    511     GraphicsLayer* m_documentOverlayRootLayer;
    512 
    513510    std::unique_ptr<GraphicsLayerUpdater> m_layerUpdater; // Updates tiled layer visible area periodically while animations are running.
    514511
  • trunk/Source/WebKit2/ChangeLog

    r167305 r167316  
     12014-04-15  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS WK2] Pages often blank on first load if page loaded by typing the URL
     4        https://bugs.webkit.org/show_bug.cgi?id=131665
     5
     6        Reviewed by Tim Horton.
     7
     8        The document overlay-related code in RemoteLayerTreeDrawingArea::setRootCompositingLayer()
     9        was triggering a compositing layer flush when called with a null rootLayer, which happens
     10        for pages going into the page cache. This would trigger a layer flush that would clobber
     11        the root layer for the visible page, resulting in missing content.
     12       
     13        Also, rebuildCompositingLayerTree() is called recursively and the m_documentOverlayRootLayer
     14        was being added to (and then removed from) every single compositing layers.
     15       
     16        Fix both these by changing to a pull model, where RenderLayerCompositor requests
     17        the overlay layer via ChromeClient, and gets it at the end of every flush,
     18        adding to the children of the root layer.
     19
     20        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
     21        (WebKit::WebChromeClient::documentOverlayLayerForFrame):
     22        * WebProcess/WebCoreSupport/WebChromeClient.h:
     23        * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
     24        (WebKit::RemoteLayerTreeDrawingArea::setRootCompositingLayer):
     25
    1262014-04-15  Jinwoo Song  <jinwoo7.song@samsung.com>
    227
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp

    r167303 r167316  
    772772}
    773773
     774GraphicsLayer* WebChromeClient::documentOverlayLayerForFrame(Frame& frame)
     775{
     776    if (&frame == &m_page->corePage()->mainFrame())
     777        return m_page->pageOverlayController().documentOverlayRootLayer();
     778
     779    return nullptr;
     780}
     781
    774782void WebChromeClient::setNeedsOneShotDrawingSynchronization()
    775783{
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h

    r167303 r167316  
    203203    virtual void setNeedsOneShotDrawingSynchronization() override;
    204204    virtual void scheduleCompositingLayerFlush() override;
     205    virtual WebCore::GraphicsLayer* documentOverlayLayerForFrame(WebCore::Frame&) override;
    205206
    206207    virtual CompositingTriggerFlags allowedCompositingTriggers() const
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm

    r167303 r167316  
    9595    }
    9696    m_rootLayer->setChildren(children);
    97 
    98     m_webPage->mainFrameView()->renderView()->compositor().setDocumentOverlayRootLayer(m_webPage->pageOverlayController().documentOverlayRootLayer());
    9997}
    10098
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm

    r167303 r167316  
    450450    [m_hostingLayer setSublayers:layer ? @[ layer, m_webPage->pageOverlayController().viewOverlayRootLayer()->platformLayer() ] : @[ ]];
    451451
    452     m_webPage->mainFrameView()->renderView()->compositor().setDocumentOverlayRootLayer(m_webPage->pageOverlayController().documentOverlayRootLayer());
    453 
    454452    bool hadRootLayer = !!m_rootLayer;
    455453    m_rootLayer = layer;
Note: See TracChangeset for help on using the changeset viewer.