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

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

Issue 2322223002: Make ElementShadow::oldestShadowRoot() return a reference (Closed)
Patch Set: Created 4 years, 3 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) 2011, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2011, 2013 Apple Inc. All rights reserved.
3 * Copyright (C) 2014 Samsung Electronics. All rights reserved. 3 * Copyright (C) 2014 Samsung Electronics. 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 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 386
387 // FIXME: Move the following helper functions, authorShadowRootOf, firstWithinTr aversingShadowTree, 387 // FIXME: Move the following helper functions, authorShadowRootOf, firstWithinTr aversingShadowTree,
388 // nextTraversingShadowTree to the best place, e.g. NodeTraversal. 388 // nextTraversingShadowTree to the best place, e.g. NodeTraversal.
389 static ShadowRoot* authorShadowRootOf(const ContainerNode& node) 389 static ShadowRoot* authorShadowRootOf(const ContainerNode& node)
390 { 390 {
391 if (!node.isElementNode() || !isShadowHost(&node)) 391 if (!node.isElementNode() || !isShadowHost(&node))
392 return nullptr; 392 return nullptr;
393 393
394 ElementShadow* shadow = toElement(node).shadow(); 394 ElementShadow* shadow = toElement(node).shadow();
395 DCHECK(shadow); 395 DCHECK(shadow);
396 for (ShadowRoot* shadowRoot = shadow->oldestShadowRoot(); shadowRoot; shadow Root = shadowRoot->youngerShadowRoot()) { 396 for (ShadowRoot* shadowRoot = &shadow->oldestShadowRoot(); shadowRoot; shado wRoot = shadowRoot->youngerShadowRoot()) {
397 if (shadowRoot->type() == ShadowRootType::V0 || shadowRoot->type() == Sh adowRootType::Open) 397 if (shadowRoot->type() == ShadowRootType::V0 || shadowRoot->type() == Sh adowRootType::Open)
398 return shadowRoot; 398 return shadowRoot;
399 } 399 }
400 return nullptr; 400 return nullptr;
401 } 401 }
402 402
403 static ContainerNode* firstWithinTraversingShadowTree(const ContainerNode& rootN ode) 403 static ContainerNode* firstWithinTraversingShadowTree(const ContainerNode& rootN ode)
404 { 404 {
405 if (ShadowRoot* shadowRoot = authorShadowRootOf(rootNode)) 405 if (ShadowRoot* shadowRoot = authorShadowRootOf(rootNode))
406 return shadowRoot; 406 return shadowRoot;
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 586
587 return m_entries.add(selectors, SelectorQuery::adopt(std::move(selectorList) )).storedValue->value.get(); 587 return m_entries.add(selectors, SelectorQuery::adopt(std::move(selectorList) )).storedValue->value.get();
588 } 588 }
589 589
590 void SelectorQueryCache::invalidate() 590 void SelectorQueryCache::invalidate()
591 { 591 {
592 m_entries.clear(); 592 m_entries.clear();
593 } 593 }
594 594
595 } // namespace blink 595 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.cpp ('k') | third_party/WebKit/Source/core/dom/shadow/ElementShadow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698