| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) | 2 * Copyright (C) 2001 Peter Kelly (pmk@post.com) |
| 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) | 3 * Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de) |
| 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 4 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 5 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. | 5 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #define MouseRelatedEvent_h | 25 #define MouseRelatedEvent_h |
| 26 | 26 |
| 27 #include "core/events/UIEventWithKeyState.h" | 27 #include "core/events/UIEventWithKeyState.h" |
| 28 #include "platform/geometry/LayoutPoint.h" | 28 #include "platform/geometry/LayoutPoint.h" |
| 29 | 29 |
| 30 namespace blink { | 30 namespace blink { |
| 31 | 31 |
| 32 // Internal only: Helper class for what's common between mouse and wheel eve
nts. | 32 // Internal only: Helper class for what's common between mouse and wheel eve
nts. |
| 33 class MouseRelatedEvent : public UIEventWithKeyState { | 33 class MouseRelatedEvent : public UIEventWithKeyState { |
| 34 public: | 34 public: |
| 35 // Note that these values are adjusted to counter the effects of zoom, s
o that values | |
| 36 // exposed via DOM APIs are invariant under zooming. | |
| 37 int screenX() const { return m_screenLocation.x(); } | 35 int screenX() const { return m_screenLocation.x(); } |
| 38 int screenY() const { return m_screenLocation.y(); } | 36 int screenY() const { return m_screenLocation.y(); } |
| 39 const IntPoint& screenLocation() const { return m_screenLocation; } | 37 const IntPoint& screenLocation() const { return m_screenLocation; } |
| 40 int clientX() const { return m_clientLocation.x(); } | 38 int clientX() const { return m_clientLocation.x(); } |
| 41 int clientY() const { return m_clientLocation.y(); } | 39 int clientY() const { return m_clientLocation.y(); } |
| 42 int movementX() const { return m_movementDelta.x(); } | 40 int movementX() const { return m_movementDelta.x(); } |
| 43 int movementY() const { return m_movementDelta.y(); } | 41 int movementY() const { return m_movementDelta.y(); } |
| 44 const LayoutPoint& clientLocation() const { return m_clientLocation; } | 42 const LayoutPoint& clientLocation() const { return m_clientLocation; } |
| 45 virtual int layerX() override final; | 43 virtual int layerX() override final; |
| 46 virtual int layerY() override final; | 44 virtual int layerY() override final; |
| 47 int offsetX(); | 45 int offsetX(); |
| 48 int offsetY(); | 46 int offsetY(); |
| 49 // FIXME: rename isSimulated to fromKeyboard() and replace m_isSimulated
with a new value | 47 // FIXME: rename isSimulated to fromKeyboard() and replace m_isSimulated
with a new value |
| 50 // in PlatformMouseEvent::SyntheticEventType. isSimulated() is only true
for synthetic | 48 // in PlatformMouseEvent::SyntheticEventType. isSimulated() is only true
for synthetic |
| 51 // mouse events that derive from keyboard input, which do not have a pos
ition. | 49 // mouse events that derive from keyboard input, which do not have a pos
ition. |
| 52 bool isSimulated() const { return m_isSimulated; } | 50 bool isSimulated() const { return m_isSimulated; } |
| 53 virtual int pageX() const override final; | 51 virtual int pageX() const override final; |
| 54 virtual int pageY() const override final; | 52 virtual int pageY() const override final; |
| 55 int x() const; | 53 int x() const; |
| 56 int y() const; | 54 int y() const; |
| 57 | 55 |
| 58 // Page point in "absolute" coordinates (i.e. post-zoomed, page-relative
coords, | 56 // Page point in "absolute" coordinates (i.e. page-relative coords, |
| 59 // usable with RenderObject::absoluteToLocal). | 57 // usable with RenderObject::absoluteToLocal). |
| 60 const LayoutPoint& absoluteLocation() const { return m_absoluteLocation;
} | 58 const LayoutPoint& absoluteLocation() const { return m_absoluteLocation;
} |
| 61 void setAbsoluteLocation(const LayoutPoint& p) { m_absoluteLocation = p;
} | 59 void setAbsoluteLocation(const LayoutPoint& p) { m_absoluteLocation = p;
} |
| 62 | 60 |
| 63 virtual void trace(Visitor*) override; | 61 virtual void trace(Visitor*) override; |
| 64 | 62 |
| 65 protected: | 63 protected: |
| 66 MouseRelatedEvent(); | 64 MouseRelatedEvent(); |
| 67 MouseRelatedEvent(const AtomicString& type, bool canBubble, bool cancela
ble, | 65 MouseRelatedEvent(const AtomicString& type, bool canBubble, bool cancela
ble, |
| 68 PassRefPtr<AbstractView>, int detail, const IntPoint& screenLocation
, | 66 PassRefPtr<AbstractView>, int detail, const IntPoint& screenLocation
, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 86 LayoutPoint m_layerLocation; | 84 LayoutPoint m_layerLocation; |
| 87 LayoutPoint m_offsetLocation; | 85 LayoutPoint m_offsetLocation; |
| 88 LayoutPoint m_absoluteLocation; | 86 LayoutPoint m_absoluteLocation; |
| 89 bool m_isSimulated; | 87 bool m_isSimulated; |
| 90 bool m_hasCachedRelativePosition; | 88 bool m_hasCachedRelativePosition; |
| 91 }; | 89 }; |
| 92 | 90 |
| 93 } // namespace blink | 91 } // namespace blink |
| 94 | 92 |
| 95 #endif // MouseRelatedEvent_h | 93 #endif // MouseRelatedEvent_h |
| OLD | NEW |