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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 pointerEventInit->setWidth(pointRadius.width()); | 122 pointerEventInit->setWidth(pointRadius.width()); |
123 pointerEventInit->setHeight(pointRadius.height()); | 123 pointerEventInit->setHeight(pointRadius.height()); |
124 } | 124 } |
125 | 125 |
126 pointerEventInit->setScreenX(touchPoint.screenPos().x()); | 126 pointerEventInit->setScreenX(touchPoint.screenPos().x()); |
127 pointerEventInit->setScreenY(touchPoint.screenPos().y()); | 127 pointerEventInit->setScreenY(touchPoint.screenPos().y()); |
128 pointerEventInit->setPressure( | 128 pointerEventInit->setPressure( |
129 getPointerEventPressure(touchPoint.force(), pointerEventInit->buttons())); | 129 getPointerEventPressure(touchPoint.force(), pointerEventInit->buttons())); |
130 pointerEventInit->setTiltX(touchPoint.pointerProperties().tiltX); | 130 pointerEventInit->setTiltX(touchPoint.pointerProperties().tiltX); |
131 pointerEventInit->setTiltY(touchPoint.pointerProperties().tiltY); | 131 pointerEventInit->setTiltY(touchPoint.pointerProperties().tiltY); |
| 132 pointerEventInit->setTangentialPressure( |
| 133 touchPoint.pointerProperties().tangentialPressure); |
| 134 pointerEventInit->setTwist(touchPoint.pointerProperties().twist); |
132 } | 135 } |
133 | 136 |
134 void updateMousePointerEventInit(const PlatformMouseEvent& mouseEvent, | 137 void updateMousePointerEventInit(const PlatformMouseEvent& mouseEvent, |
135 LocalDOMWindow* view, | 138 LocalDOMWindow* view, |
136 PointerEventInit* pointerEventInit) { | 139 PointerEventInit* pointerEventInit) { |
137 // This function should not update attributes like pointerId, isPrimary, | 140 // This function should not update attributes like pointerId, isPrimary, |
138 // and pointerType which is the same among the coalesced events and the | 141 // and pointerType which is the same among the coalesced events and the |
139 // dispatched event. | 142 // dispatched event. |
140 | 143 |
141 pointerEventInit->setScreenX(mouseEvent.globalPosition().x()); | 144 pointerEventInit->setScreenX(mouseEvent.globalPosition().x()); |
(...skipping 10 matching lines...) Expand all Loading... |
152 locationInFrameZoomed.scale(scaleFactor, scaleFactor); | 155 locationInFrameZoomed.scale(scaleFactor, scaleFactor); |
153 } | 156 } |
154 | 157 |
155 pointerEventInit->setClientX(locationInFrameZoomed.x()); | 158 pointerEventInit->setClientX(locationInFrameZoomed.x()); |
156 pointerEventInit->setClientY(locationInFrameZoomed.y()); | 159 pointerEventInit->setClientY(locationInFrameZoomed.y()); |
157 | 160 |
158 pointerEventInit->setPressure(getPointerEventPressure( | 161 pointerEventInit->setPressure(getPointerEventPressure( |
159 mouseEvent.pointerProperties().force, pointerEventInit->buttons())); | 162 mouseEvent.pointerProperties().force, pointerEventInit->buttons())); |
160 pointerEventInit->setTiltX(mouseEvent.pointerProperties().tiltX); | 163 pointerEventInit->setTiltX(mouseEvent.pointerProperties().tiltX); |
161 pointerEventInit->setTiltY(mouseEvent.pointerProperties().tiltY); | 164 pointerEventInit->setTiltY(mouseEvent.pointerProperties().tiltY); |
| 165 pointerEventInit->setTangentialPressure( |
| 166 mouseEvent.pointerProperties().tangentialPressure); |
| 167 pointerEventInit->setTwist(mouseEvent.pointerProperties().twist); |
162 } | 168 } |
163 | 169 |
164 } // namespace | 170 } // namespace |
165 | 171 |
166 const int PointerEventFactory::s_invalidId = 0; | 172 const int PointerEventFactory::s_invalidId = 0; |
167 | 173 |
168 // Mouse id is 1 to behave the same as MS Edge for compatibility reasons. | 174 // Mouse id is 1 to behave the same as MS Edge for compatibility reasons. |
169 const int PointerEventFactory::s_mouseId = 1; | 175 const int PointerEventFactory::s_mouseId = 1; |
170 | 176 |
171 void PointerEventFactory::setIdTypeButtons( | 177 void PointerEventFactory::setIdTypeButtons( |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 pointerEventInit.setHeight(pointerEvent->height()); | 368 pointerEventInit.setHeight(pointerEvent->height()); |
363 pointerEventInit.setScreenX(pointerEvent->screenX()); | 369 pointerEventInit.setScreenX(pointerEvent->screenX()); |
364 pointerEventInit.setScreenY(pointerEvent->screenY()); | 370 pointerEventInit.setScreenY(pointerEvent->screenY()); |
365 pointerEventInit.setClientX(pointerEvent->clientX()); | 371 pointerEventInit.setClientX(pointerEvent->clientX()); |
366 pointerEventInit.setClientY(pointerEvent->clientY()); | 372 pointerEventInit.setClientY(pointerEvent->clientY()); |
367 pointerEventInit.setButton(pointerEvent->button()); | 373 pointerEventInit.setButton(pointerEvent->button()); |
368 pointerEventInit.setButtons(pointerEvent->buttons()); | 374 pointerEventInit.setButtons(pointerEvent->buttons()); |
369 pointerEventInit.setPressure(pointerEvent->pressure()); | 375 pointerEventInit.setPressure(pointerEvent->pressure()); |
370 pointerEventInit.setTiltX(pointerEvent->tiltX()); | 376 pointerEventInit.setTiltX(pointerEvent->tiltX()); |
371 pointerEventInit.setTiltY(pointerEvent->tiltY()); | 377 pointerEventInit.setTiltY(pointerEvent->tiltY()); |
| 378 pointerEventInit.setTangentialPressure(pointerEvent->tangentialPressure()); |
| 379 pointerEventInit.setTwist(pointerEvent->twist()); |
372 pointerEventInit.setView(pointerEvent->view()); | 380 pointerEventInit.setView(pointerEvent->view()); |
373 | 381 |
374 setEventSpecificFields(pointerEventInit, type); | 382 setEventSpecificFields(pointerEventInit, type); |
375 | 383 |
376 if (relatedTarget) | 384 if (relatedTarget) |
377 pointerEventInit.setRelatedTarget(relatedTarget); | 385 pointerEventInit.setRelatedTarget(relatedTarget); |
378 | 386 |
379 return PointerEvent::create(type, pointerEventInit); | 387 return PointerEvent::create(type, pointerEventInit); |
380 } | 388 } |
381 | 389 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 const WebPointerProperties& properties) const { | 521 const WebPointerProperties& properties) const { |
514 if (properties.pointerType == WebPointerProperties::PointerType::Mouse) | 522 if (properties.pointerType == WebPointerProperties::PointerType::Mouse) |
515 return PointerEventFactory::s_mouseId; | 523 return PointerEventFactory::s_mouseId; |
516 IncomingId id(properties.pointerType, properties.id); | 524 IncomingId id(properties.pointerType, properties.id); |
517 if (m_pointerIncomingIdMapping.contains(id)) | 525 if (m_pointerIncomingIdMapping.contains(id)) |
518 return m_pointerIncomingIdMapping.get(id); | 526 return m_pointerIncomingIdMapping.get(id); |
519 return PointerEventFactory::s_invalidId; | 527 return PointerEventFactory::s_invalidId; |
520 } | 528 } |
521 | 529 |
522 } // namespace blink | 530 } // namespace blink |
OLD | NEW |