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

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

Issue 2782893002: WebMouseEvent coordinates are now fractional & private (Closed)
Patch Set: Truncated to int on input, git cl format Created 3 years, 9 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..5a72cb65b5052ee96a3c9900837ff63935ede5ad 100644
--- a/third_party/WebKit/Source/platform/WebMouseEvent.cpp
+++ b/third_party/WebKit/Source/platform/WebMouseEvent.cpp
@@ -17,11 +17,10 @@ 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(WebFloatPoint(gestureEvent.x, gestureEvent.y)),
dtapuska 2017/03/31 14:04:18 This is odd. Do you require the extra WebFloatPoin
mustaq 2017/03/31 15:50:31 Thanks for the catch, done.
+ m_positionInScreen(
+ WebFloatPoint(gestureEvent.globalX, gestureEvent.globalY)) {
setFrameScale(gestureEvent.frameScale());
setFrameTranslate(gestureEvent.frameTranslate());
}
@@ -31,8 +30,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 +42,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);
dtapuska 2017/03/31 14:04:18 Can we add a comment why we are taking the floor?
mustaq 2017/03/31 15:50:32 Added a comment in the class header.
+ m_positionInWidget.y =
+ floor((m_positionInWidget.y / m_frameScale) + m_frameTranslate.y);
m_frameTranslate.x = 0;
m_frameTranslate.y = 0;
m_frameScale = 1;

Powered by Google App Engine
This is Rietveld 408576698