Diff
Modified: trunk/Source/WebCore/ChangeLog (285346 => 285347)
--- trunk/Source/WebCore/ChangeLog 2021-11-05 18:14:31 UTC (rev 285346)
+++ trunk/Source/WebCore/ChangeLog 2021-11-05 18:46:21 UTC (rev 285347)
@@ -1,3 +1,30 @@
+2021-11-05 Nikolaos Mouchtaris <[email protected]>
+
+ Make scroll elasticity an enum class
+ https://bugs.webkit.org/show_bug.cgi?id=232646
+
+ Reviewed by Simon Fraser.
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::FrameView):
+ * page/Page.cpp:
+ (WebCore::Page::Page):
+ * page/Page.h:
+ * page/scrolling/ScrollingCoordinatorTypes.h:
+ * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
+ (WebCore::ScrollingTreeScrollingNodeDelegateMac::allowsHorizontalStretching const):
+ (WebCore::ScrollingTreeScrollingNodeDelegateMac::allowsVerticalStretching const):
+ * platform/ScrollTypes.cpp:
+ (WebCore::operator<<):
+ * platform/ScrollTypes.h:
+ * platform/ScrollableArea.h:
+ * platform/mac/ScrollAnimatorMac.mm:
+ (WebCore::ScrollAnimatorMac::allowsVerticalStretching const):
+ (WebCore::ScrollAnimatorMac::allowsHorizontalStretching const):
+ * rendering/RenderLayerScrollableArea.cpp:
+ (WebCore::RenderLayerScrollableArea::setHasHorizontalScrollbar):
+ (WebCore::RenderLayerScrollableArea::setHasVerticalScrollbar):
+
2021-11-05 Devin Rousso <[email protected]>
[css-values-4] viewport units should be floats
Modified: trunk/Source/WebCore/page/FrameView.cpp (285346 => 285347)
--- trunk/Source/WebCore/page/FrameView.cpp 2021-11-05 18:14:31 UTC (rev 285346)
+++ trunk/Source/WebCore/page/FrameView.cpp 2021-11-05 18:46:21 UTC (rev 285347)
@@ -196,14 +196,14 @@
init();
#if HAVE(RUBBER_BANDING)
- ScrollElasticity verticalElasticity = ScrollElasticityNone;
- ScrollElasticity horizontalElasticity = ScrollElasticityNone;
+ auto verticalElasticity = ScrollElasticity::None;
+ auto horizontalElasticity = ScrollElasticity::None;
if (m_frame->isMainFrame()) {
- verticalElasticity = m_frame->page() ? m_frame->page()->verticalScrollElasticity() : ScrollElasticityAllowed;
- horizontalElasticity = m_frame->page() ? m_frame->page()->horizontalScrollElasticity() : ScrollElasticityAllowed;
+ verticalElasticity = m_frame->page() ? m_frame->page()->verticalScrollElasticity() : ScrollElasticity::Allowed;
+ horizontalElasticity = m_frame->page() ? m_frame->page()->horizontalScrollElasticity() : ScrollElasticity::Allowed;
} else if (m_frame->settings().rubberBandingForSubScrollableRegionsEnabled()) {
- verticalElasticity = ScrollElasticityAutomatic;
- horizontalElasticity = ScrollElasticityAutomatic;
+ verticalElasticity = ScrollElasticity::Automatic;
+ horizontalElasticity = ScrollElasticity::Automatic;
}
ScrollableArea::setVerticalScrollElasticity(verticalElasticity);
Modified: trunk/Source/WebCore/page/Page.cpp (285346 => 285347)
--- trunk/Source/WebCore/page/Page.cpp 2021-11-05 18:14:31 UTC (rev 285346)
+++ trunk/Source/WebCore/page/Page.cpp 2021-11-05 18:46:21 UTC (rev 285347)
@@ -281,8 +281,6 @@
, m_speechRecognitionProvider((WTFMove(pageConfiguration.speechRecognitionProvider)))
, m_mediaRecorderProvider((WTFMove(pageConfiguration.mediaRecorderProvider)))
, m_libWebRTCProvider(WTFMove(pageConfiguration.libWebRTCProvider))
- , m_verticalScrollElasticity(ScrollElasticityAllowed)
- , m_horizontalScrollElasticity(ScrollElasticityAllowed)
, m_domTimerAlignmentInterval(DOMTimer::defaultAlignmentInterval())
, m_domTimerAlignmentIntervalIncreaseTimer(*this, &Page::domTimerAlignmentIntervalIncreaseTimerFired)
, m_activityState(pageInitialActivityState())
Modified: trunk/Source/WebCore/page/Page.h (285346 => 285347)
--- trunk/Source/WebCore/page/Page.h 2021-11-05 18:14:31 UTC (rev 285346)
+++ trunk/Source/WebCore/page/Page.h 2021-11-05 18:46:21 UTC (rev 285347)
@@ -1039,8 +1039,8 @@
bool m_suppressScrollbarAnimations { false };
- unsigned m_verticalScrollElasticity : 2; // ScrollElasticity
- unsigned m_horizontalScrollElasticity : 2; // ScrollElasticity
+ ScrollElasticity m_verticalScrollElasticity { ScrollElasticity::Allowed };
+ ScrollElasticity m_horizontalScrollElasticity { ScrollElasticity::Allowed };
Pagination m_pagination;
bool m_paginationLineGridEnabled { false };
Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinatorTypes.h (285346 => 285347)
--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinatorTypes.h 2021-11-05 18:14:31 UTC (rev 285346)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinatorTypes.h 2021-11-05 18:46:21 UTC (rev 285347)
@@ -71,8 +71,8 @@
};
struct ScrollableAreaParameters {
- ScrollElasticity horizontalScrollElasticity { ScrollElasticityNone };
- ScrollElasticity verticalScrollElasticity { ScrollElasticityNone };
+ ScrollElasticity horizontalScrollElasticity { ScrollElasticity::None };
+ ScrollElasticity verticalScrollElasticity { ScrollElasticity::None };
ScrollbarMode horizontalScrollbarMode { ScrollbarAuto };
ScrollbarMode verticalScrollbarMode { ScrollbarAuto };
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm (285346 => 285347)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm 2021-11-05 18:14:31 UTC (rev 285346)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm 2021-11-05 18:46:21 UTC (rev 285347)
@@ -213,15 +213,15 @@
bool ScrollingTreeScrollingNodeDelegateMac::allowsHorizontalStretching(const PlatformWheelEvent& wheelEvent) const
{
switch (horizontalScrollElasticity()) {
- case ScrollElasticityAutomatic: {
+ case ScrollElasticity::Automatic: {
bool scrollbarsAllowStretching = allowsHorizontalScrolling() || !allowsVerticalScrolling();
auto relevantSide = ScrollableArea::targetSideForScrollDelta(-wheelEvent.delta(), ScrollEventAxis::Horizontal);
bool eventPreventsStretching = wheelEvent.isGestureStart() && relevantSide && isPinnedOnSide(*relevantSide);
return scrollbarsAllowStretching && !eventPreventsStretching;
}
- case ScrollElasticityNone:
+ case ScrollElasticity::None:
return false;
- case ScrollElasticityAllowed: {
+ case ScrollElasticity::Allowed: {
auto relevantSide = ScrollableArea::targetSideForScrollDelta(-wheelEvent.delta(), ScrollEventAxis::Horizontal);
if (relevantSide)
return shouldRubberBandOnSide(*relevantSide);
@@ -236,15 +236,15 @@
bool ScrollingTreeScrollingNodeDelegateMac::allowsVerticalStretching(const PlatformWheelEvent& wheelEvent) const
{
switch (verticalScrollElasticity()) {
- case ScrollElasticityAutomatic: {
+ case ScrollElasticity::Automatic: {
bool scrollbarsAllowStretching = allowsVerticalScrolling() || !allowsHorizontalScrolling();
auto relevantSide = ScrollableArea::targetSideForScrollDelta(-wheelEvent.delta(), ScrollEventAxis::Vertical);
bool eventPreventsStretching = wheelEvent.isGestureStart() && relevantSide && isPinnedOnSide(*relevantSide);
return scrollbarsAllowStretching && !eventPreventsStretching;
}
- case ScrollElasticityNone:
+ case ScrollElasticity::None:
return false;
- case ScrollElasticityAllowed: {
+ case ScrollElasticity::Allowed: {
auto relevantSide = ScrollableArea::targetSideForScrollDelta(-wheelEvent.delta(), ScrollEventAxis::Vertical);
if (relevantSide)
return shouldRubberBandOnSide(*relevantSide);
Modified: trunk/Source/WebCore/platform/ScrollTypes.cpp (285346 => 285347)
--- trunk/Source/WebCore/platform/ScrollTypes.cpp 2021-11-05 18:14:31 UTC (rev 285346)
+++ trunk/Source/WebCore/platform/ScrollTypes.cpp 2021-11-05 18:46:21 UTC (rev 285347)
@@ -62,4 +62,20 @@
return ts;
}
+TextStream& operator<<(TextStream& ts, ScrollElasticity behavior)
+{
+ switch (behavior) {
+ case ScrollElasticity::Automatic:
+ ts << 0;
+ break;
+ case ScrollElasticity::None:
+ ts << 1;
+ break;
+ case ScrollElasticity::Allowed:
+ ts << 2;
+ break;
+ }
+ return ts;
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/ScrollTypes.h (285346 => 285347)
--- trunk/Source/WebCore/platform/ScrollTypes.h 2021-11-05 18:14:31 UTC (rev 285346)
+++ trunk/Source/WebCore/platform/ScrollTypes.h 2021-11-05 18:46:21 UTC (rev 285347)
@@ -137,10 +137,10 @@
ScrollByPixel
};
-enum ScrollElasticity : uint8_t {
- ScrollElasticityAutomatic,
- ScrollElasticityNone,
- ScrollElasticityAllowed
+enum class ScrollElasticity : uint8_t {
+ Automatic,
+ None,
+ Allowed
};
enum class ScrollbarOrientation : uint8_t {
@@ -260,6 +260,7 @@
WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, ScrollType);
WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, ScrollClamping);
WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, ScrollBehaviorForFixedElements);
+WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, ScrollElasticity);
struct ScrollPositionChangeOptions {
ScrollType type;
@@ -312,9 +313,9 @@
template<> struct EnumTraits<WebCore::ScrollElasticity> {
using values = EnumValues<
WebCore::ScrollElasticity,
- WebCore::ScrollElasticity::ScrollElasticityAutomatic,
- WebCore::ScrollElasticity::ScrollElasticityNone,
- WebCore::ScrollElasticity::ScrollElasticityAllowed
+ WebCore::ScrollElasticity::Automatic,
+ WebCore::ScrollElasticity::None,
+ WebCore::ScrollElasticity::Allowed
>;
};
Modified: trunk/Source/WebCore/platform/ScrollableArea.h (285346 => 285347)
--- trunk/Source/WebCore/platform/ScrollableArea.h 2021-11-05 18:14:31 UTC (rev 285346)
+++ trunk/Source/WebCore/platform/ScrollableArea.h 2021-11-05 18:46:21 UTC (rev 285347)
@@ -404,8 +404,8 @@
ScrollClamping m_scrollClamping { ScrollClamping::Clamped };
- ScrollElasticity m_verticalScrollElasticity { ScrollElasticityNone };
- ScrollElasticity m_horizontalScrollElasticity { ScrollElasticityNone };
+ ScrollElasticity m_verticalScrollElasticity { ScrollElasticity::None };
+ ScrollElasticity m_horizontalScrollElasticity { ScrollElasticity::None };
ScrollbarOverlayStyle m_scrollbarOverlayStyle { ScrollbarOverlayStyle::ScrollbarOverlayStyleDefault };
Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (285346 => 285347)
--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm 2021-11-05 18:14:31 UTC (rev 285346)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm 2021-11-05 18:46:21 UTC (rev 285347)
@@ -144,7 +144,7 @@
bool ScrollAnimatorMac::allowsVerticalStretching(const PlatformWheelEvent& wheelEvent) const
{
switch (m_scrollableArea.verticalScrollElasticity()) {
- case ScrollElasticityAutomatic: {
+ case ScrollElasticity::Automatic: {
Scrollbar* hScroller = m_scrollableArea.horizontalScrollbar();
Scrollbar* vScroller = m_scrollableArea.verticalScrollbar();
bool scrollbarsAllowStretching = ((vScroller && vScroller->enabled()) || (!hScroller || !hScroller->enabled()));
@@ -154,9 +154,9 @@
eventPreventsStretching = gestureShouldBeginSnap(wheelEvent, ScrollEventAxis::Vertical, m_scrollableArea.snapOffsetsInfo());
return scrollbarsAllowStretching && !eventPreventsStretching;
}
- case ScrollElasticityNone:
+ case ScrollElasticity::None:
return false;
- case ScrollElasticityAllowed:
+ case ScrollElasticity::Allowed:
return true;
}
@@ -167,7 +167,7 @@
bool ScrollAnimatorMac::allowsHorizontalStretching(const PlatformWheelEvent& wheelEvent) const
{
switch (m_scrollableArea.horizontalScrollElasticity()) {
- case ScrollElasticityAutomatic: {
+ case ScrollElasticity::Automatic: {
Scrollbar* hScroller = m_scrollableArea.horizontalScrollbar();
Scrollbar* vScroller = m_scrollableArea.verticalScrollbar();
bool scrollbarsAllowStretching = ((hScroller && hScroller->enabled()) || (!vScroller || !vScroller->enabled()));
@@ -177,9 +177,9 @@
eventPreventsStretching = gestureShouldBeginSnap(wheelEvent, ScrollEventAxis::Horizontal, m_scrollableArea.snapOffsetsInfo());
return scrollbarsAllowStretching && !eventPreventsStretching;
}
- case ScrollElasticityNone:
+ case ScrollElasticity::None:
return false;
- case ScrollElasticityAllowed:
+ case ScrollElasticity::Allowed:
return true;
}
Modified: trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp (285346 => 285347)
--- trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp 2021-11-05 18:14:31 UTC (rev 285346)
+++ trunk/Source/WebCore/rendering/RenderLayerScrollableArea.cpp 2021-11-05 18:46:21 UTC (rev 285347)
@@ -859,13 +859,13 @@
m_hBar = createScrollbar(ScrollbarOrientation::Horizontal);
#if HAVE(RUBBER_BANDING)
auto& renderer = m_layer.renderer();
- ScrollElasticity elasticity = scrollsOverflow() && renderer.settings().rubberBandingForSubScrollableRegionsEnabled() ? ScrollElasticityAutomatic : ScrollElasticityNone;
+ ScrollElasticity elasticity = scrollsOverflow() && renderer.settings().rubberBandingForSubScrollableRegionsEnabled() ? ScrollElasticity::Automatic : ScrollElasticity::None;
ScrollableArea::setHorizontalScrollElasticity(elasticity);
#endif
} else {
destroyScrollbar(ScrollbarOrientation::Horizontal);
#if HAVE(RUBBER_BANDING)
- ScrollableArea::setHorizontalScrollElasticity(ScrollElasticityNone);
+ ScrollableArea::setHorizontalScrollElasticity(ScrollElasticity::None);
#endif
}
@@ -885,13 +885,13 @@
m_vBar = createScrollbar(ScrollbarOrientation::Vertical);
#if HAVE(RUBBER_BANDING)
auto& renderer = m_layer.renderer();
- ScrollElasticity elasticity = scrollsOverflow() && renderer.settings().rubberBandingForSubScrollableRegionsEnabled() ? ScrollElasticityAutomatic : ScrollElasticityNone;
+ ScrollElasticity elasticity = scrollsOverflow() && renderer.settings().rubberBandingForSubScrollableRegionsEnabled() ? ScrollElasticity::Automatic : ScrollElasticity::None;
ScrollableArea::setVerticalScrollElasticity(elasticity);
#endif
} else {
destroyScrollbar(ScrollbarOrientation::Vertical);
#if HAVE(RUBBER_BANDING)
- ScrollableArea::setVerticalScrollElasticity(ScrollElasticityNone);
+ ScrollableArea::setVerticalScrollElasticity(ScrollElasticity::None);
#endif
}
Modified: trunk/Source/WebKit/ChangeLog (285346 => 285347)
--- trunk/Source/WebKit/ChangeLog 2021-11-05 18:14:31 UTC (rev 285346)
+++ trunk/Source/WebKit/ChangeLog 2021-11-05 18:46:21 UTC (rev 285347)
@@ -1,3 +1,14 @@
+2021-11-05 Nikolaos Mouchtaris <[email protected]>
+
+ Make scroll elasticity an enum class
+ https://bugs.webkit.org/show_bug.cgi?id=232646
+
+ Reviewed by Simon Fraser.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::setEnableVerticalRubberBanding):
+ (WebKit::WebPage::setEnableHorizontalRubberBanding):
+
2021-11-05 Devin Rousso <[email protected]>
[css-values-4] viewport units should be floats
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (285346 => 285347)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2021-11-05 18:14:31 UTC (rev 285346)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2021-11-05 18:46:21 UTC (rev 285347)
@@ -2394,12 +2394,12 @@
void WebPage::setEnableVerticalRubberBanding(bool enableVerticalRubberBanding)
{
- m_page->setVerticalScrollElasticity(enableVerticalRubberBanding ? ScrollElasticityAllowed : ScrollElasticityNone);
+ m_page->setVerticalScrollElasticity(enableVerticalRubberBanding ? ScrollElasticity::Allowed : ScrollElasticity::None);
}
void WebPage::setEnableHorizontalRubberBanding(bool enableHorizontalRubberBanding)
{
- m_page->setHorizontalScrollElasticity(enableHorizontalRubberBanding ? ScrollElasticityAllowed : ScrollElasticityNone);
+ m_page->setHorizontalScrollElasticity(enableHorizontalRubberBanding ? ScrollElasticity::Allowed : ScrollElasticity::None);
}
void WebPage::setBackgroundExtendsBeyondPage(bool backgroundExtendsBeyondPage)