Changeset 271788 in webkit
- Timestamp:
- Jan 25, 2021 1:45:47 AM (18 months ago)
- Location:
- trunk
- Files:
-
- 4 added
- 15 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/css3/scroll-snap/scroll-padding-mainframe-paging-expected.txt (added)
-
LayoutTests/css3/scroll-snap/scroll-padding-mainframe-paging.html (added)
-
LayoutTests/css3/scroll-snap/scroll-padding-overflow-paging-expected.txt (added)
-
LayoutTests/css3/scroll-snap/scroll-padding-overflow-paging.html (added)
-
LayoutTests/platform/ios-wk2/TestExpectations (modified) (1 diff)
-
LayoutTests/platform/mac-wk1/TestExpectations (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/page/FrameView.cpp (modified) (1 diff)
-
Source/WebCore/page/FrameView.h (modified) (1 diff)
-
Source/WebCore/platform/ScrollView.cpp (modified) (5 diffs)
-
Source/WebCore/platform/ScrollView.h (modified) (1 diff)
-
Source/WebCore/rendering/RenderBox.cpp (modified) (1 diff)
-
Source/WebCore/rendering/RenderBox.h (modified) (1 diff)
-
Source/WebCore/rendering/RenderLayer.cpp (modified) (2 diffs)
-
Source/WebCore/rendering/RenderLayer.h (modified) (1 diff)
-
Source/WebCore/rendering/RenderLayerModelObject.cpp (modified) (1 diff)
-
Source/WebCore/rendering/RenderLayerScrollableArea.cpp (modified) (1 diff)
-
Source/WebCore/rendering/RenderLayerScrollableArea.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r271787 r271788 1 2021-01-25 Martin Robinson <mrobinson@igalia.com> 2 3 scroll-padding should affect paging operations 4 https://bugs.webkit.org/show_bug.cgi?id=219074 5 <rdar://problem/71747786> 6 7 Reviewed by Simon Fraser. 8 9 * css3/scroll-snap/scroll-padding-mainframe-paging-expected.txt: Added. 10 * css3/scroll-snap/scroll-padding-mainframe-paging.html: Added. 11 * css3/scroll-snap/scroll-padding-overflow-paging-expected.txt: Added. 12 * css3/scroll-snap/scroll-padding-overflow-paging.html: Added. 13 * platform/ios-wk2/TestExpectations: Skip failing tests. 14 * platform/mac-wk1/TestExpectations: Skip failing tests. 15 1 16 2021-01-25 Carlos Garcia Campos <cgarcia@igalia.com> 2 17 -
trunk/LayoutTests/platform/ios-wk2/TestExpectations
r271320 r271788 135 135 scrollbars/scrolling-by-page-on-keyboard-spacebar.html [ Failure ] 136 136 scrollbars/scrollbars-on-positioned-content.html [ Failure ] 137 css3/scroll-snap/scroll-padding-mainframe-paging.html [ Failure ] 138 css3/scroll-snap/scroll-padding-overflow-paging.html [ Failure ] 137 139 138 140 # SVG tests that time out (these require EventSender) -
trunk/LayoutTests/platform/mac-wk1/TestExpectations
r271461 r271788 449 449 imported/w3c/web-platform-tests/cookies/secure/set-from-ws.sub.html [ Failure ] 450 450 451 # WebKit1 frames use native scrollbars causing th is reference testto fail.451 # WebKit1 frames use native scrollbars causing these tests to fail. 452 452 imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-padding-001.html [ ImageOnlyFailure ] 453 css3/scroll-snap/scroll-padding-mainframe-paging.html [ Failure ] 453 454 454 455 ### END OF (2) Failures without bug reports -
trunk/Source/WebCore/ChangeLog
r271787 r271788 1 2021-01-25 Martin Robinson <mrobinson@igalia.com> 2 3 scroll-padding should affect paging operations 4 https://bugs.webkit.org/show_bug.cgi?id=219074 5 <rdar://problem/71747786> 6 7 Reviewed by Simon Fraser. 8 9 Have scroll-padding affect the amount of the scrollable area that moves during 10 paging operations. This is the behavior specified in the scroll snap specification 11 and allows scrollable areas with partially obscured areas to properly page through 12 their content. 13 14 See https://drafts.csswg.org/css-scroll-snap-1/#propdef-scroll-padding. 15 16 Tests: css3/scroll-snap/scroll-padding-mainframe-paging.html 17 css3/scroll-snap/scroll-padding-overflow-paging.html 18 19 * page/FrameView.cpp: 20 (WebCore::FrameView::updateScrollbarSteps): Added this override method which 21 properly sets page steps. Only FrameView has access to the document. 22 * page/FrameView.h: 23 * platform/ScrollView.cpp: 24 (WebCore::ScrollView::updateScrollbars): Added this helper method, which is 25 virtual so that FrameView can override it. 26 (WebCore::ScrollView::updateScrollbarSteps): Use the helper method to actually 27 set the scrollbar steps. 28 * platform/ScrollView.h: Add new method declarations. 29 * rendering/RenderBox.cpp: 30 (WebCore::RenderBox::scrollPaddingForViewportRect): Add this new helper which 31 gets the scroll-padding for a box. 32 * rendering/RenderBox.h: Add new helper. 33 * rendering/RenderLayer.cpp: 34 (WebCore::expandScrollRectToVisibleTargetRectToIncludeScrollPadding): Use the new 35 RenderBox helper. 36 (WebCore::RenderLayer::updateScrollbarsAfterLayout): Use the new updateScrollbarSteps helper. 37 (WebCore::RenderLayer::updateScrollbarSteps): Added this helper so that RenderLayerModelObject 38 can update steps when necessary. 39 * rendering/RenderLayer.h: Added new declarations. 40 * rendering/RenderLayerModelObject.cpp: 41 (WebCore::RenderLayerModelObject::styleDidChange): Update steps on FrameViews and RenderLayers 42 when the style change dictates it. 43 1 44 2021-01-25 Carlos Garcia Campos <cgarcia@igalia.com> 2 45 -
trunk/Source/WebCore/page/FrameView.cpp
r271786 r271788 5545 5545 } 5546 5546 5547 void FrameView::updateScrollbarSteps() 5548 { 5549 auto* documentElement = frame().document() ? frame().document()->documentElement() : nullptr; 5550 auto* renderer = documentElement ? documentElement->renderBox() : nullptr; 5551 if (!renderer) { 5552 ScrollView::updateScrollbarSteps(); 5553 return; 5554 } 5555 5556 LayoutRect paddedViewRect(LayoutPoint(), visibleSize()); 5557 paddedViewRect.contract(renderer->scrollPaddingForViewportRect(paddedViewRect)); 5558 5559 if (horizontalScrollbar()) { 5560 int pageStep = Scrollbar::pageStep(paddedViewRect.width()); 5561 horizontalScrollbar()->setSteps(Scrollbar::pixelsPerLineStep(), pageStep); 5562 5563 } 5564 if (verticalScrollbar()) { 5565 int pageStep = Scrollbar::pageStep(paddedViewRect.height()); 5566 verticalScrollbar()->setSteps(Scrollbar::pixelsPerLineStep(), pageStep); 5567 } 5568 } 5547 5569 } // namespace WebCore 5548 5570 -
trunk/Source/WebCore/page/FrameView.h
r271786 r271788 681 681 String debugDescription() const final; 682 682 683 // ScrollView 684 void updateScrollbarSteps() override; 685 683 686 private: 684 687 explicit FrameView(Frame&); -
trunk/Source/WebCore/platform/ScrollView.cpp
r271786 r271788 732 732 if (m_horizontalScrollbar) { 733 733 int clientWidth = visibleWidth(); 734 int pageStep = Scrollbar::pageStep(clientWidth);735 734 IntRect oldRect(m_horizontalScrollbar->frameRect()); 736 735 IntRect hBarRect(shouldPlaceBlockDirectionScrollbarOnLeft() && m_verticalScrollbar ? m_verticalScrollbar->occupiedWidth() : 0, … … 745 744 m_horizontalScrollbar->setSuppressInvalidation(true); 746 745 m_horizontalScrollbar->setEnabled(contentsWidth() > clientWidth); 747 m_horizontalScrollbar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep);748 746 m_horizontalScrollbar->setProportion(clientWidth, contentsWidth()); 749 747 if (m_scrollbarsSuppressed) … … 753 751 if (m_verticalScrollbar) { 754 752 int clientHeight = visibleHeight(); 755 int pageStep = Scrollbar::pageStep(clientHeight);756 753 IntRect oldRect(m_verticalScrollbar->frameRect()); 757 754 IntRect vBarRect(shouldPlaceBlockDirectionScrollbarOnLeft() ? 0 : width() - m_verticalScrollbar->width(), … … 766 763 m_verticalScrollbar->setSuppressInvalidation(true); 767 764 m_verticalScrollbar->setEnabled(totalContentsSize().height() > clientHeight); 768 m_verticalScrollbar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep);769 765 m_verticalScrollbar->setProportion(clientHeight, totalContentsSize().height()); 770 766 if (m_scrollbarsSuppressed) 771 767 m_verticalScrollbar->setSuppressInvalidation(false); 772 768 } 769 770 updateScrollbarSteps(); 773 771 774 772 if (hasHorizontalScrollbar != newHasHorizontalScrollbar || hasVerticalScrollbar != newHasVerticalScrollbar) { … … 790 788 791 789 m_inUpdateScrollbars = false; 790 } 791 792 void ScrollView::updateScrollbarSteps() 793 { 794 if (m_horizontalScrollbar) 795 m_horizontalScrollbar->setSteps(Scrollbar::pixelsPerLineStep(), Scrollbar::pageStep(visibleWidth())); 796 if (m_verticalScrollbar) 797 m_verticalScrollbar->setSteps(Scrollbar::pixelsPerLineStep(), Scrollbar::pageStep(visibleHeight())); 792 798 } 793 799 -
trunk/Source/WebCore/platform/ScrollView.h
r271439 r271788 398 398 399 399 bool managesScrollbars() const; 400 virtual void updateScrollbarSteps(); 400 401 401 402 protected: -
trunk/Source/WebCore/rendering/RenderBox.cpp
r271740 r271788 5163 5163 } 5164 5164 5165 LayoutBoxExtent RenderBox::scrollPaddingForViewportRect(const LayoutRect& viewportRect) 5166 { 5167 const auto& padding = style().scrollPadding(); 5168 return LayoutBoxExtent( 5169 valueForLength(padding.top(), viewportRect.height()), valueForLength(padding.right(), viewportRect.width()), 5170 valueForLength(padding.bottom(), viewportRect.height()), valueForLength(padding.left(), viewportRect.width())); 5171 } 5172 5165 5173 } // namespace WebCore -
trunk/Source/WebCore/rendering/RenderBox.h
r271559 r271788 496 496 bool hasScrollableOverflowY() const { return scrollsOverflowY() && hasVerticalOverflow(); } 497 497 498 LayoutBoxExtent scrollPaddingForViewportRect(const LayoutRect& viewportRect); 499 498 500 bool usesCompositedScrolling() const; 499 501 -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r271740 r271788 651 651 // simulate padding the scroll container. This rectangle is passed up the tree of scrolling elements to 652 652 // ensure that the padding on this scroll container is maintained. 653 const auto& scrollPadding = renderBox->style().scrollPadding(); 654 LayoutBoxExtent scrollPaddingExtents( 655 valueForLength(scrollPadding.top(), viewRect.height()), valueForLength(scrollPadding.right(), viewRect.width()), 656 valueForLength(scrollPadding.bottom(), viewRect.height()), valueForLength(scrollPadding.left(), viewRect.width())); 657 targetRect.expand(scrollPaddingExtents); 653 targetRect.expand(renderBox->scrollPaddingForViewportRect(viewRect)); 658 654 } 659 655 … … 2886 2882 if (m_scrollableArea) 2887 2883 m_scrollableArea->updateScrollInfoAfterLayout(); 2884 } 2885 2886 void RenderLayer::updateScrollbarSteps() 2887 { 2888 if (m_scrollableArea) 2889 m_scrollableArea->updateScrollbarSteps(); 2888 2890 } 2889 2891 -
trunk/Source/WebCore/rendering/RenderLayer.h
r271740 r271788 478 478 479 479 void updateScrollInfoAfterLayout(); 480 void updateScrollbarSteps(); 480 481 481 482 void autoscroll(const IntPoint&); -
trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp
r271559 r271788 173 173 } 174 174 175 const RenderStyle& newStyle = style(); 176 if (oldStyle && oldStyle->scrollPadding() != newStyle.scrollPadding()) { 177 if (isDocumentElementRenderer()) { 178 FrameView& frameView = view().frameView(); 179 frameView.updateScrollbarSteps(); 180 } else if (RenderLayer* renderLayer = layer()) 181 renderLayer->updateScrollbarSteps(); 182 } 183 175 184 #if ENABLE(CSS_SCROLL_SNAP) 176 const RenderStyle& newStyle = style();177 185 if (oldStyle && scrollSnapContainerRequiresUpdateForStyleUpdate(*oldStyle, newStyle)) { 178 186 if (RenderLayer* renderLayer = layer()) { -
trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp
r271701 r271788 1119 1119 } 1120 1120 1121 // Set up the range (and page step/line step). 1121 // Set up the range. 1122 if (m_hBar) 1123 m_hBar->setProportion(roundToInt(box->clientWidth()), m_scrollWidth); 1124 if (m_vBar) 1125 m_vBar->setProportion(roundToInt(box->clientHeight()), m_scrollHeight); 1126 1127 updateScrollbarSteps(); 1128 1129 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollableVerticalOverflow()); 1130 } 1131 1132 void RenderLayerScrollableArea::updateScrollbarSteps() 1133 { 1134 RenderBox* box = m_layer.renderBox(); 1135 ASSERT(box); 1136 1137 LayoutRect paddedLayerBounds(0_lu, 0_lu, box->clientWidth(), box->clientHeight()); 1138 paddedLayerBounds.contract(box->scrollPaddingForViewportRect(paddedLayerBounds)); 1139 1140 // Set up the page step/line step. 1122 1141 if (m_hBar) { 1123 int clientWidth = roundToInt(box->clientWidth()); 1124 int pageStep = Scrollbar::pageStep(clientWidth); 1142 int pageStep = Scrollbar::pageStep(roundToInt(paddedLayerBounds.width())); 1125 1143 m_hBar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep); 1126 m_hBar->setProportion(clientWidth, m_scrollWidth);1127 1144 } 1128 1145 if (m_vBar) { 1129 int clientHeight = roundToInt(box->clientHeight()); 1130 int pageStep = Scrollbar::pageStep(clientHeight); 1146 int pageStep = Scrollbar::pageStep(roundToInt(paddedLayerBounds.height())); 1131 1147 m_vBar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep); 1132 m_vBar->setProportion(clientHeight, m_scrollHeight); 1133 } 1134 1135 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollableVerticalOverflow()); 1136 } 1148 } 1149 } 1150 1137 1151 1138 1152 // This is called from layout code (before updateLayerPositions). -
trunk/Source/WebCore/rendering/RenderLayerScrollableArea.h
r271559 r271788 126 126 127 127 void updateScrollInfoAfterLayout(); 128 void updateScrollbarSteps(); 128 129 129 130 bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1);
Note: See TracChangeset
for help on using the changeset viewer.