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

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

Issue 2769783002: Centralize more querySelector logic behind QuerySelectorCache. (Closed)
Patch Set: 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 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
8 * All rights reserved. 8 * All rights reserved.
9 * (C) 2007 Eric Seidel (eric@webkit.org) 9 * (C) 2007 Eric Seidel (eric@webkit.org)
10 * 10 *
(...skipping 3326 matching lines...) Expand 10 before | Expand all | Expand 10 after
3337 PseudoElement* Element::pseudoElement(PseudoId pseudoId) const { 3337 PseudoElement* Element::pseudoElement(PseudoId pseudoId) const {
3338 return hasRareData() ? elementRareData()->pseudoElement(pseudoId) : nullptr; 3338 return hasRareData() ? elementRareData()->pseudoElement(pseudoId) : nullptr;
3339 } 3339 }
3340 3340
3341 LayoutObject* Element::pseudoElementLayoutObject(PseudoId pseudoId) const { 3341 LayoutObject* Element::pseudoElementLayoutObject(PseudoId pseudoId) const {
3342 if (PseudoElement* element = pseudoElement(pseudoId)) 3342 if (PseudoElement* element = pseudoElement(pseudoId))
3343 return element->layoutObject(); 3343 return element->layoutObject();
3344 return nullptr; 3344 return nullptr;
3345 } 3345 }
3346 3346
3347 bool Element::matches(const String& selectors, ExceptionState& exceptionState) { 3347 bool Element::matches(const AtomicString& selectors,
3348 ExceptionState& exceptionState) {
3348 SelectorQuery* selectorQuery = document().selectorQueryCache().add( 3349 SelectorQuery* selectorQuery = document().selectorQueryCache().add(
3349 AtomicString(selectors), document(), exceptionState); 3350 selectors, document(), exceptionState);
3350 if (!selectorQuery) 3351 if (!selectorQuery)
3351 return false; 3352 return false;
3352 return selectorQuery->matches(*this); 3353 return selectorQuery->matches(*this);
3353 } 3354 }
3354 3355
3355 Element* Element::closest(const String& selectors, 3356 Element* Element::closest(const AtomicString& selectors,
3356 ExceptionState& exceptionState) { 3357 ExceptionState& exceptionState) {
3357 SelectorQuery* selectorQuery = document().selectorQueryCache().add( 3358 SelectorQuery* selectorQuery = document().selectorQueryCache().add(
3358 AtomicString(selectors), document(), exceptionState); 3359 selectors, document(), exceptionState);
3359 if (!selectorQuery) 3360 if (!selectorQuery)
3360 return nullptr; 3361 return nullptr;
3361 return selectorQuery->closest(*this); 3362 return selectorQuery->closest(*this);
3362 } 3363 }
3363 3364
3364 DOMTokenList& Element::classList() { 3365 DOMTokenList& Element::classList() {
3365 ElementRareData& rareData = ensureElementRareData(); 3366 ElementRareData& rareData = ensureElementRareData();
3366 if (!rareData.classList()) 3367 if (!rareData.classList())
3367 rareData.setClassList(ClassList::create(this)); 3368 rareData.setClassList(ClassList::create(this));
3368 return *rareData.classList(); 3369 return *rareData.classList();
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after
4170 } 4171 }
4171 4172
4172 DEFINE_TRACE_WRAPPERS(Element) { 4173 DEFINE_TRACE_WRAPPERS(Element) {
4173 if (hasRareData()) { 4174 if (hasRareData()) {
4174 visitor->traceWrappers(elementRareData()); 4175 visitor->traceWrappers(elementRareData());
4175 } 4176 }
4176 ContainerNode::traceWrappers(visitor); 4177 ContainerNode::traceWrappers(visitor);
4177 } 4178 }
4178 4179
4179 } // namespace blink 4180 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.h ('k') | third_party/WebKit/Source/core/dom/SelectorQuery.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698