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

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: Fix typo Created 4 years, 10 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 9b8d3e1aedffc63db881c837e0fbcaa824911947..9f86063f928b43656279cc79e7cf8f73321be5a5 100644
--- a/third_party/WebKit/Source/core/events/MouseEvent.cpp
+++ b/third_party/WebKit/Source/core/events/MouseEvent.cpp
@@ -266,7 +266,7 @@ MouseEvent& MouseEventDispatchMediator::event() const
return toMouseEvent(EventDispatchMediator::event());
}
-bool MouseEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) const
+DispatchEventResult MouseEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) const
{
MouseEvent& mouseEvent = event();
if (!mouseEvent.isTrusted()) {
@@ -275,21 +275,20 @@ bool MouseEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) cons
}
if (isDisabledFormControl(&dispatcher.node()))
- return false;
+ return DispatchEventResult::CanceledBeforeDispatch;
if (mouseEvent.type().isEmpty())
- return true; // Shouldn't happen.
+ return DispatchEventResult::NotCanceled; // 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();
+ DispatchEventResult dispatchResult = dispatcher.dispatch();
if (mouseEvent.type() != EventTypeNames::click || mouseEvent.detail() != 2)
- return !swallowEvent;
+ return dispatchResult;
// 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
@@ -303,10 +302,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;
+ DispatchEventResult doubleClickDispatchResult = EventDispatcher::dispatchEvent(dispatcher.node(), MouseEventDispatchMediator::create(doubleClickEvent));
+ if (doubleClickDispatchResult != DispatchEventResult::NotCanceled)
+ return doubleClickDispatchResult;
+ return dispatchResult;
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/events/MouseEvent.h ('k') | third_party/WebKit/Source/core/events/PointerEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698