Changeset 242601 in webkit
- Timestamp:
- Mar 7, 2019, 10:03:41 AM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
page/scrolling/ScrollingTreeFrameScrollingNode.cpp (modified) (2 diffs)
-
page/scrolling/ScrollingTreeFrameScrollingNode.h (modified) (1 diff)
-
page/scrolling/ScrollingTreeScrollingNode.cpp (modified) (2 diffs)
-
page/scrolling/ScrollingTreeScrollingNode.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r242599 r242601 1 2019-03-07 Simon Fraser <simon.fraser@apple.com> 2 3 [iOS WK] REGRESSION (r242132): Fixed position banners flicker and move when scrolling (Apple, Tesla, YouTube, Reddit) 4 https://bugs.webkit.org/show_bug.cgi?id=195396 5 rdar://problem/48518959 6 7 Reviewed by Antti Koivisto. 8 9 r242132 introduced two issues that contributed to jumpiness of position:fixed layers when scrolling. 10 11 First, ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling() would early return if the scroll position 12 hadn't changed. It also needs to check the supplied layoutViewport (if any), but in some cases running the 13 notifyRelatedNodesAfterScrollPositionChange() code is necessary even without a scroll position change: 14 if the web process has committed new scrolling tree state (e.g. with new fixed constraints) since 15 the last call, we have to run the layer positioning code to have fixed layers re-adjust their position relative 16 to the root. This was the primary bug fix. 17 18 Secondly, a layer tree commit can give ScrollingTreeFrameScrollingNode a new layout viewport, but we need to 19 adjust this by the scrolling tree's current scroll position in case it gets used before the next scroll. 20 21 Currently no way to test this, as it's very timing-dependent. 22 23 * page/scrolling/ScrollingTreeFrameScrollingNode.cpp: 24 (WebCore::ScrollingTreeFrameScrollingNode::commitStateBeforeChildren): 25 (WebCore::ScrollingTreeFrameScrollingNode::scrollPositionAndLayoutViewportMatch): 26 * page/scrolling/ScrollingTreeFrameScrollingNode.h: 27 * page/scrolling/ScrollingTreeScrollingNode.cpp: 28 (WebCore::ScrollingTreeScrollingNode::scrollPositionAndLayoutViewportMatch): 29 (WebCore::ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling): 30 * page/scrolling/ScrollingTreeScrollingNode.h: 31 1 32 2019-03-07 Youenn Fablet <youenn@apple.com> 2 33 -
trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.cpp
r242132 r242601 73 73 m_fixedElementsLayoutRelativeToFrame = state.fixedElementsLayoutRelativeToFrame(); 74 74 75 if (state.hasChangedProperty(ScrollingStateFrameScrollingNode::LayoutViewport)) 75 if (state.hasChangedProperty(ScrollingStateFrameScrollingNode::LayoutViewport)) { 76 76 m_layoutViewport = state.layoutViewport(); 77 updateViewportForCurrentScrollPosition({ }); 78 } 77 79 78 80 if (state.hasChangedProperty(ScrollingStateFrameScrollingNode::MinLayoutViewportOrigin)) … … 81 83 if (state.hasChangedProperty(ScrollingStateFrameScrollingNode::MaxLayoutViewportOrigin)) 82 84 m_maxLayoutViewportOrigin = state.maxLayoutViewportOrigin(); 85 } 86 87 bool ScrollingTreeFrameScrollingNode::scrollPositionAndLayoutViewportMatch(const FloatPoint& position, Optional<FloatRect> overrideLayoutViewport) 88 { 89 return position == currentScrollPosition() && (!overrideLayoutViewport || overrideLayoutViewport.value() == m_layoutViewport); 83 90 } 84 91 -
trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.h
r242132 r242601 71 71 72 72 WEBCORE_EXPORT void updateViewportForCurrentScrollPosition(Optional<FloatRect>) override; 73 bool scrollPositionAndLayoutViewportMatch(const FloatPoint& position, Optional<FloatRect> overrideLayoutViewport) override; 73 74 74 75 void dumpProperties(WTF::TextStream&, ScrollingStateTreeAsTextBehavior) const override; -
trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp
r242132 r242601 175 175 } 176 176 177 bool ScrollingTreeScrollingNode::scrollPositionAndLayoutViewportMatch(const FloatPoint& position, Optional<FloatRect>) 178 { 179 return position == m_currentScrollPosition; 180 } 181 177 182 void ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling(const FloatPoint& position, Optional<FloatRect> overrideLayoutViewport) 178 183 { 179 if (position == m_currentScrollPosition) 180 return; 184 // Even if position and overrideLayoutViewport haven't changed for this node, other nodes may have received new constraint data 185 // via a commit, so the call to notifyRelatedNodesAfterScrollPositionChange() is necessary. We could avoid this if we knew that 186 // no commits had happened. 187 bool scrollPositionChanged = !scrollPositionAndLayoutViewportMatch(position, overrideLayoutViewport); 181 188 182 189 m_currentScrollPosition = adjustedScrollPosition(position, ScrollPositionClamp::None); … … 186 193 187 194 scrollingTree().notifyRelatedNodesAfterScrollPositionChange(*this); 188 scrollingTree().scrollingTreeNodeDidScroll(*this); 195 196 if (scrollPositionChanged) 197 scrollingTree().scrollingTreeNodeDidScroll(*this); 189 198 } 190 199 -
trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h
r242132 r242601 94 94 virtual void currentScrollPositionChanged(); 95 95 WEBCORE_EXPORT virtual void updateViewportForCurrentScrollPosition(Optional<FloatRect> = { }) { } 96 virtual bool scrollPositionAndLayoutViewportMatch(const FloatPoint& position, Optional<FloatRect> overrideLayoutViewport); 96 97 97 98 WEBCORE_EXPORT virtual void repositionScrollingLayers() { }
Note:
See TracChangeset
for help on using the changeset viewer.