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

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

Issue 1479923002: Enumerate the return value of dispatchEvent so it is clear. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_passive_uma_add
Patch Set: Rebase Created 5 years 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 519e0df6a521a5757d61d0b6f76d26f8f2366ffa..5db92c82f7a719c752766550a553dd50b86bcddb 100644
--- a/third_party/WebKit/Source/core/events/MouseEvent.cpp
+++ b/third_party/WebKit/Source/core/events/MouseEvent.cpp
@@ -251,7 +251,7 @@ MouseEvent& MouseEventDispatchMediator::event() const
return toMouseEvent(EventDispatchMediator::event());
}
-bool MouseEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) const
+WebInputEventResult MouseEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) const
{
MouseEvent& mouseEvent = event();
if (!mouseEvent.isTrusted()) {
@@ -260,21 +260,20 @@ bool MouseEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) cons
}
if (isDisabledFormControl(&dispatcher.node()))
- return false;
+ return WebInputEventResult::HandledSuppressed;
if (mouseEvent.type().isEmpty())
- return true; // Shouldn't happen.
+ return WebInputEventResult::NotHandled; // Shouldn't happen.
ASSERT(!mouseEvent.target() || mouseEvent.target() != mouseEvent.relatedTarget());
EventTarget* relatedTarget = mouseEvent.relatedTarget();
mouseEvent.eventPath().adjustForRelatedTarget(dispatcher.node(), relatedTarget);
- dispatcher.dispatch();
- bool swallowEvent = mouseEvent.defaultHandled() || mouseEvent.defaultPrevented();
+ WebInputEventResult result = dispatcher.dispatch();
if (mouseEvent.type() != EventTypeNames::click || mouseEvent.detail() != 2)
- return !swallowEvent;
+ return result;
// Special case: If it's a double click event, we also send the dblclick event. This is not part
// of the DOM specs, but is used for compatibility with the ondblclick="" attribute. This is treated
@@ -288,10 +287,10 @@ bool MouseEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) cons
doubleClickEvent->setTrusted(mouseEvent.isTrusted());
if (mouseEvent.defaultHandled())
doubleClickEvent->setDefaultHandled();
- EventDispatcher::dispatchEvent(dispatcher.node(), MouseEventDispatchMediator::create(doubleClickEvent));
- if (doubleClickEvent->defaultHandled() || doubleClickEvent->defaultPrevented())
- return false;
- return !swallowEvent;
+ WebInputEventResult doubleClickEventResult = EventDispatcher::dispatchEvent(dispatcher.node(), MouseEventDispatchMediator::create(doubleClickEvent));
+ if (result != WebInputEventResult::NotHandled)
+ return result;
+ return doubleClickEventResult;
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698