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

Side by Side Diff: third_party/WebKit/Source/core/page/TouchAdjustment.cpp

Issue 2709033003: Migrate WTF::HashMap::get() to ::at() (Closed)
Patch Set: rebase Created 3 years, 10 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 /* 1 /*
2 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) 2 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 // either be a responder or have an ancestor that is a responder. This 275 // either be a responder or have an ancestor that is a responder. This
276 // iteration tests all ancestors at most once by caching earlier results. 276 // iteration tests all ancestors at most once by caching earlier results.
277 for (unsigned i = 0; i < intersectedNodes.size(); ++i) { 277 for (unsigned i = 0; i < intersectedNodes.size(); ++i) {
278 Node* node = intersectedNodes[i].get(); 278 Node* node = intersectedNodes[i].get();
279 HeapVector<Member<Node>> visitedNodes; 279 HeapVector<Member<Node>> visitedNodes;
280 Node* respondingNode = nullptr; 280 Node* respondingNode = nullptr;
281 for (Node* visitedNode = node; visitedNode; 281 for (Node* visitedNode = node; visitedNode;
282 visitedNode = visitedNode->parentOrShadowHostNode()) { 282 visitedNode = visitedNode->parentOrShadowHostNode()) {
283 // Check if we already have a result for a common ancestor from another 283 // Check if we already have a result for a common ancestor from another
284 // candidate. 284 // candidate.
285 respondingNode = responderMap.get(visitedNode); 285 respondingNode = responderMap.at(visitedNode);
286 if (respondingNode) 286 if (respondingNode)
287 break; 287 break;
288 visitedNodes.push_back(visitedNode); 288 visitedNodes.push_back(visitedNode);
289 // Check if the node filter applies, which would mean we have found a 289 // Check if the node filter applies, which would mean we have found a
290 // responding node. 290 // responding node.
291 if (nodeFilter(visitedNode)) { 291 if (nodeFilter(visitedNode)) {
292 respondingNode = visitedNode; 292 respondingNode = visitedNode;
293 // Continue the iteration to collect the ancestors of the responder, 293 // Continue the iteration to collect the ancestors of the responder,
294 // which we will need later. 294 // which we will need later.
295 for (visitedNode = parentShadowHostOrOwner(visitedNode); visitedNode; 295 for (visitedNode = parentShadowHostOrOwner(visitedNode); visitedNode;
(...skipping 16 matching lines...) Expand all
312 312
313 // We compile the list of component absolute quads instead of using the 313 // We compile the list of component absolute quads instead of using the
314 // bounding rect to be able to perform better hit-testing on inline links on 314 // bounding rect to be able to perform better hit-testing on inline links on
315 // line-breaks. 315 // line-breaks.
316 for (unsigned i = 0; i < candidates.size(); i++) { 316 for (unsigned i = 0; i < candidates.size(); i++) {
317 Node* candidate = candidates[i]; 317 Node* candidate = candidates[i];
318 // Skip nodes who's responders are ancestors of other responders. This gives 318 // Skip nodes who's responders are ancestors of other responders. This gives
319 // preference to the inner-most event-handlers. So that a link is always 319 // preference to the inner-most event-handlers. So that a link is always
320 // preferred even when contained in an element that monitors all 320 // preferred even when contained in an element that monitors all
321 // click-events. 321 // click-events.
322 Node* respondingNode = responderMap.get(candidate); 322 Node* respondingNode = responderMap.at(candidate);
323 ASSERT(respondingNode); 323 ASSERT(respondingNode);
324 if (ancestorsToRespondersSet.contains(respondingNode)) 324 if (ancestorsToRespondersSet.contains(respondingNode))
325 continue; 325 continue;
326 // Consolidate bounds for editable content. 326 // Consolidate bounds for editable content.
327 if (editableAncestors.contains(candidate)) 327 if (editableAncestors.contains(candidate))
328 continue; 328 continue;
329 candidate->document().updateStyleAndLayoutTree(); 329 candidate->document().updateStyleAndLayoutTree();
330 if (hasEditableStyle(*candidate)) { 330 if (hasEditableStyle(*candidate)) {
331 Node* replacement = candidate; 331 Node* replacement = candidate;
332 Node* parent = candidate->parentOrShadowHostNode(); 332 Node* parent = candidate->parentOrShadowHostNode();
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 const HeapVector<Member<Node>>& nodes) { 562 const HeapVector<Member<Node>>& nodes) {
563 IntPoint targetPoint; 563 IntPoint targetPoint;
564 TouchAdjustment::SubtargetGeometryList subtargets; 564 TouchAdjustment::SubtargetGeometryList subtargets;
565 TouchAdjustment::compileZoomableSubtargets(nodes, subtargets); 565 TouchAdjustment::compileZoomableSubtargets(nodes, subtargets);
566 return TouchAdjustment::findNodeWithLowestDistanceMetric( 566 return TouchAdjustment::findNodeWithLowestDistanceMetric(
567 targetNode, targetPoint, targetArea, touchHotspot, touchArea, subtargets, 567 targetNode, targetPoint, targetArea, touchHotspot, touchArea, subtargets,
568 TouchAdjustment::zoomableIntersectionQuotient); 568 TouchAdjustment::zoomableIntersectionQuotient);
569 } 569 }
570 570
571 } // namespace blink 571 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698