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, 2005, 2006, 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2005, 2006, 2008 Apple Inc. All rights reserved. |
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 m_layerLocation = m_pageLocation; | 100 m_layerLocation = m_pageLocation; |
101 m_offsetLocation = m_pageLocation; | 101 m_offsetLocation = m_pageLocation; |
102 | 102 |
103 computePageLocation(); | 103 computePageLocation(); |
104 m_hasCachedRelativePosition = false; | 104 m_hasCachedRelativePosition = false; |
105 } | 105 } |
106 | 106 |
107 MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, | 107 MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, |
108 const MouseEventInit& initializer) | 108 const MouseEventInit& initializer) |
109 : UIEventWithKeyState(eventType, initializer), | 109 : UIEventWithKeyState(eventType, initializer), |
110 m_screenLocation(IntPoint(initializer.screenX(), initializer.screenY())), | 110 m_screenLocation(LayoutPoint( |
| 111 FloatPoint(initializer.screenX(), initializer.screenY()))), |
111 m_movementDelta( | 112 m_movementDelta( |
112 IntPoint(initializer.movementX(), initializer.movementY())), | 113 IntPoint(initializer.movementX(), initializer.movementY())), |
113 m_positionType(PositionType::Position) { | 114 m_positionType(PositionType::Position) { |
114 initCoordinates(IntPoint(initializer.clientX(), initializer.clientY())); | 115 initCoordinates(initializer.clientX(), initializer.clientY()); |
115 } | 116 } |
116 | 117 |
117 void MouseRelatedEvent::initCoordinates(const LayoutPoint& clientLocation) { | 118 void MouseRelatedEvent::initCoordinates(const double clientX, |
| 119 const double clientY) { |
118 // Set up initial values for coordinates. | 120 // Set up initial values for coordinates. |
119 // Correct values are computed lazily, see computeRelativePosition. | 121 // Correct values are computed lazily, see computeRelativePosition. |
120 m_clientLocation = clientLocation; | 122 m_clientLocation = LayoutPoint(FloatPoint(clientX, clientY)); |
121 m_pageLocation = clientLocation + contentsScrollOffset(view()); | 123 m_pageLocation = m_clientLocation + contentsScrollOffset(view()); |
122 | 124 |
123 m_layerLocation = m_pageLocation; | 125 m_layerLocation = m_pageLocation; |
124 m_offsetLocation = m_pageLocation; | 126 m_offsetLocation = m_pageLocation; |
125 | 127 |
126 computePageLocation(); | 128 computePageLocation(); |
127 m_hasCachedRelativePosition = false; | 129 m_hasCachedRelativePosition = false; |
128 } | 130 } |
129 | 131 |
130 static float pageZoomFactor(const UIEvent* event) { | 132 static float pageZoomFactor(const UIEvent* event) { |
131 if (!event->view() || !event->view()->isLocalDOMWindow()) | 133 if (!event->view() || !event->view()->isLocalDOMWindow()) |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 // See Microsoft documentation and | 261 // See Microsoft documentation and |
260 // <http://www.quirksmode.org/dom/w3c_events.html>. | 262 // <http://www.quirksmode.org/dom/w3c_events.html>. |
261 return m_clientLocation.y().toInt(); | 263 return m_clientLocation.y().toInt(); |
262 } | 264 } |
263 | 265 |
264 DEFINE_TRACE(MouseRelatedEvent) { | 266 DEFINE_TRACE(MouseRelatedEvent) { |
265 UIEventWithKeyState::trace(visitor); | 267 UIEventWithKeyState::trace(visitor); |
266 } | 268 } |
267 | 269 |
268 } // namespace blink | 270 } // namespace blink |
OLD | NEW |