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

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

Issue 2889733002: Set the target lazily for the coalesced events (Closed)
Patch Set: Add missing override Created 3 years, 7 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 | « third_party/WebKit/Source/core/events/PointerEvent.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/PointerEvent.h" 5 #include "core/events/PointerEvent.h"
6 6
7 #include "core/dom/Element.h" 7 #include "core/dom/Element.h"
8 #include "core/events/EventDispatcher.h" 8 #include "core/events/EventDispatcher.h"
9 9
10 namespace blink { 10 namespace blink {
11 11
12 PointerEvent::PointerEvent(const AtomicString& type, 12 PointerEvent::PointerEvent(const AtomicString& type,
13 const PointerEventInit& initializer, 13 const PointerEventInit& initializer,
14 TimeTicks platform_time_stamp) 14 TimeTicks platform_time_stamp)
15 : MouseEvent(type, initializer, platform_time_stamp), 15 : MouseEvent(type, initializer, platform_time_stamp),
16 pointer_id_(0), 16 pointer_id_(0),
17 width_(0), 17 width_(0),
18 height_(0), 18 height_(0),
19 pressure_(0), 19 pressure_(0),
20 tilt_x_(0), 20 tilt_x_(0),
21 tilt_y_(0), 21 tilt_y_(0),
22 tangential_pressure_(0), 22 tangential_pressure_(0),
23 twist_(0), 23 twist_(0),
24 is_primary_(false) { 24 is_primary_(false),
25 coalesced_events_targets_dirty_(false) {
25 if (initializer.hasPointerId()) 26 if (initializer.hasPointerId())
26 pointer_id_ = initializer.pointerId(); 27 pointer_id_ = initializer.pointerId();
27 if (initializer.hasWidth()) 28 if (initializer.hasWidth())
28 width_ = initializer.width(); 29 width_ = initializer.width();
29 if (initializer.hasHeight()) 30 if (initializer.hasHeight())
30 height_ = initializer.height(); 31 height_ = initializer.height();
31 if (initializer.hasPressure()) 32 if (initializer.hasPressure())
32 pressure_ = initializer.pressure(); 33 pressure_ = initializer.pressure();
33 if (initializer.hasTiltX()) 34 if (initializer.hasTiltX())
34 tilt_x_ = initializer.tiltX(); 35 tilt_x_ = initializer.tiltX();
(...skipping 18 matching lines...) Expand all
53 } 54 }
54 55
55 bool PointerEvent::IsPointerEvent() const { 56 bool PointerEvent::IsPointerEvent() const {
56 return true; 57 return true;
57 } 58 }
58 59
59 EventDispatchMediator* PointerEvent::CreateMediator() { 60 EventDispatchMediator* PointerEvent::CreateMediator() {
60 return PointerEventDispatchMediator::Create(this); 61 return PointerEventDispatchMediator::Create(this);
61 } 62 }
62 63
63 HeapVector<Member<PointerEvent>> PointerEvent::getCoalescedEvents() const { 64 void PointerEvent::ReceivedTarget() {
65 coalesced_events_targets_dirty_ = true;
66 MouseEvent::ReceivedTarget();
67 }
68
69 HeapVector<Member<PointerEvent>> PointerEvent::getCoalescedEvents() {
70 if (coalesced_events_targets_dirty_) {
71 for (auto coalesced_event : coalesced_events_)
72 coalesced_event->SetTarget(target());
73 coalesced_events_targets_dirty_ = false;
74 }
64 return coalesced_events_; 75 return coalesced_events_;
65 } 76 }
66 77
67 DEFINE_TRACE(PointerEvent) { 78 DEFINE_TRACE(PointerEvent) {
68 visitor->Trace(coalesced_events_); 79 visitor->Trace(coalesced_events_);
69 MouseEvent::Trace(visitor); 80 MouseEvent::Trace(visitor);
70 } 81 }
71 82
72 PointerEventDispatchMediator* PointerEventDispatchMediator::Create( 83 PointerEventDispatchMediator* PointerEventDispatchMediator::Create(
73 PointerEvent* pointer_event) { 84 PointerEvent* pointer_event) {
(...skipping 15 matching lines...) Expand all
89 100
90 DCHECK(!Event().target() || Event().target() != Event().relatedTarget()); 101 DCHECK(!Event().target() || Event().target() != Event().relatedTarget());
91 102
92 Event().GetEventPath().AdjustForRelatedTarget(dispatcher.GetNode(), 103 Event().GetEventPath().AdjustForRelatedTarget(dispatcher.GetNode(),
93 Event().relatedTarget()); 104 Event().relatedTarget());
94 105
95 return dispatcher.Dispatch(); 106 return dispatcher.Dispatch();
96 } 107 }
97 108
98 } // namespace blink 109 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/events/PointerEvent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698