WebKit Bugzilla
Attachment 356505 Details for
Bug 176454
: Implement CSS overscroll-behavior
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch (applies on top of bug 192358)
0002-Bug-176454-Implement-CSS-overscroll-behavior.patch (text/plain), 52.88 KB, created by
Frédéric Wang (:fredw)
on 2018-12-04 09:16:44 PST
(
hide
)
Description:
Patch (applies on top of bug 192358)
Filename:
MIME Type:
Creator:
Frédéric Wang (:fredw)
Created:
2018-12-04 09:16:44 PST
Size:
52.88 KB
patch
obsolete
>From 88022f89c684dfed1f6a49de5c501673f4347eda Mon Sep 17 00:00:00 2001 >From: Frederic Wang <fwang@igalia.com> >Date: Thu, 29 Nov 2018 15:09:13 +0100 >Subject: [PATCH xserver 2/2] Bug 176454 - Implement CSS overscroll-behavior > >--- > .../css/CSSComputedStyleDeclaration.cpp | 8 ++++ > .../WebCore/css/CSSPrimitiveValueMappings.h | 37 ++++++++++++++++ > Source/WebCore/css/CSSProperties.json | 40 +++++++++++++++++ > Source/WebCore/css/CSSValueKeywords.in | 3 ++ > Source/WebCore/css/StyleProperties.cpp | 6 +++ > .../WebCore/css/parser/CSSParserContext.cpp | 2 + > Source/WebCore/css/parser/CSSParserContext.h | 4 +- > .../WebCore/css/parser/CSSPropertyParser.cpp | 44 +++++++++++++++++++ > Source/WebCore/css/parser/CSSPropertyParser.h | 2 + > Source/WebCore/page/EventHandler.cpp | 31 +++++++++---- > Source/WebCore/page/Settings.yaml | 2 + > .../scrolling/AsyncScrollingCoordinator.cpp | 4 ++ > .../page/scrolling/ScrollingCoordinator.h | 2 + > .../scrolling/ScrollingStateScrollingNode.cpp | 26 +++++++++++ > .../scrolling/ScrollingStateScrollingNode.h | 10 +++++ > .../scrolling/ScrollingTreeScrollingNode.cpp | 13 ++++++ > .../scrolling/ScrollingTreeScrollingNode.h | 4 ++ > Source/WebCore/platform/ScrollTypes.h | 6 +++ > .../rendering/RenderLayerCompositor.cpp | 4 ++ > Source/WebCore/rendering/style/RenderStyle.h | 9 ++++ > .../style/StyleRareNonInheritedData.cpp | 6 +++ > .../style/StyleRareNonInheritedData.h | 3 ++ > .../RemoteScrollingCoordinatorTransaction.cpp | 10 +++++ > Source/WebKit/Shared/WebCoreArgumentCoders.h | 10 +++++ > Source/WebKit/Shared/WebPreferences.yaml | 7 +++ > .../ScrollingTreeScrollingNodeDelegateIOS.mm | 20 +++++++++ > .../mac/WebView/WebPreferenceKeysPrivate.h | 1 + > .../mac/WebView/WebPreferences.mm | 11 +++++ > .../mac/WebView/WebPreferencesPrivate.h | 1 + > Source/WebKitLegacy/mac/WebView/WebView.mm | 1 + > .../win/Interfaces/IWebPreferencesPrivate.idl | 2 + > .../win/WebPreferenceKeysPrivate.h | 1 + > Source/WebKitLegacy/win/WebPreferences.cpp | 16 +++++++ > Source/WebKitLegacy/win/WebPreferences.h | 2 + > Source/WebKitLegacy/win/WebView.cpp | 5 +++ > Tools/DumpRenderTree/TestOptions.cpp | 2 + > Tools/DumpRenderTree/TestOptions.h | 1 + > Tools/DumpRenderTree/mac/DumpRenderTree.mm | 1 + > 38 files changed, 347 insertions(+), 10 deletions(-) > >diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >index f1b50fba6d9..850a978d71a 100644 >--- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >+++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >@@ -190,6 +190,8 @@ static const CSSPropertyID computedProperties[] = { > CSSPropertyOutlineWidth, > CSSPropertyOverflowWrap, > CSSPropertyOverflowX, >+ CSSPropertyOverscrollBehaviorX, >+ CSSPropertyOverscrollBehaviorY, > CSSPropertyOverflowY, > CSSPropertyPaddingBottom, > CSSPropertyPaddingLeft, >@@ -3301,6 +3303,12 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyinStyle(const RenderSty > return cssValuePool.createValue(style.overflowX()); > case CSSPropertyOverflowY: > return cssValuePool.createValue(style.overflowY()); >+ case CSSPropertyOverscrollBehavior: >+ return cssValuePool.createValue(std::max(style.overscrollBehaviorX(), style.overscrollBehaviorY())); >+ case CSSPropertyOverscrollBehaviorX: >+ return cssValuePool.createValue(style.overscrollBehaviorX()); >+ case CSSPropertyOverscrollBehaviorY: >+ return cssValuePool.createValue(style.overscrollBehaviorY()); > case CSSPropertyPaddingTop: > return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::paddingTop, &RenderBoxModelObject::computedCSSPaddingTop>(style, renderer); > case CSSPropertyPaddingRight: >diff --git a/Source/WebCore/css/CSSPrimitiveValueMappings.h b/Source/WebCore/css/CSSPrimitiveValueMappings.h >index c95ff65a835..07df8a072a0 100644 >--- a/Source/WebCore/css/CSSPrimitiveValueMappings.h >+++ b/Source/WebCore/css/CSSPrimitiveValueMappings.h >@@ -40,6 +40,7 @@ > #include "LineClampValue.h" > #include "RenderStyleConstants.h" > #include "SVGRenderStyleDefs.h" >+#include "ScrollTypes.h" > #include "TextFlags.h" > #include "ThemeTypes.h" > #include "UnicodeBidi.h" >@@ -2204,6 +2205,42 @@ template<> inline CSSPrimitiveValue::operator Overflow() const > return Overflow::Visible; > } > >+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(OverscrollBehavior e) >+ : CSSValue(PrimitiveClass) >+{ >+ m_primitiveUnitType = CSS_VALUE_ID; >+ switch (e) { >+ case OverscrollBehavior::Contain: >+ m_value.valueID = CSSValueContain; >+ break; >+ case OverscrollBehavior::None: >+ m_value.valueID = CSSValueNone; >+ break; >+ case OverscrollBehavior::Auto: >+ m_value.valueID = CSSValueAuto; >+ break; >+ } >+} >+ >+template<> inline CSSPrimitiveValue::operator OverscrollBehavior() const >+{ >+ ASSERT(isValueID()); >+ >+ switch (m_value.valueID) { >+ case CSSValueContain: >+ return OverscrollBehavior::Contain; >+ case CSSValueNone: >+ return OverscrollBehavior::None; >+ case CSSValueAuto: >+ return OverscrollBehavior::Auto; >+ default: >+ break; >+ } >+ >+ ASSERT_NOT_REACHED(); >+ return OverscrollBehavior::Auto; >+} >+ > template<> inline CSSPrimitiveValue::CSSPrimitiveValue(BreakBetween e) > : CSSValue(PrimitiveClass) > { >diff --git a/Source/WebCore/css/CSSProperties.json b/Source/WebCore/css/CSSProperties.json >index fe012ba4b22..3bab9b87a50 100644 >--- a/Source/WebCore/css/CSSProperties.json >+++ b/Source/WebCore/css/CSSProperties.json >@@ -3053,6 +3053,46 @@ > "url": "https://www.w3.org/TR/css-overflow-3/#propdef-overflow-y" > } > }, >+ "overscroll-behavior": { >+ "codegen-properties": { >+ "longhands": [ >+ "overscroll-behavior-x", >+ "overscroll-behavior-y" >+ ] >+ }, >+ "status": { >+ "status": "in development" >+ }, >+ "specification": { >+ "url": "https://wicg.github.io/overscroll-behavior/#propdef-overscroll-behavior" >+ } >+ }, >+ "overscroll-behavior-x": { >+ "values": [ >+ "contain", >+ "none", >+ "auto" >+ ], >+ "status": { >+ "status": "in development" >+ }, >+ "specification": { >+ "url": "https://wicg.github.io/overscroll-behavior/#propdef-overscroll-behavior-x" >+ } >+ }, >+ "overscroll-behavior-y": { >+ "values": [ >+ "contain", >+ "none", >+ "auto" >+ ], >+ "status": { >+ "status": "in development" >+ }, >+ "specification": { >+ "url": "https://wicg.github.io/overscroll-behavior/#propdef-overscroll-behavior-y" >+ } >+ }, > "padding": { > "codegen-properties": { > "longhands": [ >diff --git a/Source/WebCore/css/CSSValueKeywords.in b/Source/WebCore/css/CSSValueKeywords.in >index 86b5e5914f4..162216731ca 100644 >--- a/Source/WebCore/css/CSSValueKeywords.in >+++ b/Source/WebCore/css/CSSValueKeywords.in >@@ -1357,6 +1357,9 @@ scroll-position > manipulation > #endif > >+// overscroll-behavior >+// contain >+ > // hanging-punctuation > allow-end > first >diff --git a/Source/WebCore/css/StyleProperties.cpp b/Source/WebCore/css/StyleProperties.cpp >index 5acb48f911a..a17907fdb91 100644 >--- a/Source/WebCore/css/StyleProperties.cpp >+++ b/Source/WebCore/css/StyleProperties.cpp >@@ -207,6 +207,8 @@ String StyleProperties::getPropertyValue(CSSPropertyID propertyID) const > return getShorthandValue(webkitMarginCollapseShorthand()); > case CSSPropertyOverflow: > return getCommonValue(overflowShorthand()); >+ case CSSPropertyOverscrollBehavior: >+ return getCommonValue(overscrollBehaviorShorthand()); > case CSSPropertyPadding: > return get4Values(paddingShorthand()); > case CSSPropertyTransition: >@@ -1005,6 +1007,10 @@ String StyleProperties::asText() const > case CSSPropertyOverflowY: > shorthandPropertyID = CSSPropertyOverflow; > break; >+ case CSSPropertyOverscrollBehaviorX: >+ case CSSPropertyOverscrollBehaviorY: >+ shorthandPropertyID = CSSPropertyOverscrollBehavior; >+ break; > case CSSPropertyPaddingTop: > case CSSPropertyPaddingRight: > case CSSPropertyPaddingBottom: >diff --git a/Source/WebCore/css/parser/CSSParserContext.cpp b/Source/WebCore/css/parser/CSSParserContext.cpp >index 06c702a0db4..2065d30877d 100644 >--- a/Source/WebCore/css/parser/CSSParserContext.cpp >+++ b/Source/WebCore/css/parser/CSSParserContext.cpp >@@ -73,6 +73,7 @@ CSSParserContext::CSSParserContext(const Document& document, const URL& sheetBas > attachmentEnabled = RuntimeEnabledFeatures::sharedFeatures().attachmentElementEnabled(); > #endif > deferredCSSParserEnabled = document.settings().deferredCSSParserEnabled(); >+ overscrollBehaviorEnabled = document.settings().overscrollBehaviorEnabled(); > useSystemAppearance = document.page() ? document.page()->useSystemAppearance() : false; > > #if PLATFORM(IOS_FAMILY) >@@ -102,6 +103,7 @@ bool operator==(const CSSParserContext& a, const CSSParserContext& b) > && a.attachmentEnabled == b.attachmentEnabled > #endif > && a.deferredCSSParserEnabled == b.deferredCSSParserEnabled >+ && a.overscrollBehaviorEnabled == b.overscrollBehaviorEnabled > && a.hasDocumentSecurityOrigin == b.hasDocumentSecurityOrigin > && a.useSystemAppearance == b.useSystemAppearance; > } >diff --git a/Source/WebCore/css/parser/CSSParserContext.h b/Source/WebCore/css/parser/CSSParserContext.h >index 758b6eeb3af..9e97b0e7209 100644 >--- a/Source/WebCore/css/parser/CSSParserContext.h >+++ b/Source/WebCore/css/parser/CSSParserContext.h >@@ -59,6 +59,7 @@ public: > bool attachmentEnabled { false }; > #endif > bool deferredCSSParserEnabled { false }; >+ bool overscrollBehaviorEnabled { false }; > > // This is only needed to support getMatchedCSSRules. > bool hasDocumentSecurityOrigin { false }; >@@ -106,7 +107,8 @@ struct CSSParserContextHash { > #if ENABLE(ATTACHMENT_ELEMENT) > & key.attachmentEnabled << 11 > #endif >- & key.mode << 12; // Keep this last. >+ & key.overscrollBehaviorEnabled << 12 >+ & key.mode << 13; // Keep this last. > hash ^= WTF::intHash(bits); > return hash; > } >diff --git a/Source/WebCore/css/parser/CSSPropertyParser.cpp b/Source/WebCore/css/parser/CSSPropertyParser.cpp >index 5cb8945b38f..5efe80818f5 100644 >--- a/Source/WebCore/css/parser/CSSPropertyParser.cpp >+++ b/Source/WebCore/css/parser/CSSPropertyParser.cpp >@@ -2326,6 +2326,14 @@ static RefPtr<CSSValueList> consumeScrollSnapType(CSSParserTokenRange& range) > > #endif > >+static RefPtr<CSSValue> consumeOverscrollBehavior(CSSParserTokenRange& range) >+{ >+ auto valueID = range.peek().id(); >+ if (valueID != CSSValueAuto && valueID != CSSValueNone && valueID != CSSValueContain) >+ return nullptr; >+ return consumeIdent(range); >+} >+ > static RefPtr<CSSValue> consumeBorderRadiusCorner(CSSParserTokenRange& range, CSSParserMode cssParserMode) > { > RefPtr<CSSPrimitiveValue> parsedValue1 = consumeLengthOrPercent(range, cssParserMode, ValueRangeNonNegative); >@@ -4015,6 +4023,11 @@ RefPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSPropertyID property, CSS > case CSSPropertyScrollSnapType: > return consumeScrollSnapType(m_range); > #endif >+ case CSSPropertyOverscrollBehaviorX: >+ case CSSPropertyOverscrollBehaviorY: >+ if (!m_context.overscrollBehaviorEnabled) >+ return nullptr; >+ return consumeOverscrollBehavior(m_range); > case CSSPropertyClip: > return consumeClip(m_range, m_context.mode); > #if ENABLE(TOUCH_EVENTS) >@@ -5658,6 +5671,35 @@ bool CSSPropertyParser::consumePlaceSelfShorthand(bool important) > return true; > } > >+bool CSSPropertyParser::consumeOverscrollBehaviorShorthand(bool important) >+{ >+ ASSERT(shorthandForProperty(CSSPropertyOverscrollBehavior).length() == 2); >+ if (!m_context.overscrollBehaviorEnabled) >+ return false; >+ >+ if (m_range.atEnd()) >+ return false; >+ >+ RefPtr<CSSValue> overscrollBehaviorX = consumeOverscrollBehavior(m_range); >+ if (!overscrollBehaviorX) >+ return false; >+ >+ RefPtr<CSSValue> overscrollBehaviorY; >+ m_range.consumeWhitespace(); >+ if (m_range.atEnd()) >+ overscrollBehaviorY = overscrollBehaviorX; >+ else { >+ overscrollBehaviorY = consumeOverscrollBehavior(m_range); >+ m_range.consumeWhitespace(); >+ if (!m_range.atEnd()) >+ return false; >+ } >+ >+ addProperty(CSSPropertyOverscrollBehaviorX, CSSPropertyOverscrollBehavior, *overscrollBehaviorX, important); >+ addProperty(CSSPropertyOverscrollBehaviorY, CSSPropertyOverscrollBehavior, *overscrollBehaviorY, important); >+ return true; >+} >+ > bool CSSPropertyParser::parseShorthand(CSSPropertyID property, bool important) > { > switch (property) { >@@ -5697,6 +5739,8 @@ bool CSSPropertyParser::parseShorthand(CSSPropertyID property, bool important) > addProperty(CSSPropertyOverflowY, CSSPropertyOverflow, *overflowYValue, important); > return true; > } >+ case CSSPropertyOverscrollBehavior: >+ return consumeOverscrollBehaviorShorthand(important); > case CSSPropertyFont: { > const CSSParserToken& token = m_range.peek(); > if (token.id() >= CSSValueCaption && token.id() <= CSSValueStatusBar) >diff --git a/Source/WebCore/css/parser/CSSPropertyParser.h b/Source/WebCore/css/parser/CSSPropertyParser.h >index 1dc05ef88da..3fc16653560 100644 >--- a/Source/WebCore/css/parser/CSSPropertyParser.h >+++ b/Source/WebCore/css/parser/CSSPropertyParser.h >@@ -107,6 +107,8 @@ private: > bool consumeTransformOrigin(bool important); > bool consumePerspectiveOrigin(bool important); > >+ bool consumeOverscrollBehaviorShorthand(bool important); >+ > private: > // Inputs: > CSSParserTokenRange m_range; >diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp >index 6d141eafdaf..6f511b9f5b0 100644 >--- a/Source/WebCore/page/EventHandler.cpp >+++ b/Source/WebCore/page/EventHandler.cpp >@@ -283,15 +283,15 @@ static inline ScrollGranularity wheelGranularityToScrollGranularity(unsigned del > } > } > >-static inline bool didScrollInScrollableArea(ScrollableArea* scrollableArea, WheelEvent& wheelEvent) >+static inline bool didScrollInScrollableArea(ScrollableArea* scrollableArea, double deltaX, double deltaY, unsigned deltaMode) > { >- ScrollGranularity scrollGranularity = wheelGranularityToScrollGranularity(wheelEvent.deltaMode()); >+ ScrollGranularity scrollGranularity = wheelGranularityToScrollGranularity(deltaMode); > bool didHandleWheelEvent = false; >- if (float absoluteDelta = std::abs(wheelEvent.deltaX())) >- didHandleWheelEvent |= scrollableArea->scroll(wheelEvent.deltaX() > 0 ? ScrollRight : ScrollLeft, scrollGranularity, absoluteDelta); >+ if (float absoluteDelta = std::abs(deltaX)) >+ didHandleWheelEvent |= scrollableArea->scroll(deltaX > 0 ? ScrollRight : ScrollLeft, scrollGranularity, absoluteDelta); > >- if (float absoluteDelta = std::abs(wheelEvent.deltaY())) >- didHandleWheelEvent |= scrollableArea->scroll(wheelEvent.deltaY() > 0 ? ScrollDown : ScrollUp, scrollGranularity, absoluteDelta); >+ if (float absoluteDelta = std::abs(deltaY)) >+ didHandleWheelEvent |= scrollableArea->scroll(deltaY > 0 ? ScrollDown : ScrollUp, scrollGranularity, absoluteDelta); > > return didHandleWheelEvent; > } >@@ -310,18 +310,20 @@ static inline bool handleWheelEventInAppropriateEnclosingBox(Node* startNode, Wh > > RenderBox& initialEnclosingBox = startNode->renderer()->enclosingBox(); > if (initialEnclosingBox.isListBox()) >- return didScrollInScrollableArea(static_cast<RenderListBox*>(&initialEnclosingBox), wheelEvent); >+ return didScrollInScrollableArea(static_cast<RenderListBox*>(&initialEnclosingBox), wheelEvent.deltaX(), wheelEvent.deltaY(), wheelEvent.deltaMode()); > > RenderBox* currentEnclosingBox = &initialEnclosingBox; >+ bool ignoreDeltaX = false; >+ bool ignoreDeltaY = false; > while (currentEnclosingBox) { > if (RenderLayer* boxLayer = currentEnclosingBox->layer()) { > auto platformEvent = wheelEvent.underlyingPlatformEvent(); > bool scrollingWasHandled; > if (platformEvent) { >- auto copiedEvent = platformEvent->copyWithDeltasAndVelocity(filteredPlatformDelta.width(), filteredPlatformDelta.height(), filteredVelocity); >+ auto copiedEvent = platformEvent->copyWithDeltasAndVelocity(ignoreDeltaX ? 0 : filteredPlatformDelta.width(), ignoreDeltaY ? 0 : filteredPlatformDelta.height(), filteredVelocity); > scrollingWasHandled = boxLayer->handleWheelEvent(copiedEvent); > } else >- scrollingWasHandled = didScrollInScrollableArea(boxLayer, wheelEvent); >+ scrollingWasHandled = didScrollInScrollableArea(boxLayer, ignoreDeltaX ? 0 : wheelEvent.deltaX(), ignoreDeltaY ? 0 : wheelEvent.deltaY(), wheelEvent.deltaMode()); > > if (scrollingWasHandled) { > if (stopElement) >@@ -333,6 +335,17 @@ static inline bool handleWheelEventInAppropriateEnclosingBox(Node* startNode, Wh > if (stopElement && *stopElement && *stopElement == currentEnclosingBox->element()) > return true; > >+ if (!ignoreDeltaX && currentEnclosingBox->style().overscrollBehaviorX() != OverscrollBehavior::Auto) >+ ignoreDeltaX = true; >+ if (!ignoreDeltaY && currentEnclosingBox->style().overscrollBehaviorY() != OverscrollBehavior::Auto) >+ ignoreDeltaY = true; >+ if (ignoreDeltaX && ignoreDeltaY) { >+ // We claim that the event was handled so that it is not propagated to the ancestor frames. >+ if (stopElement) >+ *stopElement = currentEnclosingBox->element(); >+ return true; >+ } >+ > currentEnclosingBox = currentEnclosingBox->containingBlock(); > if (!currentEnclosingBox || currentEnclosingBox->isRenderView()) > return false; >diff --git a/Source/WebCore/page/Settings.yaml b/Source/WebCore/page/Settings.yaml >index 6daec2ae5b7..7f673bccc70 100644 >--- a/Source/WebCore/page/Settings.yaml >+++ b/Source/WebCore/page/Settings.yaml >@@ -372,6 +372,8 @@ frameFlattening: > asyncFrameScrollingEnabled: > initial: false > onChange: setNeedsRelayoutAllFrames >+overscrollBehaviorEnabled: >+ initial: false > > asyncOverflowScrollingEnabled: > initial: false >diff --git a/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp b/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp >index 2638826b507..530032e5571 100644 >--- a/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp >+++ b/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp >@@ -523,6 +523,8 @@ void AsyncScrollingCoordinator::updateFrameScrollingNode(ScrollingNodeID nodeID, > node->setInsetClipLayer(insetClipLayer); > node->setScrolledContentsLayer(scrolledContentsLayer); > node->setCounterScrollingLayer(counterScrollingLayer); >+ node->setHorizontalOverscrollBehavior(scrollingGeometry.horizontalOverscrollBehavior); >+ node->setVerticalOverscrollBehavior(scrollingGeometry.verticalOverscrollBehavior); > node->setParentRelativeScrollableRect(scrollingGeometry.parentRelativeScrollableRect); > node->setScrollOrigin(scrollingGeometry.scrollOrigin); > node->setScrollPosition(scrollingGeometry.scrollPosition); >@@ -540,6 +542,8 @@ void AsyncScrollingCoordinator::updateOverflowScrollingNode(ScrollingNodeID node > > node->setLayer(layer); > node->setScrolledContentsLayer(scrolledContentsLayer); >+ node->setHorizontalOverscrollBehavior(scrollingGeometry.horizontalOverscrollBehavior); >+ node->setVerticalOverscrollBehavior(scrollingGeometry.verticalOverscrollBehavior); > node->setParentRelativeScrollableRect(scrollingGeometry.parentRelativeScrollableRect); > node->setScrollOrigin(scrollingGeometry.scrollOrigin); > node->setScrollPosition(scrollingGeometry.scrollPosition); >diff --git a/Source/WebCore/page/scrolling/ScrollingCoordinator.h b/Source/WebCore/page/scrolling/ScrollingCoordinator.h >index f917089a5af..b2020997894 100644 >--- a/Source/WebCore/page/scrolling/ScrollingCoordinator.h >+++ b/Source/WebCore/page/scrolling/ScrollingCoordinator.h >@@ -173,6 +173,8 @@ public: > virtual void updateNodeViewportConstraints(ScrollingNodeID, const ViewportConstraints&) { } > > struct ScrollingGeometry { >+ OverscrollBehavior horizontalOverscrollBehavior { OverscrollBehavior:: Auto }; >+ OverscrollBehavior verticalOverscrollBehavior { OverscrollBehavior:: Auto }; > LayoutRect parentRelativeScrollableRect; > FloatSize scrollableAreaSize; > FloatSize contentSize; >diff --git a/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp b/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp >index 153362bb198..9728ccab826 100644 >--- a/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp >+++ b/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp >@@ -51,6 +51,8 @@ ScrollingStateScrollingNode::ScrollingStateScrollingNode(const ScrollingStateScr > , m_snapOffsetsInfo(stateNode.m_snapOffsetsInfo) > #endif > , m_scrollableAreaParameters(stateNode.scrollableAreaParameters()) >+ , m_horizontalOverscrollBehavior(stateNode.horizontalOverscrollBehavior()) >+ , m_verticalOverscrollBehavior(stateNode.verticalOverscrollBehavior()) > , m_requestedScrollPositionRepresentsProgrammaticScroll(stateNode.requestedScrollPositionRepresentsProgrammaticScroll()) > , m_expectsWheelEventTestTrigger(stateNode.expectsWheelEventTestTrigger()) > { >@@ -87,6 +89,24 @@ void ScrollingStateScrollingNode::setReachableContentsSize(const FloatSize& reac > setPropertyChanged(ReachableContentsSize); > } > >+void ScrollingStateScrollingNode::setHorizontalOverscrollBehavior(OverscrollBehavior behavior) >+{ >+ if (m_horizontalOverscrollBehavior == behavior) >+ return; >+ >+ m_horizontalOverscrollBehavior = behavior; >+ setPropertyChanged(HorizontalOverscrollBehavior); >+} >+ >+void ScrollingStateScrollingNode::setVerticalOverscrollBehavior(OverscrollBehavior behavior) >+{ >+ if (m_verticalOverscrollBehavior == behavior) >+ return; >+ >+ m_verticalOverscrollBehavior = behavior; >+ setPropertyChanged(VerticalOverscrollBehavior); >+} >+ > void ScrollingStateScrollingNode::setParentRelativeScrollableRect(const LayoutRect& parentRelativeScrollableRect) > { > if (m_parentRelativeScrollableRect == parentRelativeScrollableRect) >@@ -241,6 +261,12 @@ void ScrollingStateScrollingNode::dumpProperties(TextStream& ts, ScrollingStateT > if (m_requestedScrollPositionRepresentsProgrammaticScroll) > ts.dumpProperty("requested scroll position represents programmatic scroll", m_requestedScrollPositionRepresentsProgrammaticScroll); > >+ if (m_horizontalOverscrollBehavior != OverscrollBehavior::Auto) >+ ts.dumpProperty("horizontal overscroll behavior", static_cast<int>(m_horizontalOverscrollBehavior)); >+ >+ if (m_verticalOverscrollBehavior != OverscrollBehavior::Auto) >+ ts.dumpProperty("vertical overscroll behavior", static_cast<int>(m_verticalOverscrollBehavior)); >+ > if (!m_parentRelativeScrollableRect.isEmpty()) > ts.dumpProperty("parent relative scrollable rect", m_parentRelativeScrollableRect); > >diff --git a/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h b/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h >index 7de737b6487..8a11ab0a50f 100644 >--- a/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h >+++ b/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h >@@ -42,6 +42,8 @@ public: > ScrollableAreaSize = NumStateNodeBits, > TotalContentsSize, > ReachableContentsSize, >+ HorizontalOverscrollBehavior, >+ VerticalOverscrollBehavior, > ParentRelativeScrollableRect, > ScrollPosition, > ScrollOrigin, >@@ -69,6 +71,12 @@ public: > const FloatSize& reachableContentsSize() const { return m_reachableContentsSize; } > WEBCORE_EXPORT void setReachableContentsSize(const FloatSize&); > >+ const OverscrollBehavior& horizontalOverscrollBehavior() const { return m_horizontalOverscrollBehavior; } >+ WEBCORE_EXPORT void setHorizontalOverscrollBehavior(OverscrollBehavior); >+ >+ const OverscrollBehavior& verticalOverscrollBehavior() const { return m_verticalOverscrollBehavior; } >+ WEBCORE_EXPORT void setVerticalOverscrollBehavior(OverscrollBehavior); >+ > const LayoutRect& parentRelativeScrollableRect() const { return m_parentRelativeScrollableRect; } > WEBCORE_EXPORT void setParentRelativeScrollableRect(const LayoutRect&); > >@@ -133,6 +141,8 @@ private: > #endif > ScrollableAreaParameters m_scrollableAreaParameters; > LayerRepresentation m_scrolledContentsLayer; >+ OverscrollBehavior m_horizontalOverscrollBehavior { OverscrollBehavior::Auto }; >+ OverscrollBehavior m_verticalOverscrollBehavior { OverscrollBehavior::Auto }; > bool m_requestedScrollPositionRepresentsProgrammaticScroll { false }; > bool m_expectsWheelEventTestTrigger { false }; > }; >diff --git a/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp b/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp >index 74a873dde40..43158f5d54d 100644 >--- a/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp >+++ b/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp >@@ -28,6 +28,7 @@ > > #if ENABLE(ASYNC_SCROLLING) > >+#include "RenderStyleConstants.h" > #include "ScrollingStateTree.h" > #include "ScrollingTree.h" > #include <wtf/text/TextStream.h> >@@ -63,6 +64,12 @@ void ScrollingTreeScrollingNode::commitStateBeforeChildren(const ScrollingStateN > if (state.hasChangedProperty(ScrollingStateScrollingNode::ScrollPosition)) > m_lastCommittedScrollPosition = state.scrollPosition(); > >+ if (state.hasChangedProperty(ScrollingStateScrollingNode::HorizontalOverscrollBehavior)) >+ m_horizontalOverscrollBehavior = state.horizontalOverscrollBehavior(); >+ >+ if (state.hasChangedProperty(ScrollingStateScrollingNode::VerticalOverscrollBehavior)) >+ m_verticalOverscrollBehavior = state.verticalOverscrollBehavior(); >+ > if (state.hasChangedProperty(ScrollingStateScrollingNode::ParentRelativeScrollableRect)) > m_parentRelativeScrollableRect = state.parentRelativeScrollableRect(); > >@@ -143,6 +150,12 @@ void ScrollingTreeScrollingNode::dumpProperties(TextStream& ts, ScrollingStateTr > ts.dumpProperty("reachable content size", m_reachableContentsSize); > ts.dumpProperty("last committed scroll position", m_lastCommittedScrollPosition); > >+ if (m_horizontalOverscrollBehavior != OverscrollBehavior::Auto) >+ ts.dumpProperty("horizontal overscroll behavior", static_cast<int>(m_horizontalOverscrollBehavior)); >+ >+ if (m_verticalOverscrollBehavior != OverscrollBehavior::Auto) >+ ts.dumpProperty("vertical overscroll behavior", static_cast<int>(m_verticalOverscrollBehavior)); >+ > if (!m_parentRelativeScrollableRect.isEmpty()) > ts.dumpProperty("parent relative scrollable rect", m_parentRelativeScrollableRect); > >diff --git a/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h b/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h >index f6de7830374..85fb751f897 100644 >--- a/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h >+++ b/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h >@@ -87,6 +87,8 @@ protected: > const FloatSize& scrollableAreaSize() const { return m_scrollableAreaSize; } > const FloatSize& totalContentsSize() const { return m_totalContentsSize; } > const FloatSize& reachableContentsSize() const { return m_reachableContentsSize; } >+ const OverscrollBehavior& horizontalOverscrollBehavior() const { return m_horizontalOverscrollBehavior; } >+ const OverscrollBehavior& verticalOverscrollBehavior() const { return m_verticalOverscrollBehavior; } > const LayoutRect& parentRelativeScrollableRect() const { return m_parentRelativeScrollableRect; } > const IntPoint& scrollOrigin() const { return m_scrollOrigin; } > >@@ -120,6 +122,8 @@ private: > unsigned m_currentVerticalSnapPointIndex { 0 }; > #endif > ScrollableAreaParameters m_scrollableAreaParameters; >+ OverscrollBehavior m_horizontalOverscrollBehavior { OverscrollBehavior::Auto }; >+ OverscrollBehavior m_verticalOverscrollBehavior { OverscrollBehavior::Auto }; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/platform/ScrollTypes.h b/Source/WebCore/platform/ScrollTypes.h >index 33f38c31168..cdf2dcdd741 100644 >--- a/Source/WebCore/platform/ScrollTypes.h >+++ b/Source/WebCore/platform/ScrollTypes.h >@@ -31,6 +31,12 @@ > > namespace WebCore { > >+enum class OverscrollBehavior : uint8_t { >+ Auto = 0, >+ Contain, >+ None >+}; >+ > enum ScrollDirection : uint8_t { > ScrollUp, > ScrollDown, >diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp >index ec2f5a0539d..373785cb980 100644 >--- a/Source/WebCore/rendering/RenderLayerCompositor.cpp >+++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp >@@ -3875,6 +3875,8 @@ void RenderLayerCompositor::updateScrollCoordinationForThisFrame(ScrollingNodeID > ScrollingNodeID nodeID = attachScrollingNode(*m_renderView.layer(), m_renderView.frame().isMainFrame() ? MainFrameScrollingNode : SubframeScrollingNode, parentNodeID); > ScrollingCoordinator::ScrollingGeometry scrollingGeometry; > // FIXME(https://webkit.org/b/172917): Pass parentRelativeScrollableRect? >+ scrollingGeometry.horizontalOverscrollBehavior = m_renderView.style().overscrollBehaviorX(); >+ scrollingGeometry.verticalOverscrollBehavior = m_renderView.style().overscrollBehaviorY(); > scrollingGeometry.scrollOrigin = frameView.scrollOrigin(); > scrollingGeometry.scrollableAreaSize = frameView.visibleContentRect().size(); > scrollingGeometry.contentSize = frameView.totalContentsSize(); >@@ -3968,6 +3970,8 @@ void RenderLayerCompositor::updateScrollCoordinatedLayer(RenderLayer& layer, Opt > scrollingGeometry.scrollableAreaSize = layer.visibleSize(); > scrollingGeometry.contentSize = layer.contentsSize(); > scrollingGeometry.reachableContentSize = layer.scrollableContentsSize(); >+ scrollingGeometry.horizontalOverscrollBehavior = layer.renderer().style().overscrollBehaviorX(); >+ scrollingGeometry.verticalOverscrollBehavior = layer.renderer().style().overscrollBehaviorY(); > #if ENABLE(CSS_SCROLL_SNAP) > if (const Vector<LayoutUnit>* offsets = layer.horizontalSnapOffsets()) > scrollingGeometry.horizontalSnapOffsets = *offsets; >diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h >index dbaaf0c763e..abd8ceb43ef 100644 >--- a/Source/WebCore/rendering/style/RenderStyle.h >+++ b/Source/WebCore/rendering/style/RenderStyle.h >@@ -47,6 +47,7 @@ > #include "RenderStyleConstants.h" > #include "RoundedRect.h" > #include "SVGRenderStyle.h" >+#include "ScrollTypes.h" > #include "ShadowData.h" > #include "ShapeValue.h" > #include "StyleBackgroundData.h" >@@ -339,6 +340,9 @@ public: > Overflow overflowInlineDirection() const { return isHorizontalWritingMode() ? overflowX() : overflowY(); } > Overflow overflowBlockDirection() const { return isHorizontalWritingMode() ? overflowY() : overflowX(); } > bool isOverflowVisible() const { return overflowX() == Overflow::Visible || overflowY() == Overflow::Visible; } >+ >+ OverscrollBehavior overscrollBehaviorX() const { return static_cast<OverscrollBehavior>(m_rareNonInheritedData->overscrollBehaviorX); } >+ OverscrollBehavior overscrollBehaviorY() const { return static_cast<OverscrollBehavior>(m_rareNonInheritedData->overscrollBehaviorY); } > > Visibility visibility() const { return static_cast<Visibility>(m_inheritedFlags.visibility); } > VerticalAlign verticalAlign() const { return static_cast<VerticalAlign>(m_nonInheritedFlags.verticalAlign); } >@@ -895,6 +899,8 @@ public: > > void setOverflowX(Overflow v) { m_nonInheritedFlags.overflowX = static_cast<unsigned>(v); } > void setOverflowY(Overflow v) { m_nonInheritedFlags.overflowY = static_cast<unsigned>(v); } >+ void setOverscrollBehaviorX(OverscrollBehavior v) { SET_VAR(m_rareNonInheritedData, overscrollBehaviorX, static_cast<unsigned>(v)); } >+ void setOverscrollBehaviorY(OverscrollBehavior v) { SET_VAR(m_rareNonInheritedData, overscrollBehaviorY, static_cast<unsigned>(v)); } > void setVisibility(Visibility v) { m_inheritedFlags.visibility = static_cast<unsigned>(v); } > void setVerticalAlign(VerticalAlign v) { m_nonInheritedFlags.verticalAlign = static_cast<unsigned>(v); } > void setVerticalAlignLength(Length&& length) { setVerticalAlign(VerticalAlign::Length); SET_VAR(m_boxData, m_verticalAlign, WTFMove(length)); } >@@ -1448,6 +1454,9 @@ public: > // Initial values for all the properties > static Overflow initialOverflowX() { return Overflow::Visible; } > static Overflow initialOverflowY() { return Overflow::Visible; } >+ static OverscrollBehavior initialOverscrollBehaviorX() { return OverscrollBehavior::Auto; } >+ static OverscrollBehavior initialOverscrollBehaviorY() { return OverscrollBehavior::Auto; } >+ > static Clear initialClear() { return Clear::None; } > static DisplayType initialDisplay() { return DisplayType::Inline; } > static EUnicodeBidi initialUnicodeBidi() { return UBNormal; } >diff --git a/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp b/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp >index a312bdaebd5..dbb6eda2b2f 100644 >--- a/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp >+++ b/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp >@@ -60,6 +60,8 @@ StyleRareNonInheritedData::StyleRareNonInheritedData() > , scrollSnapPort(StyleScrollSnapPort::create()) > , scrollSnapArea(StyleScrollSnapArea::create()) > #endif >+ , overscrollBehaviorX(static_cast<unsigned>(RenderStyle::initialOverscrollBehaviorX())) >+ , overscrollBehaviorY(static_cast<unsigned>(RenderStyle::initialOverscrollBehaviorY())) > , willChange(RenderStyle::initialWillChange()) > , mask(FillLayerType::Mask) > , objectPosition(RenderStyle::initialObjectPosition()) >@@ -137,6 +139,8 @@ inline StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonIn > , scrollSnapPort(o.scrollSnapPort) > , scrollSnapArea(o.scrollSnapArea) > #endif >+ , overscrollBehaviorX(o.overscrollBehaviorX) >+ , overscrollBehaviorY(o.overscrollBehaviorY) > , content(o.content ? o.content->clone() : nullptr) > , counterDirectives(o.counterDirectives ? std::make_unique<CounterDirectiveMap>(*o.counterDirectives) : nullptr) > , altText(o.altText) >@@ -240,6 +244,8 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c > && scrollSnapPort == o.scrollSnapPort > && scrollSnapArea == o.scrollSnapArea > #endif >+ && overscrollBehaviorX == o.overscrollBehaviorX >+ && overscrollBehaviorY == o.overscrollBehaviorY > && contentDataEquivalent(o) > && arePointingToEqualData(counterDirectives, o.counterDirectives) > && altText == o.altText >diff --git a/Source/WebCore/rendering/style/StyleRareNonInheritedData.h b/Source/WebCore/rendering/style/StyleRareNonInheritedData.h >index f9baa142305..7c112cd80fc 100644 >--- a/Source/WebCore/rendering/style/StyleRareNonInheritedData.h >+++ b/Source/WebCore/rendering/style/StyleRareNonInheritedData.h >@@ -128,6 +128,9 @@ public: > DataRef<StyleScrollSnapArea> scrollSnapArea; > #endif > >+ unsigned overscrollBehaviorX : 2; // OverscrollBehavior >+ unsigned overscrollBehaviorY : 2; // OverscrollBehavior >+ > std::unique_ptr<ContentData> content; > std::unique_ptr<CounterDirectiveMap> counterDirectives; > String altText; >diff --git a/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp b/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp >index 8d2d18c096e..c87ad0353fa 100644 >--- a/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp >+++ b/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp >@@ -119,6 +119,8 @@ void ArgumentCoder<ScrollingStateScrollingNode>::encode(Encoder& encoder, const > { > encoder << static_cast<const ScrollingStateNode&>(node); > >+ SCROLLING_NODE_ENCODE_ENUM(ScrollingStateScrollingNode::HorizontalOverscrollBehavior, horizontalOverscrollBehavior) >+ SCROLLING_NODE_ENCODE_ENUM(ScrollingStateScrollingNode::VerticalOverscrollBehavior, verticalOverscrollBehavior) > SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::ScrollableAreaSize, scrollableAreaSize) > SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::TotalContentsSize, totalContentsSize) > SCROLLING_NODE_ENCODE(ScrollingStateScrollingNode::ReachableContentsSize, reachableContentsSize) >@@ -193,6 +195,8 @@ bool ArgumentCoder<ScrollingStateScrollingNode>::decode(Decoder& decoder, Scroll > if (!decoder.decode(static_cast<ScrollingStateNode&>(node))) > return false; > >+ SCROLLING_NODE_DECODE_ENUM(ScrollingStateScrollingNode::HorizontalOverscrollBehavior, WebCore::OverscrollBehavior, setHorizontalOverscrollBehavior); >+ SCROLLING_NODE_DECODE_ENUM(ScrollingStateScrollingNode::VerticalOverscrollBehavior, WebCore::OverscrollBehavior, setVerticalOverscrollBehavior); > SCROLLING_NODE_DECODE(ScrollingStateScrollingNode::ScrollableAreaSize, FloatSize, setScrollableAreaSize); > SCROLLING_NODE_DECODE(ScrollingStateScrollingNode::TotalContentsSize, FloatSize, setTotalContentsSize); > SCROLLING_NODE_DECODE(ScrollingStateScrollingNode::ReachableContentsSize, FloatSize, setReachableContentsSize); >@@ -456,6 +460,12 @@ bool RemoteScrollingCoordinatorTransaction::decode(IPC::Decoder& decoder) > > static void dump(TextStream& ts, const ScrollingStateScrollingNode& node, bool changedPropertiesOnly) > { >+ if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::HorizontalOverscrollBehavior)) >+ ts.dumpProperty("horizontal-overscroll-behavior", static_cast<int>(node.horizontalOverscrollBehavior())); >+ >+ if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::VerticalOverscrollBehavior)) >+ ts.dumpProperty("vertical-overscroll-behavior", static_cast<int>(node.verticalOverscrollBehavior())); >+ > if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::ScrollableAreaSize)) > ts.dumpProperty("scrollable-area-size", node.scrollableAreaSize()); > >diff --git a/Source/WebKit/Shared/WebCoreArgumentCoders.h b/Source/WebKit/Shared/WebCoreArgumentCoders.h >index 3a3ea994910..964ba0140c7 100644 >--- a/Source/WebKit/Shared/WebCoreArgumentCoders.h >+++ b/Source/WebKit/Shared/WebCoreArgumentCoders.h >@@ -37,6 +37,7 @@ > #include <WebCore/NotificationDirection.h> > #include <WebCore/RealtimeMediaSource.h> > #include <WebCore/ScrollSnapOffsetsInfo.h> >+#include <WebCore/ScrollTypes.h> > #include <WebCore/ServiceWorkerTypes.h> > #include <WebCore/StoredCredentialsPolicy.h> > #include <WebCore/WorkerType.h> >@@ -747,6 +748,15 @@ template<> struct ArgumentCoder<WebCore::SerializedAttachmentData> { > > namespace WTF { > >+template<> struct EnumTraits<WebCore::OverscrollBehavior> { >+ using values = EnumValues< >+ WebCore::OverscrollBehavior, >+ WebCore::OverscrollBehavior::Auto, >+ WebCore::OverscrollBehavior::Contain, >+ WebCore::OverscrollBehavior::None >+ >; >+}; >+ > template<> struct EnumTraits<WebCore::ColorSpace> { > using values = EnumValues< > WebCore::ColorSpace, >diff --git a/Source/WebKit/Shared/WebPreferences.yaml b/Source/WebKit/Shared/WebPreferences.yaml >index 6d25e71f13c..40cb5ce5ad4 100644 >--- a/Source/WebKit/Shared/WebPreferences.yaml >+++ b/Source/WebKit/Shared/WebPreferences.yaml >@@ -1233,6 +1233,13 @@ PointerEventsEnabled: > webcoreBinding: RuntimeEnabledFeatures > category: experimental > >+OverscrollBehaviorEnabled: >+ type: bool >+ defaultValue: false >+ humanReadableName: "CSS Overscroll Behavior" >+ humanReadableDescription: "CSS Overscroll Behavior prototype" >+ category: experimental >+ > CSSOMViewScrollingAPIEnabled: > type: bool > defaultValue: false >diff --git a/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm b/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm >index 3d4060f8026..a80bfd8e3d8 100644 >--- a/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm >+++ b/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm >@@ -163,6 +163,8 @@ void ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren(const Scrol > { > SetForScope<bool> updatingChange(m_updatingFromStateNode, true); > if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollLayer) >+ || scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::HorizontalOverscrollBehavior) >+ || scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::VerticalOverscrollBehavior) > || scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::TotalContentsSize) > || scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ReachableContentsSize) > || scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollPosition) >@@ -171,6 +173,24 @@ void ScrollingTreeScrollingNodeDelegateIOS::commitStateAfterChildren(const Scrol > UIScrollView *scrollView = (UIScrollView *)[scrollLayer() delegate]; > ASSERT([scrollView isKindOfClass:[UIScrollView self]]); > >+ // FIXME(rdar://problem/34315997): UIScrollView should have some kind of support for overscroll-behavior to enable/disable: >+ // - non-local boundary default actions (e.g. scroll chaining). >+ // - local boundary default actions (e.g. bouncing). >+#if USE(APPLE_INTERNAL_SDK) >+ // if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::HorizontalOverscrollBehavior)) >+ // scrollView.overscrollBehaviorHorizontal = convertOverscrollBehaviorFromWebKitToUIKit(scrollingStateNode.horizontalOverscrollBehavior()); >+ // if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::VerticalOverscrollBehavior)) >+ // scrollView.overscrollBehaviorVertical = convertOverscrollBehaviorFromWebKitToUIKit(scrollingStateNode.verticalOverscrollBehavior()); >+#endif >+ // For now, we only disable bouncing when both overflow-x and overflow-y are none. >+ // UIScrollView::alwaysBounce* functions cannot help here. >+ if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::HorizontalOverscrollBehavior) >+ || scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::VerticalOverscrollBehavior)) { >+ scrollView.bounces = scrollingStateNode.horizontalOverscrollBehavior() == OverscrollBehavior::None >+ && scrollingStateNode.verticalOverscrollBehavior() == OverscrollBehavior::None >+ ? NO : YES; >+ } >+ > if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollLayer)) { > if (!m_scrollViewDelegate) > m_scrollViewDelegate = adoptNS([[WKScrollingNodeScrollViewDelegate alloc] initWithScrollingTreeNodeDelegate:this]); >diff --git a/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h b/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h >index b73f6cb6830..47870c00099 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h >+++ b/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h >@@ -182,6 +182,7 @@ > #define WebKitDirectoryUploadEnabledPreferenceKey @"WebKitDirectoryUploadEnabled" > #define WebKitVisualViewportEnabledPreferenceKey @"WebKitVisualViewportEnabled" > #define WebKitVisualViewportAPIEnabledPreferenceKey @"WebKitVisualViewportAPIEnabled" >+#define WebKitOverscrollBehaviorEnabledPreferenceKey @"WebKitOverscrollBehaviorEnabled" > #define WebKitCSSOMViewScrollingAPIEnabledPreferenceKey @"WebKitCSSOMViewScrollingAPIEnabled" > #define WebKitModernMediaControlsEnabledPreferenceKey @"WebKitModernMediaControlsEnabled" > #define WebKitSubtleCryptoEnabledPreferenceKey @"WebKitSubtleCryptoEnabled" >diff --git a/Source/WebKitLegacy/mac/WebView/WebPreferences.mm b/Source/WebKitLegacy/mac/WebView/WebPreferences.mm >index 7e1cfc1b1e2..ece0c7ac505 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebPreferences.mm >+++ b/Source/WebKitLegacy/mac/WebView/WebPreferences.mm >@@ -656,6 +656,7 @@ public: > #endif > [NSNumber numberWithBool:NO], WebKitVisualViewportAPIEnabledPreferenceKey, > >+ [NSNumber numberWithBool:NO], WebKitOverscrollBehaviorEnabledPreferenceKey, > [NSNumber numberWithBool:NO], WebKitCSSOMViewScrollingAPIEnabledPreferenceKey, > [NSNumber numberWithBool:YES], WebKitNeedsStorageAccessFromFileURLsQuirkKey, > [NSNumber numberWithBool:NO], WebKitAllowCrossOriginSubresourcesToAskForCredentialsKey, >@@ -3097,6 +3098,16 @@ static NSString *classIBCreatorID = nil; > [self _setBoolValue:flag forKey:WebKitVisualViewportAPIEnabledPreferenceKey]; > } > >+- (BOOL)overscrollBehaviorEnabled >+{ >+ return [self _boolValueForKey:WebKitOverscrollBehaviorEnabledPreferenceKey]; >+} >+ >+- (void)setOverscrollBehaviorEnabled:(BOOL)flag >+{ >+ [self _setBoolValue:flag forKey:WebKitOverscrollBehaviorEnabledPreferenceKey]; >+} >+ > - (BOOL)CSSOMViewScrollingAPIEnabled > { > return [self _boolValueForKey:WebKitCSSOMViewScrollingAPIEnabledPreferenceKey]; >diff --git a/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h b/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h >index 20b33429510..186153dbca8 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h >+++ b/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h >@@ -587,6 +587,7 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification WEBKIT_DEPR > > @property (nonatomic) BOOL visualViewportEnabled; > @property (nonatomic) BOOL visualViewportAPIEnabled; >+@property (nonatomic) BOOL overscrollBehaviorEnabled; > @property (nonatomic) BOOL CSSOMViewScrollingAPIEnabled; > @property (nonatomic) BOOL largeImageAsyncDecodingEnabled; > @property (nonatomic) BOOL animatedImageAsyncDecodingEnabled; >diff --git a/Source/WebKitLegacy/mac/WebView/WebView.mm b/Source/WebKitLegacy/mac/WebView/WebView.mm >index 5eb9575282c..758831d1922 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebView.mm >+++ b/Source/WebKitLegacy/mac/WebView/WebView.mm >@@ -2953,6 +2953,7 @@ static bool needsSelfRetainWhileLoadingQuirk() > > settings.setVisualViewportEnabled([preferences visualViewportEnabled]); > settings.setVisualViewportAPIEnabled([preferences visualViewportAPIEnabled]); >+ settings.setOverscrollBehaviorEnabled([preferences overscrollBehaviorEnabled]); > settings.setCSSOMViewScrollingAPIEnabled([preferences CSSOMViewScrollingAPIEnabled]); > settings.setMediaContentTypesRequiringHardwareSupport([preferences mediaContentTypesRequiringHardwareSupport]); > >diff --git a/Source/WebKitLegacy/win/Interfaces/IWebPreferencesPrivate.idl b/Source/WebKitLegacy/win/Interfaces/IWebPreferencesPrivate.idl >index 19882cdd0f0..7c864bdea5c 100644 >--- a/Source/WebKitLegacy/win/Interfaces/IWebPreferencesPrivate.idl >+++ b/Source/WebKitLegacy/win/Interfaces/IWebPreferencesPrivate.idl >@@ -221,6 +221,8 @@ interface IWebPreferencesPrivate6 : IWebPreferencesPrivate5 > HRESULT setInspectorAdditionsEnabled([in] BOOL enabled); > HRESULT visualViewportAPIEnabled([out, retval] BOOL*); > HRESULT setVisualViewportAPIEnabled([in] BOOL enabled); >+ HRESULT overscrollBehaviorEnabled([out, retval] BOOL*); >+ HRESULT setOverscrollBehaviorEnabled([in] BOOL enabled); > HRESULT CSSOMViewScrollingAPIEnabled([out, retval] BOOL*); > HRESULT setCSSOMViewScrollingAPIEnabled([in] BOOL enabled); > HRESULT fetchAPIKeepAliveEnabled([out, retval] BOOL* enabled); >diff --git a/Source/WebKitLegacy/win/WebPreferenceKeysPrivate.h b/Source/WebKitLegacy/win/WebPreferenceKeysPrivate.h >index 940d5cf55d1..144be01d132 100644 >--- a/Source/WebKitLegacy/win/WebPreferenceKeysPrivate.h >+++ b/Source/WebKitLegacy/win/WebPreferenceKeysPrivate.h >@@ -204,5 +204,6 @@ > > #define WebKitServerTimingEnabledPreferenceKey "WebKitServerTimingEnabled" > >+#define WebKitOverscrollBehaviorEnabledPreferenceKey "WebKitOverscrollBehaviorEnabled" > #define WebKitCSSOMViewScrollingAPIEnabledPreferenceKey "WebKitCSSOMViewScrollingAPIEnabled" > >diff --git a/Source/WebKitLegacy/win/WebPreferences.cpp b/Source/WebKitLegacy/win/WebPreferences.cpp >index 59be0c443f4..e55d1f272fe 100644 >--- a/Source/WebKitLegacy/win/WebPreferences.cpp >+++ b/Source/WebKitLegacy/win/WebPreferences.cpp >@@ -326,6 +326,8 @@ void WebPreferences::initializeDefaultSettings() > > CFDictionaryAddValue(defaults, CFSTR(WebKitVisualViewportAPIEnabledPreferenceKey), kCFBooleanFalse); > >+ CFDictionaryAddValue(defaults, CFSTR(WebKitOverscrollBehaviorEnabledPreferenceKey), kCFBooleanFalse); >+ > CFDictionaryAddValue(defaults, CFSTR(WebKitCSSOMViewScrollingAPIEnabledPreferenceKey), kCFBooleanFalse); > > defaultSettings = defaults; >@@ -2184,6 +2186,20 @@ HRESULT WebPreferences::setVisualViewportAPIEnabled(BOOL enabled) > return S_OK; > } > >+HRESULT WebPreferences::overscrollBehaviorEnabled(_Out_ BOOL* enabled) >+{ >+ if (!enabled) >+ return E_POINTER; >+ *enabled = boolValueForKey(WebKitOverscrollBehaviorEnabledPreferenceKey); >+ return S_OK; >+} >+ >+HRESULT WebPreferences::setOverscrollBehaviorEnabled(BOOL enabled) >+{ >+ setBoolValue(WebKitOverscrollBehaviorEnabledPreferenceKey, enabled); >+ return S_OK; >+} >+ > HRESULT WebPreferences::CSSOMViewScrollingAPIEnabled(_Out_ BOOL* enabled) > { > if (!enabled) >diff --git a/Source/WebKitLegacy/win/WebPreferences.h b/Source/WebKitLegacy/win/WebPreferences.h >index 3ce4485b8a0..d4be90f42fc 100644 >--- a/Source/WebKitLegacy/win/WebPreferences.h >+++ b/Source/WebKitLegacy/win/WebPreferences.h >@@ -269,6 +269,8 @@ public: > virtual HRESULT STDMETHODCALLTYPE setInspectorAdditionsEnabled(BOOL); > virtual HRESULT STDMETHODCALLTYPE visualViewportAPIEnabled(_Out_ BOOL*); > virtual HRESULT STDMETHODCALLTYPE setVisualViewportAPIEnabled(BOOL); >+ virtual HRESULT STDMETHODCALLTYPE overscrollBehaviorEnabled(_Out_ BOOL*); >+ virtual HRESULT STDMETHODCALLTYPE setOverscrollBehaviorEnabled(BOOL); > virtual HRESULT STDMETHODCALLTYPE CSSOMViewScrollingAPIEnabled(_Out_ BOOL*); > virtual HRESULT STDMETHODCALLTYPE setCSSOMViewScrollingAPIEnabled(BOOL); > virtual HRESULT STDMETHODCALLTYPE fetchAPIKeepAliveEnabled(_Out_ BOOL*); >diff --git a/Source/WebKitLegacy/win/WebView.cpp b/Source/WebKitLegacy/win/WebView.cpp >index e4b2e5f5c57..c5d2c9c9b2a 100644 >--- a/Source/WebKitLegacy/win/WebView.cpp >+++ b/Source/WebKitLegacy/win/WebView.cpp >@@ -5278,6 +5278,11 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification) > return hr; > settings.setVisualViewportAPIEnabled(!!enabled); > >+ hr = prefsPrivate->overscrollBehaviorEnabled(&enabled); >+ if (FAILED(hr)) >+ return hr; >+ settings.setOverscrollBehaviorEnabled(!!enabled); >+ > hr = prefsPrivate->CSSOMViewScrollingAPIEnabled(&enabled); > if (FAILED(hr)) > return hr; >diff --git a/Tools/DumpRenderTree/TestOptions.cpp b/Tools/DumpRenderTree/TestOptions.cpp >index 81b2487b233..e111f2d02c9 100644 >--- a/Tools/DumpRenderTree/TestOptions.cpp >+++ b/Tools/DumpRenderTree/TestOptions.cpp >@@ -109,6 +109,8 @@ TestOptions::TestOptions(const std::string& pathOrURL, const std::string& absolu > jscOptions = value; > else if (key == "experimental:WebGPUEnabled") > enableWebGPU = parseBooleanTestHeaderValue(value); >+ else if (key == "experimental:overscrollBehaviorEnabled") >+ enableOverscrollBehavior = parseBooleanTestHeaderValue(value); > pairStart = pairEnd + 1; > } > } >diff --git a/Tools/DumpRenderTree/TestOptions.h b/Tools/DumpRenderTree/TestOptions.h >index 8aedb946417..9fdd056a0a0 100644 >--- a/Tools/DumpRenderTree/TestOptions.h >+++ b/Tools/DumpRenderTree/TestOptions.h >@@ -45,6 +45,7 @@ struct TestOptions { > bool enableColorFilter { false }; > bool enableSelectionAcrossShadowBoundaries { true }; > bool enableWebGPU { false }; >+ bool enableOverscrollBehavior { false }; > std::string jscOptions; > > TestOptions(const std::string& pathOrURL, const std::string& absolutePath); >diff --git a/Tools/DumpRenderTree/mac/DumpRenderTree.mm b/Tools/DumpRenderTree/mac/DumpRenderTree.mm >index 5de612c59f3..a701cdce058 100644 >--- a/Tools/DumpRenderTree/mac/DumpRenderTree.mm >+++ b/Tools/DumpRenderTree/mac/DumpRenderTree.mm >@@ -1011,6 +1011,7 @@ static void setWebPreferencesForTestOptions(const TestOptions& options) > preferences.colorFilterEnabled = options.enableColorFilter; > preferences.selectionAcrossShadowBoundariesEnabled = options.enableSelectionAcrossShadowBoundaries; > preferences.webGPUEnabled = options.enableWebGPU; >+ preferences.overscrollBehaviorEnabled = options.enableOverscrollBehavior; > } > > // Called once on DumpRenderTree startup. >-- >2.19.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 176454
:
349309
|
349310
|
350862
|
353488
|
354920
|
355733
|
355887
|
355888
|
356006
|
356410
|
356479
|
356505
|
363094
|
377722
|
377735
|
377789
|
378100
|
378196
|
399351
|
399352
|
399355
|
403978
|
404040
|
404095
|
404100
|
407661
|
407672
|
408125
|
408185
|
408212
|
408213