| 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 20 matching lines...) Expand all Loading... |
| 31 #include "core/rendering/RenderObject.h" | 31 #include "core/rendering/RenderObject.h" |
| 32 | 32 |
| 33 namespace blink { | 33 namespace blink { |
| 34 | 34 |
| 35 MouseRelatedEvent::MouseRelatedEvent() | 35 MouseRelatedEvent::MouseRelatedEvent() |
| 36 : m_isSimulated(false) | 36 : m_isSimulated(false) |
| 37 , m_hasCachedRelativePosition(false) | 37 , m_hasCachedRelativePosition(false) |
| 38 { | 38 { |
| 39 } | 39 } |
| 40 | 40 |
| 41 static LayoutSize contentsScrollOffset(AbstractView* abstractView) | |
| 42 { | |
| 43 if (!abstractView) | |
| 44 return LayoutSize(); | |
| 45 LocalFrame* frame = abstractView->frame(); | |
| 46 if (!frame) | |
| 47 return LayoutSize(); | |
| 48 FrameView* frameView = frame->view(); | |
| 49 if (!frameView) | |
| 50 return LayoutSize(); | |
| 51 float scaleFactor = frame->pageZoomFactor(); | |
| 52 return LayoutSize(frameView->scrollX() / scaleFactor, frameView->scrollY() /
scaleFactor); | |
| 53 } | |
| 54 | |
| 55 MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, bool canBubb
le, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView> abstractView, | 41 MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, bool canBubb
le, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView> abstractView, |
| 56 int detail, const IntPoint& screenLocation,
const IntPoint& windowLocation, | 42 int detail, const IntPoint& screenLocation,
const IntPoint& windowLocation, |
| 57 const IntPoint& movementDelta, | 43 const IntPoint& movementDelta, |
| 58 bool ctrlKey, bool altKey, bool shiftKey, b
ool metaKey, bool isSimulated) | 44 bool ctrlKey, bool altKey, bool shiftKey, b
ool metaKey, bool isSimulated) |
| 59 : UIEventWithKeyState(eventType, canBubble, cancelable, abstractView, detail
, ctrlKey, altKey, shiftKey, metaKey) | 45 : UIEventWithKeyState(eventType, canBubble, cancelable, abstractView, detail
, ctrlKey, altKey, shiftKey, metaKey) |
| 60 , m_screenLocation(screenLocation) | 46 , m_screenLocation(screenLocation) |
| 61 , m_movementDelta(movementDelta) | 47 , m_movementDelta(movementDelta) |
| 62 , m_isSimulated(isSimulated) | 48 , m_isSimulated(isSimulated) |
| 63 { | 49 { |
| 64 LayoutPoint adjustedPageLocation; | 50 LayoutPoint adjustedPageLocation; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 92 | 78 |
| 93 computePageLocation(); | 79 computePageLocation(); |
| 94 m_hasCachedRelativePosition = false; | 80 m_hasCachedRelativePosition = false; |
| 95 } | 81 } |
| 96 | 82 |
| 97 void MouseRelatedEvent::initCoordinates(const LayoutPoint& clientLocation) | 83 void MouseRelatedEvent::initCoordinates(const LayoutPoint& clientLocation) |
| 98 { | 84 { |
| 99 // Set up initial values for coordinates. | 85 // Set up initial values for coordinates. |
| 100 // Correct values are computed lazily, see computeRelativePosition. | 86 // Correct values are computed lazily, see computeRelativePosition. |
| 101 m_clientLocation = clientLocation; | 87 m_clientLocation = clientLocation; |
| 102 m_pageLocation = clientLocation + contentsScrollOffset(view()); | 88 // FIXME(sky): We don't need this anymore? |
| 89 m_pageLocation = clientLocation; |
| 103 | 90 |
| 104 m_layerLocation = m_pageLocation; | 91 m_layerLocation = m_pageLocation; |
| 105 m_offsetLocation = m_pageLocation; | 92 m_offsetLocation = m_pageLocation; |
| 106 | 93 |
| 107 computePageLocation(); | 94 computePageLocation(); |
| 108 m_hasCachedRelativePosition = false; | 95 m_hasCachedRelativePosition = false; |
| 109 } | 96 } |
| 110 | 97 |
| 111 static float pageZoomFactor(const UIEvent* event) | 98 static float pageZoomFactor(const UIEvent* event) |
| 112 { | 99 { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 // See Microsoft documentation and <http://www.quirksmode.org/dom/w3c_events
.html>. | 211 // See Microsoft documentation and <http://www.quirksmode.org/dom/w3c_events
.html>. |
| 225 return m_clientLocation.y(); | 212 return m_clientLocation.y(); |
| 226 } | 213 } |
| 227 | 214 |
| 228 void MouseRelatedEvent::trace(Visitor* visitor) | 215 void MouseRelatedEvent::trace(Visitor* visitor) |
| 229 { | 216 { |
| 230 UIEventWithKeyState::trace(visitor); | 217 UIEventWithKeyState::trace(visitor); |
| 231 } | 218 } |
| 232 | 219 |
| 233 } // namespace blink | 220 } // namespace blink |
| OLD | NEW |