Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(474)

Side by Side Diff: Source/core/events/MouseRelatedEvent.cpp

Issue 967213004: Removed FrameView's windowToContents and contentsToWindow methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/events/MouseRelatedEvent.h ('k') | Source/core/frame/FrameView.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « Source/core/events/MouseRelatedEvent.h ('k') | Source/core/frame/FrameView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698