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

Unified Diff: third_party/WebKit/public/platform/WebMouseEvent.h

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/public/platform/WebMouseEvent.h
diff --git a/third_party/WebKit/public/platform/WebMouseEvent.h b/third_party/WebKit/public/platform/WebMouseEvent.h
index fee8a2572fe5cd5faf5746d128e2b097a15ad115..912319c7ae64c22f54c0b20aaa474e4ae8b46a00 100644
--- a/third_party/WebKit/public/platform/WebMouseEvent.h
+++ b/third_party/WebKit/public/platform/WebMouseEvent.h
@@ -18,16 +18,6 @@ class WebGestureEvent;
class WebMouseEvent : public WebInputEvent, public WebPointerProperties {
public:
- // Renderer coordinates. Similar to viewport coordinates but without
- // DevTools emulation transform or overscroll applied. i.e. the coordinates
- // in Chromium's RenderView bounds.
- int x;
- int y;
-
- // Screen coordinate
- int globalX;
- int globalY;
-
int clickCount;
WebMouseEvent(Type typeParam,
@@ -42,10 +32,8 @@ class WebMouseEvent : public WebInputEvent, public WebPointerProperties {
modifiersParam,
timeStampSecondsParam),
WebPointerProperties(),
- x(xParam),
- y(yParam),
- globalX(globalXParam),
- globalY(globalYParam) {}
+ m_positionInWidget(xParam, yParam),
+ m_positionInScreen(globalXParam, globalYParam) {}
WebMouseEvent(Type typeParam,
WebFloatPoint position,
@@ -59,11 +47,9 @@ class WebMouseEvent : public WebInputEvent, public WebPointerProperties {
modifiersParam,
timeStampSecondsParam),
WebPointerProperties(buttonParam, PointerType::Mouse),
- x(position.x),
- y(position.y),
- globalX(globalPosition.x),
- globalY(globalPosition.y),
- clickCount(clickCountParam) {}
+ clickCount(clickCountParam),
+ m_positionInWidget(floor(position.x), floor(position.y)),
dtapuska 2017/03/31 14:04:18 Can we add a comment regarding the floor... refere
mustaq 2017/03/31 15:50:32 Added a class comment above.
+ m_positionInScreen(floor(globalPosition.x), floor(globalPosition.y)) {}
WebMouseEvent(Type typeParam,
int modifiersParam,
@@ -95,6 +81,16 @@ class WebMouseEvent : public WebInputEvent, public WebPointerProperties {
BLINK_PLATFORM_EXPORT WebMouseEvent flattenTransform() const;
#endif
+ WebFloatPoint positionInWidget() const { return m_positionInWidget; }
+ void setPositionInWidget(float x, float y) {
+ m_positionInWidget = WebFloatPoint(floor(x), floor(y));
dtapuska 2017/03/31 14:04:18 Same as why we are doing the floor...
mustaq 2017/03/31 15:50:32 Ditto.
+ }
+
+ WebFloatPoint positionInScreen() const { return m_positionInScreen; }
+ void setPositionInScreen(float x, float y) {
+ m_positionInScreen = WebFloatPoint(floor(x), floor(y));
dtapuska 2017/03/31 14:04:18 here too :-)
mustaq 2017/03/31 15:50:32 Ditto too :-)
+ }
+
protected:
explicit WebMouseEvent(unsigned sizeParam)
: WebInputEvent(sizeParam), WebPointerProperties() {}
@@ -107,6 +103,15 @@ class WebMouseEvent : public WebInputEvent, public WebPointerProperties {
WebPointerProperties() {}
void flattenTransformSelf();
+
+ private:
+ // Widget coordinates, i.e., the coordinates in Chromium's RenderView
+ // bounds. Similar to viewport coordinates but without DevTools emulation
+ // transform or overscroll applied.
+ WebFloatPoint m_positionInWidget;
+
+ // Screen coordinate
+ WebFloatPoint m_positionInScreen;
};
#pragma pack(pop)

Powered by Google App Engine
This is Rietveld 408576698