Title: [266252] trunk/Source/WebCore
Revision
266252
Author
[email protected]
Date
2020-08-27 14:02:09 -0700 (Thu, 27 Aug 2020)

Log Message

ScrollLatchingState::previousWheelScrolledElement() is unused
https://bugs.webkit.org/show_bug.cgi?id=215881

Reviewed by Zalan Bujtas.

Scroll latching's previousWheelScrolledElement() was unused. It was never set since
we never end up with a null wheelEventElement. This functionality has been retained
from ancient code with little understanding of its utility.

* page/EventHandler.cpp:
(WebCore::handleWheelEventInAppropriateEnclosingBox):
(WebCore::EventHandler::defaultWheelEventHandler):
* page/scrolling/ScrollLatchingState.cpp:
(WebCore::ScrollLatchingState::clear):
(WebCore::operator<<):
(WebCore::ScrollLatchingState::setPreviousWheelScrolledElement): Deleted.
* page/scrolling/ScrollLatchingState.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (266251 => 266252)


--- trunk/Source/WebCore/ChangeLog	2020-08-27 20:11:57 UTC (rev 266251)
+++ trunk/Source/WebCore/ChangeLog	2020-08-27 21:02:09 UTC (rev 266252)
@@ -1,3 +1,23 @@
+2020-08-27  Simon Fraser  <[email protected]>
+
+        ScrollLatchingState::previousWheelScrolledElement() is unused
+        https://bugs.webkit.org/show_bug.cgi?id=215881
+
+        Reviewed by Zalan Bujtas.
+
+        Scroll latching's previousWheelScrolledElement() was unused. It was never set since
+        we never end up with a null wheelEventElement. This functionality has been retained
+        from ancient code with little understanding of its utility.
+
+        * page/EventHandler.cpp:
+        (WebCore::handleWheelEventInAppropriateEnclosingBox):
+        (WebCore::EventHandler::defaultWheelEventHandler):
+        * page/scrolling/ScrollLatchingState.cpp:
+        (WebCore::ScrollLatchingState::clear):
+        (WebCore::operator<<):
+        (WebCore::ScrollLatchingState::setPreviousWheelScrolledElement): Deleted.
+        * page/scrolling/ScrollLatchingState.h:
+
 2020-08-27  Wenson Hsieh  <[email protected]>
 
         Occasional crashes when restoring replaced text under Editor::changeBackToReplacedString

Modified: trunk/Source/WebCore/page/EventHandler.cpp (266251 => 266252)


--- trunk/Source/WebCore/page/EventHandler.cpp	2020-08-27 20:11:57 UTC (rev 266251)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2020-08-27 21:02:09 UTC (rev 266252)
@@ -315,7 +315,7 @@
     return didHandleWheelEvent;
 }
 
-static bool handleWheelEventInAppropriateEnclosingBox(Node* startNode, const WheelEvent& wheelEvent, RefPtr<Element>& stopElement, const FloatSize& filteredPlatformDelta, const FloatSize& filteredVelocity)
+static bool handleWheelEventInAppropriateEnclosingBox(Node* startNode, const WheelEvent& wheelEvent, const FloatSize& filteredPlatformDelta, const FloatSize& filteredVelocity)
 {
     bool shouldHandleEvent = wheelEvent.deltaX() || wheelEvent.deltaY();
 #if ENABLE(WHEEL_EVENT_LATCHING)
@@ -350,15 +350,10 @@
             } else
                 scrollingWasHandled = didScrollInScrollableArea(*boxLayer, wheelEvent);
 
-            if (scrollingWasHandled) {
-                stopElement = currentEnclosingBox->element();
+            if (scrollingWasHandled)
                 return true;
-            }
         }
 
-        if (stopElement.get() && stopElement.get() == currentEnclosingBox->element())
-            return true;
-
         currentEnclosingBox = currentEnclosingBox->containingBlock();
         if (!currentEnclosingBox || currentEnclosingBox->isRenderView())
             return false;
@@ -2993,11 +2988,7 @@
         filteredPlatformDelta.setHeight(platformWheelEvent->deltaY());
     }
 
-    RefPtr<Element> stopElement;
 #if ENABLE(WHEEL_EVENT_LATCHING)
-    ScrollLatchingState* latchedState = m_frame.page() ? m_frame.page()->latchingState() : nullptr;
-    stopElement = latchedState ? latchedState->previousWheelScrolledElement() : nullptr;
-
     if (m_frame.page() && m_frame.page()->wheelEventDeltaFilter()->isFilteringDeltas()) {
         filteredPlatformDelta = m_frame.page()->wheelEventDeltaFilter()->filteredDelta();
         filteredVelocity = m_frame.page()->wheelEventDeltaFilter()->filteredVelocity();
@@ -3004,13 +2995,8 @@
     }
 #endif
 
-    if (handleWheelEventInAppropriateEnclosingBox(startNode, wheelEvent, stopElement, filteredPlatformDelta, filteredVelocity))
+    if (handleWheelEventInAppropriateEnclosingBox(startNode, wheelEvent, filteredPlatformDelta, filteredVelocity))
         wheelEvent.setDefaultHandled();
-
-#if ENABLE(WHEEL_EVENT_LATCHING)
-    if (latchedState && !latchedState->wheelEventElement())
-        latchedState->setPreviousWheelScrolledElement(stopElement.get());
-#endif
 }
 
 #if ENABLE(CONTEXT_MENU_EVENT)

Modified: trunk/Source/WebCore/page/scrolling/ScrollLatchingState.cpp (266251 => 266252)


--- trunk/Source/WebCore/page/scrolling/ScrollLatchingState.cpp	2020-08-27 20:11:57 UTC (rev 266251)
+++ trunk/Source/WebCore/page/scrolling/ScrollLatchingState.cpp	2020-08-27 21:02:09 UTC (rev 266252)
@@ -41,7 +41,6 @@
     m_frame = nullptr;
     m_scrollableContainer = nullptr;
     m_widgetIsLatched = false;
-    m_previousWheelScrolledElement = nullptr;
 }
 
 void ScrollLatchingState::setWheelEventElement(Element* element)
@@ -54,11 +53,6 @@
     m_widgetIsLatched = isOverWidget;
 }
 
-void ScrollLatchingState::setPreviousWheelScrolledElement(Element* element)
-{
-    m_previousWheelScrolledElement = makeWeakPtr(element);
-}
-
 void ScrollLatchingState::setScrollableContainer(ContainerNode* container)
 {
     m_scrollableContainer = makeWeakPtr(container);
@@ -70,7 +64,6 @@
     multilineStream.setIndent(ts.indent() + 2);
 
     multilineStream.dumpProperty("element", state.wheelEventElement());
-    multilineStream.dumpProperty("previousElement", state.previousWheelScrolledElement());
     multilineStream.dumpProperty("scrollable container", state.scrollableContainer());
     multilineStream.dumpProperty("widgetIsLatched", state.widgetIsLatched());
 

Modified: trunk/Source/WebCore/page/scrolling/ScrollLatchingState.h (266251 => 266252)


--- trunk/Source/WebCore/page/scrolling/ScrollLatchingState.h	2020-08-27 20:11:57 UTC (rev 266251)
+++ trunk/Source/WebCore/page/scrolling/ScrollLatchingState.h	2020-08-27 21:02:09 UTC (rev 266252)
@@ -53,15 +53,11 @@
     bool widgetIsLatched() const { return m_widgetIsLatched; }
     void setWidgetIsLatched(bool isOverWidget);
 
-    Element* previousWheelScrolledElement() const { return m_previousWheelScrolledElement.get(); }
-    void setPreviousWheelScrolledElement(Element*);
-    
     ContainerNode* scrollableContainer() const { return m_scrollableContainer.get(); }
     void setScrollableContainer(ContainerNode*);
 
 private:
     WeakPtr<Element> m_wheelEventElement;
-    WeakPtr<Element> m_previousWheelScrolledElement;
     WeakPtr<ContainerNode> m_scrollableContainer;
 
     Frame* m_frame { nullptr };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to