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

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

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/public/platform/WebMouseEvent.h
diff --git a/third_party/WebKit/public/platform/WebMouseEvent.h b/third_party/WebKit/public/platform/WebMouseEvent.h
index fee8a2572fe5cd5faf5746d128e2b097a15ad115..26ab12a0d66a0fc3118d5f507aab3421f9c16bc3 100644
--- a/third_party/WebKit/public/platform/WebMouseEvent.h
+++ b/third_party/WebKit/public/platform/WebMouseEvent.h
@@ -16,18 +16,11 @@ class WebGestureEvent;
// WebMouseEvent --------------------------------------------------------------
+// TODO(mustaq): We are truncating |float|s to integers whenever setting
+// coordinate values, to avoid regressions for now. Will be fixed later
+// on. crbug.com/456625
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 +35,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 +50,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)),
+ m_positionInScreen(floor(globalPosition.x), floor(globalPosition.y)) {}
WebMouseEvent(Type typeParam,
int modifiersParam,
@@ -95,6 +84,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));
+ }
+
+ WebFloatPoint positionInScreen() const { return m_positionInScreen; }
+ void setPositionInScreen(float x, float y) {
+ m_positionInScreen = WebFloatPoint(floor(x), floor(y));
+ }
+
protected:
explicit WebMouseEvent(unsigned sizeParam)
: WebInputEvent(sizeParam), WebPointerProperties() {}
@@ -107,6 +106,15 @@ class WebMouseEvent : public WebInputEvent, public WebPointerProperties {
WebPointerProperties() {}
void flattenTransformSelf();
+
+ private:
+ // Widget coordinate, which is relative to the bound of current RenderWidget
+ // (e.g. a plugin or OOPIF inside a RenderView). Similar to viewport
+ // coordinates but without DevTools emulation transform or overscroll applied.
+ WebFloatPoint m_positionInWidget;
+
+ // Screen coordinate
+ WebFloatPoint m_positionInScreen;
};
#pragma pack(pop)
« no previous file with comments | « third_party/WebKit/public/platform/WebGestureEvent.h ('k') | third_party/WebKit/public/platform/WebTouchPoint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698