Changeset 243701 in webkit
- Timestamp:
- Apr 1, 2019, 11:33:04 AM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 11 edited
-
ChangeLog (modified) (1 diff)
-
dom/Element.cpp (modified) (3 diffs)
-
platform/ScrollTypes.h (modified) (1 diff)
-
rendering/RenderBox.cpp (modified) (1 diff)
-
rendering/RenderBox.h (modified) (1 diff)
-
rendering/RenderLayer.cpp (modified) (2 diffs)
-
rendering/RenderLayer.h (modified) (1 diff)
-
rendering/RenderListBox.cpp (modified) (2 diffs)
-
rendering/RenderListBox.h (modified) (1 diff)
-
rendering/RenderTextControlSingleLine.cpp (modified) (2 diffs)
-
rendering/RenderTextControlSingleLine.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r243695 r243701 1 2019-04-01 Simon Fraser <simon.fraser@apple.com> 2 3 Plumb through a ScrollType value that indicates whether a scroll was a user or programmatic scroll 4 https://bugs.webkit.org/show_bug.cgi?id=196424 5 6 Reviewed by Zalan Bujtas. 7 8 In preparation for fixing webkit.org/b/195584, we need to know if an overflow scroll 9 is programmatic, so plumb through an enum value. The functions touched by this patch are 10 only ever called for programmatic scrolls. 11 12 * dom/Element.cpp: 13 (WebCore::Element::scrollTo): 14 (WebCore::Element::setScrollLeft): 15 (WebCore::Element::setScrollTop): 16 * platform/ScrollTypes.h: 17 * rendering/RenderBox.cpp: 18 (WebCore::RenderBox::setScrollLeft): 19 (WebCore::RenderBox::setScrollTop): 20 * rendering/RenderBox.h: 21 * rendering/RenderLayer.cpp: 22 (WebCore::RenderLayer::scrollToXPosition): 23 (WebCore::RenderLayer::scrollToYPosition): 24 * rendering/RenderLayer.h: 25 * rendering/RenderListBox.cpp: 26 (WebCore::RenderListBox::setScrollLeft): 27 (WebCore::RenderListBox::setScrollTop): 28 * rendering/RenderListBox.h: 29 * rendering/RenderTextControlSingleLine.cpp: 30 (WebCore::RenderTextControlSingleLine::setScrollLeft): 31 (WebCore::RenderTextControlSingleLine::setScrollTop): 32 * rendering/RenderTextControlSingleLine.h: 33 1 34 2019-04-01 Wenson Hsieh <wenson_hsieh@apple.com> 2 35 -
trunk/Source/WebCore/dom/Element.cpp
r243643 r243701 823 823 adjustForAbsoluteZoom(renderer->scrollTop(), *renderer) 824 824 ); 825 renderer->setScrollLeft(clampToInteger(scrollToOptions.left.value() * renderer->style().effectiveZoom()), clamping);826 renderer->setScrollTop(clampToInteger(scrollToOptions.top.value() * renderer->style().effectiveZoom()), clamping);825 renderer->setScrollLeft(clampToInteger(scrollToOptions.left.value() * renderer->style().effectiveZoom()), ScrollType::Programmatic, clamping); 826 renderer->setScrollTop(clampToInteger(scrollToOptions.top.value() * renderer->style().effectiveZoom()), ScrollType::Programmatic, clamping); 827 827 } 828 828 … … 1145 1145 1146 1146 if (auto* renderer = renderBox()) { 1147 renderer->setScrollLeft(static_cast<int>(newLeft * renderer->style().effectiveZoom()) );1147 renderer->setScrollLeft(static_cast<int>(newLeft * renderer->style().effectiveZoom()), ScrollType::Programmatic); 1148 1148 if (auto* scrollableArea = renderer->layer()) 1149 1149 scrollableArea->setScrolledProgrammatically(true); … … 1162 1162 1163 1163 if (auto* renderer = renderBox()) { 1164 renderer->setScrollTop(static_cast<int>(newTop * renderer->style().effectiveZoom()) );1164 renderer->setScrollTop(static_cast<int>(newTop * renderer->style().effectiveZoom()), ScrollType::Programmatic); 1165 1165 if (auto* scrollableArea = renderer->layer()) 1166 1166 scrollableArea->setScrolledProgrammatically(true); -
trunk/Source/WebCore/platform/ScrollTypes.h
r242913 r243701 31 31 namespace WebCore { 32 32 33 enum class ScrollType : uint8_t { 34 User, 35 Programmatic 36 }; 37 33 38 enum ScrollDirection : uint8_t { 34 39 ScrollUp, -
trunk/Source/WebCore/rendering/RenderBox.cpp
r241747 r243701 576 576 } 577 577 578 void RenderBox::setScrollLeft(int newLeft, Scroll Clamping clamping)578 void RenderBox::setScrollLeft(int newLeft, ScrollType scrollType, ScrollClamping clamping) 579 579 { 580 580 if (!hasOverflowClip() || !layer()) 581 581 return; 582 582 setupWheelEventTestTrigger(*layer()); 583 layer()->scrollToXPosition(newLeft, clamping);584 } 585 586 void RenderBox::setScrollTop(int newTop, Scroll Clamping clamping)583 layer()->scrollToXPosition(newLeft, scrollType, clamping); 584 } 585 586 void RenderBox::setScrollTop(int newTop, ScrollType scrollType, ScrollClamping clamping) 587 587 { 588 588 if (!hasOverflowClip() || !layer()) 589 589 return; 590 590 setupWheelEventTestTrigger(*layer()); 591 layer()->scrollToYPosition(newTop, clamping);591 layer()->scrollToYPosition(newTop, scrollType, clamping); 592 592 } 593 593 -
trunk/Source/WebCore/rendering/RenderBox.h
r240218 r243701 248 248 virtual int scrollWidth() const; 249 249 virtual int scrollHeight() const; 250 virtual void setScrollLeft(int, Scroll Clamping = ScrollClamping::Clamped);251 virtual void setScrollTop(int, Scroll Clamping = ScrollClamping::Clamped);250 virtual void setScrollLeft(int, ScrollType, ScrollClamping = ScrollClamping::Clamped); 251 virtual void setScrollTop(int, ScrollType, ScrollClamping = ScrollClamping::Clamped); 252 252 253 253 LayoutUnit marginTop() const override { return m_marginBox.top(); } -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r243694 r243701 2322 2322 } 2323 2323 2324 void RenderLayer::scrollToXPosition(int x, Scroll Clamping clamping)2324 void RenderLayer::scrollToXPosition(int x, ScrollType, ScrollClamping clamping) 2325 2325 { 2326 2326 ScrollPosition position(x, m_scrollPosition.y()); … … 2328 2328 } 2329 2329 2330 void RenderLayer::scrollToYPosition(int y, Scroll Clamping clamping)2330 void RenderLayer::scrollToYPosition(int y, ScrollType, ScrollClamping clamping) 2331 2331 { 2332 2332 ScrollPosition position(m_scrollPosition.x(), y); -
trunk/Source/WebCore/rendering/RenderLayer.h
r243416 r243701 415 415 void scrollToYOffset(int y, ScrollClamping clamping = ScrollClamping::Clamped) { scrollToOffset(ScrollOffset(scrollOffset().x(), y), clamping); } 416 416 417 void scrollToXPosition(int x, Scroll Clamping = ScrollClamping::Clamped);418 void scrollToYPosition(int y, Scroll Clamping = ScrollClamping::Clamped);417 void scrollToXPosition(int x, ScrollType, ScrollClamping = ScrollClamping::Clamped); 418 void scrollToYPosition(int y, ScrollType, ScrollClamping = ScrollClamping::Clamped); 419 419 420 420 void setPostLayoutScrollPosition(Optional<ScrollPosition>); -
trunk/Source/WebCore/rendering/RenderListBox.cpp
r240011 r243701 750 750 } 751 751 752 void RenderListBox::setScrollLeft(int, Scroll Clamping)752 void RenderListBox::setScrollLeft(int, ScrollType, ScrollClamping) 753 753 { 754 754 } … … 767 767 } 768 768 769 void RenderListBox::setScrollTop(int newTop, Scroll Clamping)769 void RenderListBox::setScrollTop(int newTop, ScrollType, ScrollClamping) 770 770 { 771 771 // Determine an index and scroll to it. -
trunk/Source/WebCore/rendering/RenderListBox.h
r239427 r243701 107 107 int scrollWidth() const override; 108 108 int scrollHeight() const override; 109 void setScrollLeft(int, Scroll Clamping) override;110 void setScrollTop(int, Scroll Clamping) override;109 void setScrollLeft(int, ScrollType, ScrollClamping) override; 110 void setScrollTop(int, ScrollType, ScrollClamping) override; 111 111 112 112 bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override; -
trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp
r239652 r243701 377 377 } 378 378 379 void RenderTextControlSingleLine::setScrollLeft(int newLeft, Scroll Clamping)379 void RenderTextControlSingleLine::setScrollLeft(int newLeft, ScrollType, ScrollClamping) 380 380 { 381 381 if (innerTextElement()) … … 383 383 } 384 384 385 void RenderTextControlSingleLine::setScrollTop(int newTop, Scroll Clamping)385 void RenderTextControlSingleLine::setScrollTop(int newTop, ScrollType, ScrollClamping) 386 386 { 387 387 if (innerTextElement()) -
trunk/Source/WebCore/rendering/RenderTextControlSingleLine.h
r225879 r243701 58 58 int scrollWidth() const override; 59 59 int scrollHeight() const override; 60 void setScrollLeft(int, Scroll Clamping) override;61 void setScrollTop(int, Scroll Clamping) override;60 void setScrollLeft(int, ScrollType, ScrollClamping) override; 61 void setScrollTop(int, ScrollType, ScrollClamping) override; 62 62 bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = nullptr, RenderBox* startBox = nullptr, const IntPoint& wheelEventAbsolutePoint = IntPoint()) final; 63 63 bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = 0) final;
Note:
See TracChangeset
for help on using the changeset viewer.