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

Unified Diff: sky/engine/core/css/ElementRuleCollector.cpp

Issue 848493003: Don't scope check in SelectorChecker. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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.h ('k') | sky/engine/core/css/RuleSet.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/css/ElementRuleCollector.cpp
diff --git a/sky/engine/core/css/ElementRuleCollector.cpp b/sky/engine/core/css/ElementRuleCollector.cpp
index b9fd6dbec387fbe76df572b84e3936cb925d94b4..9df4ab7c35eed9da92cbf6bd57092a47d33bd87e 100644
--- a/sky/engine/core/css/ElementRuleCollector.cpp
+++ b/sky/engine/core/css/ElementRuleCollector.cpp
@@ -43,7 +43,6 @@ ElementRuleCollector::ElementRuleCollector(const ElementResolveContext& context,
RenderStyle* style)
: m_context(context)
, m_style(style)
- , m_matchingUARules(false)
{ }
ElementRuleCollector::~ElementRuleCollector()
@@ -81,14 +80,6 @@ void ElementRuleCollector::addElementStyleProperties(const StylePropertySet* pro
m_result.isCacheable = false;
}
-static bool rulesApplicableInCurrentTreeScope(const Element* element, const ContainerNode* scopingNode)
-{
- TreeScope& treeScope = element->treeScope();
- return !scopingNode ||
- treeScope == scopingNode->treeScope() ||
- SelectorChecker::isHostInItsShadowTree(*element, scopingNode);
-}
-
void ElementRuleCollector::collectMatchingRules(const MatchRequest& matchRequest, RuleRange& ruleRange, CascadeOrder cascadeOrder)
{
ASSERT(matchRequest.ruleSet);
@@ -96,9 +87,6 @@ void ElementRuleCollector::collectMatchingRules(const MatchRequest& matchRequest
Element& element = *m_context.element();
- if (!m_matchingUARules && !rulesApplicableInCurrentTreeScope(&element, matchRequest.scope))
- return;
-
// We need to collect the rules for id, class, tag, and everything else into a buffer and
// then sort the buffer.
if (element.hasID())
@@ -112,6 +100,11 @@ void ElementRuleCollector::collectMatchingRules(const MatchRequest& matchRequest
collectMatchingRulesForList(matchRequest.ruleSet->universalRules(), cascadeOrder, matchRequest, ruleRange);
}
+void ElementRuleCollector::collectMatchingHostRules(const MatchRequest& matchRequest, RuleRange& ruleRange, CascadeOrder cascadeOrder)
+{
+ collectMatchingRulesForList(matchRequest.ruleSet->hostRules(), cascadeOrder, matchRequest, ruleRange);
+}
+
void ElementRuleCollector::sortAndTransferMatchedRules()
{
if (!m_matchedRules || m_matchedRules->isEmpty())
@@ -128,10 +121,10 @@ void ElementRuleCollector::sortAndTransferMatchedRules()
}
}
-inline bool ElementRuleCollector::ruleMatches(const RuleData& ruleData, const ContainerNode* scope)
+inline bool ElementRuleCollector::ruleMatches(const RuleData& ruleData)
{
SelectorChecker checker(*m_context.element());
- if (checker.match(ruleData.selector(), scope)) {
+ if (checker.match(ruleData.selector())) {
if (checker.matchedAttributeSelector())
m_style->setUnique();
if (checker.matchedFocusSelector())
@@ -148,7 +141,7 @@ inline bool ElementRuleCollector::ruleMatches(const RuleData& ruleData, const Co
void ElementRuleCollector::collectRuleIfMatches(const RuleData& ruleData, CascadeOrder cascadeOrder, const MatchRequest& matchRequest, RuleRange& ruleRange)
{
StyleRule* rule = ruleData.rule();
- if (ruleMatches(ruleData, matchRequest.scope)) {
+ if (ruleMatches(ruleData)) {
// If the rule has no properties to apply, then ignore it in the non-debug mode.
const StylePropertySet& properties = rule->properties();
if (properties.isEmpty())
« no previous file with comments | « sky/engine/core/css/ElementRuleCollector.h ('k') | sky/engine/core/css/RuleSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698