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

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

Issue 2614033002: Migrate WTF::Vector::append() to ::push_back() [part 11 of N] (Closed)
Patch Set: Created 3 years, 11 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 return false; 146 return false;
147 } 147 }
148 148
149 static inline void appendQuadsToSubtargetList( 149 static inline void appendQuadsToSubtargetList(
150 Vector<FloatQuad>& quads, 150 Vector<FloatQuad>& quads,
151 Node* node, 151 Node* node,
152 SubtargetGeometryList& subtargets) { 152 SubtargetGeometryList& subtargets) {
153 Vector<FloatQuad>::const_iterator it = quads.begin(); 153 Vector<FloatQuad>::const_iterator it = quads.begin();
154 const Vector<FloatQuad>::const_iterator end = quads.end(); 154 const Vector<FloatQuad>::const_iterator end = quads.end();
155 for (; it != end; ++it) 155 for (; it != end; ++it)
156 subtargets.append(SubtargetGeometry(node, *it)); 156 subtargets.push_back(SubtargetGeometry(node, *it));
157 } 157 }
158 158
159 static inline void appendBasicSubtargetsForNode( 159 static inline void appendBasicSubtargetsForNode(
160 Node* node, 160 Node* node,
161 SubtargetGeometryList& subtargets) { 161 SubtargetGeometryList& subtargets) {
162 // Node guaranteed to have layoutObject due to check in node filter. 162 // Node guaranteed to have layoutObject due to check in node filter.
163 ASSERT(node->layoutObject()); 163 ASSERT(node->layoutObject());
164 164
165 Vector<FloatQuad> quads; 165 Vector<FloatQuad> quads;
166 node->layoutObject()->absoluteQuads(quads); 166 node->layoutObject()->absoluteQuads(quads);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 } 233 }
234 234
235 static inline void appendZoomableSubtargets(Node* node, 235 static inline void appendZoomableSubtargets(Node* node,
236 SubtargetGeometryList& subtargets) { 236 SubtargetGeometryList& subtargets) {
237 LayoutBox* layoutObject = toLayoutBox(node->layoutObject()); 237 LayoutBox* layoutObject = toLayoutBox(node->layoutObject());
238 ASSERT(layoutObject); 238 ASSERT(layoutObject);
239 239
240 Vector<FloatQuad> quads; 240 Vector<FloatQuad> quads;
241 FloatRect borderBoxRect(layoutObject->borderBoxRect()); 241 FloatRect borderBoxRect(layoutObject->borderBoxRect());
242 FloatRect contentBoxRect(layoutObject->contentBoxRect()); 242 FloatRect contentBoxRect(layoutObject->contentBoxRect());
243 quads.append(layoutObject->localToAbsoluteQuad(borderBoxRect)); 243 quads.push_back(layoutObject->localToAbsoluteQuad(borderBoxRect));
244 if (borderBoxRect != contentBoxRect) 244 if (borderBoxRect != contentBoxRect)
245 quads.append(layoutObject->localToAbsoluteQuad(contentBoxRect)); 245 quads.push_back(layoutObject->localToAbsoluteQuad(contentBoxRect));
246 // FIXME: For LayoutBlocks, add column boxes and content boxes cleared for 246 // FIXME: For LayoutBlocks, add column boxes and content boxes cleared for
247 // floats. 247 // floats.
248 248
249 Vector<FloatQuad>::const_iterator it = quads.begin(); 249 Vector<FloatQuad>::const_iterator it = quads.begin();
250 const Vector<FloatQuad>::const_iterator end = quads.end(); 250 const Vector<FloatQuad>::const_iterator end = quads.end();
251 for (; it != end; ++it) 251 for (; it != end; ++it)
252 subtargets.append(SubtargetGeometry(node, *it)); 252 subtargets.push_back(SubtargetGeometry(node, *it));
253 } 253 }
254 254
255 static inline Node* parentShadowHostOrOwner(const Node* node) { 255 static inline Node* parentShadowHostOrOwner(const Node* node) {
256 if (Node* ancestor = node->parentOrShadowHostNode()) 256 if (Node* ancestor = node->parentOrShadowHostNode())
257 return ancestor; 257 return ancestor;
258 if (node->isDocumentNode()) 258 if (node->isDocumentNode())
259 return toDocument(node)->localOwner(); 259 return toDocument(node)->localOwner();
260 return nullptr; 260 return nullptr;
261 } 261 }
262 262
(...skipping 15 matching lines...) Expand all
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.get(visitedNode);
286 if (respondingNode) 286 if (respondingNode)
287 break; 287 break;
288 visitedNodes.append(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;
296 visitedNode = parentShadowHostOrOwner(visitedNode)) { 296 visitedNode = parentShadowHostOrOwner(visitedNode)) {
297 HeapHashSet<Member<Node>>::AddResult addResult = 297 HeapHashSet<Member<Node>>::AddResult addResult =
298 ancestorsToRespondersSet.add(visitedNode); 298 ancestorsToRespondersSet.add(visitedNode);
299 if (!addResult.isNewEntry) 299 if (!addResult.isNewEntry)
300 break; 300 break;
301 } 301 }
302 break; 302 break;
303 } 303 }
304 } 304 }
305 // Insert the detected responder for all the visited nodes. 305 // Insert the detected responder for all the visited nodes.
306 for (unsigned j = 0; j < visitedNodes.size(); j++) 306 for (unsigned j = 0; j < visitedNodes.size(); j++)
307 responderMap.add(visitedNodes[j], respondingNode); 307 responderMap.add(visitedNodes[j], respondingNode);
308 308
309 if (respondingNode) 309 if (respondingNode)
310 candidates.append(node); 310 candidates.push_back(node);
311 } 311 }
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
(...skipping 241 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
« no previous file with comments | « third_party/WebKit/Source/core/page/PrintContextTest.cpp ('k') | third_party/WebKit/Source/core/page/TouchDisambiguation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698