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

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

Issue 2227563003: Refactoring button field and its type (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix new instances Created 4 years, 4 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 77e22e2fbff9203f84dcd29a7b5c229a2ed92978..730fd1040920a0141cdba20dc00b4c77d69dacc9 100644
--- a/third_party/WebKit/Source/core/events/MouseEvent.cpp
+++ b/third_party/WebKit/Source/core/events/MouseEvent.cpp
@@ -27,6 +27,7 @@
#include "core/dom/Element.h"
#include "core/events/EventDispatcher.h"
#include "platform/PlatformMouseEvent.h"
+#include "public/platform/WebPointerProperties.h"
namespace blink {
@@ -39,7 +40,7 @@ MouseEvent* MouseEvent::create(ScriptState* scriptState, const AtomicString& typ
MouseEvent* MouseEvent::create(const AtomicString& eventType, AbstractView* view, const PlatformMouseEvent& event, int detail, Node* relatedTarget)
{
- ASSERT(event.type() == PlatformEvent::MouseMoved || event.button() != NoButton);
+ DCHECK(event.type() == PlatformEvent::MouseMoved || event.pointerProperties().button != WebPointerProperties::Button::NoButton);
bool isMouseEnterOrLeave = eventType == EventTypeNames::mouseenter || eventType == EventTypeNames::mouseleave;
bool isCancelable = !isMouseEnterOrLeave;
@@ -49,7 +50,7 @@ MouseEvent* MouseEvent::create(const AtomicString& eventType, AbstractView* view
eventType, isBubbling, isCancelable, view,
detail, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y(),
event.movementDelta().x(), event.movementDelta().y(),
- event.getModifiers(), event.button(),
+ event.getModifiers(), static_cast<short>(event.pointerProperties().button),
platformModifiersToButtons(event.getModifiers()),
relatedTarget, event.timestamp(), event.getSyntheticEventType(), event.region());
}
@@ -160,22 +161,6 @@ unsigned short MouseEvent::platformModifiersToButtons(unsigned modifiers)
return buttons;
}
-unsigned short MouseEvent::buttonToButtons(short button)
-{
- switch (button) {
- case NoButton:
- return static_cast<unsigned short>(Buttons::None);
- case LeftButton:
- return static_cast<unsigned short>(Buttons::Left);
- case RightButton:
- return static_cast<unsigned short>(Buttons::Right);
- case MiddleButton:
- return static_cast<unsigned short>(Buttons::Middle);
- }
- ASSERT_NOT_REACHED();
- return 0;
-}
-
void MouseEvent::initMouseEvent(ScriptState* scriptState, const AtomicString& type, bool canBubble, bool cancelable, AbstractView* view,
int detail, int screenX, int screenY, int clientX, int clientY,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
@@ -284,7 +269,7 @@ DispatchEventResult MouseEventDispatchMediator::dispatchEvent(EventDispatcher& d
if (mouseEvent.type().isEmpty())
return DispatchEventResult::NotCanceled; // Shouldn't happen.
- ASSERT(!mouseEvent.target() || mouseEvent.target() != mouseEvent.relatedTarget());
+ DCHECK(!mouseEvent.target() || mouseEvent.target() != mouseEvent.relatedTarget());
EventTarget* relatedTarget = mouseEvent.relatedTarget();
« no previous file with comments | « third_party/WebKit/Source/core/events/MouseEvent.h ('k') | third_party/WebKit/Source/core/events/PointerEventFactory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698