Changeset 151581 in webkit


Ignore:
Timestamp:
Jun 13, 2013 9:58:11 PM (11 years ago)
Author:
Simon Fraser
Message:

Sometimes we stick in slow scrolling mode even after leaving a page
https://bugs.webkit.org/show_bug.cgi?id=117622

Reviewed by Sam Weinig.

ScrollingCoordinator, and thus the scrolling state tree, is owned by Page,
and so persists when navigating between cached pages. We do give the ScrollingStateTree
a new ScrollingStateScrollingNode on navigation, however the ScrollingStateScrollingNode
would not have dirty flags set for, say, WheelEventHandlerCount if the document had
no wheel handlers. And because that dirty flag wasn't set, ScrollingTree::commitNewTreeState()
would fail to update m_hasWheelEventHandlers, so we'd remain in slow scrolling.

Fix by having ScrollingStateTree remember if it's been given a new root ScrollingStateScrollingNode,
and making ScrollingTree::commitNewTreeState() to the right thing in that case.

Also fix a couple of issues with the tiled scrolling indicator. First, on cached page
navigation, the indicator color would show the state for the old page, because
ScrollingCoordinatorMac::commitTreeState() checked scrollingTree()->hasWheelEventHandlers()
before the scrolling thread has committed the new scrolling tree.

Second, the color change would animate, so stop that.

Not testable, since tests can only dump the scrolling state tree.

  • page/scrolling/ScrollingStateTree.cpp:

(WebCore::ScrollingStateTree::ScrollingStateTree):
(WebCore::ScrollingStateTree::attachNode):
(WebCore::ScrollingStateTree::commit):

  • page/scrolling/ScrollingStateTree.h:

(WebCore::ScrollingStateTree::hasNewRootStateNode):

  • page/scrolling/ScrollingTree.cpp:

(WebCore::ScrollingTree::commitNewTreeState):

  • page/scrolling/mac/ScrollingCoordinatorMac.mm:

(WebCore::ScrollingCoordinatorMac::commitTreeState):

  • platform/graphics/ca/mac/TileController.mm:

(-[WebTiledScrollingIndicatorLayer init]): Turn off borderColor implicit animations.

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r151580 r151581  
     12013-06-13  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Sometimes we stick in slow scrolling mode even after leaving a page
     4        https://bugs.webkit.org/show_bug.cgi?id=117622
     5
     6        Reviewed by Sam Weinig.
     7       
     8        ScrollingCoordinator, and thus the scrolling state tree, is owned by Page,
     9        and so persists when navigating between cached pages. We do give the ScrollingStateTree
     10        a new ScrollingStateScrollingNode on navigation, however the ScrollingStateScrollingNode
     11        would not have dirty flags set for, say, WheelEventHandlerCount if the document had
     12        no wheel handlers. And because that dirty flag wasn't set, ScrollingTree::commitNewTreeState()
     13        would fail to update m_hasWheelEventHandlers, so we'd remain in slow scrolling.
     14       
     15        Fix by having ScrollingStateTree remember if it's been given a new root ScrollingStateScrollingNode,
     16        and making ScrollingTree::commitNewTreeState() to the right thing in that case.
     17       
     18        Also fix a couple of issues with the tiled scrolling indicator. First, on cached page
     19        navigation, the indicator color would show the state for the old page, because
     20        ScrollingCoordinatorMac::commitTreeState() checked scrollingTree()->hasWheelEventHandlers()
     21        before the scrolling thread has committed the new scrolling tree.
     22       
     23        Second, the color change would animate, so stop that.
     24
     25        Not testable, since tests can only dump the scrolling state tree.
     26
     27        * page/scrolling/ScrollingStateTree.cpp:
     28        (WebCore::ScrollingStateTree::ScrollingStateTree):
     29        (WebCore::ScrollingStateTree::attachNode):
     30        (WebCore::ScrollingStateTree::commit):
     31        * page/scrolling/ScrollingStateTree.h:
     32        (WebCore::ScrollingStateTree::hasNewRootStateNode):
     33        * page/scrolling/ScrollingTree.cpp:
     34        (WebCore::ScrollingTree::commitNewTreeState):
     35        * page/scrolling/mac/ScrollingCoordinatorMac.mm:
     36        (WebCore::ScrollingCoordinatorMac::commitTreeState):
     37        * platform/graphics/ca/mac/TileController.mm:
     38        (-[WebTiledScrollingIndicatorLayer init]): Turn off borderColor implicit animations.
     39
    1402013-06-13  Peter Gal  <galpeter@inf.u-szeged.hu>
    241
  • trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp

    r148298 r151581  
    4242ScrollingStateTree::ScrollingStateTree()
    4343    : m_hasChangedProperties(false)
     44    , m_hasNewRootStateNode(false)
    4445{
    4546}
     
    7172        setRootStateNode(ScrollingStateScrollingNode::create(this, newNodeID));
    7273        newNode = rootStateNode();
     74        m_hasNewRootStateNode = true;
    7375    } else {
    7476        ScrollingStateNode* parent = stateNodeForID(parentID);
     
    137139    m_hasChangedProperties = false;
    138140
     141    treeStateClone->m_hasNewRootStateNode = m_hasNewRootStateNode;
     142    m_hasNewRootStateNode = false;
     143
    139144    return treeStateClone.release();
    140145}
  • trunk/Source/WebCore/page/scrolling/ScrollingStateTree.h

    r148298 r151581  
    6363    bool hasChangedProperties() const { return m_hasChangedProperties; }
    6464
     65    bool hasNewRootStateNode() const { return m_hasNewRootStateNode; }
     66
    6567private:
    6668    ScrollingStateTree();
     
    7678    Vector<ScrollingNodeID> m_nodesRemovedSinceLastCommit;
    7779    bool m_hasChangedProperties;
     80    bool m_hasNewRootStateNode;
    7881};
    7982
  • trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp

    r147749 r151581  
    133133    ASSERT(ScrollingThread::isCurrentThread());
    134134
     135    bool rootStateNodeChanged = scrollingStateTree->hasNewRootStateNode();
     136   
    135137    ScrollingStateScrollingNode* rootNode = scrollingStateTree->rootStateNode();
    136138    if (rootNode
    137         && (rootNode->hasChangedProperty(ScrollingStateScrollingNode::WheelEventHandlerCount)
     139        && (rootStateNodeChanged
     140            || rootNode->hasChangedProperty(ScrollingStateScrollingNode::WheelEventHandlerCount)
    138141            || rootNode->hasChangedProperty(ScrollingStateScrollingNode::NonFastScrollableRegion)
    139142            || rootNode->hasChangedProperty(ScrollingStateNode::ScrollLayer))) {
    140143        MutexLocker lock(m_mutex);
    141144
    142         if (rootNode->hasChangedProperty(ScrollingStateNode::ScrollLayer))
     145        if (rootStateNodeChanged || rootNode->hasChangedProperty(ScrollingStateNode::ScrollLayer))
    143146            m_mainFrameScrollPosition = IntPoint();
    144         if (rootNode->hasChangedProperty(ScrollingStateScrollingNode::WheelEventHandlerCount))
     147        if (rootStateNodeChanged || rootNode->hasChangedProperty(ScrollingStateScrollingNode::WheelEventHandlerCount))
    145148            m_hasWheelEventHandlers = scrollingStateTree->rootStateNode()->wheelEventHandlerCount();
    146         if (rootNode->hasChangedProperty(ScrollingStateScrollingNode::NonFastScrollableRegion))
     149        if (rootStateNodeChanged || rootNode->hasChangedProperty(ScrollingStateScrollingNode::NonFastScrollableRegion))
    147150            m_nonFastScrollableRegion = scrollingStateTree->rootStateNode()->nonFastScrollableRegion();
    148151    }
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm

    r150043 r151581  
    443443    if (shouldUpdateScrollLayerPositionOnMainThread())
    444444        indicatorMode = MainThreadScrollingBecauseOfStyleIndication;
    445     else if (scrollingTree() && scrollingTree()->hasWheelEventHandlers())
     445    else if (m_scrollingStateTree->rootStateNode()->wheelEventHandlerCount())
    446446        indicatorMode =  MainThreadScrollingBecauseOfEventHandlersIndication;
    447447    else
  • trunk/Source/WebCore/platform/graphics/ca/mac/TileController.mm

    r149768 r151581  
    6464
    6565        _visibleRectFrameLayer = [CALayer layer];
    66         [_visibleRectFrameLayer setStyle:[NSDictionary dictionaryWithObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNull null], @"bounds", [NSNull null], @"position", nil] forKey:@"actions"]];
     66        [_visibleRectFrameLayer setStyle:[NSDictionary dictionaryWithObject:[NSDictionary dictionaryWithObjectsAndKeys:[NSNull null], @"bounds", [NSNull null], @"position", [NSNull null], @"borderColor", nil] forKey:@"actions"]];
    6767        [self addSublayer:_visibleRectFrameLayer];
    6868        [_visibleRectFrameLayer setBorderColor:WebCore::cachedCGColor(WebCore::Color(255, 0, 0), WebCore::ColorSpaceDeviceRGB)];
Note: See TracChangeset for help on using the changeset viewer.