| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 m_layerLocation -= toLayoutSize(layer->location()); | 192 m_layerLocation -= toLayoutSize(layer->location()); |
| 193 } | 193 } |
| 194 | 194 |
| 195 m_hasCachedRelativePosition = true; | 195 m_hasCachedRelativePosition = true; |
| 196 } | 196 } |
| 197 | 197 |
| 198 int MouseRelatedEvent::layerX() | 198 int MouseRelatedEvent::layerX() |
| 199 { | 199 { |
| 200 if (!m_hasCachedRelativePosition) | 200 if (!m_hasCachedRelativePosition) |
| 201 computeRelativePosition(); | 201 computeRelativePosition(); |
| 202 return m_layerLocation.x(); | 202 return m_layerLocation.x().toInt(); |
| 203 } | 203 } |
| 204 | 204 |
| 205 int MouseRelatedEvent::layerY() | 205 int MouseRelatedEvent::layerY() |
| 206 { | 206 { |
| 207 if (!m_hasCachedRelativePosition) | 207 if (!m_hasCachedRelativePosition) |
| 208 computeRelativePosition(); | 208 computeRelativePosition(); |
| 209 return m_layerLocation.y(); | 209 return m_layerLocation.y().toInt(); |
| 210 } | 210 } |
| 211 | 211 |
| 212 int MouseRelatedEvent::offsetX() | 212 int MouseRelatedEvent::offsetX() |
| 213 { | 213 { |
| 214 if (!hasPosition()) | 214 if (!hasPosition()) |
| 215 return 0; | 215 return 0; |
| 216 if (!m_hasCachedRelativePosition) | 216 if (!m_hasCachedRelativePosition) |
| 217 computeRelativePosition(); | 217 computeRelativePosition(); |
| 218 return roundToInt(m_offsetLocation.x()); | 218 return roundToInt(m_offsetLocation.x()); |
| 219 } | 219 } |
| 220 | 220 |
| 221 int MouseRelatedEvent::offsetY() | 221 int MouseRelatedEvent::offsetY() |
| 222 { | 222 { |
| 223 if (!hasPosition()) | 223 if (!hasPosition()) |
| 224 return 0; | 224 return 0; |
| 225 if (!m_hasCachedRelativePosition) | 225 if (!m_hasCachedRelativePosition) |
| 226 computeRelativePosition(); | 226 computeRelativePosition(); |
| 227 return roundToInt(m_offsetLocation.y()); | 227 return roundToInt(m_offsetLocation.y()); |
| 228 } | 228 } |
| 229 | 229 |
| 230 int MouseRelatedEvent::pageX() const | 230 int MouseRelatedEvent::pageX() const |
| 231 { | 231 { |
| 232 return m_pageLocation.x(); | 232 return m_pageLocation.x().toInt(); |
| 233 } | 233 } |
| 234 | 234 |
| 235 int MouseRelatedEvent::pageY() const | 235 int MouseRelatedEvent::pageY() const |
| 236 { | 236 { |
| 237 return m_pageLocation.y(); | 237 return m_pageLocation.y().toInt(); |
| 238 } | 238 } |
| 239 | 239 |
| 240 int MouseRelatedEvent::x() const | 240 int MouseRelatedEvent::x() const |
| 241 { | 241 { |
| 242 // FIXME: This is not correct. | 242 // FIXME: This is not correct. |
| 243 // See Microsoft documentation and <http://www.quirksmode.org/dom/w3c_events
.html>. | 243 // See Microsoft documentation and <http://www.quirksmode.org/dom/w3c_events
.html>. |
| 244 return m_clientLocation.x(); | 244 return m_clientLocation.x().toInt(); |
| 245 } | 245 } |
| 246 | 246 |
| 247 int MouseRelatedEvent::y() const | 247 int MouseRelatedEvent::y() const |
| 248 { | 248 { |
| 249 // FIXME: This is not correct. | 249 // FIXME: This is not correct. |
| 250 // See Microsoft documentation and <http://www.quirksmode.org/dom/w3c_events
.html>. | 250 // See Microsoft documentation and <http://www.quirksmode.org/dom/w3c_events
.html>. |
| 251 return m_clientLocation.y(); | 251 return m_clientLocation.y().toInt(); |
| 252 } | 252 } |
| 253 | 253 |
| 254 DEFINE_TRACE(MouseRelatedEvent) | 254 DEFINE_TRACE(MouseRelatedEvent) |
| 255 { | 255 { |
| 256 UIEventWithKeyState::trace(visitor); | 256 UIEventWithKeyState::trace(visitor); |
| 257 } | 257 } |
| 258 | 258 |
| 259 } // namespace blink | 259 } // namespace blink |
| OLD | NEW |