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

Unified Diff: third_party/WebKit/Source/core/events/MouseRelatedEvent.h

Issue 2406263003: Make PointerEvent coordinates fractional for touch (Closed)
Patch Set: Fixed zoom issues Created 4 years, 2 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/MouseRelatedEvent.h
diff --git a/third_party/WebKit/Source/core/events/MouseRelatedEvent.h b/third_party/WebKit/Source/core/events/MouseRelatedEvent.h
index 6d90d75eaf845aba5b91e226656c5d2798e6d6e9..ac3d2cf5847780f931f3bcafd0b53fb4299d68ae 100644
--- a/third_party/WebKit/Source/core/events/MouseRelatedEvent.h
+++ b/third_party/WebKit/Source/core/events/MouseRelatedEvent.h
@@ -43,14 +43,24 @@ class CORE_EXPORT MouseRelatedEvent : public UIEventWithKeyState {
};
// Note that these values are adjusted to counter the effects of zoom, so that
// values exposed via DOM APIs are invariant under zooming.
- int screenX() const { return m_screenLocation.x(); }
- int screenY() const { return m_screenLocation.y(); }
- const IntPoint& screenLocation() const { return m_screenLocation; }
- int clientX() const { return m_clientLocation.x().toInt(); }
- int clientY() const { return m_clientLocation.y().toInt(); }
+ double screenX() const {
+ return isPointerEvent() ? m_screenLocation.x().toDouble()
Rick Byers 2016/10/12 14:09:54 It seems odd that this pattern of conditional retu
mustaq 2016/10/12 16:00:01 The problem here is that the initialization is don
+ : m_screenLocation.x().toInt();
+ }
+ double screenY() const {
+ return isPointerEvent() ? m_screenLocation.y().toDouble()
+ : m_screenLocation.y().toInt();
+ }
+ double clientX() const {
+ return isPointerEvent() ? m_clientLocation.x().toDouble()
+ : m_clientLocation.x().toInt();
+ }
+ double clientY() const {
+ return isPointerEvent() ? m_clientLocation.y().toDouble()
+ : m_clientLocation.y().toInt();
+ }
int movementX() const { return m_movementDelta.x().toInt(); }
int movementY() const { return m_movementDelta.y().toInt(); }
- const LayoutPoint& clientLocation() const { return m_clientLocation; }
int layerX();
int layerY();
int offsetX();
@@ -90,14 +100,14 @@ class CORE_EXPORT MouseRelatedEvent : public UIEventWithKeyState {
MouseRelatedEvent(const AtomicString& type,
const MouseEventInit& initializer);
- void initCoordinates(const LayoutPoint& clientLocation);
+ void initCoordinates(const double clientX, const double clientY);
void receivedTarget() final;
void computePageLocation();
void computeRelativePosition();
// Expose these so MouseEvent::initMouseEvent can set them.
- IntPoint m_screenLocation;
+ LayoutPoint m_screenLocation;
LayoutPoint m_clientLocation;
LayoutPoint m_movementDelta;
« no previous file with comments | « third_party/WebKit/Source/core/events/MouseEventInit.idl ('k') | third_party/WebKit/Source/core/events/MouseRelatedEvent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698