Title: [277463] trunk/Source/WebCore
- Revision
- 277463
- Author
- drou...@apple.com
- Date
- 2021-05-13 16:20:07 -0700 (Thu, 13 May 2021)
Log Message
[iOS] REGRESSION(r271216) pointerevents/ios/pointer-events-no-mousedown-when-prevent-default-called-on-pointerdown.html is consistently failing
https://bugs.webkit.org/show_bug.cgi?id=225734
<rdar://problem/77070765>
Reviewed by Tim Horton.
r271216 made it so that `touchWithIdentifierWasRemoved` is eagerly called when dispatching
`"pointerup"` for a touch event. This is problematic because (compatibility) mouse events
are dispatched after both pointer and touch events, meaning that if the `CapturingData` for
the touch event is removed, there's no way of knowing if the pointer event `preventDefault`.
Instead of fully removing the `CapturingData` entirely, change its state such that it's
marked as `CapturingData::State::Finished` and check for that instead.
* page/PointerCaptureController.h:
* page/PointerCaptureController.cpp:
(WebCore::PointerCaptureController::hasCancelledPointerEventForIdentifier const):
(WebCore::PointerCaptureController::dispatchEventForTouchAtIndex):
(WebCore::PointerCaptureController::pointerEventForMouseEvent):
(WebCore::PointerCaptureController::cancelPointer):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (277462 => 277463)
--- trunk/Source/WebCore/ChangeLog 2021-05-13 23:19:48 UTC (rev 277462)
+++ trunk/Source/WebCore/ChangeLog 2021-05-13 23:20:07 UTC (rev 277463)
@@ -1,3 +1,26 @@
+2021-05-13 Devin Rousso <drou...@apple.com>
+
+ [iOS] REGRESSION(r271216) pointerevents/ios/pointer-events-no-mousedown-when-prevent-default-called-on-pointerdown.html is consistently failing
+ https://bugs.webkit.org/show_bug.cgi?id=225734
+ <rdar://problem/77070765>
+
+ Reviewed by Tim Horton.
+
+ r271216 made it so that `touchWithIdentifierWasRemoved` is eagerly called when dispatching
+ `"pointerup"` for a touch event. This is problematic because (compatibility) mouse events
+ are dispatched after both pointer and touch events, meaning that if the `CapturingData` for
+ the touch event is removed, there's no way of knowing if the pointer event `preventDefault`.
+
+ Instead of fully removing the `CapturingData` entirely, change its state such that it's
+ marked as `CapturingData::State::Finished` and check for that instead.
+
+ * page/PointerCaptureController.h:
+ * page/PointerCaptureController.cpp:
+ (WebCore::PointerCaptureController::hasCancelledPointerEventForIdentifier const):
+ (WebCore::PointerCaptureController::dispatchEventForTouchAtIndex):
+ (WebCore::PointerCaptureController::pointerEventForMouseEvent):
+ (WebCore::PointerCaptureController::cancelPointer):
+
2021-05-13 Cameron McCormack <hey...@apple.com>
Ensure scrollable transformed elements that are themselves within scrollable elements don't ignore border-radius
Modified: trunk/Source/WebCore/page/PointerCaptureController.cpp (277462 => 277463)
--- trunk/Source/WebCore/page/PointerCaptureController.cpp 2021-05-13 23:19:48 UTC (rev 277462)
+++ trunk/Source/WebCore/page/PointerCaptureController.cpp 2021-05-13 23:20:07 UTC (rev 277463)
@@ -193,7 +193,7 @@
bool PointerCaptureController::hasCancelledPointerEventForIdentifier(PointerID pointerId) const
{
auto iterator = m_activePointerIdsToCapturingData.find(pointerId);
- return iterator != m_activePointerIdsToCapturingData.end() && iterator->value.cancelled;
+ return iterator != m_activePointerIdsToCapturingData.end() && iterator->value.state == CapturingData::State::Cancelled;
}
bool PointerCaptureController::preventsCompatibilityMouseEventsForIdentifier(PointerID pointerId) const
@@ -316,8 +316,7 @@
dispatchOverOrOutEvent(eventNames().pointeroutEvent, currentTarget.get());
dispatchEnterOrLeaveEvent(eventNames().pointerleaveEvent);
capturingData.previousTarget = nullptr;
-
- touchWithIdentifierWasRemoved(pointerEvent->pointerId());
+ capturingData.state = CapturingData::State::Finished;
}
}
#endif
@@ -327,7 +326,7 @@
// If we already have known touches then we cannot dispatch a mouse event,
// for instance in the case of a long press to initiate a system drag.
for (auto& capturingData : m_activePointerIdsToCapturingData.values()) {
- if (capturingData.pointerType == touchPointerEventType() && capturingData.pointerIsPressed && !capturingData.cancelled)
+ if (capturingData.pointerType == touchPointerEventType() && capturingData.state == CapturingData::State::Ready)
return nullptr;
}
@@ -484,11 +483,11 @@
return;
auto& capturingData = iterator->value;
- if (capturingData.cancelled)
+ if (capturingData.state == CapturingData::State::Cancelled)
return;
capturingData.pendingTargetOverride = nullptr;
- capturingData.cancelled = true;
+ capturingData.state = CapturingData::State::Cancelled;
#if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS_FAMILY)
capturingData.previousTarget = nullptr;
Modified: trunk/Source/WebCore/page/PointerCaptureController.h (277462 => 277463)
--- trunk/Source/WebCore/page/PointerCaptureController.h 2021-05-13 23:19:48 UTC (rev 277462)
+++ trunk/Source/WebCore/page/PointerCaptureController.h 2021-05-13 23:20:07 UTC (rev 277463)
@@ -83,7 +83,12 @@
;
}
String pointerType;
- bool cancelled { false };
+ enum class State : uint8_t {
+ Ready,
+ Finished,
+ Cancelled,
+ };
+ State state { State::Ready };
bool isPrimary { false };
bool preventsCompatibilityMouseEvents { false };
bool pointerIsPressed { false };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes