OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |