Changeset 238409 in webkit
- Timestamp:
- Nov 20, 2018 4:12:25 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r238393 r238409 1 2018-11-20 Ryosuke Niwa <rniwa@webkit.org> 2 3 Input element gains focus when a selectstart event listener on document prevents the default action 4 https://bugs.webkit.org/show_bug.cgi?id=191714 5 <rdar://problem/46174389> 6 7 Reviewed by Antti Koivisto. 8 9 Added a regression test. 10 11 * fast/events/selectstart-prevent-default-should-not-focus-input-expected.txt: Added. 12 * fast/events/selectstart-prevent-default-should-not-focus-input.html: Added. 13 * platform/ios/TestExpectations: 14 1 15 2018-11-19 Ryosuke Niwa <rniwa@webkit.org> 2 16 -
trunk/LayoutTests/platform/ios/TestExpectations
r238375 r238409 530 530 fast/events/selectstart-by-single-click-with-shift.html [ Skip ] 531 531 fast/events/selectstart-prevent-selection-on-right-click.html [ Skip ] 532 fast/events/selectstart-prevent-default-should-not-focus-input.html [ Skip ] 532 533 fast/events/shadow-event-path-2.html [ Skip ] 533 534 fast/events/shadow-event-path.html [ Skip ] -
trunk/Source/WebCore/ChangeLog
r238406 r238409 1 2018-11-20 Ryosuke Niwa <rniwa@webkit.org> 2 3 Input element gains focus when a selectstart event listener on document prevents the default action 4 https://bugs.webkit.org/show_bug.cgi?id=191714 5 <rdar://problem/46174389> 6 7 Reviewed by Antti Koivisto. 8 9 The bug was caused by WebKit keep firing selectstart upon mousemove after the drag had already started 10 when preventDefault had been called in the previous firings of selectstart event. Because input element 11 has its own editable element and fires selectstart on the input element itself, which won't be prevented 12 by selectstart on docuemnt, this allowed the selection to be set inside the input element even though 13 the mouse cursor was simply passing over the input element after the drag had already started. 14 15 Fixed the bug by not firing selectstart if the default action had been prevented by the initial firing 16 of selectstart by setting m_mouseDownMayStartDrag to false. This also matches the behaviors of Chrome 17 and Firefox. 18 19 Test: fast/events/selectstart-prevent-default-should-not-focus-input.html 20 21 * page/EventHandler.cpp: 22 (WebCore::EventHandler::updateSelectionForMouseDownDispatchingSelectStart): 23 (WebCore::EventHandler::updateSelectionForMouseDrag): 24 1 25 2018-11-20 Christopher Reid <chris.reid@sony.com> 2 26 -
trunk/Source/WebCore/page/EventHandler.cpp
r238393 r238409 511 511 return false; 512 512 513 if (!dispatchSelectStart(targetNode)) 514 return false; 513 if (!dispatchSelectStart(targetNode)) { 514 m_mouseDownMayStartSelect = false; 515 return false; 516 } 515 517 516 518 if (selection.isRange()) … … 954 956 // Special case to limit selection to the containing block for SVG text. 955 957 // FIXME: Isn't there a better non-SVG-specific way to do this? 956 if (Node* selectionBaseNode = newSelection.base().deprecatedNode()) 957 if (RenderObject* selectionBaseRenderer = selectionBaseNode->renderer()) 958 if (selectionBaseRenderer->isSVGText()) 958 if (Node* selectionBaseNode = newSelection.base().deprecatedNode()) { 959 if (RenderObject* selectionBaseRenderer = selectionBaseNode->renderer()) { 960 if (selectionBaseRenderer->isSVGText()) { 959 961 if (target->renderer()->containingBlock() != selectionBaseRenderer->containingBlock()) 960 962 return; 961 962 if (m_selectionInitiationState == HaveNotStartedSelection && !dispatchSelectStart(target)) 963 return; 963 } 964 } 965 } 966 967 968 if (m_selectionInitiationState == HaveNotStartedSelection && !dispatchSelectStart(target)) { 969 m_mouseDownMayStartSelect = false; 970 return; 971 } 964 972 965 973 if (m_selectionInitiationState != ExtendedSelection) {
Note: See TracChangeset
for help on using the changeset viewer.