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

Unified Diff: Source/core/dom/SelectorQuery.cpp

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/ScriptLoader.cpp ('k') | Source/core/dom/StyleElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/SelectorQuery.cpp
diff --git a/Source/core/dom/SelectorQuery.cpp b/Source/core/dom/SelectorQuery.cpp
index db7afdf450aa0a064a5f95944ccca290d17b2872..520228ffdabafe1eadfcadcfc5142f0b4d8a7d46 100644
--- a/Source/core/dom/SelectorQuery.cpp
+++ b/Source/core/dom/SelectorQuery.cpp
@@ -148,7 +148,7 @@ inline bool SelectorDataList::selectorMatches(const SelectorData& selectorData,
return selectorCheckerFastPath.matches();
}
- SelectorChecker selectorChecker(element->document(), SelectorChecker::QueryingRules);
+ SelectorChecker selectorChecker(&element->document(), SelectorChecker::QueryingRules);
SelectorChecker::SelectorCheckingContext selectorCheckingContext(selectorData.selector, element, SelectorChecker::VisitedMatchDisabled);
selectorCheckingContext.behaviorAtBoundary = SelectorChecker::StaysWithinTreeScope;
selectorCheckingContext.scope = !rootNode->isDocumentNode() && rootNode->isContainerNode() ? toContainerNode(rootNode) : 0;
@@ -223,7 +223,7 @@ Element* SelectorDataList::findElementByTagName(Node* rootNode, const QualifiedN
inline bool SelectorDataList::canUseFastQuery(Node* rootNode) const
{
- return m_selectors.size() == 1 && rootNode->inDocument() && !rootNode->document()->inQuirksMode();
+ return m_selectors.size() == 1 && rootNode->inDocument() && !rootNode->document().inQuirksMode();
}
// If returns true, traversalRoots has the elements that may match the selector query.
@@ -245,7 +245,7 @@ PassOwnPtr<SimpleNodeList> SelectorDataList::findTraverseRoots(Node* rootNode, b
bool startFromParent = false;
for (const CSSSelector* selector = m_selectors[0].selector; selector; selector = selector->tagHistory()) {
- if (selector->m_match == CSSSelector::Id && !rootNode->document()->containsMultipleElementsWithId(selector->value())) {
+ if (selector->m_match == CSSSelector::Id && !rootNode->document().containsMultipleElementsWithId(selector->value())) {
Element* element = rootNode->treeScope()->getElementById(selector->value());
if (element && (isTreeScopeRoot(rootNode) || element->isDescendantOf(rootNode)))
rootNode = element;
@@ -313,7 +313,7 @@ void SelectorDataList::executeQueryAll(Node* rootNode, Vector<RefPtr<Node> >& ma
switch (firstSelector->m_match) {
case CSSSelector::Id:
{
- if (rootNode->document()->containsMultipleElementsWithId(firstSelector->value()))
+ if (rootNode->document().containsMultipleElementsWithId(firstSelector->value()))
break;
// Just the same as getElementById.
@@ -374,7 +374,7 @@ Node* SelectorDataList::findTraverseRoot(Node* rootNode, bool& matchTraverseRoot
bool matchSingleNode = true;
bool startFromParent = false;
for (const CSSSelector* selector = m_selectors[0].selector; selector; selector = selector->tagHistory()) {
- if (selector->m_match == CSSSelector::Id && !rootNode->document()->containsMultipleElementsWithId(selector->value())) {
+ if (selector->m_match == CSSSelector::Id && !rootNode->document().containsMultipleElementsWithId(selector->value())) {
Element* element = rootNode->treeScope()->getElementById(selector->value());
if (element && (isTreeScopeRoot(rootNode) || element->isDescendantOf(rootNode)))
rootNode = element;
@@ -427,7 +427,7 @@ Element* SelectorDataList::executeQueryFirst(Node* rootNode) const
switch (selector->m_match) {
case CSSSelector::Id:
{
- if (rootNode->document()->containsMultipleElementsWithId(selector->value()))
+ if (rootNode->document().containsMultipleElementsWithId(selector->value()))
break;
Element* element = rootNode->treeScope()->getElementById(selector->value());
return element && (isTreeScopeRoot(rootNode) || element->isDescendantOf(rootNode)) ? element : 0;
« no previous file with comments | « Source/core/dom/ScriptLoader.cpp ('k') | Source/core/dom/StyleElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698