Changeset 224914 in webkit


Ignore:
Timestamp:
Nov 16, 2017 5:49:02 AM (6 years ago)
Author:
fred.wang@free.fr
Message:

Consider non-main frames for frameViewRootLayerDidChange
https://bugs.webkit.org/show_bug.cgi?id=178508

Patch by Frederic Wang <fwang@igalia.com> on 2017-11-16
Reviewed by Antonio Gomes.

No new tests, behavior unchanged.

AsyncScrollingCoordinator::frameViewRootLayerDidChange assumes that frameView is always a
main-frame. It calls ensureRootStateNodeForFrameView, which always attaches a frame node with
null parent ID. It also has an ASSERT to check m_scrollingStateTree->rootStateNode(), instead
of m_scrollingStateTree->stateNodeForID(frameView.scrollLayerID()). This patch makes the
ASSERT more generic. It also adds an early return into ensureRootStateNodeForFrameView when the
node already exists so that the call to attachToStateTree can be skipped. It turns out that that
call is actually only necessary for main frame, so another ASSERT is added to verify it.

  • page/scrolling/AsyncScrollingCoordinator.cpp:

(WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange): Modify the ASSERT to
verify the availability of a scrolling node for the frame, not just the root node.
(WebCore::AsyncScrollingCoordinator::ensureRootStateNodeForFrameView): Add an early return to
skip the call to attachToStateTree when the node is actually already available. Add an ASSERT to
ensure that attaching a new node is only necessary for main frames.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r224912 r224914  
     12017-11-16  Frederic Wang  <fwang@igalia.com>
     2
     3        Consider non-main frames for frameViewRootLayerDidChange
     4        https://bugs.webkit.org/show_bug.cgi?id=178508
     5
     6        Reviewed by Antonio Gomes.
     7
     8        No new tests, behavior unchanged.
     9
     10        AsyncScrollingCoordinator::frameViewRootLayerDidChange assumes that frameView is always a
     11        main-frame. It calls ensureRootStateNodeForFrameView, which always attaches a frame node with
     12        null parent ID. It also has an ASSERT to check m_scrollingStateTree->rootStateNode(), instead
     13        of m_scrollingStateTree->stateNodeForID(frameView.scrollLayerID()). This patch makes the
     14        ASSERT more generic. It also adds an early return into ensureRootStateNodeForFrameView when the
     15        node already exists so that the call to attachToStateTree can be skipped. It turns out that that
     16        call is actually only necessary for main frame, so another ASSERT is added to verify it.
     17
     18        * page/scrolling/AsyncScrollingCoordinator.cpp:
     19        (WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange): Modify the ASSERT to
     20        verify the availability of a scrolling node for the frame, not just the root node.
     21        (WebCore::AsyncScrollingCoordinator::ensureRootStateNodeForFrameView): Add an early return to
     22        skip the call to attachToStateTree when the node is actually already available. Add an ASSERT to
     23        ensure that attaching a new node is only necessary for main frames.
     24
    1252017-11-16  Miguel Gomez  <magomez@igalia.com>
    226
  • trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp

    r223728 r224914  
    221221    // If the root layer does not have a ScrollingStateNode, then we should create one.
    222222    ensureRootStateNodeForFrameView(frameView);
    223     ASSERT(m_scrollingStateTree->rootStateNode());
     223    ASSERT(m_scrollingStateTree->stateNodeForID(frameView.scrollLayerID()));
    224224
    225225    ScrollingCoordinator::frameViewRootLayerDidChange(frameView);
     
    513513{
    514514    ASSERT(frameView.scrollLayerID());
     515    if (m_scrollingStateTree->stateNodeForID(frameView.scrollLayerID()))
     516        return;
     517
     518    // For non-main frames, it is only possible to arrive in this function from
     519    // RenderLayerCompositor::updateBacking where the node has already been created.
     520    ASSERT(frameView.frame().isMainFrame());
    515521    attachToStateTree(FrameScrollingNode, frameView.scrollLayerID(), 0);
    516522}
Note: See TracChangeset for help on using the changeset viewer.