Changeset 278193 in webkit
- Timestamp:
- May 28, 2021 1:59:20 AM (14 months ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/css3/scroll-snap/scroll-snap-style-change-crash-expected.txt (added)
-
LayoutTests/css3/scroll-snap/scroll-snap-style-change-crash.html (added)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-snap-type-change-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/rendering/RenderLayerModelObject.cpp (modified) (2 diffs)
-
Source/WebCore/rendering/RenderObject.cpp (modified) (1 diff)
-
Source/WebCore/rendering/RenderObject.h (modified) (1 diff)
-
Source/WebCore/rendering/style/RenderStyle.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r278182 r278193 1 2021-05-28 Martin Robinson <mrobinson@webkit.org> 2 3 More readily layout when scroll-snap properties change 4 https://bugs.webkit.org/show_bug.cgi?id=225950 5 6 Reviewed by Simon Fraser. 7 8 * css3/scroll-snap/scroll-snap-style-change-crash-expected.txt: Added. 9 * css3/scroll-snap/scroll-snap-style-change-crash.html: Added. 10 1 11 2021-05-27 Amir Mark Jr <amir_mark@apple.com> 2 12 -
trunk/LayoutTests/imported/w3c/ChangeLog
r278188 r278193 1 2021-05-28 Martin Robinson <mrobinson@webkit.org> 2 3 More readily layout when scroll-snap properties change 4 https://bugs.webkit.org/show_bug.cgi?id=225950 5 6 Reviewed by Simon Fraser. 7 8 * web-platform-tests/css/css-scroll-snap/scroll-snap-type-change-expected.txt: Updated expectation 9 for newly passing test. 10 1 11 2021-05-27 Said Abou-Hallawa <said@apple.com> 2 12 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-snap-type-change-expected.txt
r271480 r278193 1 1 2 FAIL scroll-snap-type on HTML should control snapping behavior and changing it takes effect assert_equals: scrolling should not snap expected 100 but got 200 2 PASS scroll-snap-type on HTML should control snapping behavior and changing it takes effect 3 3 PASS scroll-snap-type on DIV should control snapping behavior and changing it takes effect 4 4 -
trunk/Source/WebCore/ChangeLog
r278190 r278193 1 2021-05-28 Martin Robinson <mrobinson@webkit.org> 2 3 More readily layout when scroll-snap properties change 4 https://bugs.webkit.org/show_bug.cgi?id=225950 5 6 Reviewed by Simon Fraser. 7 8 Do a layout when scroll-snap properties change instead of trying 9 to update scroll positions without a layout. 10 11 Test: css3/scroll-snap/scroll-snap-style-change-crash.html 12 13 * rendering/RenderLayerModelObject.cpp: 14 (WebCore::RenderLayerModelObject::styleDidChange): Remove code dealing with scrollports 15 as this is now handled by the RenderStyle diff. Now trigger a layout for scrollports 16 when the scrolled children change their snap properties. 17 * rendering/RenderObject.cpp: 18 (WebCore::RenderObject::enclosingScrollableContainerForSnapping const): Made this return a non-const. 19 * rendering/RenderObject.h: 20 * rendering/style/RenderStyle.cpp: 21 (WebCore::RenderStyle::changeRequiresLayout const): Added code to handle scrollport specific 22 properties. 23 1 24 2021-05-27 Wenson Hsieh <wenson_hsieh@apple.com> 2 25 -
trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp
r278185 r278193 108 108 } 109 109 110 #if ENABLE(CSS_SCROLL_SNAP)111 static bool scrollSnapContainerRequiresUpdateForStyleUpdate(const RenderStyle& oldStyle, const RenderStyle& newStyle)112 {113 return oldStyle.scrollPadding() != newStyle.scrollPadding() || oldStyle.scrollSnapType() != newStyle.scrollSnapType();114 }115 #endif116 117 110 void RenderLayerModelObject::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) 118 111 { … … 172 165 173 166 #if ENABLE(CSS_SCROLL_SNAP) 174 if (oldStyle && scrollSnapContainerRequiresUpdateForStyleUpdate(*oldStyle, newStyle)) {175 if (RenderLayer* renderLayer = layer()) {176 if (auto* scrollableArea = renderLayer->scrollableArea()) {177 scrollableArea->updateSnapOffsets();178 scrollableArea->updateScrollSnapState();179 }180 } else if (isBody() || isDocumentElementRenderer()) {181 FrameView& frameView = view().frameView();182 frameView.updateSnapOffsets();183 frameView.updateScrollSnapState();184 frameView.updateScrollingCoordinatorScrollSnapProperties();185 }186 }187 188 167 bool scrollMarginChanged = oldStyle && oldStyle->scrollMargin() != newStyle.scrollMargin(); 189 168 bool scrollAlignChanged = oldStyle && oldStyle->scrollSnapAlign() != newStyle.scrollSnapAlign(); 190 169 bool scrollSnapStopChanged = oldStyle && oldStyle->scrollSnapStop() != newStyle.scrollSnapStop(); 191 170 if (scrollMarginChanged || scrollAlignChanged || scrollSnapStopChanged) { 192 auto* scrollSnapBox = enclosingScrollableContainerForSnapping(); 193 if (scrollSnapBox && scrollSnapBox->layer()) { 194 const RenderStyle& style = scrollSnapBox->style(); 195 if (style.scrollSnapType().strictness != ScrollSnapStrictness::None) { 196 if (auto* scrollableArea = scrollSnapBox->layer()->scrollableArea()) { 197 scrollableArea->updateSnapOffsets(); 198 scrollableArea->updateScrollSnapState(); 199 } 200 if (scrollSnapBox->isBody() || scrollSnapBox->isDocumentElementRenderer()) 201 scrollSnapBox->view().frameView().updateSnapOffsets(); 202 scrollSnapBox->view().frameView().updateScrollSnapState(); 203 scrollSnapBox->view().frameView().updateScrollingCoordinatorScrollSnapProperties(); 204 } 205 } 171 if (auto* scrollSnapBox = enclosingScrollableContainerForSnapping()) 172 scrollSnapBox->setNeedsLayout(); 206 173 } 207 174 #endif -
trunk/Source/WebCore/rendering/RenderObject.cpp
r278185 r278193 470 470 } 471 471 472 constRenderBox* RenderObject::enclosingScrollableContainerForSnapping() const472 RenderBox* RenderObject::enclosingScrollableContainerForSnapping() const 473 473 { 474 474 // Walk up the container chain to find the scrollable container that contains -
trunk/Source/WebCore/rendering/RenderObject.h
r278185 r278193 156 156 WEBCORE_EXPORT RenderBox& enclosingBox() const; 157 157 RenderBoxModelObject& enclosingBoxModelObject() const; 158 constRenderBox* enclosingScrollableContainerForSnapping() const;158 RenderBox* enclosingScrollableContainerForSnapping() const; 159 159 160 160 // Return our enclosing flow thread if we are contained inside one. Follows the containing block chain. -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r277538 r278193 952 952 return true; 953 953 } 954 955 #if ENABLE(CSS_SCROLL_SNAP) 956 if (scrollPadding() != other.scrollPadding() || scrollSnapType() != other.scrollSnapType()) 957 return true; 958 #endif 954 959 955 960 return false;
Note: See TracChangeset
for help on using the changeset viewer.