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

Unified Diff: sky/engine/core/css/SelectorChecker.h

Issue 801283006: Get rid of SelectorCheckingContext. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: missing static. Created 5 years, 11 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 | « sky/engine/core/css/ElementRuleCollector.cpp ('k') | sky/engine/core/css/SelectorChecker.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/css/SelectorChecker.h
diff --git a/sky/engine/core/css/SelectorChecker.h b/sky/engine/core/css/SelectorChecker.h
index de9c526eb4081607df7cb86c1604e77c523c90ae..004d03b42d39a62314175de0ce042cd775f47bf9 100644
--- a/sky/engine/core/css/SelectorChecker.h
+++ b/sky/engine/core/css/SelectorChecker.h
@@ -28,7 +28,6 @@
#ifndef SKY_ENGINE_CORE_CSS_SELECTORCHECKER_H_
#define SKY_ENGINE_CORE_CSS_SELECTORCHECKER_H_
-#include "sky/engine/core/css/CSSSelector.h"
#include "sky/engine/core/dom/Element.h"
namespace blink {
@@ -36,69 +35,33 @@ namespace blink {
class CSSSelector;
class ContainerNode;
class Element;
-class RenderStyle;
class SelectorChecker {
WTF_MAKE_NONCOPYABLE(SelectorChecker);
public:
- explicit SelectorChecker();
+ explicit SelectorChecker(const Element&);
- struct SelectorCheckingContext {
- STACK_ALLOCATED();
- public:
- // Initial selector constructor
- SelectorCheckingContext(const CSSSelector& selector, const Element* element)
- : selector(&selector)
- , element(element)
- , scope(nullptr)
- {
- }
-
- const CSSSelector* selector;
- const Element* element;
- RawPtr<const ContainerNode> scope;
- };
-
- bool match(const SelectorCheckingContext&);
+ // TODO(esprehn): scope should never be null.
+ bool match(const CSSSelector&, const ContainerNode* scope);
bool matchedAttributeSelector() const { return m_matchedAttributeSelector; }
bool matchedFocusSelector() const { return m_matchedFocusSelector; }
bool matchedHoverSelector() const { return m_matchedHoverSelector; }
bool matchedActiveSelector() const { return m_matchedActiveSelector; }
- static bool tagMatches(const Element&, const QualifiedName&);
static bool isHostInItsShadowTree(const Element&, const ContainerNode* scope);
private:
- bool checkPseudoClass(const SelectorCheckingContext&);
- bool checkOne(const SelectorCheckingContext&);
-
- static bool checkExactAttribute(const Element&, const QualifiedName& selectorAttributeName, const StringImpl* value);
- static bool matchesFocusPseudoClass(const Element&);
+ bool checkPseudoClass(const CSSSelector&, const ContainerNode* scope);
+ bool checkOne(const CSSSelector&, const ContainerNode* scope);
+ const Element& m_element;
bool m_matchedAttributeSelector;
bool m_matchedFocusSelector;
bool m_matchedHoverSelector;
bool m_matchedActiveSelector;
};
-inline bool SelectorChecker::tagMatches(const Element& element, const QualifiedName& tagQName)
-{
- const AtomicString& localName = tagQName.localName();
- return localName == starAtom || localName == element.localName();
-}
-
-inline bool SelectorChecker::checkExactAttribute(const Element& element, const QualifiedName& selectorAttributeName, const StringImpl* value)
-{
- AttributeCollection attributes = element.attributesWithoutUpdate();
- AttributeCollection::iterator end = attributes.end();
- for (AttributeCollection::iterator it = attributes.begin(); it != end; ++it) {
- if (it->matches(selectorAttributeName) && (!value || it->value().impl() == value))
- return true;
- }
- return false;
-}
-
inline bool SelectorChecker::isHostInItsShadowTree(const Element& element, const ContainerNode* scope)
{
return scope && scope->isInShadowTree() && scope->shadowHost() == element;
« no previous file with comments | « sky/engine/core/css/ElementRuleCollector.cpp ('k') | sky/engine/core/css/SelectorChecker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698