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

Side by Side Diff: third_party/WebKit/Source/core/input/TouchEventManager.cpp

Issue 2709033003: Migrate WTF::HashMap::get() to ::at() (Closed)
Patch Set: rebase Created 3 years, 9 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/input/TouchEventManager.h" 5 #include "core/input/TouchEventManager.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/events/TouchEvent.h" 8 #include "core/events/TouchEvent.h"
9 #include "core/frame/Deprecation.h" 9 #include "core/frame/Deprecation.h"
10 #include "core/frame/EventHandlerRegistry.h" 10 #include "core/frame/EventHandlerRegistry.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 // sending TouchEvents to the targets as required. 203 // sending TouchEvents to the targets as required.
204 for (unsigned state = 0; state <= WebTouchPoint::StateMax; ++state) { 204 for (unsigned state = 0; state <= WebTouchPoint::StateMax; ++state) {
205 if (!changedTouches[state].m_touches) 205 if (!changedTouches[state].m_touches)
206 continue; 206 continue;
207 207
208 const AtomicString& eventName(touchEventNameForTouchPointState( 208 const AtomicString& eventName(touchEventNameForTouchPointState(
209 static_cast<WebTouchPoint::State>(state))); 209 static_cast<WebTouchPoint::State>(state)));
210 for (const auto& eventTarget : changedTouches[state].m_targets) { 210 for (const auto& eventTarget : changedTouches[state].m_targets) {
211 EventTarget* touchEventTarget = eventTarget; 211 EventTarget* touchEventTarget = eventTarget;
212 TouchEvent* touchEvent = TouchEvent::create( 212 TouchEvent* touchEvent = TouchEvent::create(
213 event, touches, touchesByTarget.get(touchEventTarget), 213 event, touches, touchesByTarget.at(touchEventTarget),
214 changedTouches[state].m_touches.get(), eventName, 214 changedTouches[state].m_touches.get(), eventName,
215 touchEventTarget->toNode()->document().domWindow(), 215 touchEventTarget->toNode()->document().domWindow(),
216 m_currentTouchAction); 216 m_currentTouchAction);
217 217
218 DispatchEventResult domDispatchResult = 218 DispatchEventResult domDispatchResult =
219 touchEventTarget->dispatchEvent(touchEvent); 219 touchEventTarget->dispatchEvent(touchEvent);
220 220
221 // Only report for top level documents with a single touch on 221 // Only report for top level documents with a single touch on
222 // touch-start or the first touch-move. 222 // touch-start or the first touch-move.
223 if (event.touchStartOrFirstTouchMove && touchInfos.size() == 1 && 223 if (event.touchStartOrFirstTouchMove && touchInfos.size() == 1 &&
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 if (pointState == WebTouchPoint::StateReleased || 388 if (pointState == WebTouchPoint::StateReleased ||
389 pointState == WebTouchPoint::StateCancelled) { 389 pointState == WebTouchPoint::StateCancelled) {
390 // The target should be the original target for this touch, so get 390 // The target should be the original target for this touch, so get
391 // it from the hashmap. As it's a release or cancel we also remove 391 // it from the hashmap. As it's a release or cancel we also remove
392 // it from the map. 392 // it from the map.
393 touchNode = m_targetForTouchID.take(touchInfo.point.id); 393 touchNode = m_targetForTouchID.take(touchInfo.point.id);
394 regionID = m_regionForTouchID.take(touchInfo.point.id); 394 regionID = m_regionForTouchID.take(touchInfo.point.id);
395 } else { 395 } else {
396 // No hittest is performed on move or stationary, since the target 396 // No hittest is performed on move or stationary, since the target
397 // is not allowed to change anyway. 397 // is not allowed to change anyway.
398 touchNode = m_targetForTouchID.get(touchInfo.point.id); 398 touchNode = m_targetForTouchID.at(touchInfo.point.id);
399 regionID = m_regionForTouchID.get(touchInfo.point.id); 399 regionID = m_regionForTouchID.at(touchInfo.point.id);
400 } 400 }
401 401
402 LocalFrame* targetFrame = nullptr; 402 LocalFrame* targetFrame = nullptr;
403 bool knownTarget = false; 403 bool knownTarget = false;
404 if (touchNode) { 404 if (touchNode) {
405 Document& doc = touchNode->document(); 405 Document& doc = touchNode->document();
406 // If the target node has moved to a new document while it was being 406 // If the target node has moved to a new document while it was being
407 // touched, we can't send events to the new document because that could 407 // touched, we can't send events to the new document because that could
408 // leak nodes from one document to another. See http://crbug.com/394339. 408 // leak nodes from one document to another. See http://crbug.com/394339.
409 if (&doc == m_touchSequenceDocument.get()) { 409 if (&doc == m_touchSequenceDocument.get()) {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 } 514 }
515 515
516 return dispatchTouchEvents(event, touchInfos, allTouchesReleased); 516 return dispatchTouchEvents(event, touchInfos, allTouchesReleased);
517 } 517 }
518 518
519 bool TouchEventManager::isAnyTouchActive() const { 519 bool TouchEventManager::isAnyTouchActive() const {
520 return m_touchPressed; 520 return m_touchPressed;
521 } 521 }
522 522
523 } // namespace blink 523 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698