Summary: | Make scroll-padding independent of scroll-snap and have it affect scrollIntoView | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Martin Robinson <mrobinson> | ||||||||
Component: | CSS | Assignee: | Martin Robinson <mrobinson> | ||||||||
Status: | RESOLVED FIXED | ||||||||||
Severity: | Normal | CC: | changseok, diane.ko, esprehn+autocc, ews-watchlist, fred.wang, glenn, gyuyoung.kim, joepeck, kondapallykalyan, macpherson, menard, pdr, simon.fraser, webkit-bug-importer | ||||||||
Priority: | P2 | Keywords: | InRadar | ||||||||
Version: | WebKit Nightly Build | ||||||||||
Hardware: | Unspecified | ||||||||||
OS: | Unspecified | ||||||||||
See Also: | https://bugs.webkit.org/show_bug.cgi?id=219498 | ||||||||||
Bug Depends on: | |||||||||||
Bug Blocks: | 179379 | ||||||||||
Attachments: |
|
Description
Martin Robinson
2020-11-18 02:12:19 PST
Created attachment 414436 [details]
Patch
Created attachment 414445 [details]
Patch
Comment on attachment 414445 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=414445&action=review > Source/WebCore/rendering/RenderLayer.cpp:601 > +static void expandScrollRectToVisibleTargetRectToIncludeScrollPadding(RenderBox* renderBox, const LayoutRect& viewRect, LayoutRect* targetRect) targetRect should be a LayoutRect& > Source/WebCore/rendering/RenderLayer.cpp:2825 > +AnimatedScroll RenderLayer::shouldUseAnimatedScrollForScrollRectToVisible(Element* element, ScrollBehavior behavior) > +{ > + bool useAnimatedScrolling = !renderer().frame().eventHandler().autoscrollInProgress() > + && element && useSmoothScrolling(behavior, element); > + return useAnimatedScrolling ? AnimatedScroll::Yes : AnimatedScroll::No; > +} This could just be a lambda function in scrollRectToVisible() > Source/WebCore/rendering/RenderLayer.cpp:2858 > + AnimatedScroll animated = this->shouldUseAnimatedScrollForScrollRectToVisible(box->element(), options.behavior); auto animated > Source/WebCore/rendering/RenderLayer.cpp:2890 > + AnimatedScroll animated = this->shouldUseAnimatedScrollForScrollRectToVisible(element, options.behavior); auto animated > Source/WebCore/rendering/RenderLayerModelObject.cpp:125 > + return oldStyle.scrollPadding() != newStyle.scrollPadding() || oldStyle.scrollSnapType() != newStyle.scrollSnapType(); This should not all be inside the #if ENABLE(CSS_SCROLL_SNAP) right? > Source/WebCore/rendering/style/RenderStyle.cpp:2498 > +const ScrollSnapType& RenderStyle::scrollSnapType() const Just return by value. It's an enum. > Source/WebCore/rendering/style/RenderStyle.cpp:2503 > +const ScrollSnapAlign& RenderStyle::scrollSnapAlign() const Return by value. > Source/WebCore/rendering/style/RenderStyle.cpp:2508 > +void RenderStyle::setScrollSnapType(const ScrollSnapType& type) Argument should be a ScrollSnapType > Source/WebCore/rendering/style/RenderStyle.h:736 > + const ScrollSnapType& scrollSnapType() const; > const ScrollSnapAlign& scrollSnapAlign() const; Return by value. > Source/WebCore/rendering/style/RenderStyle.h:1276 > + void setScrollSnapType(const ScrollSnapType&); > void setScrollSnapAlign(const ScrollSnapAlign&); Pass values not references. Created attachment 414547 [details]
Patch
(In reply to Simon Fraser (smfr) from comment #3) > Comment on attachment 414445 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=414445&action=review Thanks for the review. I've applied all your suggestions, apart from one: > > Source/WebCore/rendering/RenderLayerModelObject.cpp:125 > > + return oldStyle.scrollPadding() != newStyle.scrollPadding() || oldStyle.scrollSnapType() != newStyle.scrollSnapType(); > > This should not all be inside the #if ENABLE(CSS_SCROLL_SNAP) right? This helper function is still only used by the scroll snap code. It's possible that this should be moved to the callsite in a cleanup change. Comment on attachment 414547 [details]
Patch
Landing as the failures are unrelated to this change.
Committed r270023: <https://trac.webkit.org/changeset/270023> All reviewed patches have been landed. Closing bug and clearing flags on attachment 414547 [details]. |