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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 171 |
172 // Must have an updated layout tree for this math to work correctly. | 172 // Must have an updated layout tree for this math to work correctly. |
173 targetNode->document().updateStyleAndLayoutIgnorePendingStylesheets(); | 173 targetNode->document().updateStyleAndLayoutIgnorePendingStylesheets(); |
174 | 174 |
175 // Adjust offsetLocation to be relative to the target's padding box. | 175 // Adjust offsetLocation to be relative to the target's padding box. |
176 if (const LayoutObject* layoutObject = findTargetLayoutObject(targetNode)) { | 176 if (const LayoutObject* layoutObject = findTargetLayoutObject(targetNode)) { |
177 FloatPoint localPos = layoutObject->absoluteToLocal( | 177 FloatPoint localPos = layoutObject->absoluteToLocal( |
178 FloatPoint(absoluteLocation()), UseTransforms); | 178 FloatPoint(absoluteLocation()), UseTransforms); |
179 | 179 |
180 // Adding this here to address crbug.com/570666. Basically we'd like to | 180 // Adding this here to address crbug.com/570666. Basically we'd like to |
181 // find the local coordinates relative to the padding box not the border box
. | 181 // find the local coordinates relative to the padding box not the border |
| 182 // box. |
182 if (layoutObject->isBoxModelObject()) { | 183 if (layoutObject->isBoxModelObject()) { |
183 const LayoutBoxModelObject* layoutBox = | 184 const LayoutBoxModelObject* layoutBox = |
184 toLayoutBoxModelObject(layoutObject); | 185 toLayoutBoxModelObject(layoutObject); |
185 localPos.move(-layoutBox->borderLeft(), -layoutBox->borderTop()); | 186 localPos.move(-layoutBox->borderLeft(), -layoutBox->borderTop()); |
186 } | 187 } |
187 | 188 |
188 m_offsetLocation = roundedLayoutPoint(localPos); | 189 m_offsetLocation = roundedLayoutPoint(localPos); |
189 float scaleFactor = 1 / pageZoomFactor(this); | 190 float scaleFactor = 1 / pageZoomFactor(this); |
190 if (scaleFactor != 1.0f) | 191 if (scaleFactor != 1.0f) |
191 m_offsetLocation.scale(scaleFactor, scaleFactor); | 192 m_offsetLocation.scale(scaleFactor, scaleFactor); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 int MouseRelatedEvent::pageX() const { | 241 int MouseRelatedEvent::pageX() const { |
241 return m_pageLocation.x().toInt(); | 242 return m_pageLocation.x().toInt(); |
242 } | 243 } |
243 | 244 |
244 int MouseRelatedEvent::pageY() const { | 245 int MouseRelatedEvent::pageY() const { |
245 return m_pageLocation.y().toInt(); | 246 return m_pageLocation.y().toInt(); |
246 } | 247 } |
247 | 248 |
248 int MouseRelatedEvent::x() const { | 249 int MouseRelatedEvent::x() const { |
249 // FIXME: This is not correct. | 250 // FIXME: This is not correct. |
250 // See Microsoft documentation and <http://www.quirksmode.org/dom/w3c_events.h
tml>. | 251 // See Microsoft documentation and |
| 252 // <http://www.quirksmode.org/dom/w3c_events.html>. |
251 return m_clientLocation.x().toInt(); | 253 return m_clientLocation.x().toInt(); |
252 } | 254 } |
253 | 255 |
254 int MouseRelatedEvent::y() const { | 256 int MouseRelatedEvent::y() const { |
255 // FIXME: This is not correct. | 257 // FIXME: This is not correct. |
256 // See Microsoft documentation and <http://www.quirksmode.org/dom/w3c_events.h
tml>. | 258 // See Microsoft documentation and |
| 259 // <http://www.quirksmode.org/dom/w3c_events.html>. |
257 return m_clientLocation.y().toInt(); | 260 return m_clientLocation.y().toInt(); |
258 } | 261 } |
259 | 262 |
260 DEFINE_TRACE(MouseRelatedEvent) { | 263 DEFINE_TRACE(MouseRelatedEvent) { |
261 UIEventWithKeyState::trace(visitor); | 264 UIEventWithKeyState::trace(visitor); |
262 } | 265 } |
263 | 266 |
264 } // namespace blink | 267 } // namespace blink |
OLD | NEW |