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

Unified Diff: Source/core/css/SelectorChecker.h

Issue 334263020: Refactor SelectorChecker::BehaviorAtBoundary (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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
Index: Source/core/css/SelectorChecker.h
diff --git a/Source/core/css/SelectorChecker.h b/Source/core/css/SelectorChecker.h
index 55fddb9b94246bd5005aa9db388028156cf1be49..30ded5bb5967ee50b6aba937080fcf5d66cfca0b 100644
--- a/Source/core/css/SelectorChecker.h
+++ b/Source/core/css/SelectorChecker.h
@@ -47,16 +47,11 @@ public:
enum VisitedMatchType { VisitedMatchDisabled, VisitedMatchEnabled };
enum Mode { ResolvingStyle = 0, CollectingStyleRules, CollectingCSSRules, QueryingRules, SharingRules };
explicit SelectorChecker(Document&, Mode);
- enum BehaviorAtBoundary {
- DoesNotCrossBoundary = 0,
- // FIXME: refactor to remove BoundaryBehavior (i.e. DoesNotCrossBoundary and StaysWithinTreeScope).
- StaysWithinTreeScope = 2,
- BoundaryBehaviorMask = 3, // 2bit for boundary behavior
- ScopeContainsLastMatchedElement = 4,
- ScopeIsShadowRoot = 8,
- TreatShadowHostAsNormalScope = 16,
-
- ScopeIsShadowHostInPseudoHostParameter = ScopeIsShadowRoot | TreatShadowHostAsNormalScope
+ enum ContextFlags {
+ // FIXME: Revmoe DefaultBehavior.
+ DefaultBehavior = 0,
+ ScopeContainsLastMatchedElement = 1,
+ TreatShadowHostAsNormalScope = 2,
};
struct SelectorCheckingContext {
@@ -74,7 +69,7 @@ public:
, isSubSelector(false)
, hasScrollbarPseudo(false)
, hasSelectionPseudo(false)
- , behaviorAtBoundary(DoesNotCrossBoundary)
+ , contextFlags(DefaultBehavior)
{ }
const CSSSelector* selector;
@@ -89,7 +84,7 @@ public:
bool isSubSelector;
bool hasScrollbarPseudo;
bool hasSelectionPseudo;
- BehaviorAtBoundary behaviorAtBoundary;
+ ContextFlags contextFlags;
};
struct MatchResult {
@@ -119,7 +114,7 @@ public:
enum LinkMatchMask { MatchLink = 1, MatchVisited = 2, MatchAll = MatchLink | MatchVisited };
static unsigned determineLinkMatchType(const CSSSelector&);
- static bool isHostInItsShadowTree(const Element&, BehaviorAtBoundary, const ContainerNode* scope);
+ static bool isHostInItsShadowTree(const Element&, const ContainerNode* scope);
private:
template<typename SiblingTraversalStrategy>
@@ -132,8 +127,6 @@ private:
Match matchForPseudoShadow(const ContainerNode*, const SelectorCheckingContext&, const SiblingTraversalStrategy&, MatchResult*) const;
bool checkScrollbarPseudoClass(const SelectorCheckingContext&, Document*, const CSSSelector&) const;
- Element* parentElement(const SelectorCheckingContext&, bool allowToCrossBoundary = false) const;
- bool scopeContainsLastMatchedElement(const SelectorCheckingContext&) const;
static bool isFrameFocused(const Element&);
@@ -177,7 +170,7 @@ inline bool SelectorChecker::checkExactAttribute(const Element& element, const Q
return false;
}
-inline bool SelectorChecker::isHostInItsShadowTree(const Element& element, BehaviorAtBoundary behaviorAtBoundary, const ContainerNode* scope)
+inline bool SelectorChecker::isHostInItsShadowTree(const Element& element, const ContainerNode* scope)
{
return scope && scope->isInShadowTree() && scope->shadowHost() == element;
}

Powered by Google App Engine
This is Rietveld 408576698