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

Side by Side Diff: third_party/WebKit/Source/core/dom/TreeScope.cpp

Issue 2502413004: WTF/std normalization: replace WTF::Vector::last with ::back (Closed)
Patch Set: rebase Created 4 years, 1 month 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) 2011 Google Inc. All Rights Reserved. 2 * Copyright (C) 2011 Google Inc. All Rights Reserved.
3 * Copyright (C) 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 continue; 308 continue;
309 309
310 if (node && node->isElementNode()) { 310 if (node && node->isElementNode()) {
311 elements.append(toElement(node)); 311 elements.append(toElement(node));
312 lastNode = node; 312 lastNode = node;
313 } 313 }
314 } 314 }
315 315
316 if (rootNode().isDocumentNode()) { 316 if (rootNode().isDocumentNode()) {
317 if (Element* rootElement = toDocument(rootNode()).documentElement()) { 317 if (Element* rootElement = toDocument(rootNode()).documentElement()) {
318 if (elements.isEmpty() || elements.last() != rootElement) 318 if (elements.isEmpty() || elements.back() != rootElement)
319 elements.append(rootElement); 319 elements.append(rootElement);
320 } 320 }
321 } 321 }
322 322
323 return elements; 323 return elements;
324 } 324 }
325 325
326 HeapVector<Member<Element>> TreeScope::elementsFromPoint(int x, int y) const { 326 HeapVector<Member<Element>> TreeScope::elementsFromPoint(int x, int y) const {
327 Document& document = rootNode().document(); 327 Document& document = rootNode().document();
328 IntPoint hitPoint(x, y); 328 IntPoint hitPoint(x, y);
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 496
497 HeapVector<Member<const TreeScope>, 16> otherChain; 497 HeapVector<Member<const TreeScope>, 16> otherChain;
498 for (const TreeScope* tree = &other; tree; tree = tree->parentTreeScope()) 498 for (const TreeScope* tree = &other; tree; tree = tree->parentTreeScope())
499 otherChain.append(tree); 499 otherChain.append(tree);
500 500
501 // Keep popping out the last elements of these chains until a mismatched pair 501 // Keep popping out the last elements of these chains until a mismatched pair
502 // is found. If |this| and |other| belong to different documents, null will be 502 // is found. If |this| and |other| belong to different documents, null will be
503 // returned. 503 // returned.
504 const TreeScope* lastAncestor = nullptr; 504 const TreeScope* lastAncestor = nullptr;
505 while (!thisChain.isEmpty() && !otherChain.isEmpty() && 505 while (!thisChain.isEmpty() && !otherChain.isEmpty() &&
506 thisChain.last() == otherChain.last()) { 506 thisChain.back() == otherChain.back()) {
507 lastAncestor = thisChain.last(); 507 lastAncestor = thisChain.back();
508 thisChain.pop_back(); 508 thisChain.pop_back();
509 otherChain.pop_back(); 509 otherChain.pop_back();
510 } 510 }
511 return lastAncestor; 511 return lastAncestor;
512 } 512 }
513 513
514 TreeScope* TreeScope::commonAncestorTreeScope(TreeScope& other) { 514 TreeScope* TreeScope::commonAncestorTreeScope(TreeScope& other) {
515 return const_cast<TreeScope*>( 515 return const_cast<TreeScope*>(
516 static_cast<const TreeScope&>(*this).commonAncestorTreeScope(other)); 516 static_cast<const TreeScope&>(*this).commonAncestorTreeScope(other));
517 } 517 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 visitor->trace(m_parentTreeScope); 562 visitor->trace(m_parentTreeScope);
563 visitor->trace(m_idTargetObserverRegistry); 563 visitor->trace(m_idTargetObserverRegistry);
564 visitor->trace(m_selection); 564 visitor->trace(m_selection);
565 visitor->trace(m_elementsById); 565 visitor->trace(m_elementsById);
566 visitor->trace(m_imageMapsByName); 566 visitor->trace(m_imageMapsByName);
567 visitor->trace(m_scopedStyleResolver); 567 visitor->trace(m_scopedStyleResolver);
568 visitor->trace(m_radioButtonGroupScope); 568 visitor->trace(m_radioButtonGroupScope);
569 } 569 }
570 570
571 } // namespace blink 571 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698