- Revision
- 259154
- Author
- [email protected]
- Date
- 2020-03-27 21:21:03 -0700 (Fri, 27 Mar 2020)
Log Message
Define ENABLE_WHEEL_EVENT_LATCHING and use it to wrap wheel event latching code
https://bugs.webkit.org/show_bug.cgi?id=209693
Reviewed by Zalan Bujtas.
Source/WebCore:
Replace some #if PLATFORM(MAC) with #if ENABLE(WHEEL_EVENT_LATCHING).
ENABLE_WHEEL_EVENT_LATCHING is currently only enabled on macOS, but it's possible
that it should be defined everywhere that ENABLE_KINETIC_SCROLLING is defined.
This requires testing on WPE, GTK etc.
* page/EventHandler.cpp:
(WebCore::handleWheelEventInAppropriateEnclosingBox):
(WebCore::EventHandler::handleWheelEvent):
(WebCore::EventHandler::clearLatchedState):
(WebCore::EventHandler::defaultWheelEventHandler):
* page/Page.cpp:
* page/Page.h:
Source/WTF:
Define ENABLE_WHEEL_EVENT_LATCHING for macOS.
* wtf/PlatformEnable.h:
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (259153 => 259154)
--- trunk/Source/WTF/ChangeLog 2020-03-28 04:17:00 UTC (rev 259153)
+++ trunk/Source/WTF/ChangeLog 2020-03-28 04:21:03 UTC (rev 259154)
@@ -1,3 +1,14 @@
+2020-03-27 Simon Fraser <[email protected]>
+
+ Define ENABLE_WHEEL_EVENT_LATCHING and use it to wrap wheel event latching code
+ https://bugs.webkit.org/show_bug.cgi?id=209693
+
+ Reviewed by Zalan Bujtas.
+
+ Define ENABLE_WHEEL_EVENT_LATCHING for macOS.
+
+ * wtf/PlatformEnable.h:
+
2020-03-27 Michael Catanzaro <[email protected]>
REGRESSION(r258857): Broke aarch64 JSCOnly CI
Modified: trunk/Source/WTF/wtf/PlatformEnable.h (259153 => 259154)
--- trunk/Source/WTF/wtf/PlatformEnable.h 2020-03-28 04:17:00 UTC (rev 259153)
+++ trunk/Source/WTF/wtf/PlatformEnable.h 2020-03-28 04:21:03 UTC (rev 259154)
@@ -828,6 +828,11 @@
#define ENABLE_KINETIC_SCROLLING 1
#endif
+#if PLATFORM(MAC)
+// FIXME: Maybe this can be combined with ENABLE_KINETIC_SCROLLING.
+#define ENABLE_WHEEL_EVENT_LATCHING 1
+#endif
+
#if !defined(ENABLE_SCROLLING_THREAD)
#if USE(NICOSIA)
#define ENABLE_SCROLLING_THREAD 1
Modified: trunk/Source/WebCore/ChangeLog (259153 => 259154)
--- trunk/Source/WebCore/ChangeLog 2020-03-28 04:17:00 UTC (rev 259153)
+++ trunk/Source/WebCore/ChangeLog 2020-03-28 04:21:03 UTC (rev 259154)
@@ -1,3 +1,24 @@
+2020-03-27 Simon Fraser <[email protected]>
+
+ Define ENABLE_WHEEL_EVENT_LATCHING and use it to wrap wheel event latching code
+ https://bugs.webkit.org/show_bug.cgi?id=209693
+
+ Reviewed by Zalan Bujtas.
+
+ Replace some #if PLATFORM(MAC) with #if ENABLE(WHEEL_EVENT_LATCHING).
+
+ ENABLE_WHEEL_EVENT_LATCHING is currently only enabled on macOS, but it's possible
+ that it should be defined everywhere that ENABLE_KINETIC_SCROLLING is defined.
+ This requires testing on WPE, GTK etc.
+
+ * page/EventHandler.cpp:
+ (WebCore::handleWheelEventInAppropriateEnclosingBox):
+ (WebCore::EventHandler::handleWheelEvent):
+ (WebCore::EventHandler::clearLatchedState):
+ (WebCore::EventHandler::defaultWheelEventHandler):
+ * page/Page.cpp:
+ * page/Page.h:
+
2020-03-27 Jack Lee <[email protected]>
Nullptr crash in CompositeEditCommand::moveParagraphs when inserting OL into uneditable parent.
Modified: trunk/Source/WebCore/page/EventHandler.cpp (259153 => 259154)
--- trunk/Source/WebCore/page/EventHandler.cpp 2020-03-28 04:17:00 UTC (rev 259153)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2020-03-28 04:21:03 UTC (rev 259154)
@@ -306,7 +306,7 @@
static inline bool handleWheelEventInAppropriateEnclosingBox(Node* startNode, WheelEvent& wheelEvent, RefPtr<Element>& stopElement, const FloatSize& filteredPlatformDelta, const FloatSize& filteredVelocity)
{
bool shouldHandleEvent = wheelEvent.deltaX() || wheelEvent.deltaY();
-#if PLATFORM(MAC)
+#if ENABLE(WHEEL_EVENT_LATCHING)
shouldHandleEvent |= wheelEvent.phase() == PlatformWheelEventPhaseEnded;
#if ENABLE(CSS_SCROLL_SNAP)
shouldHandleEvent |= wheelEvent.momentumPhase() == PlatformWheelEventPhaseEnded;
@@ -2850,7 +2850,7 @@
bool isOverWidget = result.isOverWidget();
platformPrepareForWheelEvents(event, result, element, scrollableContainer, scrollableArea, isOverWidget);
-#if PLATFORM(MAC)
+#if ENABLE(WHEEL_EVENT_LATCHING)
if (event.phase() == PlatformWheelEventPhaseNone && event.momentumPhase() == PlatformWheelEventPhaseNone && m_frame.page())
m_frame.page()->resetLatchingState();
#endif
@@ -2895,7 +2895,7 @@
if (!page)
return;
-#if PLATFORM(MAC)
+#if ENABLE(WHEEL_EVENT_LATCHING)
page->resetLatchingState();
#endif
if (auto filter = page->wheelEventDeltaFilter())
@@ -2916,7 +2916,7 @@
filteredPlatformDelta.setHeight(platformWheelEvent->deltaY());
}
-#if PLATFORM(MAC)
+#if ENABLE(WHEEL_EVENT_LATCHING)
ScrollLatchingState* latchedState = m_frame.page() ? m_frame.page()->latchingState() : nullptr;
RefPtr<Element> stopElement = latchedState ? latchedState->previousWheelScrolledElement() : nullptr;
@@ -2931,7 +2931,7 @@
if (handleWheelEventInAppropriateEnclosingBox(startNode, wheelEvent, stopElement, filteredPlatformDelta, filteredVelocity))
wheelEvent.setDefaultHandled();
-#if PLATFORM(MAC)
+#if ENABLE(WHEEL_EVENT_LATCHING)
if (latchedState && !latchedState->wheelEventElement())
latchedState->setPreviousWheelScrolledElement(WTFMove(stopElement));
#endif
Modified: trunk/Source/WebCore/page/Page.cpp (259153 => 259154)
--- trunk/Source/WebCore/page/Page.cpp 2020-03-28 04:17:00 UTC (rev 259153)
+++ trunk/Source/WebCore/page/Page.cpp 2020-03-28 04:21:03 UTC (rev 259154)
@@ -2941,7 +2941,7 @@
#endif
}
-#if PLATFORM(MAC)
+#if ENABLE(WHEEL_EVENT_LATCHING)
ScrollLatchingState* Page::latchingState()
{
if (m_latchingState.isEmpty())
@@ -2978,7 +2978,7 @@
return targetNode.isEqualNode(wheelElement);
});
}
-#endif // PLATFORM(MAC)
+#endif // ENABLE(WHEEL_EVENT_LATCHING)
static void dispatchPrintEvent(Frame& mainFrame, const AtomString& eventType)
{
Modified: trunk/Source/WebCore/page/Page.h (259153 => 259154)
--- trunk/Source/WebCore/page/Page.h 2020-03-28 04:17:00 UTC (rev 259153)
+++ trunk/Source/WebCore/page/Page.h 2020-03-28 04:21:03 UTC (rev 259154)
@@ -428,13 +428,13 @@
ServicesOverlayController& servicesOverlayController() { return *m_servicesOverlayController; }
#endif
-#if PLATFORM(MAC)
+#if ENABLE(WHEEL_EVENT_LATCHING)
ScrollLatchingState* latchingState();
void pushNewLatchingState();
void popLatchingState();
void resetLatchingState();
void removeLatchingStateForTarget(Element&);
-#endif // PLATFORM(MAC)
+#endif // ENABLE(WHEEL_EVENT_LATCHING)
#if ENABLE(APPLE_PAY)
PaymentCoordinator& paymentCoordinator() const { return *m_paymentCoordinator; }
@@ -978,7 +978,7 @@
Optional<Navigation> m_navigationToLogWhenVisible;
std::unique_ptr<PerformanceLogging> m_performanceLogging;
-#if PLATFORM(MAC)
+#if ENABLE(WHEEL_EVENT_LATCHING)
Vector<ScrollLatchingState> m_latchingState;
#endif
#if PLATFORM(MAC) && (ENABLE(SERVICE_CONTROLS) || ENABLE(TELEPHONE_NUMBER_DETECTION))