Changeset 245286 in webkit
- Timestamp:
- May 14, 2019 9:50:37 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r245285 r245286 1 2019-05-14 Antoine Quint <graouts@apple.com> 2 3 [Pointer Events] The pointerenter and pointerleave events target the wrong element on iOS 4 https://bugs.webkit.org/show_bug.cgi?id=197881 5 <rdar://problem/50187657> 6 7 Reviewed by Dean Jackson. 8 9 Add a test where we tap an element that is the child of another element where the parent is the element with the "pointerenter" 10 and "pointerleave" events registered. The test shows that we correctly set the target to the parent element and not the child. 11 12 * pointerevents/ios/enter-leave-target-expected.txt: Added. 13 * pointerevents/ios/enter-leave-target.html: Added. 14 1 15 2019-05-14 Daniel Bates <dabates@apple.com> 2 16 -
trunk/Source/WebCore/ChangeLog
r245280 r245286 1 2019-05-14 Antoine Quint <graouts@apple.com> 2 3 [Pointer Events] The pointerenter and pointerleave events target the wrong element on iOS 4 https://bugs.webkit.org/show_bug.cgi?id=197881 5 <rdar://problem/50187657> 6 7 Reviewed by Dean Jackson. 8 9 Test: pointerevents/ios/enter-leave-target.html 10 11 The "pointerenter" and "pointerleave" should target the element on which the event listener was added and not 12 the element that would otherwise hit test. This matches the behavior of "mouseenter" and "mouseleave" on macOS. 13 14 * page/PointerCaptureController.cpp: 15 (WebCore::PointerCaptureController::dispatchEventForTouchAtIndex): 16 1 17 2019-05-14 Said Abou-Hallawa <sabouhallawa@apple.com> 2 18 -
trunk/Source/WebCore/page/PointerCaptureController.cpp
r245020 r245286 165 165 }; 166 166 167 auto dispatchEnterOrLeaveEvent = [&](const String& type) { 168 if (!is<Element>(&target)) 169 return; 170 171 auto* targetElement = &downcast<Element>(target); 172 173 bool hasCapturingListenerInHierarchy = false; 174 for (ContainerNode* curr = targetElement; curr; curr = curr->parentInComposedTree()) { 175 if (curr->hasCapturingEventListeners(type)) { 176 hasCapturingListenerInHierarchy = true; 177 break; 178 } 179 } 180 181 for (Element* element = &downcast<Element>(target); element; element = element->parentElementInComposedTree()) { 182 if (hasCapturingListenerInHierarchy || element->hasEventListeners(type)) 183 element->dispatchEvent(PointerEvent::create(type, platformTouchEvent, index, isPrimary, view)); 184 } 185 }; 186 167 187 auto pointerEvent = PointerEvent::create(platformTouchEvent, index, isPrimary, view); 168 188 … … 172 192 // pointerenter prior to dispatching the pointerdown event. 173 193 dispatchEvent(eventNames().pointeroverEvent); 174 dispatchE vent(eventNames().pointerenterEvent);194 dispatchEnterOrLeaveEvent(eventNames().pointerenterEvent); 175 195 } 176 196 … … 184 204 // pointer event named pointerleave after dispatching the pointerup event. 185 205 dispatchEvent(eventNames().pointeroutEvent); 186 dispatchE vent(eventNames().pointerleaveEvent);206 dispatchEnterOrLeaveEvent(eventNames().pointerleaveEvent); 187 207 } 188 208 }
Note: See TracChangeset
for help on using the changeset viewer.