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

Side by Side Diff: third_party/WebKit/Source/core/events/PointerEventFactory.cpp

Issue 2782893002: WebMouseEvent coordinates are now fractional & private (Closed)
Patch Set: Rebased, fixed a comment in web_input_event_builders_mac.mm Created 3 years, 8 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/events/PointerEventFactory.h" 5 #include "core/events/PointerEventFactory.h"
6 6
7 #include "core/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "platform/geometry/FloatSize.h" 8 #include "platform/geometry/FloatSize.h"
9 9
10 namespace blink { 10 namespace blink {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 pointerEventInit->setTwist(touchPoint.twist); 139 pointerEventInit->setTwist(touchPoint.twist);
140 } 140 }
141 141
142 void updateMousePointerEventInit(const WebMouseEvent& mouseEvent, 142 void updateMousePointerEventInit(const WebMouseEvent& mouseEvent,
143 LocalDOMWindow* view, 143 LocalDOMWindow* view,
144 PointerEventInit* pointerEventInit) { 144 PointerEventInit* pointerEventInit) {
145 // This function should not update attributes like pointerId, isPrimary, 145 // This function should not update attributes like pointerId, isPrimary,
146 // and pointerType which is the same among the coalesced events and the 146 // and pointerType which is the same among the coalesced events and the
147 // dispatched event. 147 // dispatched event.
148 148
149 pointerEventInit->setScreenX(mouseEvent.globalX); 149 pointerEventInit->setScreenX(mouseEvent.positionInScreen().x);
150 pointerEventInit->setScreenY(mouseEvent.globalY); 150 pointerEventInit->setScreenY(mouseEvent.positionInScreen().y);
151 151
152 IntPoint locationInFrameZoomed; 152 IntPoint locationInFrameZoomed;
153 if (view && view->frame() && view->frame()->view()) { 153 if (view && view->frame() && view->frame()->view()) {
154 LocalFrame* frame = view->frame(); 154 LocalFrame* frame = view->frame();
155 FrameView* frameView = frame->view(); 155 FrameView* frameView = frame->view();
156 IntPoint locationInContents = frameView->rootFrameToContents( 156 IntPoint locationInContents = frameView->rootFrameToContents(
157 flooredIntPoint(mouseEvent.positionInRootFrame())); 157 flooredIntPoint(mouseEvent.positionInRootFrame()));
158 locationInFrameZoomed = frameView->contentsToFrame(locationInContents); 158 locationInFrameZoomed = frameView->contentsToFrame(locationInContents);
159 float scaleFactor = 1 / frame->pageZoomFactor(); 159 float scaleFactor = 1 / frame->pageZoomFactor();
160 locationInFrameZoomed.scale(scaleFactor, scaleFactor); 160 locationInFrameZoomed.scale(scaleFactor, scaleFactor);
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 const WebPointerProperties& properties) const { 544 const WebPointerProperties& properties) const {
545 if (properties.pointerType == WebPointerProperties::PointerType::Mouse) 545 if (properties.pointerType == WebPointerProperties::PointerType::Mouse)
546 return PointerEventFactory::s_mouseId; 546 return PointerEventFactory::s_mouseId;
547 IncomingId id(properties.pointerType, properties.id); 547 IncomingId id(properties.pointerType, properties.id);
548 if (m_pointerIncomingIdMapping.contains(id)) 548 if (m_pointerIncomingIdMapping.contains(id))
549 return m_pointerIncomingIdMapping.at(id); 549 return m_pointerIncomingIdMapping.at(id);
550 return PointerEventFactory::s_invalidId; 550 return PointerEventFactory::s_invalidId;
551 } 551 }
552 552
553 } // namespace blink 553 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/events/MouseEvent.cpp ('k') | third_party/WebKit/Source/core/input/EventHandlerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698