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

Unified Diff: Source/core/css/SelectorChecker.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/css/SVGCSSComputedStyleDeclaration.cpp ('k') | Source/core/css/StyleSheetContents.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/SelectorChecker.cpp
diff --git a/Source/core/css/SelectorChecker.cpp b/Source/core/css/SelectorChecker.cpp
index c4f4d7a468ef9bc2ab151b844a694025ad8b71d6..5c96f10b6bec7102b4c377c6c0a8df8758810c84 100644
--- a/Source/core/css/SelectorChecker.cpp
+++ b/Source/core/css/SelectorChecker.cpp
@@ -154,7 +154,7 @@ SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext& con
PseudoId pseudoId = CSSSelector::pseudoId(context.selector->pseudoType());
if (pseudoId == FIRST_LETTER)
- context.element->document()->styleSheetCollections()->setUsesFirstLetterRules(true);
+ context.element->document().styleSheetCollections()->setUsesFirstLetterRules(true);
if (pseudoId != NOPSEUDO && m_mode != SharingRules)
dynamicPseudo = pseudoId;
}
@@ -435,10 +435,10 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
} else if (context.hasScrollbarPseudo) {
// CSS scrollbars match a specific subset of pseudo classes, and they have specialized rules for each
// (since there are no elements involved).
- return checkScrollbarPseudoClass(context, element->document(), selector);
+ return checkScrollbarPseudoClass(context, &element->document(), selector);
} else if (context.hasSelectionPseudo) {
if (selector->pseudoType() == CSSSelector::PseudoWindowInactive)
- return !element->document()->page()->focusController().isActive();
+ return !element->document().page()->focusController().isActive();
}
// Normal element pseudo class checking.
@@ -466,7 +466,7 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
element->setStyleAffectedByEmpty();
if (context.elementStyle)
context.elementStyle->setEmptyState(result);
- else if (element->renderStyle() && (element->document()->styleSheetCollections()->usesSiblingRules() || element->renderStyle()->unique()))
+ else if (element->renderStyle() && (element->document().styleSheetCollections()->usesSiblingRules() || element->renderStyle()->unique()))
element->renderStyle()->setEmptyState(result);
}
return result;
@@ -601,7 +601,7 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
}
break;
case CSSSelector::PseudoTarget:
- if (element == element->document()->cssTarget())
+ if (element == element->document().cssTarget())
return true;
break;
case CSSSelector::PseudoAny:
@@ -673,7 +673,7 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
return !element->isDisabledFormControl();
break;
case CSSSelector::PseudoFullPageMedia:
- return element && element->document()->isMediaDocument();
+ return element && element->document().isMediaDocument();
break;
case CSSSelector::PseudoDefault:
return element && element->isDefaultButtonForForm();
@@ -692,12 +692,12 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
case CSSSelector::PseudoValid:
if (!element)
return false;
- element->document()->setContainsValidityStyleRules();
+ element->document().setContainsValidityStyleRules();
return element->willValidate() && element->isValidFormControlElement();
case CSSSelector::PseudoInvalid:
if (!element)
return false;
- element->document()->setContainsValidityStyleRules();
+ element->document().setContainsValidityStyleRules();
return element->willValidate() && !element->isValidFormControlElement();
case CSSSelector::PseudoChecked:
{
@@ -719,7 +719,7 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
case CSSSelector::PseudoIndeterminate:
return element && element->shouldAppearIndeterminate();
case CSSSelector::PseudoRoot:
- if (element == element->document()->documentElement())
+ if (element == element->document().documentElement())
return true;
break;
case CSSSelector::PseudoLang:
@@ -743,7 +743,7 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
// context's Document is in the fullscreen state has the 'full-screen' pseudoclass applied.
if (element->isFrameElementBase() && element->containsFullScreenElement())
return true;
- if (FullscreenElementStack* fullscreen = FullscreenElementStack::fromIfExists(element->document())) {
+ if (FullscreenElementStack* fullscreen = FullscreenElementStack::fromIfExists(&element->document())) {
if (!fullscreen->webkitIsFullScreen())
return false;
return element == fullscreen->webkitCurrentFullScreenElement();
@@ -754,22 +754,22 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
case CSSSelector::PseudoFullScreenDocument:
// While a Document is in the fullscreen state, the 'full-screen-document' pseudoclass applies
// to all elements of that Document.
- if (!FullscreenElementStack::isFullScreen(element->document()))
+ if (!FullscreenElementStack::isFullScreen(&element->document()))
return false;
return true;
case CSSSelector::PseudoSeamlessDocument:
// While a document is rendered in a seamless iframe, the 'seamless-document' pseudoclass applies
// to all elements of that Document.
- return element->document()->shouldDisplaySeamlesslyWithParent();
+ return element->document().shouldDisplaySeamlesslyWithParent();
case CSSSelector::PseudoInRange:
if (!element)
return false;
- element->document()->setContainsValidityStyleRules();
+ element->document().setContainsValidityStyleRules();
return element->isInRange();
case CSSSelector::PseudoOutOfRange:
if (!element)
return false;
- element->document()->setContainsValidityStyleRules();
+ element->document().setContainsValidityStyleRules();
return element->isOutOfRange();
case CSSSelector::PseudoFutureCue:
return (element->isWebVTTElement() && !toWebVTTElement(element)->isPastNode());
@@ -778,7 +778,7 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
case CSSSelector::PseudoScope:
{
- const Node* contextualReferenceNode = !context.scope || (context.behaviorAtBoundary & BoundaryBehaviorMask) == CrossesBoundary ? element->document()->documentElement() : context.scope;
+ const Node* contextualReferenceNode = !context.scope || (context.behaviorAtBoundary & BoundaryBehaviorMask) == CrossesBoundary ? element->document().documentElement() : context.scope;
if (element == contextualReferenceNode)
return true;
break;
@@ -982,7 +982,7 @@ unsigned SelectorChecker::determineLinkMatchType(const CSSSelector* selector)
bool SelectorChecker::isFrameFocused(const Element* element)
{
- return element->document()->frame() && element->document()->frame()->selection()->isFocusedAndActive();
+ return element->document().frame() && element->document().frame()->selection()->isFocusedAndActive();
}
bool SelectorChecker::matchesFocusPseudoClass(const Element* element)
« no previous file with comments | « Source/core/css/SVGCSSComputedStyleDeclaration.cpp ('k') | Source/core/css/StyleSheetContents.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698