Changeset 269144 in webkit
- Timestamp:
- Oct 29, 2020 4:37:18 AM (3 years ago)
- Location:
- trunk
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r269141 r269144 1 2020-10-29 Martin Robinson <mrobinson@igalia.com> 2 3 Make scroll-margin independent of scroll snapping and have it apply when scrolling to anchors 4 https://bugs.webkit.org/show_bug.cgi?id=218076 5 6 Reviewed by Simon Fraser. 7 8 * TestExpectations: Updated expectations for newly passing tests and marked some tests 9 as flaky. 10 1 11 2020-10-29 Cathie Chen <cathiechen@igalia.com> 2 12 -
trunk/LayoutTests/TestExpectations
r269133 r269144 4503 4503 imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-align-002.html [ ImageOnlyFailure ] 4504 4504 imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-align-003.html [ ImageOnlyFailure ] 4505 imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-margin-001.html [ ImageOnlyFailure ] 4506 imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-margin-002.html [ ImageOnlyFailure ] 4507 imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-margin-003.html [ ImageOnlyFailure ] 4508 imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-margin-004.html [ ImageOnlyFailure ] 4505 webkit.org/b/218325 imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-margin-001.html [ Pass ImageOnlyFailure ] 4506 webkit.org/b/218325 imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-margin-003.html [ Pass ImageOnlyFailure ] 4509 4507 imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-padding-001.html [ ImageOnlyFailure ] 4510 4508 imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-padding-002.html [ ImageOnlyFailure ] -
trunk/LayoutTests/imported/w3c/ChangeLog
r269133 r269144 1 2020-10-29 Martin Robinson <mrobinson@igalia.com> 2 3 Make scroll-margin independent of scroll snapping and have it apply when scrolling to anchors 4 https://bugs.webkit.org/show_bug.cgi?id=218076 5 6 Reviewed by Simon Fraser. 7 8 * web-platform-tests/css/cssom-view/scrollIntoView-scrollMargin-expected.txt: Updated expectation to note new pass. 9 1 10 2020-10-28 Chris Dumez <cdumez@apple.com> 2 11 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-scrollMargin-expected.txt
r235659 r269144 1 1 2 FAIL scrollIntoView({block: "center", inline: "center"}) assert_approx_equals: scrollX expected 153.5 +/- 0.5 but got 158 3 FAIL scrollIntoView({block: "start", inline: "start"}) assert_approx_equals: scrollX expected 184 +/- 0.5 but got 200 4 FAIL scrollIntoView({block: "end", inline: "end"}) assert_approx_equals: scrollX expected 123 +/- 0.5 but got 115 2 PASS scrollIntoView({block: "center", inline: "center"}) 3 PASS scrollIntoView({block: "start", inline: "start"}) 4 PASS scrollIntoView({block: "end", inline: "end"}) 5 5 -
trunk/Source/WebCore/ChangeLog
r269143 r269144 1 2020-10-29 Martin Robinson <mrobinson@igalia.com> 2 3 Make scroll-margin independent of scroll snapping and have it apply when scrolling to anchors 4 https://bugs.webkit.org/show_bug.cgi?id=218076 5 6 Reviewed by Simon Fraser. 7 8 * dom/Element.cpp: 9 (WebCore::Element::scrollIntoView): Use absoluteAnchorRectWithScrollMargin, taking into 10 account scroll-margin. 11 (WebCore::Element::scrollIntoViewIfNeeded): Ditto. 12 (WebCore::Element::scrollIntoViewIfNotVisible): Ditto. 13 * page/FrameView.cpp: 14 (WebCore::FrameView::scrollToAnchor): Ditto. 15 * rendering/RenderBox.cpp: 16 (WebCore::RenderBox::absoluteAnchorRectWithScrollMargin const): Added this override 17 which properly converts the scroll-margin to LayoutUnits and applies it to absoluteAnchorRect. 18 * rendering/RenderBox.h: Added method declaration. 19 * rendering/RenderElement.cpp: 20 (WebCore::RenderElement::absoluteAnchorRectWithScrollMargin const): Added implementation 21 that simply calls absoluteAnchorRect. 22 * rendering/RenderElement.h: Added declaration of new virtual 23 absoluteAnchorRectWithScrollMargin. 24 * rendering/RenderLayerModelObject.cpp: 25 (WebCore::RenderLayerModelObject::styleDidChange): Get the scroll-margin directly from the 26 style instead of the now-removed ScrollSnapArea. 27 * rendering/style/RenderStyle.cpp: 28 (WebCore::RenderStyle::scrollMargin const): Move scroll-margin and scroll-snap-align to 29 m_rareNonInheritedData and get rid of intermediate ScrollSnapArea. These two properties 30 are no independent. 31 (WebCore::RenderStyle::scrollMarginTop const): Ditto. 32 (WebCore::RenderStyle::scrollMarginBottom const): Ditto. 33 (WebCore::RenderStyle::scrollMarginLeft const): Ditto. 34 (WebCore::RenderStyle::scrollMarginRight const): Ditto. 35 (WebCore::RenderStyle::setScrollMarginTop): Ditto. 36 (WebCore::RenderStyle::setScrollMarginBottom): Ditto. 37 (WebCore::RenderStyle::setScrollMarginLeft): Ditto. 38 (WebCore::RenderStyle::setScrollMarginRight): Ditto. 39 (WebCore::RenderStyle::scrollSnapAlign const): Ditto. 40 (WebCore::RenderStyle::setScrollSnapAlign): Ditto. 41 (WebCore::RenderStyle::hasSnapPosition const): Ditto. 42 (WebCore::RenderStyle::scrollSnapArea const): Deleted. 43 * rendering/style/RenderStyle.h: Add accessors for scroll-margin and moved hasSnapPosition 44 from ScrollSnapArea. 45 * rendering/style/StyleRareNonInheritedData.cpp: Removed intermediate ScrollSnapArea data 46 structure and moved members here. 47 (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): Ditto. 48 (WebCore::StyleRareNonInheritedData::operator== const): Ditto. 49 * rendering/style/StyleRareNonInheritedData.h: Ditto. 50 * rendering/style/StyleScrollSnapPoints.cpp: Ditto. 51 (WebCore::StyleScrollSnapArea::copy const): Deleted. 52 (WebCore::StyleScrollSnapArea::StyleScrollSnapArea): Deleted. 53 * rendering/style/StyleScrollSnapPoints.h: Removed ScrollSnapArea. 54 (WebCore::StyleScrollSnapArea::create): Deleted. 55 (WebCore::StyleScrollSnapArea::hasSnapPosition const): Deleted. 56 1 57 2020-10-29 Chris Lord <clord@igalia.com> 2 58 -
trunk/Source/WebCore/dom/Element.cpp
r268932 r269144 862 862 863 863 bool insideFixed; 864 LayoutRect absoluteBounds = renderer()->absoluteAnchorRect (&insideFixed);864 LayoutRect absoluteBounds = renderer()->absoluteAnchorRectWithScrollMargin(&insideFixed); 865 865 866 866 ScrollIntoViewOptions options; … … 896 896 897 897 bool insideFixed; 898 LayoutRect absoluteBounds = renderer()->absoluteAnchorRect (&insideFixed);898 LayoutRect absoluteBounds = renderer()->absoluteAnchorRectWithScrollMargin(&insideFixed); 899 899 // Align to the top / bottom and to the closest edge. 900 900 if (alignToTop) … … 912 912 913 913 bool insideFixed; 914 LayoutRect absoluteBounds = renderer()->absoluteAnchorRect (&insideFixed);914 LayoutRect absoluteBounds = renderer()->absoluteAnchorRectWithScrollMargin(&insideFixed); 915 915 if (centerIfNeeded) 916 916 renderer()->scrollRectToVisible(absoluteBounds, insideFixed, { SelectionRevealMode::Reveal, ScrollAlignment::alignCenterIfNeeded, ScrollAlignment::alignCenterIfNeeded, ShouldAllowCrossOriginScrolling::No }); … … 927 927 928 928 bool insideFixed; 929 LayoutRect absoluteBounds = renderer()->absoluteAnchorRect (&insideFixed);929 LayoutRect absoluteBounds = renderer()->absoluteAnchorRectWithScrollMargin(&insideFixed); 930 930 if (centerIfNotVisible) 931 931 renderer()->scrollRectToVisible(absoluteBounds, insideFixed, { SelectionRevealMode::Reveal, ScrollAlignment::alignCenterIfNotVisible, ScrollAlignment::alignCenterIfNotVisible, ShouldAllowCrossOriginScrolling::No }); -
trunk/Source/WebCore/page/FrameView.cpp
r268902 r269144 3177 3177 bool insideFixed = false; 3178 3178 if (anchorNode != frame().document() && anchorNode->renderer()) 3179 rect = anchorNode->renderer()->absoluteAnchorRect (&insideFixed);3179 rect = anchorNode->renderer()->absoluteAnchorRectWithScrollMargin(&insideFixed); 3180 3180 3181 3181 LOG_WITH_STREAM(Scrolling, stream << " anchor node rect " << rect); -
trunk/Source/WebCore/rendering/RenderBox.cpp
r268919 r269144 162 162 163 163 #if ENABLE(CSS_SCROLL_SNAP) 164 if (hasInitializedStyle() && style(). scrollSnapArea().hasSnapPosition())164 if (hasInitializedStyle() && style().hasSnapPosition()) 165 165 view().unregisterBoxWithScrollSnapPositions(*this); 166 166 #endif … … 278 278 279 279 #if ENABLE(CSS_SCROLL_SNAP) 280 bool boxContributesSnapPositions = newStyle. scrollSnapArea().hasSnapPosition();281 if (boxContributesSnapPositions || (oldStyle && oldStyle-> scrollSnapArea().hasSnapPosition())) {280 bool boxContributesSnapPositions = newStyle.hasSnapPosition(); 281 if (boxContributesSnapPositions || (oldStyle && oldStyle->hasSnapPosition())) { 282 282 if (boxContributesSnapPositions) 283 283 view().registerBoxWithScrollSnapPositions(*this); … … 5055 5055 } 5056 5056 5057 LayoutRect RenderBox::absoluteAnchorRectWithScrollMargin(bool* insideFixed) const 5058 { 5059 LayoutRect anchorRect = absoluteAnchorRect(insideFixed); 5060 const LengthBox& scrollMargin = style().scrollMargin(); 5061 if (scrollMargin.isZero()) 5062 return anchorRect; 5063 5064 // The scroll snap specification says that the scroll-margin should be applied in the 5065 // coordinate system of the scroll container and applied to the rectangular bounding 5066 // box of the transformed border box of the target element. 5067 // See https://www.w3.org/TR/css-scroll-snap-1/#scroll-margin. 5068 const LayoutSize boxSize = size(); 5069 const LayoutBoxExtent margin( 5070 valueForLength(scrollMargin.top(), boxSize.height()), 5071 valueForLength(scrollMargin.right(), boxSize.width()), 5072 valueForLength(scrollMargin.bottom(), boxSize.height()), 5073 valueForLength(scrollMargin.left(), boxSize.width())); 5074 anchorRect.expand(margin); 5075 5076 return anchorRect; 5077 } 5078 5057 5079 } // namespace WebCore -
trunk/Source/WebCore/rendering/RenderBox.h
r268919 r269144 645 645 virtual void adjustBorderBoxRectForPainting(LayoutRect&) { }; 646 646 647 LayoutRect absoluteAnchorRectWithScrollMargin(bool* insideFixed = nullptr) const override; 648 647 649 protected: 648 650 RenderBox(Element&, RenderStyle&&, BaseTypeFlags); -
trunk/Source/WebCore/rendering/RenderElement.cpp
r268249 r269144 1658 1658 } 1659 1659 1660 LayoutRect RenderElement::absoluteAnchorRectWithScrollMargin(bool* insideFixed) const 1661 { 1662 return absoluteAnchorRect(insideFixed); 1663 } 1664 1660 1665 const RenderElement* RenderElement::enclosingRendererWithTextDecoration(OptionSet<TextDecoration> textDecoration, bool firstLine) const 1661 1666 { -
trunk/Source/WebCore/rendering/RenderElement.h
r268932 r269144 156 156 bool checkForRepaintDuringLayout() const; 157 157 158 // a nchorRect() is conceptually similar to absoluteBoundingBoxRect(), but is intended for scrolling to an anchor.159 // For inline renderers, this gets the logical top left of the first leaf child and the logical bottom right of the160 // last leaf child, converts them to absolute coordinates, and makes a box out of them.158 // absoluteAnchorRect() is conceptually similar to absoluteBoundingBoxRect(), but is intended for scrolling to an 159 // anchor. For inline renderers, this gets the logical top left of the first leaf child and the logical bottom 160 // right of the last leaf child, converts them to absolute coordinates, and makes a box out of them. 161 161 LayoutRect absoluteAnchorRect(bool* insideFixed = nullptr) const; 162 163 // absoluteAnchorRectWithScrollMargin() is similar to absoluteAnchorRect, but it also takes into account any 164 // CSS scroll-margin that is set in the style of this RenderElement. 165 virtual LayoutRect absoluteAnchorRectWithScrollMargin(bool* insideFixed = nullptr) const; 162 166 163 167 bool hasFilter() const { return style().hasFilter(); } -
trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp
r268932 r269144 186 186 } 187 187 } 188 if (oldStyle && oldStyle->scrollSnapArea() != newStyle.scrollSnapArea()) { 188 189 bool scrollMarginChanged = 190 oldStyle && oldStyle->scrollMargin() != newStyle.scrollMargin(); 191 bool scrollAlignChanged = 192 oldStyle && oldStyle->scrollSnapAlign() != newStyle.scrollSnapAlign(); 193 if (scrollMarginChanged || scrollAlignChanged) { 189 194 auto* scrollSnapBox = enclosingScrollableContainerForSnapping(); 190 195 if (scrollSnapBox && scrollSnapBox->layer()) { -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r268889 r269144 2393 2393 } 2394 2394 2395 const LengthBox& RenderStyle::scrollMargin() const 2396 { 2397 return m_rareNonInheritedData->scrollMargin; 2398 } 2399 2400 const Length& RenderStyle::scrollMarginTop() const 2401 { 2402 return scrollMargin().top(); 2403 } 2404 2405 const Length& RenderStyle::scrollMarginBottom() const 2406 { 2407 return scrollMargin().bottom(); 2408 } 2409 2410 const Length& RenderStyle::scrollMarginLeft() const 2411 { 2412 return scrollMargin().left(); 2413 } 2414 2415 const Length& RenderStyle::scrollMarginRight() const 2416 { 2417 return scrollMargin().right(); 2418 } 2419 2420 void RenderStyle::setScrollMarginTop(Length&& length) 2421 { 2422 SET_VAR(m_rareNonInheritedData, scrollMargin.top(), WTFMove(length)); 2423 } 2424 2425 void RenderStyle::setScrollMarginBottom(Length&& length) 2426 { 2427 SET_VAR(m_rareNonInheritedData, scrollMargin.bottom(), WTFMove(length)); 2428 } 2429 2430 void RenderStyle::setScrollMarginLeft(Length&& length) 2431 { 2432 SET_VAR(m_rareNonInheritedData, scrollMargin.left(), WTFMove(length)); 2433 } 2434 2435 void RenderStyle::setScrollMarginRight(Length&& length) 2436 { 2437 SET_VAR(m_rareNonInheritedData, scrollMargin.right(), WTFMove(length)); 2438 } 2439 2395 2440 #if ENABLE(CSS_SCROLL_SNAP) 2396 2441 … … 2405 2450 } 2406 2451 2407 const StyleScrollSnapArea& RenderStyle::scrollSnapArea() const2408 {2409 return *m_rareNonInheritedData->scrollSnapArea;2410 }2411 2412 2452 const StyleScrollSnapPort& RenderStyle::scrollSnapPort() const 2413 2453 { … … 2447 2487 const ScrollSnapAlign& RenderStyle::scrollSnapAlign() const 2448 2488 { 2449 return m_rareNonInheritedData->scrollSnapArea->alignment; 2450 } 2451 2452 const LengthBox& RenderStyle::scrollMargin() const 2453 { 2454 return m_rareNonInheritedData->scrollSnapArea->scrollMargin; 2455 } 2456 2457 const Length& RenderStyle::scrollMarginTop() const 2458 { 2459 return scrollMargin().top(); 2460 } 2461 2462 const Length& RenderStyle::scrollMarginBottom() const 2463 { 2464 return scrollMargin().bottom(); 2465 } 2466 2467 const Length& RenderStyle::scrollMarginLeft() const 2468 { 2469 return scrollMargin().left(); 2470 } 2471 2472 const Length& RenderStyle::scrollMarginRight() const 2473 { 2474 return scrollMargin().right(); 2489 return m_rareNonInheritedData->scrollSnapAlign; 2475 2490 } 2476 2491 … … 2502 2517 void RenderStyle::setScrollSnapAlign(const ScrollSnapAlign& alignment) 2503 2518 { 2504 SET_NESTED_VAR(m_rareNonInheritedData, scrollSnapArea, alignment, alignment); 2505 } 2506 2507 void RenderStyle::setScrollMarginTop(Length&& length) 2508 { 2509 SET_NESTED_VAR(m_rareNonInheritedData, scrollSnapArea, scrollMargin.top(), WTFMove(length)); 2510 } 2511 2512 void RenderStyle::setScrollMarginBottom(Length&& length) 2513 { 2514 SET_NESTED_VAR(m_rareNonInheritedData, scrollSnapArea, scrollMargin.bottom(), WTFMove(length)); 2515 } 2516 2517 void RenderStyle::setScrollMarginLeft(Length&& length) 2518 { 2519 SET_NESTED_VAR(m_rareNonInheritedData, scrollSnapArea, scrollMargin.left(), WTFMove(length)); 2520 } 2521 2522 void RenderStyle::setScrollMarginRight(Length&& length) 2523 { 2524 SET_NESTED_VAR(m_rareNonInheritedData, scrollSnapArea, scrollMargin.right(), WTFMove(length)); 2525 } 2526 2519 SET_VAR(m_rareNonInheritedData, scrollSnapAlign, alignment); 2520 } 2521 2522 bool RenderStyle::hasSnapPosition() const 2523 { 2524 const ScrollSnapAlign& alignment = this->scrollSnapAlign(); 2525 return alignment.x != ScrollSnapAxisAlignType::None || alignment.y != ScrollSnapAxisAlignType::None; 2526 } 2527 2527 #endif 2528 2528 -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r269037 r269144 720 720 OptionSet<EventListenerRegionType> eventListenerRegionTypes() const { return m_rareInheritedData->eventListenerRegionTypes; } 721 721 722 const LengthBox& scrollMargin() const; 723 const Length& scrollMarginTop() const; 724 const Length& scrollMarginBottom() const; 725 const Length& scrollMarginLeft() const; 726 const Length& scrollMarginRight() const; 727 722 728 #if ENABLE(CSS_SCROLL_SNAP) 729 bool hasSnapPosition() const; 730 723 731 // Scroll snap port style. 724 732 const StyleScrollSnapPort& scrollSnapPort() const; … … 730 738 const Length& scrollPaddingRight() const; 731 739 732 // Scroll snap area style.733 const StyleScrollSnapArea& scrollSnapArea() const;734 740 const ScrollSnapAlign& scrollSnapAlign() const; 735 const LengthBox& scrollMargin() const;736 const Length& scrollMarginTop() const;737 const Length& scrollMarginBottom() const;738 const Length& scrollMarginLeft() const;739 const Length& scrollMarginRight() const;740 741 #endif 741 742 … … 1266 1267 void setEventListenerRegionTypes(OptionSet<EventListenerRegionType> eventListenerTypes) { SET_VAR(m_rareInheritedData, eventListenerRegionTypes, eventListenerTypes); } 1267 1268 1269 void setScrollMarginTop(Length&&); 1270 void setScrollMarginBottom(Length&&); 1271 void setScrollMarginLeft(Length&&); 1272 void setScrollMarginRight(Length&&); 1273 1268 1274 #if ENABLE(CSS_SCROLL_SNAP) 1269 1275 void setScrollSnapType(const ScrollSnapType&); … … 1274 1280 1275 1281 void setScrollSnapAlign(const ScrollSnapAlign&); 1276 void setScrollMarginTop(Length&&);1277 void setScrollMarginBottom(Length&&);1278 void setScrollMarginLeft(Length&&);1279 void setScrollMarginRight(Length&&);1280 1282 #endif 1281 1283 … … 1675 1677 static TouchAction initialTouchActions() { return TouchAction::Auto; } 1676 1678 1679 static Length initialScrollMargin() { return Length(Fixed); } 1680 1677 1681 #if ENABLE(CSS_SCROLL_SNAP) 1678 1682 static ScrollSnapType initialScrollSnapType(); 1679 1683 static ScrollSnapAlign initialScrollSnapAlign(); 1680 static Length initialScrollMargin() { return Length(Fixed); }1681 1684 static Length initialScrollPadding() { return Length(Fixed); } 1682 1685 #endif -
trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
r268173 r269144 32 32 #include "StyleImage.h" 33 33 #include "StyleResolver.h" 34 #include "StyleScrollSnapPoints.h"35 34 #include <wtf/PointerComparison.h> 36 35 #include <wtf/RefPtr.h> … … 63 62 #if ENABLE(CSS_SCROLL_SNAP) 64 63 , scrollSnapPort(StyleScrollSnapPort::create()) 65 , scrollSnapArea(StyleScrollSnapArea::create())66 64 #endif 67 65 , willChange(RenderStyle::initialWillChange()) … … 140 138 , grid(o.grid) 141 139 , gridItem(o.gridItem) 140 , scrollMargin(o.scrollMargin) 142 141 #if ENABLE(CSS_SCROLL_SNAP) 143 142 , scrollSnapPort(o.scrollSnapPort) 144 , scrollSnapA rea(o.scrollSnapArea)143 , scrollSnapAlign(o.scrollSnapAlign) 145 144 #endif 146 145 , content(o.content ? o.content->clone() : nullptr) … … 242 241 && grid == o.grid 243 242 && gridItem == o.gridItem 243 && scrollMargin == o.scrollMargin 244 244 #if ENABLE(CSS_SCROLL_SNAP) 245 245 && scrollSnapPort == o.scrollSnapPort 246 && scrollSnapA rea == o.scrollSnapArea246 && scrollSnapAlign == o.scrollSnapAlign 247 247 #endif 248 248 && contentDataEquivalent(o) -
trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h
r267985 r269144 46 46 #include <wtf/Vector.h> 47 47 48 #if ENABLE(CSS_SCROLL_SNAP) 49 #include "StyleScrollSnapPoints.h" 50 #endif 51 48 52 namespace WebCore { 49 53 … … 61 65 class StyleReflection; 62 66 class StyleResolver; 63 class StyleScrollSnapArea;64 class StyleScrollSnapPort;65 67 class StyleTransformData; 66 68 … … 130 132 DataRef<StyleGridItemData> gridItem; 131 133 134 LengthBox scrollMargin { 0, 0, 0, 0 }; 132 135 #if ENABLE(CSS_SCROLL_SNAP) 133 136 DataRef<StyleScrollSnapPort> scrollSnapPort; 134 DataRef<StyleScrollSnapArea> scrollSnapArea;137 ScrollSnapAlign scrollSnapAlign; 135 138 #endif 136 139 -
trunk/Source/WebCore/rendering/style/StyleScrollSnapPoints.cpp
r268889 r269144 47 47 } 48 48 49 Ref<StyleScrollSnapArea> StyleScrollSnapArea::copy() const50 {51 return adoptRef(*new StyleScrollSnapArea(*this));52 }53 54 StyleScrollSnapArea::StyleScrollSnapArea()55 : scrollMargin(0, 0, 0, 0)56 {57 }58 59 inline StyleScrollSnapArea::StyleScrollSnapArea(const StyleScrollSnapArea& other)60 : RefCounted()61 , alignment(other.alignment)62 , scrollMargin(other.scrollMargin)63 {64 }65 66 49 } // namespace WebCore 67 50 -
trunk/Source/WebCore/rendering/style/StyleScrollSnapPoints.h
r268889 r269144 80 80 inline bool operator!=(const ScrollSnapAlign& a, const ScrollSnapAlign& b) { return !(a == b); } 81 81 82 class StyleScrollSnapArea : public RefCounted<StyleScrollSnapArea> {83 public:84 static Ref<StyleScrollSnapArea> create() { return adoptRef(*new StyleScrollSnapArea); }85 Ref<StyleScrollSnapArea> copy() const;86 bool hasSnapPosition() const { return alignment.x != ScrollSnapAxisAlignType::None || alignment.y != ScrollSnapAxisAlignType::None; }87 88 ScrollSnapAlign alignment;89 LengthBox scrollMargin { 0, 0, 0, 0 };90 91 private:92 StyleScrollSnapArea();93 StyleScrollSnapArea(const StyleScrollSnapArea&);94 };95 96 inline bool operator==(const StyleScrollSnapArea& a, const StyleScrollSnapArea& b)97 {98 return a.alignment == b.alignment && a.scrollMargin == b.scrollMargin;99 }100 101 inline bool operator!=(const StyleScrollSnapArea& a, const StyleScrollSnapArea& b) { return !(a == b); }102 103 82 } // namespace WebCore 104 83
Note: See TracChangeset
for help on using the changeset viewer.