Changeset 243905 in webkit
- Timestamp:
- Apr 4, 2019, 2:10:29 PM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
-
ChangeLog (modified) (1 diff)
-
dom/Element.cpp (modified) (2 diffs)
-
page/EventHandler.cpp (modified) (3 diffs)
-
page/FrameView.cpp (modified) (8 diffs)
-
page/FrameView.h (modified) (2 diffs)
-
platform/ScrollView.h (modified) (1 diff)
-
platform/ScrollableArea.cpp (modified) (1 diff)
-
platform/ScrollableArea.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r243903 r243905 1 2019-04-04 Simon Fraser <simon.fraser@apple.com> 2 3 Move "inProgrammaticScroll" down to ScrollableArea 4 https://bugs.webkit.org/show_bug.cgi?id=196614 5 6 Reviewed by Zalan Bujtas. 7 8 A future patch will need to update "inProgrammaticScroll" on RenderLayers, so push 9 inProgrammaticScroll() down to ScrollableArea. 10 11 ScrollableArea already has "isScrolledProgrammatically", which I rename to "scrollShouldClearLatchedState" 12 to reduce confusion. It might be possible to remove this in future with some refactoring. 13 14 Sadly we can no longer use SetForScope<> in FrameView after this change so add some manual save/restore code. 15 16 * dom/Element.cpp: 17 (WebCore::Element::setScrollLeft): 18 (WebCore::Element::setScrollTop): 19 * page/EventHandler.cpp: 20 (WebCore::EventHandler::completeWidgetWheelEvent): 21 (WebCore::EventHandler::handleWheelEvent): 22 * page/FrameView.cpp: 23 (WebCore::FrameView::setFrameRect): 24 (WebCore::FrameView::topContentInsetDidChange): 25 (WebCore::FrameView::updateLayoutViewport): 26 (WebCore::FrameView::setScrollPosition): 27 (WebCore::FrameView::setWasScrolledByUser): 28 * page/FrameView.h: 29 * platform/ScrollView.h: 30 (WebCore::ScrollView::inProgrammaticScroll const): Deleted. 31 * platform/ScrollableArea.cpp: 32 (WebCore::ScrollableArea::ScrollableArea): 33 * platform/ScrollableArea.h: 34 (WebCore::ScrollableArea::inProgrammaticScroll const): 35 (WebCore::ScrollableArea::setInProgrammaticScroll): 36 (WebCore::ScrollableArea::scrollShouldClearLatchedState const): 37 (WebCore::ScrollableArea::setScrollShouldClearLatchedState): 38 (WebCore::ScrollableArea::isScrolledProgrammatically const): Deleted. 39 (WebCore::ScrollableArea::setScrolledProgrammatically): Deleted. 40 1 41 2019-04-04 Sihui Liu <sihui_liu@apple.com> 2 42 -
trunk/Source/WebCore/dom/Element.cpp
r243893 r243905 1141 1141 renderer->setScrollLeft(static_cast<int>(newLeft * renderer->style().effectiveZoom()), ScrollType::Programmatic); 1142 1142 if (auto* scrollableArea = renderer->layer()) 1143 scrollableArea->setScroll edProgrammatically(true);1143 scrollableArea->setScrollShouldClearLatchedState(true); 1144 1144 } 1145 1145 } … … 1158 1158 renderer->setScrollTop(static_cast<int>(newTop * renderer->style().effectiveZoom()), ScrollType::Programmatic); 1159 1159 if (auto* scrollableArea = renderer->layer()) 1160 scrollableArea->setScroll edProgrammatically(true);1160 scrollableArea->setScrollShouldClearLatchedState(true); 1161 1161 } 1162 1162 } -
trunk/Source/WebCore/page/EventHandler.cpp
r242798 r243905 2750 2750 2751 2751 if (scrollableArea) 2752 scrollableArea->setScroll edProgrammatically(false);2752 scrollableArea->setScrollShouldClearLatchedState(false); 2753 2753 2754 2754 platformNotifyIfEndGesture(event, scrollableArea); … … 2813 2813 if (!element->dispatchWheelEvent(adjustedEvent)) { 2814 2814 m_isHandlingWheelEvent = false; 2815 if (scrollableArea && scrollableArea-> isScrolledProgrammatically()) {2815 if (scrollableArea && scrollableArea->scrollShouldClearLatchedState()) { 2816 2816 // Web developer is controlling scrolling, so don't attempt to latch. 2817 2817 clearLatchedState(); 2818 scrollableArea->setScroll edProgrammatically(false);2818 scrollableArea->setScrollShouldClearLatchedState(false); 2819 2819 } 2820 2820 … … 2825 2825 2826 2826 if (scrollableArea) 2827 scrollableArea->setScroll edProgrammatically(false);2827 scrollableArea->setScrollShouldClearLatchedState(false); 2828 2828 2829 2829 bool handledEvent = platformCompleteWheelEvent(adjustedEvent, scrollableContainer.get(), scrollableArea); -
trunk/Source/WebCore/page/FrameView.cpp
r243643 r243905 461 461 return; 462 462 // Every scroll that happens as the result of frame size change is programmatic. 463 SetForScope<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, true); 463 bool wasInProgrammaticScroll = inProgrammaticScroll(); 464 setInProgrammaticScroll(true); 464 465 ScrollView::setFrameRect(newRect); 465 466 … … 475 476 476 477 viewportContentsChanged(); 478 setInProgrammaticScroll(wasInProgrammaticScroll); 477 479 } 478 480 … … 1091 1093 layoutContext().layout(); 1092 1094 // Every scroll that happens as the result of content inset change is programmatic. 1093 SetForScope<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, true); 1095 bool wasInProgrammaticScroll = inProgrammaticScroll(); 1096 setInProgrammaticScroll(true); 1094 1097 updateScrollbars(scrollPosition()); 1095 1098 if (renderView->usesCompositing()) … … 1098 1101 if (TiledBacking* tiledBacking = this->tiledBacking()) 1099 1102 tiledBacking->setTopContentInset(newTopContentInset); 1103 1104 setInProgrammaticScroll(wasInProgrammaticScroll); 1100 1105 } 1101 1106 … … 1671 1676 1672 1677 if (m_layoutViewportOverrideRect) { 1673 if ( m_inProgrammaticScroll) {1678 if (inProgrammaticScroll()) { 1674 1679 LOG_WITH_STREAM(Scrolling, stream << "computing new override layout viewport because of programmatic scrolling"); 1675 1680 LayoutPoint newOrigin = computeLayoutViewportOrigin(visualViewportRect(), minStableLayoutViewportOrigin(), maxStableLayoutViewportOrigin(), layoutViewport, StickToDocumentBounds); … … 2275 2280 LOG_WITH_STREAM(Scrolling, stream << "FrameView::setScrollPosition " << scrollPosition << " , clearing anchor"); 2276 2281 2277 SetForScope<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, true); 2282 bool wasInProgrammaticScroll = inProgrammaticScroll(); 2283 setInProgrammaticScroll(true); 2284 2278 2285 m_maintainScrollPositionAnchor = nullptr; 2279 2286 m_shouldScrollToFocusedElement = false; … … 2283 2290 scrollAnimator().setWheelEventTestTrigger(page->testTrigger()); 2284 2291 ScrollView::setScrollPosition(scrollPosition); 2292 2293 setInProgrammaticScroll(wasInProgrammaticScroll); 2285 2294 } 2286 2295 … … 4101 4110 m_shouldScrollToFocusedElement = false; 4102 4111 m_delayedScrollToFocusedElementTimer.stop(); 4103 if ( m_inProgrammaticScroll)4112 if (inProgrammaticScroll()) 4104 4113 return; 4105 4114 m_maintainScrollPositionAnchor = nullptr; -
trunk/Source/WebCore/page/FrameView.h
r242082 r243905 556 556 void setPagination(const Pagination&); 557 557 558 bool inProgrammaticScroll() const final { return m_inProgrammaticScroll; }559 void setInProgrammaticScroll(bool programmaticScroll) { m_inProgrammaticScroll = programmaticScroll; }560 561 558 #if ENABLE(CSS_DEVICE_ADAPTATION) 562 559 IntSize initialViewportSize() const { return m_initialViewportSize; } … … 924 921 bool m_isTrackingRepaints { false }; // Used for testing. 925 922 bool m_wasScrolledByUser { false }; 926 bool m_inProgrammaticScroll { false };927 923 bool m_shouldScrollToFocusedElement { false }; 928 924 -
trunk/Source/WebCore/platform/ScrollView.h
r242333 r243905 197 197 #endif 198 198 199 virtual bool inProgrammaticScroll() const { return false; }200 201 199 // Size available for view contents, including content inset areas. Not affected by zooming. 202 200 IntSize sizeForVisibleContent(VisibleContentRectIncludesScrollbars = ExcludeScrollbars) const; -
trunk/Source/WebCore/platform/ScrollableArea.cpp
r242333 r243905 67 67 , m_scrollbarOverlayStyle(ScrollbarOverlayStyleDefault) 68 68 , m_scrollOriginChanged(false) 69 , m_scrolledProgrammatically(false) 69 , m_inProgrammaticScroll(false) 70 , m_scrollShouldClearLatchedState(false) 70 71 { 71 72 } -
trunk/Source/WebCore/platform/ScrollableArea.h
r243416 r243905 229 229 WEBCORE_EXPORT virtual bool scrolledToRight() const; 230 230 231 bool isScrolledProgrammatically() const { return m_scrolledProgrammatically; } 232 void setScrolledProgrammatically(bool state) { m_scrolledProgrammatically = state; } 231 bool inProgrammaticScroll() const { return m_inProgrammaticScroll; } 232 void setInProgrammaticScroll(bool inProgrammaticScroll) { m_inProgrammaticScroll = inProgrammaticScroll; } 233 234 bool scrollShouldClearLatchedState() const { return m_scrollShouldClearLatchedState; } 235 void setScrollShouldClearLatchedState(bool shouldClear) { m_scrollShouldClearLatchedState = shouldClear; } 233 236 234 237 enum VisibleContentRectIncludesScrollbars { ExcludeScrollbars, IncludeScrollbars }; … … 392 395 393 396 unsigned m_scrollOriginChanged : 1; 394 unsigned m_scrolledProgrammatically : 1; 397 unsigned m_inProgrammaticScroll : 1; 398 unsigned m_scrollShouldClearLatchedState : 1; 395 399 }; 396 400
Note:
See TracChangeset
for help on using the changeset viewer.