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

Unified Diff: third_party/WebKit/Source/platform/WebMouseEvent.cpp

Issue 2782893002: WebMouseEvent coordinates are now fractional & private (Closed)
Patch Set: Rebased, fixed a comment in web_input_event_builders_mac.mm 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/platform/WebMouseEvent.cpp
diff --git a/third_party/WebKit/Source/platform/WebMouseEvent.cpp b/third_party/WebKit/Source/platform/WebMouseEvent.cpp
index 8e297fa165b3b6574d0b8c73e9c0f53c27a206fe..50bfed8acd183343ec6a0d8580dc41496ff84fe0 100644
--- a/third_party/WebKit/Source/platform/WebMouseEvent.cpp
+++ b/third_party/WebKit/Source/platform/WebMouseEvent.cpp
@@ -17,11 +17,9 @@ WebMouseEvent::WebMouseEvent(WebInputEvent::Type type,
: WebInputEvent(sizeof(WebMouseEvent), type, modifiers, timeStampSeconds),
WebPointerProperties(buttonParam,
WebPointerProperties::PointerType::Mouse),
- x(gestureEvent.x),
- y(gestureEvent.y),
- globalX(gestureEvent.globalX),
- globalY(gestureEvent.globalY),
- clickCount(clickCountParam) {
+ clickCount(clickCountParam),
+ m_positionInWidget(gestureEvent.x, gestureEvent.y),
+ m_positionInScreen(gestureEvent.globalX, gestureEvent.globalY) {
setFrameScale(gestureEvent.frameScale());
setFrameTranslate(gestureEvent.frameTranslate());
}
@@ -31,8 +29,9 @@ WebFloatPoint WebMouseEvent::movementInRootFrame() const {
}
WebFloatPoint WebMouseEvent::positionInRootFrame() const {
- return WebFloatPoint((x / m_frameScale) + m_frameTranslate.x,
- (y / m_frameScale) + m_frameTranslate.y);
+ return WebFloatPoint(
+ (m_positionInWidget.x / m_frameScale) + m_frameTranslate.x,
+ (m_positionInWidget.y / m_frameScale) + m_frameTranslate.y);
}
WebMouseEvent WebMouseEvent::flattenTransform() const {
@@ -42,8 +41,10 @@ WebMouseEvent WebMouseEvent::flattenTransform() const {
}
void WebMouseEvent::flattenTransformSelf() {
- x = (x / m_frameScale) + m_frameTranslate.x;
- y = (y / m_frameScale) + m_frameTranslate.y;
+ m_positionInWidget.x =
+ floor((m_positionInWidget.x / m_frameScale) + m_frameTranslate.x);
+ m_positionInWidget.y =
+ floor((m_positionInWidget.y / m_frameScale) + m_frameTranslate.y);
m_frameTranslate.x = 0;
m_frameTranslate.y = 0;
m_frameScale = 1;
« no previous file with comments | « third_party/WebKit/Source/core/input/MouseEventManager.cpp ('k') | third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698