Title: [287252] trunk/Source/WebCore
- Revision
- 287252
- Author
- simon.fra...@apple.com
- Date
- 2021-12-19 19:37:38 -0800 (Sun, 19 Dec 2021)
Log Message
Minor cleanup in aisle EventHandler::handleWheelEventInAppropriateEnclosingBox()
https://bugs.webkit.org/show_bug.cgi?id=234493
Reviewed by Wenson Hsieh.
Remove a confusing RenderListBox special case, which simply existed because the loop
below didn't know how to get a ScrollableArea for a RenderListBox.
Also rename didScrollInScrollableArea() to scrollViaNonPlatformEvent() because
the past tense in the name was inaccurate.
* page/EventHandler.cpp:
(WebCore::scrollViaNonPlatformEvent):
(WebCore::EventHandler::handleWheelEventInAppropriateEnclosingBox):
(WebCore::didScrollInScrollableArea): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (287251 => 287252)
--- trunk/Source/WebCore/ChangeLog 2021-12-20 03:22:44 UTC (rev 287251)
+++ trunk/Source/WebCore/ChangeLog 2021-12-20 03:37:38 UTC (rev 287252)
@@ -1,5 +1,23 @@
2021-12-19 Simon Fraser <simon.fra...@apple.com>
+ Minor cleanup in aisle EventHandler::handleWheelEventInAppropriateEnclosingBox()
+ https://bugs.webkit.org/show_bug.cgi?id=234493
+
+ Reviewed by Wenson Hsieh.
+
+ Remove a confusing RenderListBox special case, which simply existed because the loop
+ below didn't know how to get a ScrollableArea for a RenderListBox.
+
+ Also rename didScrollInScrollableArea() to scrollViaNonPlatformEvent() because
+ the past tense in the name was inaccurate.
+
+ * page/EventHandler.cpp:
+ (WebCore::scrollViaNonPlatformEvent):
+ (WebCore::EventHandler::handleWheelEventInAppropriateEnclosingBox):
+ (WebCore::didScrollInScrollableArea): Deleted.
+
+2021-12-19 Simon Fraser <simon.fra...@apple.com>
+
Remove EventHandler::scrollDistance()
https://bugs.webkit.org/show_bug.cgi?id=234494
Modified: trunk/Source/WebCore/page/EventHandler.cpp (287251 => 287252)
--- trunk/Source/WebCore/page/EventHandler.cpp 2021-12-20 03:22:44 UTC (rev 287251)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2021-12-20 03:37:38 UTC (rev 287252)
@@ -3048,7 +3048,7 @@
#endif
}
-static bool didScrollInScrollableArea(ScrollableArea& scrollableArea, const WheelEvent& wheelEvent)
+static bool scrollViaNonPlatformEvent(ScrollableArea& scrollableArea, const WheelEvent& wheelEvent)
{
ScrollGranularity scrollGranularity = wheelGranularityToScrollGranularity(wheelEvent.deltaMode());
bool didHandleWheelEvent = false;
@@ -3080,12 +3080,19 @@
if (!shouldHandleEvent)
return false;
- if (is<RenderListBox>(initialEnclosingBox))
- return didScrollInScrollableArea(downcast<RenderListBox>(initialEnclosingBox), wheelEvent);
+ auto scrollableAreaForBox = [](RenderBox& box) -> ScrollableArea* {
+ if (is<RenderListBox>(box))
+ return &downcast<RenderListBox>(box);
+ if (box.hasLayer())
+ return box.layer()->scrollableArea();
+
+ return nullptr;
+ };
+
RenderBox* currentEnclosingBox = &initialEnclosingBox;
while (currentEnclosingBox) {
- if (auto* boxScrollableArea = currentEnclosingBox->layer() ? currentEnclosingBox->layer()->scrollableArea() : nullptr) {
+ if (auto* boxScrollableArea = scrollableAreaForBox(*currentEnclosingBox)) {
auto platformEvent = wheelEvent.underlyingPlatformEvent();
bool scrollingWasHandled;
if (platformEvent) {
@@ -3092,7 +3099,7 @@
auto copiedEvent = platformEvent->copyWithDeltaAndVelocity(filteredPlatformDelta, filteredVelocity);
scrollingWasHandled = scrollableAreaCanHandleEvent(copiedEvent, *boxScrollableArea) && handleWheelEventInScrollableArea(copiedEvent, *boxScrollableArea, eventHandling);
} else
- scrollingWasHandled = didScrollInScrollableArea(*boxScrollableArea, wheelEvent);
+ scrollingWasHandled = scrollViaNonPlatformEvent(*boxScrollableArea, wheelEvent);
if (scrollingWasHandled)
return true;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes