Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1058)

Unified Diff: third_party/WebKit/Source/core/events/MouseEvent.cpp

Issue 2832073003: Send mouse events for disabled form controls. (Closed)
Patch Set: Rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/events/MouseEvent.cpp
diff --git a/third_party/WebKit/Source/core/events/MouseEvent.cpp b/third_party/WebKit/Source/core/events/MouseEvent.cpp
index ae1da564be060c79e755b2e07b32b77cddc9a3e5..e5c12ba5b42af861a63276341235636918b9dc90 100644
--- a/third_party/WebKit/Source/core/events/MouseEvent.cpp
+++ b/third_party/WebKit/Source/core/events/MouseEvent.cpp
@@ -439,10 +439,19 @@ DispatchEventResult MouseEventDispatchMediator::DispatchEvent(
mouse_event.GetEventPath().AdjustForRelatedTarget(
dispatcher.GetNode(), mouse_event.relatedTarget());
+ bool is_click = mouse_event.type() == EventTypeNames::click;
+ bool send_to_disabled_forms =
jbroman 2017/04/24 18:19:49 super-nit: send_to_disabled_controls or something
dtapuska 2017/04/24 19:14:39 Done.
+ RuntimeEnabledFeatures::sendMouseEventsDisabledFormControlsEnabled();
+
+ if (send_to_disabled_forms && is_click &&
+ mouse_event.GetEventPath().DisabledFormControlExistsInPath()) {
+ return DispatchEventResult::kCanceledBeforeDispatch;
+ }
+
if (!mouse_event.isTrusted())
jbroman 2017/04/24 18:19:49 Does the layout test cover the logic beyond this p
dtapuska 2017/04/24 19:14:39 Yes that is correct. But the changed logic is *bef
return dispatcher.Dispatch();
- if (IsDisabledFormControl(&dispatcher.GetNode()))
+ if (!send_to_disabled_forms && IsDisabledFormControl(&dispatcher.GetNode()))
return DispatchEventResult::kCanceledBeforeDispatch;
if (mouse_event.type().IsEmpty())
@@ -455,7 +464,7 @@ DispatchEventResult MouseEventDispatchMediator::DispatchEvent(
DispatchEventResult dispatch_result = dispatcher.Dispatch();
- if (mouse_event.type() != EventTypeNames::click || mouse_event.detail() != 2)
+ if (!is_click || mouse_event.detail() != 2)
return dispatch_result;
// Special case: If it's a double click event, we also send the dblclick

Powered by Google App Engine
This is Rietveld 408576698