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

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

Issue 2586133003: Remove PlatformWheelEvent and use WebMouseWheelEvent instead (Closed)
Patch Set: Address comments Created 3 years, 12 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 6d6f1cf54b48f08ee03e6a209cc1a3c249ec5df0..5d64a5f5e3706ea417a46679bf28ccade7d680b9 100644
--- a/third_party/WebKit/Source/core/events/MouseEvent.cpp
+++ b/third_party/WebKit/Source/core/events/MouseEvent.cpp
@@ -186,6 +186,40 @@ MouseEvent::MouseEvent(
bool canBubble,
bool cancelable,
AbstractView* abstractView,
+ PlatformMouseEvent::SyntheticEventType syntheticEventType,
+ const String& region,
+ const WebMouseEvent& event)
+ : UIEventWithKeyState(
+ eventType,
+ canBubble,
+ cancelable,
+ abstractView,
+ 0,
+ static_cast<PlatformEvent::Modifiers>(event.modifiers),
+ TimeTicks::FromSeconds(event.timeStampSeconds),
+ syntheticEventType == PlatformMouseEvent::FromTouch
+ ? InputDeviceCapabilities::firesTouchEventsSourceCapabilities()
+ : InputDeviceCapabilities::
+ doesntFireTouchEventsSourceCapabilities()),
+ m_screenLocation(event.globalX, event.globalY),
+ m_movementDelta(flooredIntPoint(event.movementInRootFrame())),
+ m_positionType(syntheticEventType == PlatformMouseEvent::Positionless
+ ? PositionType::Positionless
+ : PositionType::Position),
+ m_button(0),
+ m_buttons(platformModifiersToButtons(event.modifiers)),
+ m_syntheticEventType(syntheticEventType),
+ m_region(region) {
+ IntPoint rootFrameCoordinates = flooredIntPoint(event.positionInRootFrame());
+ initCoordinatesFromRootFrame(rootFrameCoordinates.x(),
+ rootFrameCoordinates.y());
+}
+
+MouseEvent::MouseEvent(
+ const AtomicString& eventType,
+ bool canBubble,
+ bool cancelable,
+ AbstractView* abstractView,
int detail,
int screenX,
int screenY,
@@ -225,7 +259,39 @@ MouseEvent::MouseEvent(
m_region(region) {
if (mouseEvent)
m_mouseEvent.reset(new PlatformMouseEvent(*mouseEvent));
+ initCoordinatesFromRootFrame(windowX, windowY);
+}
+MouseEvent::MouseEvent(const AtomicString& eventType,
+ const MouseEventInit& initializer)
+ : UIEventWithKeyState(eventType, initializer),
+ m_screenLocation(
+ DoublePoint(initializer.screenX(), initializer.screenY())),
+ m_movementDelta(
+ IntPoint(initializer.movementX(), initializer.movementY())),
+ m_positionType(PositionType::Position),
+ m_button(initializer.button()),
+ m_buttons(initializer.buttons()),
+ m_relatedTarget(initializer.relatedTarget()),
+ m_syntheticEventType(PlatformMouseEvent::RealOrIndistinguishable),
+ m_region(initializer.region()) {
+ initCoordinates(initializer.clientX(), initializer.clientY());
+}
+
+void MouseEvent::initCoordinates(const double clientX, const double clientY) {
+ // Set up initial values for coordinates.
+ // Correct values are computed lazily, see computeRelativePosition.
+ m_clientLocation = DoublePoint(clientX, clientY);
+ m_pageLocation = m_clientLocation + DoubleSize(contentsScrollOffset(view()));
+
+ m_layerLocation = m_pageLocation;
+ m_offsetLocation = m_pageLocation;
+
+ computePageLocation();
+ m_hasCachedRelativePosition = false;
+}
+
+void MouseEvent::initCoordinatesFromRootFrame(int windowX, int windowY) {
DoublePoint adjustedPageLocation;
DoubleSize scrollOffset;
@@ -257,35 +323,6 @@ MouseEvent::MouseEvent(
m_hasCachedRelativePosition = false;
}
-MouseEvent::MouseEvent(const AtomicString& eventType,
- const MouseEventInit& initializer)
- : UIEventWithKeyState(eventType, initializer),
- m_screenLocation(
- DoublePoint(initializer.screenX(), initializer.screenY())),
- m_movementDelta(
- IntPoint(initializer.movementX(), initializer.movementY())),
- m_positionType(PositionType::Position),
- m_button(initializer.button()),
- m_buttons(initializer.buttons()),
- m_relatedTarget(initializer.relatedTarget()),
- m_syntheticEventType(PlatformMouseEvent::RealOrIndistinguishable),
- m_region(initializer.region()) {
- initCoordinates(initializer.clientX(), initializer.clientY());
-}
-
-void MouseEvent::initCoordinates(const double clientX, const double clientY) {
- // Set up initial values for coordinates.
- // Correct values are computed lazily, see computeRelativePosition.
- m_clientLocation = DoublePoint(clientX, clientY);
- m_pageLocation = m_clientLocation + DoubleSize(contentsScrollOffset(view()));
-
- m_layerLocation = m_pageLocation;
- m_offsetLocation = m_pageLocation;
-
- computePageLocation();
- m_hasCachedRelativePosition = false;
-}
-
MouseEvent::~MouseEvent() {}
unsigned short MouseEvent::platformModifiersToButtons(unsigned modifiers) {

Powered by Google App Engine
This is Rietveld 408576698