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

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

Issue 2585283002: Migrate WTF::Vector::append() to ::push_back() [part 6 of N] (Closed)
Patch Set: Created 4 years 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 261
262 // Created coalesced events init structure 262 // Created coalesced events init structure
263 HeapVector<Member<PointerEvent>> coalescedPointerEvents; 263 HeapVector<Member<PointerEvent>> coalescedPointerEvents;
264 for (const auto& coalescedMouseEvent : coalescedMouseEvents) { 264 for (const auto& coalescedMouseEvent : coalescedMouseEvents) {
265 DCHECK_EQ(mouseEvent.pointerProperties().id, 265 DCHECK_EQ(mouseEvent.pointerProperties().id,
266 coalescedMouseEvent.pointerProperties().id); 266 coalescedMouseEvent.pointerProperties().id);
267 DCHECK_EQ(mouseEvent.pointerProperties().pointerType, 267 DCHECK_EQ(mouseEvent.pointerProperties().pointerType,
268 coalescedMouseEvent.pointerProperties().pointerType); 268 coalescedMouseEvent.pointerProperties().pointerType);
269 PointerEventInit coalescedEventInit = pointerEventInit; 269 PointerEventInit coalescedEventInit = pointerEventInit;
270 updateMousePointerEventInit(coalescedMouseEvent, view, &coalescedEventInit); 270 updateMousePointerEventInit(coalescedMouseEvent, view, &coalescedEventInit);
271 coalescedPointerEvents.append( 271 coalescedPointerEvents.push_back(
272 PointerEvent::create(pointerEventName, coalescedEventInit)); 272 PointerEvent::create(pointerEventName, coalescedEventInit));
273 } 273 }
274 pointerEventInit.setCoalescedEvents(coalescedPointerEvents); 274 pointerEventInit.setCoalescedEvents(coalescedPointerEvents);
275 275
276 return PointerEvent::create(pointerEventName, pointerEventInit); 276 return PointerEvent::create(pointerEventName, pointerEventInit);
277 } 277 }
278 278
279 PointerEvent* PointerEventFactory::create( 279 PointerEvent* PointerEventFactory::create(
280 const PlatformTouchPoint& touchPoint, 280 const PlatformTouchPoint& touchPoint,
281 const Vector<PlatformTouchPoint>& coalescedPoints, 281 const Vector<PlatformTouchPoint>& coalescedPoints,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 HeapVector<Member<PointerEvent>> coalescedPointerEvents; 314 HeapVector<Member<PointerEvent>> coalescedPointerEvents;
315 for (const auto& coalescedTouchPoint : coalescedPoints) { 315 for (const auto& coalescedTouchPoint : coalescedPoints) {
316 DCHECK_EQ(touchPoint.state(), coalescedTouchPoint.state()); 316 DCHECK_EQ(touchPoint.state(), coalescedTouchPoint.state());
317 DCHECK_EQ(touchPoint.pointerProperties().id, 317 DCHECK_EQ(touchPoint.pointerProperties().id,
318 coalescedTouchPoint.pointerProperties().id); 318 coalescedTouchPoint.pointerProperties().id);
319 DCHECK_EQ(touchPoint.pointerProperties().pointerType, 319 DCHECK_EQ(touchPoint.pointerProperties().pointerType,
320 coalescedTouchPoint.pointerProperties().pointerType); 320 coalescedTouchPoint.pointerProperties().pointerType);
321 PointerEventInit coalescedEventInit = pointerEventInit; 321 PointerEventInit coalescedEventInit = pointerEventInit;
322 updateTouchPointerEventInit(coalescedTouchPoint, targetFrame, 322 updateTouchPointerEventInit(coalescedTouchPoint, targetFrame,
323 &coalescedEventInit); 323 &coalescedEventInit);
324 coalescedPointerEvents.append( 324 coalescedPointerEvents.push_back(
325 PointerEvent::create(type, coalescedEventInit)); 325 PointerEvent::create(type, coalescedEventInit));
326 } 326 }
327 pointerEventInit.setCoalescedEvents(coalescedPointerEvents); 327 pointerEventInit.setCoalescedEvents(coalescedPointerEvents);
328 328
329 return PointerEvent::create(type, pointerEventInit); 329 return PointerEvent::create(type, pointerEventInit);
330 } 330 }
331 331
332 PointerEvent* PointerEventFactory::createPointerCancelEvent( 332 PointerEvent* PointerEventFactory::createPointerCancelEvent(
333 const int pointerId, 333 const int pointerId,
334 const WebPointerProperties::PointerType pointerType) { 334 const WebPointerProperties::PointerType pointerType) {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 } 470 }
471 471
472 Vector<int> PointerEventFactory::getPointerIdsOfType( 472 Vector<int> PointerEventFactory::getPointerIdsOfType(
473 WebPointerProperties::PointerType pointerType) const { 473 WebPointerProperties::PointerType pointerType) const {
474 Vector<int> mappedIds; 474 Vector<int> mappedIds;
475 475
476 for (auto iter = m_pointerIdMapping.begin(); iter != m_pointerIdMapping.end(); 476 for (auto iter = m_pointerIdMapping.begin(); iter != m_pointerIdMapping.end();
477 ++iter) { 477 ++iter) {
478 int mappedId = iter->key; 478 int mappedId = iter->key;
479 if (iter->value.incomingId.pointerType() == pointerType) 479 if (iter->value.incomingId.pointerType() == pointerType)
480 mappedIds.append(mappedId); 480 mappedIds.push_back(mappedId);
481 } 481 }
482 482
483 // Sorting for a predictable ordering. 483 // Sorting for a predictable ordering.
484 std::sort(mappedIds.begin(), mappedIds.end()); 484 std::sort(mappedIds.begin(), mappedIds.end());
485 return mappedIds; 485 return mappedIds;
486 } 486 }
487 487
488 bool PointerEventFactory::isPrimary(int mappedId) const { 488 bool PointerEventFactory::isPrimary(int mappedId) const {
489 if (!m_pointerIdMapping.contains(mappedId)) 489 if (!m_pointerIdMapping.contains(mappedId))
490 return false; 490 return false;
(...skipping 22 matching lines...) Expand all
513 const WebPointerProperties& properties) const { 513 const WebPointerProperties& properties) const {
514 if (properties.pointerType == WebPointerProperties::PointerType::Mouse) 514 if (properties.pointerType == WebPointerProperties::PointerType::Mouse)
515 return PointerEventFactory::s_mouseId; 515 return PointerEventFactory::s_mouseId;
516 IncomingId id(properties.pointerType, properties.id); 516 IncomingId id(properties.pointerType, properties.id);
517 if (m_pointerIncomingIdMapping.contains(id)) 517 if (m_pointerIncomingIdMapping.contains(id))
518 return m_pointerIncomingIdMapping.get(id); 518 return m_pointerIncomingIdMapping.get(id);
519 return PointerEventFactory::s_invalidId; 519 return PointerEventFactory::s_invalidId;
520 } 520 }
521 521
522 } // namespace blink 522 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698