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

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

Issue 2832073003: Send mouse events for disabled form controls. (Closed)
Patch Set: Fix nits 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..4b4f1ef599d43784b0e9b36299350a0957b6559c 100644
--- a/third_party/WebKit/Source/core/events/MouseEvent.cpp
+++ b/third_party/WebKit/Source/core/events/MouseEvent.cpp
@@ -439,10 +439,20 @@ DispatchEventResult MouseEventDispatchMediator::DispatchEvent(
mouse_event.GetEventPath().AdjustForRelatedTarget(
dispatcher.GetNode(), mouse_event.relatedTarget());
+ bool is_click = mouse_event.type() == EventTypeNames::click;
+ bool send_to_disabled_form_controls =
+ RuntimeEnabledFeatures::sendMouseEventsDisabledFormControlsEnabled();
+
+ if (send_to_disabled_form_controls && is_click &&
+ mouse_event.GetEventPath().DisabledFormControlExistsInPath()) {
+ return DispatchEventResult::kCanceledBeforeDispatch;
+ }
+
if (!mouse_event.isTrusted())
return dispatcher.Dispatch();
- if (IsDisabledFormControl(&dispatcher.GetNode()))
+ if (!send_to_disabled_form_controls &&
+ IsDisabledFormControl(&dispatcher.GetNode()))
return DispatchEventResult::kCanceledBeforeDispatch;
if (mouse_event.type().IsEmpty())
@@ -455,7 +465,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
« no previous file with comments | « third_party/WebKit/Source/core/events/EventPath.cpp ('k') | third_party/WebKit/Source/core/html/HTMLSelectElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698