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

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: Skip the touch test on Mac 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 // Set the trusted flag for the coalesced events at the creation time
289 // as oppose to the normal events which is done at the dispatch time. This
290 // is because we don't want to go over all the coalesced events at every
291 // dispatch and add the implementation complexity while it has no sensible
292 // usecase at this time.
293 event->setTrusted(true);
294 coalescedPointerEvents.push_back(event);
286 } 295 }
287 pointerEventInit.setCoalescedEvents(coalescedPointerEvents); 296 pointerEventInit.setCoalescedEvents(coalescedPointerEvents);
288 } 297 }
289 298
290 return PointerEvent::create(pointerEventName, pointerEventInit); 299 return PointerEvent::create(pointerEventName, pointerEventInit);
291 } 300 }
292 301
293 PointerEvent* PointerEventFactory::create( 302 PointerEvent* PointerEventFactory::create(
294 const WebTouchPoint& touchPoint, 303 const WebTouchPoint& touchPoint,
295 const Vector<WebTouchPoint>& coalescedPoints, 304 const Vector<WebTouchPoint>& coalescedPoints,
(...skipping 27 matching lines...) Expand all
323 332
324 setEventSpecificFields(pointerEventInit, type); 333 setEventSpecificFields(pointerEventInit, type);
325 334
326 if (type == EventTypeNames::pointermove) { 335 if (type == EventTypeNames::pointermove) {
327 HeapVector<Member<PointerEvent>> coalescedPointerEvents; 336 HeapVector<Member<PointerEvent>> coalescedPointerEvents;
328 for (const auto& coalescedTouchPoint : coalescedPoints) { 337 for (const auto& coalescedTouchPoint : coalescedPoints) {
329 DCHECK_EQ(touchPoint.state, coalescedTouchPoint.state); 338 DCHECK_EQ(touchPoint.state, coalescedTouchPoint.state);
330 DCHECK_EQ(touchPoint.id, coalescedTouchPoint.id); 339 DCHECK_EQ(touchPoint.id, coalescedTouchPoint.id);
331 DCHECK_EQ(touchPoint.pointerType, coalescedTouchPoint.pointerType); 340 DCHECK_EQ(touchPoint.pointerType, coalescedTouchPoint.pointerType);
332 PointerEventInit coalescedEventInit = pointerEventInit; 341 PointerEventInit coalescedEventInit = pointerEventInit;
342 coalescedEventInit.setCancelable(false);
343 coalescedEventInit.setBubbles(false);
333 updateTouchPointerEventInit(coalescedTouchPoint, targetFrame, 344 updateTouchPointerEventInit(coalescedTouchPoint, targetFrame,
334 &coalescedEventInit); 345 &coalescedEventInit);
335 coalescedPointerEvents.push_back( 346 PointerEvent* event = PointerEvent::create(type, coalescedEventInit);
336 PointerEvent::create(type, coalescedEventInit)); 347 // Set the trusted flag for the coalesced events at the creation time
348 // as oppose to the normal events which is done at the dispatch time. This
349 // is because we don't want to go over all the coalesced events at every
350 // dispatch and add the implementation complexity while it has no sensible
351 // usecase at this time.
352 event->setTrusted(true);
353 coalescedPointerEvents.push_back(event);
337 } 354 }
338 pointerEventInit.setCoalescedEvents(coalescedPointerEvents); 355 pointerEventInit.setCoalescedEvents(coalescedPointerEvents);
339 } 356 }
340 357
341 return PointerEvent::create(type, pointerEventInit); 358 return PointerEvent::create(type, pointerEventInit);
342 } 359 }
343 360
344 PointerEvent* PointerEventFactory::createPointerCancelEvent( 361 PointerEvent* PointerEventFactory::createPointerCancelEvent(
345 const int pointerId, 362 const int pointerId,
346 const WebPointerProperties::PointerType pointerType) { 363 const WebPointerProperties::PointerType pointerType) {
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 const WebPointerProperties& properties) const { 544 const WebPointerProperties& properties) const {
528 if (properties.pointerType == WebPointerProperties::PointerType::Mouse) 545 if (properties.pointerType == WebPointerProperties::PointerType::Mouse)
529 return PointerEventFactory::s_mouseId; 546 return PointerEventFactory::s_mouseId;
530 IncomingId id(properties.pointerType, properties.id); 547 IncomingId id(properties.pointerType, properties.id);
531 if (m_pointerIncomingIdMapping.contains(id)) 548 if (m_pointerIncomingIdMapping.contains(id))
532 return m_pointerIncomingIdMapping.at(id); 549 return m_pointerIncomingIdMapping.at(id);
533 return PointerEventFactory::s_invalidId; 550 return PointerEventFactory::s_invalidId;
534 } 551 }
535 552
536 } // namespace blink 553 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698