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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 if (!frame) | 46 if (!frame) |
47 return LayoutSize(); | 47 return LayoutSize(); |
48 FrameView* frameView = frame->view(); | 48 FrameView* frameView = frame->view(); |
49 if (!frameView) | 49 if (!frameView) |
50 return LayoutSize(); | 50 return LayoutSize(); |
51 float scaleFactor = frame->pageZoomFactor(); | 51 float scaleFactor = frame->pageZoomFactor(); |
52 return LayoutSize(frameView->scrollX() / scaleFactor, frameView->scrollY() /
scaleFactor); | 52 return LayoutSize(frameView->scrollX() / scaleFactor, frameView->scrollY() /
scaleFactor); |
53 } | 53 } |
54 | 54 |
55 MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, bool canBubb
le, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView> abstractView, | 55 MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, bool canBubb
le, bool cancelable, PassRefPtrWillBeRawPtr<AbstractView> abstractView, |
56 int detail, const IntPoint& screenLocation,
const IntPoint& windowLocation, | 56 int detail, const IntPoint& screenLocation, const IntPoint& rootFrameLocatio
n, |
57 const IntPoint& movementDelta, | 57 const IntPoint& movementDelta, |
58 bool ctrlKey, bool altKey, bool shiftKey, b
ool metaKey, bool isSimulated) | 58 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool isSimulated) |
59 : UIEventWithKeyState(eventType, canBubble, cancelable, abstractView, detail
, ctrlKey, altKey, shiftKey, metaKey) | 59 : UIEventWithKeyState(eventType, canBubble, cancelable, abstractView, detail
, ctrlKey, altKey, shiftKey, metaKey) |
60 , m_screenLocation(screenLocation) | 60 , m_screenLocation(screenLocation) |
61 , m_movementDelta(movementDelta) | 61 , m_movementDelta(movementDelta) |
62 , m_isSimulated(isSimulated) | 62 , m_isSimulated(isSimulated) |
63 { | 63 { |
64 LayoutPoint adjustedPageLocation; | 64 LayoutPoint adjustedPageLocation; |
65 LayoutPoint scrollPosition; | 65 LayoutPoint scrollPosition; |
66 | 66 |
67 LocalFrame* frame = view() && view()->isLocalDOMWindow() ? toLocalDOMWindow(
view())->frame() : 0; | 67 LocalFrame* frame = view() && view()->isLocalDOMWindow() ? toLocalDOMWindow(
view())->frame() : 0; |
68 if (frame && !isSimulated) { | 68 if (frame && !isSimulated) { |
69 if (FrameView* frameView = frame->view()) { | 69 if (FrameView* frameView = frame->view()) { |
70 scrollPosition = frameView->scrollPosition(); | 70 scrollPosition = frameView->scrollPosition(); |
71 adjustedPageLocation = frameView->windowToContents(windowLocation); | 71 adjustedPageLocation = frameView->rootFrameToContents(rootFrameLocat
ion); |
72 float scaleFactor = 1 / frame->pageZoomFactor(); | 72 float scaleFactor = 1 / frame->pageZoomFactor(); |
73 if (scaleFactor != 1.0f) { | 73 if (scaleFactor != 1.0f) { |
74 adjustedPageLocation.scale(scaleFactor, scaleFactor); | 74 adjustedPageLocation.scale(scaleFactor, scaleFactor); |
75 scrollPosition.scale(scaleFactor, scaleFactor); | 75 scrollPosition.scale(scaleFactor, scaleFactor); |
76 } | 76 } |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 m_clientLocation = adjustedPageLocation - toLayoutSize(scrollPosition); | 80 m_clientLocation = adjustedPageLocation - toLayoutSize(scrollPosition); |
81 m_pageLocation = adjustedPageLocation; | 81 m_pageLocation = adjustedPageLocation; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 // See Microsoft documentation and <http://www.quirksmode.org/dom/w3c_events
.html>. | 223 // See Microsoft documentation and <http://www.quirksmode.org/dom/w3c_events
.html>. |
224 return m_clientLocation.y(); | 224 return m_clientLocation.y(); |
225 } | 225 } |
226 | 226 |
227 DEFINE_TRACE(MouseRelatedEvent) | 227 DEFINE_TRACE(MouseRelatedEvent) |
228 { | 228 { |
229 UIEventWithKeyState::trace(visitor); | 229 UIEventWithKeyState::trace(visitor); |
230 } | 230 } |
231 | 231 |
232 } // namespace blink | 232 } // namespace blink |
OLD | NEW |