Changeset 270023 in webkit
- Timestamp:
- Nov 19, 2020 5:59:56 AM (20 months ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 19 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/TestExpectations (modified) (1 diff)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-scrollPadding-expected.txt (modified) (1 diff)
-
LayoutTests/platform/mac-wk1/TestExpectations (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Sources.txt (modified) (1 diff)
-
Source/WebCore/WebCore.xcodeproj/project.pbxproj (modified) (2 diffs)
-
Source/WebCore/css/CSSComputedStyleDeclaration.cpp (modified) (2 diffs)
-
Source/WebCore/css/CSSProperties.json (modified) (11 diffs)
-
Source/WebCore/css/StyleProperties.cpp (modified) (3 diffs)
-
Source/WebCore/css/parser/CSSPropertyParser.cpp (modified) (3 diffs)
-
Source/WebCore/rendering/RenderLayer.cpp (modified) (8 diffs)
-
Source/WebCore/rendering/RenderLayerModelObject.cpp (modified) (1 diff)
-
Source/WebCore/rendering/style/RenderStyle.cpp (modified) (3 diffs)
-
Source/WebCore/rendering/style/RenderStyle.h (modified) (6 diffs)
-
Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp (modified) (3 diffs)
-
Source/WebCore/rendering/style/StyleRareNonInheritedData.h (modified) (1 diff)
-
Source/WebCore/rendering/style/StyleScrollSnapPoints.cpp (deleted)
-
Source/WebCore/rendering/style/StyleScrollSnapPoints.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r270018 r270023 1 2020-11-19 Martin Robinson <mrobinson@webkit.org> 2 3 Make scroll-padding independent of scroll-snap and have it affect scrollIntoView 4 https://bugs.webkit.org/show_bug.cgi?id=219073 5 6 Reviewed by Simon Fraser. 7 8 * TestExpectations: Mark some tests as passing. 9 * platform/mac-wk1/TestExpectations: Mark one test as failing due to WebKit1 scrollbars. 10 1 11 2020-11-17 Sergio Villar Senin <svillar@igalia.com> 2 12 -
trunk/LayoutTests/TestExpectations
r270016 r270023 4569 4569 webkit.org/b/218325 imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-margin-001.html [ Pass ImageOnlyFailure ] 4570 4570 webkit.org/b/218325 imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-margin-003.html [ Pass ImageOnlyFailure ] 4571 imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-padding-001.html [ ImageOnlyFailure ]4572 imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-padding-002.html [ ImageOnlyFailure ]4573 imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-padding-003.html [ ImageOnlyFailure ]4574 4571 imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-snap-001.html [ ImageOnlyFailure ] 4575 4572 imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-snap-002.html [ ImageOnlyFailure ] -
trunk/LayoutTests/imported/w3c/ChangeLog
r270020 r270023 1 2020-11-19 Martin Robinson <mrobinson@webkit.org> 2 3 Make scroll-padding independent of scroll-snap and have it affect scrollIntoView 4 https://bugs.webkit.org/show_bug.cgi?id=219073 5 6 Reviewed by Simon Fraser. 7 8 * web-platform-tests/css/cssom-view/scrollIntoView-scrollPadding-expected.txt: Updated to reflect newly passing test. 9 1 10 2020-11-19 Chris Lord <clord@igalia.com> 2 11 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-scrollPadding-expected.txt
r235659 r270023 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/LayoutTests/platform/mac-wk1/TestExpectations
r270016 r270023 446 446 imported/w3c/web-platform-tests/cookies/secure/set-from-ws.sub.html [ Failure ] 447 447 448 # WebKit1 frames use native scrollbars causing this reference test to fail. 449 imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-padding-001.html [ ImageOnlyFailure ] 450 448 451 ### END OF (2) Failures without bug reports 449 452 ######################################## -
trunk/Source/WebCore/ChangeLog
r270019 r270023 1 2020-11-19 Martin Robinson <mrobinson@webkit.org> 2 3 Make scroll-padding independent of scroll-snap and have it affect scrollIntoView 4 https://bugs.webkit.org/show_bug.cgi?id=219073 5 6 Reviewed by Simon Fraser. 7 8 The scroll-padding CSS property is now available even when scroll-snap is not 9 enabled at compile-time. Also make scroll-snap affect positioning during 10 scrollIntoView operations. 11 12 * Sources.txt: Remove ScrollSnapPoints.cpp, because it is no longer necessary. 13 * WebCore.xcodeproj/project.pbxproj: Ditto. 14 * css/CSSComputedStyleDeclaration.cpp: Enable scroll-padding and scroll-padding-* unconditionally. 15 (WebCore::ComputedStyleExtractor::valueForPropertyInStyle): Ditto. 16 * css/CSSProperties.json: Ditto. 17 * css/StyleProperties.cpp: Ditto. 18 (WebCore::StyleProperties::getPropertyValue const): Ditto. 19 (WebCore::StyleProperties::asText const): Ditto. 20 * css/parser/CSSPropertyParser.cpp: Ditto. 21 (WebCore::CSSPropertyParser::parseSingleValue): Ditto. 22 (WebCore::CSSPropertyParser::parseShorthand): Ditto. 23 * rendering/RenderLayer.cpp: Ditto. 24 (WebCore::expandScrollRectToVisibleTargetRectToIncludeScrollPadding): Added this helper 25 function which expands the target rectangle to include scroll padding from the container. 26 This creates the affect that the container has a padding rectangle. 27 (WebCore::RenderLayer::scrollRectToVisible): Now expand target rectangle to include 28 scroll container padding. Also put some code into a lambda to simplify things. 29 * rendering/RenderLayerModelObject.cpp: Ditto. 30 (WebCore::scrollSnapContainerRequiresUpdateForStyleUpdate): Ditto. 31 * rendering/style/RenderStyle.cpp: Ditto. 32 (WebCore::RenderStyle::scrollPadding const): Ditto. 33 (WebCore::RenderStyle::setScrollPaddingTop): Ditto. 34 (WebCore::RenderStyle::setScrollPaddingBottom): Ditto. 35 (WebCore::RenderStyle::setScrollPaddingLeft): Ditto. 36 (WebCore::RenderStyle::setScrollPaddingRight): Ditto. 37 (WebCore::RenderStyle::initialScrollSnapType): Ditto. 38 (WebCore::RenderStyle::initialScrollSnapAlign): Ditto. 39 (WebCore::RenderStyle::scrollSnapType const): Ditto. 40 (WebCore::RenderStyle::scrollSnapAlign const): Ditto. 41 (WebCore::RenderStyle::setScrollSnapType): Ditto. 42 * rendering/style/RenderStyle.h: Ditto. 43 (WebCore::RenderStyle::initialScrollPadding): Ditto. 44 * rendering/style/StyleRareNonInheritedData.cpp: Have scroll-padding related properties 45 be stored directly on StyleRareNonInheritedData. 46 (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): 47 (WebCore::StyleRareNonInheritedData::operator== const): 48 * rendering/style/StyleRareNonInheritedData.h: Ditto. 49 * rendering/style/StyleScrollSnapPoints.cpp: Removed. 50 * rendering/style/StyleScrollSnapPoints.h: 51 1 52 2020-11-19 Carlos Garcia Campos <cgarcia@igalia.com> 2 53 -
trunk/Source/WebCore/Sources.txt
r269984 r270023 2324 2324 rendering/style/StyleRareInheritedData.cpp 2325 2325 rendering/style/StyleRareNonInheritedData.cpp 2326 rendering/style/StyleScrollSnapPoints.cpp2327 2326 rendering/style/StyleSelfAlignmentData.cpp 2328 2327 rendering/style/StyleSurroundData.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r269999 r270023 16460 16460 F47A09CF20A939F600240FAE /* DisabledAdaptations.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DisabledAdaptations.h; sourceTree = "<group>"; }; 16461 16461 F47A09D420A9DD0400240FAE /* DisabledAdaptations.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DisabledAdaptations.cpp; sourceTree = "<group>"; }; 16462 F47A5E3A195B8C8A00483100 /* StyleScrollSnapPoints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleScrollSnapPoints.cpp; sourceTree = "<group>"; };16463 16462 F47A5E3B195B8C8A00483100 /* StyleScrollSnapPoints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleScrollSnapPoints.h; sourceTree = "<group>"; }; 16464 16463 F47A633C1FF6FD500081B3CC /* PromisedAttachmentInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PromisedAttachmentInfo.h; sourceTree = "<group>"; }; … … 26991 26990 BC2272BB0E82EAAE00E7F975 /* StyleRareNonInheritedData.h */, 26992 26991 BC2272860E82E70700E7F975 /* StyleReflection.h */, 26993 F47A5E3A195B8C8A00483100 /* StyleScrollSnapPoints.cpp */,26994 26992 F47A5E3B195B8C8A00483100 /* StyleScrollSnapPoints.h */, 26995 26993 7199B94F2552103E00494A57 /* StyleSelfAlignmentData.cpp */, -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r269820 r270023 3810 3810 case CSSPropertyScrollMarginLeft: 3811 3811 return zoomAdjustedPixelValueForLength(style.scrollMarginLeft(), style); 3812 #if ENABLE(CSS_SCROLL_SNAP)3813 3812 case CSSPropertyScrollPadding: 3814 3813 return getCSSPropertyValuesFor4SidesShorthand(scrollPaddingShorthand()); … … 3821 3820 case CSSPropertyScrollPaddingLeft: 3822 3821 return zoomAdjustedPixelValueForLength(style.scrollPaddingLeft(), style); 3822 #if ENABLE(CSS_SCROLL_SNAP) 3823 3823 case CSSPropertyScrollSnapType: 3824 3824 return valueForScrollSnapType(style.scrollSnapType()); -
trunk/Source/WebCore/css/CSSProperties.json
r269862 r270023 6630 6630 "scroll-padding": { 6631 6631 "codegen-properties": { 6632 "enable-if": "ENABLE_CSS_SCROLL_SNAP",6633 6632 "longhands": [ 6634 6633 "scroll-padding-top", … … 6645 6644 "scroll-padding-bottom": { 6646 6645 "codegen-properties": { 6647 "enable-if": "ENABLE_CSS_SCROLL_SNAP",6648 6646 "initial": "initialScrollPadding", 6649 6647 "converter": "Length" … … 6656 6654 "scroll-padding-left": { 6657 6655 "codegen-properties": { 6658 "enable-if": "ENABLE_CSS_SCROLL_SNAP",6659 6656 "initial": "initialScrollPadding", 6660 6657 "converter": "Length" … … 6667 6664 "scroll-padding-right": { 6668 6665 "codegen-properties": { 6669 "enable-if": "ENABLE_CSS_SCROLL_SNAP",6670 6666 "initial": "initialScrollPadding", 6671 6667 "converter": "Length" … … 6678 6674 "scroll-padding-top": { 6679 6675 "codegen-properties": { 6680 "enable-if": "ENABLE_CSS_SCROLL_SNAP",6681 6676 "initial": "initialScrollPadding", 6682 6677 "converter": "Length" … … 6689 6684 "scroll-padding-inline-start": { 6690 6685 "codegen-properties": { 6691 "enable-if": "ENABLE_CSS_SCROLL_SNAP",6692 6686 "skip-codegen": true 6693 6687 }, … … 6702 6696 "scroll-padding-block-start": { 6703 6697 "codegen-properties": { 6704 "enable-if": "ENABLE_CSS_SCROLL_SNAP",6705 6698 "skip-codegen": true 6706 6699 }, … … 6715 6708 "scroll-padding-inline-end": { 6716 6709 "codegen-properties": { 6717 "enable-if": "ENABLE_CSS_SCROLL_SNAP",6718 6710 "skip-codegen": true 6719 6711 }, … … 6728 6720 "scroll-padding-block-end": { 6729 6721 "codegen-properties": { 6730 "enable-if": "ENABLE_CSS_SCROLL_SNAP",6731 6722 "skip-codegen": true 6732 6723 }, … … 6745 6736 "scroll-padding-block-end" 6746 6737 ], 6747 "enable-if": "ENABLE_CSS_SCROLL_SNAP",6748 6738 "skip-codegen": true 6749 6739 }, … … 6762 6752 "scroll-padding-inline-end" 6763 6753 ], 6764 "enable-if": "ENABLE_CSS_SCROLL_SNAP",6765 6754 "skip-codegen": true 6766 6755 }, -
trunk/Source/WebCore/css/StyleProperties.cpp
r269820 r270023 288 288 case CSSPropertyScrollMargin: 289 289 return get4Values(scrollMarginShorthand()); 290 #if ENABLE(CSS_SCROLL_SNAP)291 290 case CSSPropertyScrollPadding: 292 291 return get4Values(scrollPaddingShorthand()); 293 #endif294 292 default: 295 293 return String(); … … 1175 1173 shorthandPropertyID = CSSPropertyScrollMargin; 1176 1174 break; 1177 #if ENABLE(CSS_SCROLL_SNAP)1178 1175 case CSSPropertyScrollPaddingTop: 1179 1176 case CSSPropertyScrollPaddingRight: … … 1182 1179 shorthandPropertyID = CSSPropertyScrollPadding; 1183 1180 break; 1184 #endif1185 1181 case CSSPropertyTransitionProperty: 1186 1182 case CSSPropertyTransitionDuration: -
trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp
r269957 r270023 4135 4135 case CSSPropertyScrollMarginTop: 4136 4136 return consumeLength(m_range, m_context.mode, ValueRangeAll); 4137 #if ENABLE(CSS_SCROLL_SNAP)4138 4137 case CSSPropertyScrollPaddingBottom: 4139 4138 case CSSPropertyScrollPaddingLeft: … … 4141 4140 case CSSPropertyScrollPaddingTop: 4142 4141 return consumeLengthOrPercent(m_range, m_context.mode, ValueRangeAll); 4142 #if ENABLE(CSS_SCROLL_SNAP) 4143 4143 case CSSPropertyScrollSnapAlign: 4144 4144 return consumeScrollSnapAlign(m_range); … … 5817 5817 case CSSPropertyScrollMargin: 5818 5818 return consume4ValueShorthand(scrollMarginShorthand(), important); 5819 #if ENABLE(CSS_SCROLL_SNAP)5820 5819 case CSSPropertyScrollPadding: 5821 5820 return consume4ValueShorthand(scrollPaddingShorthand(), important); 5822 #endif5823 5821 case CSSPropertyWebkitTextEmphasis: 5824 5822 return consumeShorthandGreedily(webkitTextEmphasisShorthand(), important); -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r269888 r270023 599 599 } 600 600 601 static void expandScrollRectToVisibleTargetRectToIncludeScrollPadding(RenderBox* renderBox, const LayoutRect& viewRect, LayoutRect& targetRect) 602 { 603 if (!renderBox) 604 return; 605 // scroll-padding applies to the scroll container, but expand the rectangle that we want to expose in order 606 // simulate padding the scroll container. This rectangle is passed up the tree of scrolling elements to 607 // ensure that the padding on this scroll container is maintained. 608 const auto& scrollPadding = renderBox->style().scrollPadding(); 609 LayoutBoxExtent scrollPaddingExtents( 610 valueForLength(scrollPadding.top(), viewRect.height()), valueForLength(scrollPadding.right(), viewRect.width()), 611 valueForLength(scrollPadding.bottom(), viewRect.height()), valueForLength(scrollPadding.left(), viewRect.width())); 612 targetRect.expand(scrollPaddingExtents); 613 } 614 601 615 bool RenderLayer::shouldBeNormalFlowOnly() const 602 616 { … … 2811 2825 FrameView& frameView = renderer().view().frameView(); 2812 2826 auto* parentLayer = enclosingContainingBlockLayer(*this, CrossFrameBoundaries::No); 2813 bool autoscrollNotInProgress = !renderer().frame().eventHandler().autoscrollInProgress(); 2827 2828 auto shouldUseAnimatedScroll = [this](Element* element, ScrollBehavior behavior) 2829 { 2830 bool useAnimatedScrolling = !renderer().frame().eventHandler().autoscrollInProgress() 2831 && element && useSmoothScrolling(behavior, element); 2832 return useAnimatedScrolling ? AnimatedScroll::Yes : AnimatedScroll::No; 2833 }; 2814 2834 2815 2835 if (allowsCurrentScroll()) { … … 2830 2850 } 2831 2851 LayoutRect layerBounds(0_lu, 0_lu, box->clientWidth(), box->clientHeight()); 2852 expandScrollRectToVisibleTargetRectToIncludeScrollPadding(box, layerBounds, localExposeRect); 2832 2853 LayoutRect revealRect = getRectToExpose(layerBounds, localExposeRect, insideFixed, options.alignX, options.alignY); 2833 2854 … … 2835 2856 if (clampedScrollOffset != scrollOffset() || currentScrollBehaviorStatus() != ScrollBehaviorStatus::NotInAnimation) { 2836 2857 ScrollOffset oldScrollOffset = scrollOffset(); 2837 AnimatedScroll animated = AnimatedScroll::No; 2838 if (autoscrollNotInProgress && useSmoothScrolling(options.behavior, box->element())) 2839 animated = AnimatedScroll::Yes; 2858 auto animated = shouldUseAnimatedScroll(box->element(), options.behavior); 2840 2859 setScrollPosition(scrollPositionFromOffset(clampedScrollOffset), ScrollType::Programmatic, ScrollClamping::Clamped, animated); 2841 2860 IntSize scrollOffsetDifference = clampedScrollOffset - oldScrollOffset; … … 2857 2876 2858 2877 LayoutRect viewRect = frameView.visibleContentRect(LegacyIOSDocumentVisibleRect); 2859 LayoutRect exposeRect = getRectToExpose(viewRect, absoluteRect, insideFixed, options.alignX, options.alignY); 2878 2879 auto* element = ownerElement->contentDocument() ? ownerElement->contentDocument()->documentElement() : nullptr; 2880 RenderBox* renderer = element ? element->renderBox() : nullptr; 2881 expandScrollRectToVisibleTargetRectToIncludeScrollPadding(renderer, viewRect, newRect); 2882 2883 LayoutRect exposeRect = getRectToExpose(viewRect, newRect, insideFixed, options.alignX, options.alignY); 2860 2884 2861 2885 IntPoint scrollPosition(roundedIntPoint(exposeRect.location())); … … 2864 2888 // FIXME: Should we use contentDocument()->scrollingElement()? 2865 2889 // See https://bugs.webkit.org/show_bug.cgi?id=205059 2866 AnimatedScroll animated = AnimatedScroll::No; 2867 if (autoscrollNotInProgress 2868 && ownerElement->contentDocument() 2869 && useSmoothScrolling(options.behavior, ownerElement->contentDocument()->documentElement())) 2870 animated = AnimatedScroll::Yes; 2890 auto animated = shouldUseAnimatedScroll(element, options.behavior); 2871 2891 frameView.setScrollPosition(scrollPosition, ScrollClamping::Clamped, animated); 2872 2892 … … 2905 2925 targetRect.move(0, frameView.headerHeight()); 2906 2926 2927 auto* element = frameView.frame().document() ? frameView.frame().document()->documentElement() : nullptr; 2928 RenderBox* renderer = element ? element->renderBox() : nullptr; 2929 expandScrollRectToVisibleTargetRectToIncludeScrollPadding(renderer, viewRect, targetRect); 2930 2907 2931 LayoutRect revealRect = getRectToExpose(viewRect, targetRect, insideFixed, options.alignX, options.alignY); 2908 2932 // Avoid scrolling to the rounded value of revealRect.location() if we don't actually need to scroll … … 2911 2935 // FIXME: Should we use document()->scrollingElement()? 2912 2936 // See https://bugs.webkit.org/show_bug.cgi?id=205059 2913 AnimatedScroll animated = AnimatedScroll::No; 2914 if (autoscrollNotInProgress && useSmoothScrolling(options.behavior, renderer().document().documentElement())) 2915 animated = AnimatedScroll::Yes; 2937 auto animated = shouldUseAnimatedScroll(element, options.behavior); 2916 2938 frameView.setScrollPosition(clampedScrollPosition, ScrollClamping::Clamped, animated); 2917 2939 } -
trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp
r269144 r270023 123 123 static bool scrollSnapContainerRequiresUpdateForStyleUpdate(const RenderStyle& oldStyle, const RenderStyle& newStyle) 124 124 { 125 return oldStyle.scroll SnapPort() != newStyle.scrollSnapPort();125 return oldStyle.scrollPadding() != newStyle.scrollPadding() || oldStyle.scrollSnapType() != newStyle.scrollSnapType(); 126 126 } 127 127 #endif -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r269835 r270023 2440 2440 } 2441 2441 2442 const LengthBox& RenderStyle::scrollPadding() const 2443 { 2444 return m_rareNonInheritedData->scrollPadding; 2445 } 2446 2447 const Length& RenderStyle::scrollPaddingTop() const 2448 { 2449 return scrollPadding().top(); 2450 } 2451 2452 const Length& RenderStyle::scrollPaddingBottom() const 2453 { 2454 return scrollPadding().bottom(); 2455 } 2456 2457 const Length& RenderStyle::scrollPaddingLeft() const 2458 { 2459 return scrollPadding().left(); 2460 } 2461 2462 const Length& RenderStyle::scrollPaddingRight() const 2463 { 2464 return scrollPadding().right(); 2465 } 2466 2467 void RenderStyle::setScrollPaddingTop(Length&& length) 2468 { 2469 SET_VAR(m_rareNonInheritedData, scrollPadding.top(), WTFMove(length)); 2470 } 2471 2472 void RenderStyle::setScrollPaddingBottom(Length&& length) 2473 { 2474 SET_VAR(m_rareNonInheritedData, scrollPadding.bottom(), WTFMove(length)); 2475 } 2476 2477 void RenderStyle::setScrollPaddingLeft(Length&& length) 2478 { 2479 SET_VAR(m_rareNonInheritedData, scrollPadding.left(), WTFMove(length)); 2480 } 2481 2482 void RenderStyle::setScrollPaddingRight(Length&& length) 2483 { 2484 SET_VAR(m_rareNonInheritedData, scrollPadding.right(), WTFMove(length)); 2485 } 2442 2486 #if ENABLE(CSS_SCROLL_SNAP) 2443 2487 … … 2452 2496 } 2453 2497 2454 const StyleScrollSnapPort& RenderStyle::scrollSnapPort() const 2455 { 2456 return *m_rareNonInheritedData->scrollSnapPort; 2457 } 2458 2459 const ScrollSnapType& RenderStyle::scrollSnapType() const 2460 { 2461 return m_rareNonInheritedData->scrollSnapPort->type; 2462 } 2463 2464 const LengthBox& RenderStyle::scrollPadding() const 2465 { 2466 return m_rareNonInheritedData->scrollSnapPort->scrollPadding; 2467 } 2468 2469 const Length& RenderStyle::scrollPaddingTop() const 2470 { 2471 return scrollPadding().top(); 2472 } 2473 2474 const Length& RenderStyle::scrollPaddingBottom() const 2475 { 2476 return scrollPadding().bottom(); 2477 } 2478 2479 const Length& RenderStyle::scrollPaddingLeft() const 2480 { 2481 return scrollPadding().left(); 2482 } 2483 2484 const Length& RenderStyle::scrollPaddingRight() const 2485 { 2486 return scrollPadding().right(); 2498 const ScrollSnapType RenderStyle::scrollSnapType() const 2499 { 2500 return m_rareNonInheritedData->scrollSnapType; 2487 2501 } 2488 2502 … … 2492 2506 } 2493 2507 2494 void RenderStyle::setScrollSnapType(const ScrollSnapType& type) 2495 { 2496 SET_NESTED_VAR(m_rareNonInheritedData, scrollSnapPort, type, type); 2497 } 2498 2499 void RenderStyle::setScrollPaddingTop(Length&& length) 2500 { 2501 SET_NESTED_VAR(m_rareNonInheritedData, scrollSnapPort, scrollPadding.top(), WTFMove(length)); 2502 } 2503 2504 void RenderStyle::setScrollPaddingBottom(Length&& length) 2505 { 2506 SET_NESTED_VAR(m_rareNonInheritedData, scrollSnapPort, scrollPadding.bottom(), WTFMove(length)); 2507 } 2508 2509 void RenderStyle::setScrollPaddingLeft(Length&& length) 2510 { 2511 SET_NESTED_VAR(m_rareNonInheritedData, scrollSnapPort, scrollPadding.left(), WTFMove(length)); 2512 } 2513 2514 void RenderStyle::setScrollPaddingRight(Length&& length) 2515 { 2516 SET_NESTED_VAR(m_rareNonInheritedData, scrollSnapPort, scrollPadding.right(), WTFMove(length)); 2508 void RenderStyle::setScrollSnapType(const ScrollSnapType type) 2509 { 2510 SET_VAR(m_rareNonInheritedData, scrollSnapType, type); 2517 2511 } 2518 2512 -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r269835 r270023 118 118 class StyleInheritedData; 119 119 class StyleScrollSnapArea; 120 class StyleScrollSnapPort;121 120 class TransformationMatrix; 122 121 … … 726 725 const Length& scrollMarginRight() const; 727 726 728 #if ENABLE(CSS_SCROLL_SNAP)729 bool hasSnapPosition() const;730 731 // Scroll snap port style.732 const StyleScrollSnapPort& scrollSnapPort() const;733 const ScrollSnapType& scrollSnapType() const;734 727 const LengthBox& scrollPadding() const; 735 728 const Length& scrollPaddingTop() const; … … 738 731 const Length& scrollPaddingRight() const; 739 732 733 #if ENABLE(CSS_SCROLL_SNAP) 734 bool hasSnapPosition() const; 735 const ScrollSnapType scrollSnapType() const; 740 736 const ScrollSnapAlign& scrollSnapAlign() const; 741 737 #endif … … 1271 1267 void setScrollMarginRight(Length&&); 1272 1268 1273 #if ENABLE(CSS_SCROLL_SNAP)1274 void setScrollSnapType(const ScrollSnapType&);1275 1269 void setScrollPaddingTop(Length&&); 1276 1270 void setScrollPaddingBottom(Length&&); … … 1278 1272 void setScrollPaddingRight(Length&&); 1279 1273 1274 #if ENABLE(CSS_SCROLL_SNAP) 1275 void setScrollSnapType(const ScrollSnapType); 1280 1276 void setScrollSnapAlign(const ScrollSnapAlign&); 1281 1277 #endif … … 1677 1673 1678 1674 static Length initialScrollMargin() { return Length(Fixed); } 1675 static Length initialScrollPadding() { return Length(Fixed); } 1679 1676 1680 1677 #if ENABLE(CSS_SCROLL_SNAP) 1681 1678 static ScrollSnapType initialScrollSnapType(); 1682 1679 static ScrollSnapAlign initialScrollSnapAlign(); 1683 static Length initialScrollPadding() { return Length(Fixed); }1684 1680 #endif 1685 1681 -
trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
r269820 r270023 60 60 , grid(StyleGridData::create()) 61 61 , gridItem(StyleGridItemData::create()) 62 #if ENABLE(CSS_SCROLL_SNAP)63 , scrollSnapPort(StyleScrollSnapPort::create())64 #endif65 62 , willChange(RenderStyle::initialWillChange()) 66 63 , mask(FillLayer::create(FillLayerType::Mask)) … … 139 136 , gridItem(o.gridItem) 140 137 , scrollMargin(o.scrollMargin) 138 , scrollPadding(o.scrollPadding) 141 139 #if ENABLE(CSS_SCROLL_SNAP) 142 , scrollSnap Port(o.scrollSnapPort)140 , scrollSnapType(o.scrollSnapType) 143 141 , scrollSnapAlign(o.scrollSnapAlign) 144 142 #endif … … 242 240 && gridItem == o.gridItem 243 241 && scrollMargin == o.scrollMargin 242 && scrollPadding == o.scrollPadding 244 243 #if ENABLE(CSS_SCROLL_SNAP) 245 && scrollSnap Port == o.scrollSnapPort244 && scrollSnapType == o.scrollSnapType 246 245 && scrollSnapAlign == o.scrollSnapAlign 247 246 #endif -
trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h
r269820 r270023 133 133 134 134 LengthBox scrollMargin { 0, 0, 0, 0 }; 135 LengthBox scrollPadding { 0, 0, 0, 0 }; 135 136 #if ENABLE(CSS_SCROLL_SNAP) 136 DataRef<StyleScrollSnapPort> scrollSnapPort;137 ScrollSnapType scrollSnapType; 137 138 ScrollSnapAlign scrollSnapAlign; 138 139 #endif -
trunk/Source/WebCore/rendering/style/StyleScrollSnapPoints.h
r269144 r270023 48 48 inline bool operator!=(const ScrollSnapType& a, const ScrollSnapType& b) { return !(a == b); } 49 49 50 class StyleScrollSnapPort : public RefCounted<StyleScrollSnapPort> {51 public:52 static Ref<StyleScrollSnapPort> create() { return adoptRef(*new StyleScrollSnapPort); }53 Ref<StyleScrollSnapPort> copy() const;54 55 ScrollSnapType type;56 LengthBox scrollPadding { 0, 0, 0, 0 };57 58 private:59 StyleScrollSnapPort();60 StyleScrollSnapPort(const StyleScrollSnapPort&);61 };62 63 inline bool operator==(const StyleScrollSnapPort& a, const StyleScrollSnapPort& b)64 {65 return a.type == b.type && a.scrollPadding == b.scrollPadding;66 }67 68 inline bool operator!=(const StyleScrollSnapPort& a, const StyleScrollSnapPort& b) { return !(a == b); }69 70 50 struct ScrollSnapAlign { 71 51 ScrollSnapAxisAlignType x { ScrollSnapAxisAlignType::None };
Note: See TracChangeset
for help on using the changeset viewer.