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

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

Issue 2772443006: Set trusted flag of coalesced events at creation (Closed)
Patch Set: 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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 // Create coalesced events init structure only for pointermove. 272 // Create coalesced events init structure only for pointermove.
273 if (pointerEventName == EventTypeNames::pointermove) { 273 if (pointerEventName == EventTypeNames::pointermove) {
274 HeapVector<Member<PointerEvent>> coalescedPointerEvents; 274 HeapVector<Member<PointerEvent>> coalescedPointerEvents;
275 for (const auto& coalescedMouseEvent : coalescedMouseEvents) { 275 for (const auto& coalescedMouseEvent : coalescedMouseEvents) {
276 // TODO(crbug.com/694742): We will set the id from low-level OS events 276 // TODO(crbug.com/694742): We will set the id from low-level OS events
277 // and enable this DCHECK again. 277 // and enable this DCHECK again.
278 // DCHECK_EQ(mouseEvent.id, coalescedMouseEvent.id); 278 // DCHECK_EQ(mouseEvent.id, coalescedMouseEvent.id);
279 279
280 DCHECK_EQ(mouseEvent.pointerType, coalescedMouseEvent.pointerType); 280 DCHECK_EQ(mouseEvent.pointerType, coalescedMouseEvent.pointerType);
281 PointerEventInit coalescedEventInit = pointerEventInit; 281 PointerEventInit coalescedEventInit = pointerEventInit;
282 coalescedEventInit.setCancelable(false);
283 coalescedEventInit.setBubbles(false);
282 updateMousePointerEventInit(coalescedMouseEvent, view, 284 updateMousePointerEventInit(coalescedMouseEvent, view,
283 &coalescedEventInit); 285 &coalescedEventInit);
284 coalescedPointerEvents.push_back( 286 PointerEvent* event =
285 PointerEvent::create(pointerEventName, coalescedEventInit)); 287 PointerEvent::create(pointerEventName, coalescedEventInit);
288 event->setTrusted(true);
dtapuska 2017/03/24 21:14:02 likely this deserves a comment
Navid Zolghadr 2017/03/27 15:16:16 Done.
289 coalescedPointerEvents.push_back(event);
286 } 290 }
287 pointerEventInit.setCoalescedEvents(coalescedPointerEvents); 291 pointerEventInit.setCoalescedEvents(coalescedPointerEvents);
288 } 292 }
289 293
290 return PointerEvent::create(pointerEventName, pointerEventInit); 294 return PointerEvent::create(pointerEventName, pointerEventInit);
291 } 295 }
292 296
293 PointerEvent* PointerEventFactory::create( 297 PointerEvent* PointerEventFactory::create(
294 const WebTouchPoint& touchPoint, 298 const WebTouchPoint& touchPoint,
295 const Vector<WebTouchPoint>& coalescedPoints, 299 const Vector<WebTouchPoint>& coalescedPoints,
(...skipping 27 matching lines...) Expand all
323 327
324 setEventSpecificFields(pointerEventInit, type); 328 setEventSpecificFields(pointerEventInit, type);
325 329
326 if (type == EventTypeNames::pointermove) { 330 if (type == EventTypeNames::pointermove) {
327 HeapVector<Member<PointerEvent>> coalescedPointerEvents; 331 HeapVector<Member<PointerEvent>> coalescedPointerEvents;
328 for (const auto& coalescedTouchPoint : coalescedPoints) { 332 for (const auto& coalescedTouchPoint : coalescedPoints) {
329 DCHECK_EQ(touchPoint.state, coalescedTouchPoint.state); 333 DCHECK_EQ(touchPoint.state, coalescedTouchPoint.state);
330 DCHECK_EQ(touchPoint.id, coalescedTouchPoint.id); 334 DCHECK_EQ(touchPoint.id, coalescedTouchPoint.id);
331 DCHECK_EQ(touchPoint.pointerType, coalescedTouchPoint.pointerType); 335 DCHECK_EQ(touchPoint.pointerType, coalescedTouchPoint.pointerType);
332 PointerEventInit coalescedEventInit = pointerEventInit; 336 PointerEventInit coalescedEventInit = pointerEventInit;
337 coalescedEventInit.setCancelable(false);
338 coalescedEventInit.setBubbles(false);
333 updateTouchPointerEventInit(coalescedTouchPoint, targetFrame, 339 updateTouchPointerEventInit(coalescedTouchPoint, targetFrame,
334 &coalescedEventInit); 340 &coalescedEventInit);
335 coalescedPointerEvents.push_back( 341 PointerEvent* event = PointerEvent::create(type, coalescedEventInit);
336 PointerEvent::create(type, coalescedEventInit)); 342 event->setTrusted(true);
dtapuska 2017/03/24 21:14:02 ditto
Navid Zolghadr 2017/03/27 15:16:16 Done.
343 coalescedPointerEvents.push_back(event);
337 } 344 }
338 pointerEventInit.setCoalescedEvents(coalescedPointerEvents); 345 pointerEventInit.setCoalescedEvents(coalescedPointerEvents);
339 } 346 }
340 347
341 return PointerEvent::create(type, pointerEventInit); 348 return PointerEvent::create(type, pointerEventInit);
342 } 349 }
343 350
344 PointerEvent* PointerEventFactory::createPointerCancelEvent( 351 PointerEvent* PointerEventFactory::createPointerCancelEvent(
345 const int pointerId, 352 const int pointerId,
346 const WebPointerProperties::PointerType pointerType) { 353 const WebPointerProperties::PointerType pointerType) {
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 const WebPointerProperties& properties) const { 534 const WebPointerProperties& properties) const {
528 if (properties.pointerType == WebPointerProperties::PointerType::Mouse) 535 if (properties.pointerType == WebPointerProperties::PointerType::Mouse)
529 return PointerEventFactory::s_mouseId; 536 return PointerEventFactory::s_mouseId;
530 IncomingId id(properties.pointerType, properties.id); 537 IncomingId id(properties.pointerType, properties.id);
531 if (m_pointerIncomingIdMapping.contains(id)) 538 if (m_pointerIncomingIdMapping.contains(id))
532 return m_pointerIncomingIdMapping.at(id); 539 return m_pointerIncomingIdMapping.at(id);
533 return PointerEventFactory::s_invalidId; 540 return PointerEventFactory::s_invalidId;
534 } 541 }
535 542
536 } // namespace blink 543 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698