| 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/LocalFrameView.h" | 7 #include "core/frame/LocalFrameView.h" |
| 8 #include "platform/geometry/FloatSize.h" | 8 #include "platform/geometry/FloatSize.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 coalesced_pointer_events.push_back(event); | 362 coalesced_pointer_events.push_back(event); |
| 363 } | 363 } |
| 364 pointer_event_init.setCoalescedEvents(coalesced_pointer_events); | 364 pointer_event_init.setCoalescedEvents(coalesced_pointer_events); |
| 365 } | 365 } |
| 366 | 366 |
| 367 return PointerEvent::Create(type, pointer_event_init, | 367 return PointerEvent::Create(type, pointer_event_init, |
| 368 event_platform_time_stamp); | 368 event_platform_time_stamp); |
| 369 } | 369 } |
| 370 | 370 |
| 371 PointerEvent* PointerEventFactory::CreatePointerCancelEvent( | 371 PointerEvent* PointerEventFactory::CreatePointerCancelEvent( |
| 372 const WebPointerEvent& event) { |
| 373 DCHECK_EQ(event.GetType(), WebInputEvent::Type::kPointerCancel); |
| 374 int pointer_id = GetPointerEventId(event); |
| 375 |
| 376 return CreatePointerCancelEvent( |
| 377 pointer_id, event.pointer_type, |
| 378 TimeTicks::FromSeconds(event.TimeStampSeconds())); |
| 379 } |
| 380 |
| 381 PointerEvent* PointerEventFactory::CreatePointerCancelEvent( |
| 372 const int pointer_id, | 382 const int pointer_id, |
| 373 const WebPointerProperties::PointerType pointer_type, | 383 const WebPointerProperties::PointerType pointer_type, |
| 374 TimeTicks platfrom_time_stamp) { | 384 TimeTicks platfrom_time_stamp) { |
| 375 DCHECK(pointer_id_mapping_.Contains(pointer_id)); | 385 DCHECK(pointer_id_mapping_.Contains(pointer_id)); |
| 376 pointer_id_mapping_.Set( | 386 pointer_id_mapping_.Set( |
| 377 pointer_id, | 387 pointer_id, |
| 378 PointerAttributes(pointer_id_mapping_.at(pointer_id).incoming_id, false)); | 388 PointerAttributes(pointer_id_mapping_.at(pointer_id).incoming_id, false)); |
| 379 | 389 |
| 380 PointerEventInit pointer_event_init; | 390 PointerEventInit pointer_event_init; |
| 381 | 391 |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 const WebPointerProperties& properties) const { | 570 const WebPointerProperties& properties) const { |
| 561 if (properties.pointer_type == WebPointerProperties::PointerType::kMouse) | 571 if (properties.pointer_type == WebPointerProperties::PointerType::kMouse) |
| 562 return PointerEventFactory::kMouseId; | 572 return PointerEventFactory::kMouseId; |
| 563 IncomingId id(properties.pointer_type, properties.id); | 573 IncomingId id(properties.pointer_type, properties.id); |
| 564 if (pointer_incoming_id_mapping_.Contains(id)) | 574 if (pointer_incoming_id_mapping_.Contains(id)) |
| 565 return pointer_incoming_id_mapping_.at(id); | 575 return pointer_incoming_id_mapping_.at(id); |
| 566 return PointerEventFactory::kInvalidId; | 576 return PointerEventFactory::kInvalidId; |
| 567 } | 577 } |
| 568 | 578 |
| 569 } // namespace blink | 579 } // namespace blink |
| OLD | NEW |