Changeset 288947 in webkit
- Timestamp:
- Feb 2, 2022 1:12:57 AM (6 months ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-margin-006-expected.txt (added)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-margin-006.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/rendering/RenderBox.cpp (modified) (1 diff)
-
Source/WebCore/rendering/RenderBox.h (modified) (1 diff)
-
Source/WebCore/rendering/RenderElement.cpp (modified) (1 diff)
-
Source/WebCore/rendering/RenderElement.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r288906 r288947 1 2022-02-02 Martin Robinson <mrobinson@webkit.org> 2 3 scroll-margin-top doesn't work on inline elements 4 https://bugs.webkit.org/show_bug.cgi?id=235933 5 <rdar://87983307> 6 7 Reviewed by Simon Fraser. 8 9 * web-platform-tests/css/css-scroll-snap/scroll-target-margin-006-expected.txt: Added. 10 * web-platform-tests/css/css-scroll-snap/scroll-target-margin-006.html: Added. 11 1 12 2022-02-01 Antti Koivisto <antti@apple.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r288944 r288947 1 2022-02-02 Martin Robinson <mrobinson@webkit.org> 2 3 scroll-margin-top doesn't work on inline elements 4 https://bugs.webkit.org/show_bug.cgi?id=235933 5 <rdar://87983307> 6 7 Reviewed by Simon Fraser. 8 9 Test: imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-margin-005.html 10 11 Move the implementation of absoluteAnchorRectWithScrollMargin which actually processes 12 the CSS scroll-margin property to RenderElement. This allows it to be used for inline 13 as well as block elements. The specification says it should apply to both. The box 14 sizes passed in here do not matter too much, because the Length should never be a 15 percentage. 16 17 * rendering/RenderBox.cpp: 18 (WebCore::RenderBox::absoluteAnchorRectWithScrollMargin const): Deleted. 19 * rendering/RenderBox.h: 20 * rendering/RenderElement.cpp: 21 (WebCore::RenderElement::absoluteAnchorRectWithScrollMargin const): 22 * rendering/RenderElement.h: 23 1 24 2022-02-01 Alan Bujtas <zalan@apple.com> 2 25 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r288069 r288947 5473 5473 } 5474 5474 5475 LayoutRect RenderBox::absoluteAnchorRectWithScrollMargin(bool* insideFixed) const5476 {5477 LayoutRect anchorRect = absoluteAnchorRect(insideFixed);5478 const LengthBox& scrollMargin = style().scrollMargin();5479 if (scrollMargin.isZero())5480 return anchorRect;5481 5482 // The scroll snap specification says that the scroll-margin should be applied in the5483 // coordinate system of the scroll container and applied to the rectangular bounding5484 // box of the transformed border box of the target element.5485 // See https://www.w3.org/TR/css-scroll-snap-1/#scroll-margin.5486 const LayoutSize boxSize = size();5487 const LayoutBoxExtent margin(5488 valueForLength(scrollMargin.top(), boxSize.height()),5489 valueForLength(scrollMargin.right(), boxSize.width()),5490 valueForLength(scrollMargin.bottom(), boxSize.height()),5491 valueForLength(scrollMargin.left(), boxSize.width()));5492 anchorRect.expand(margin);5493 5494 return anchorRect;5495 }5496 5497 5475 LayoutBoxExtent RenderBox::scrollPaddingForViewportRect(const LayoutRect& viewportRect) 5498 5476 { -
trunk/Source/WebCore/rendering/RenderBox.h
r288067 r288947 670 670 virtual void adjustBorderBoxRectForPainting(LayoutRect&) { }; 671 671 672 LayoutRect absoluteAnchorRectWithScrollMargin(bool* insideFixed = nullptr) const override;673 674 672 bool shouldComputeLogicalHeightFromAspectRatio() const; 675 673 -
trunk/Source/WebCore/rendering/RenderElement.cpp
r288267 r288947 1735 1735 LayoutRect RenderElement::absoluteAnchorRectWithScrollMargin(bool* insideFixed) const 1736 1736 { 1737 return absoluteAnchorRect(insideFixed); 1737 LayoutRect anchorRect = absoluteAnchorRect(insideFixed); 1738 const LengthBox& scrollMargin = style().scrollMargin(); 1739 if (scrollMargin.isZero()) 1740 return anchorRect; 1741 1742 // The scroll snap specification says that the scroll-margin should be applied in the 1743 // coordinate system of the scroll container and applied to the rectangular bounding 1744 // box of the transformed border box of the target element. 1745 // See https://www.w3.org/TR/css-scroll-snap-1/#scroll-margin. 1746 const LayoutBoxExtent margin( 1747 valueForLength(scrollMargin.top(), anchorRect.height()), 1748 valueForLength(scrollMargin.right(), anchorRect.width()), 1749 valueForLength(scrollMargin.bottom(), anchorRect.height()), 1750 valueForLength(scrollMargin.left(), anchorRect.width())); 1751 anchorRect.expand(margin); 1752 return anchorRect; 1738 1753 } 1739 1754 -
trunk/Source/WebCore/rendering/RenderElement.h
r288267 r288947 191 191 // absoluteAnchorRectWithScrollMargin() is similar to absoluteAnchorRect, but it also takes into account any 192 192 // CSS scroll-margin that is set in the style of this RenderElement. 193 virtualLayoutRect absoluteAnchorRectWithScrollMargin(bool* insideFixed = nullptr) const;193 LayoutRect absoluteAnchorRectWithScrollMargin(bool* insideFixed = nullptr) const; 194 194 195 195 bool hasFilter() const { return style().hasFilter(); }
Note: See TracChangeset
for help on using the changeset viewer.