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

Side by Side Diff: Source/core/css/ElementRuleCollector.cpp

Issue 143323014: *** DO NOT LAND *** Attempt to understand Regions complexity Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/css/ElementRuleCollector.h ('k') | Source/core/css/RuleSet.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 24 matching lines...) Expand all
35 #include "core/css/CSSRuleList.h" 35 #include "core/css/CSSRuleList.h"
36 #include "core/css/CSSSelector.h" 36 #include "core/css/CSSSelector.h"
37 #include "core/css/CSSStyleRule.h" 37 #include "core/css/CSSStyleRule.h"
38 #include "core/css/CSSStyleSheet.h" 38 #include "core/css/CSSStyleSheet.h"
39 #include "core/css/CSSSupportsRule.h" 39 #include "core/css/CSSSupportsRule.h"
40 #include "core/css/SelectorCheckerFastPath.h" 40 #include "core/css/SelectorCheckerFastPath.h"
41 #include "core/css/SiblingTraversalStrategies.h" 41 #include "core/css/SiblingTraversalStrategies.h"
42 #include "core/css/StylePropertySet.h" 42 #include "core/css/StylePropertySet.h"
43 #include "core/css/resolver/StyleResolver.h" 43 #include "core/css/resolver/StyleResolver.h"
44 #include "core/dom/shadow/ShadowRoot.h" 44 #include "core/dom/shadow/ShadowRoot.h"
45 #include "core/rendering/RenderRegion.h"
46 45
47 namespace WebCore { 46 namespace WebCore {
48 47
49 ElementRuleCollector::ElementRuleCollector(const ElementResolveContext& context, 48 ElementRuleCollector::ElementRuleCollector(const ElementResolveContext& context,
50 const SelectorFilter& filter, RenderStyle* style) 49 const SelectorFilter& filter, RenderStyle* style)
51 : m_context(context) 50 : m_context(context)
52 , m_selectorFilter(filter) 51 , m_selectorFilter(filter)
53 , m_style(style) 52 , m_style(style)
54 , m_regionForStyling(0)
55 , m_pseudoStyleRequest(NOPSEUDO) 53 , m_pseudoStyleRequest(NOPSEUDO)
56 , m_mode(SelectorChecker::ResolvingStyle) 54 , m_mode(SelectorChecker::ResolvingStyle)
57 , m_canUseFastReject(m_selectorFilter.parentStackIsConsistent(context.parent Node())) 55 , m_canUseFastReject(m_selectorFilter.parentStackIsConsistent(context.parent Node()))
58 , m_sameOriginOnly(false) 56 , m_sameOriginOnly(false)
59 , m_matchingUARules(false) 57 , m_matchingUARules(false)
60 { } 58 { }
61 59
62 ElementRuleCollector::~ElementRuleCollector() 60 ElementRuleCollector::~ElementRuleCollector()
63 { 61 {
64 } 62 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 } 169 }
172 170
173 if (element.isLink()) 171 if (element.isLink())
174 collectMatchingRulesForList(matchRequest.ruleSet->linkPseudoClassRules() , behaviorAtBoundary, cascadeScope, cascadeOrder, matchRequest, ruleRange); 172 collectMatchingRulesForList(matchRequest.ruleSet->linkPseudoClassRules() , behaviorAtBoundary, cascadeScope, cascadeOrder, matchRequest, ruleRange);
175 if (SelectorChecker::matchesFocusPseudoClass(element)) 173 if (SelectorChecker::matchesFocusPseudoClass(element))
176 collectMatchingRulesForList(matchRequest.ruleSet->focusPseudoClassRules( ), behaviorAtBoundary, cascadeScope, cascadeOrder, matchRequest, ruleRange); 174 collectMatchingRulesForList(matchRequest.ruleSet->focusPseudoClassRules( ), behaviorAtBoundary, cascadeScope, cascadeOrder, matchRequest, ruleRange);
177 collectMatchingRulesForList(matchRequest.ruleSet->tagRules(element.localName ().impl()), behaviorAtBoundary, cascadeScope, cascadeOrder, matchRequest, ruleRa nge); 175 collectMatchingRulesForList(matchRequest.ruleSet->tagRules(element.localName ().impl()), behaviorAtBoundary, cascadeScope, cascadeOrder, matchRequest, ruleRa nge);
178 collectMatchingRulesForList(matchRequest.ruleSet->universalRules(), behavior AtBoundary, cascadeScope, cascadeOrder, matchRequest, ruleRange); 176 collectMatchingRulesForList(matchRequest.ruleSet->universalRules(), behavior AtBoundary, cascadeScope, cascadeOrder, matchRequest, ruleRange);
179 } 177 }
180 178
181 void ElementRuleCollector::collectMatchingRulesForRegion(const MatchRequest& mat chRequest, RuleRange& ruleRange, SelectorChecker::BehaviorAtBoundary behaviorAtB oundary, CascadeScope cascadeScope, CascadeOrder cascadeOrder)
182 {
183 if (!m_regionForStyling)
184 return;
185
186 unsigned size = matchRequest.ruleSet->m_regionSelectorsAndRuleSets.size();
187 for (unsigned i = 0; i < size; ++i) {
188 const CSSSelector* regionSelector = matchRequest.ruleSet->m_regionSelect orsAndRuleSets.at(i).selector;
189 if (checkRegionSelector(regionSelector, toElement(m_regionForStyling->no deForRegion()))) {
190 RuleSet* regionRules = matchRequest.ruleSet->m_regionSelectorsAndRul eSets.at(i).ruleSet.get();
191 ASSERT(regionRules);
192 collectMatchingRules(MatchRequest(regionRules, matchRequest.includeE mptyRules, matchRequest.scope), ruleRange, behaviorAtBoundary, cascadeScope, cas cadeOrder);
193 }
194 }
195 }
196 179
197 CSSRuleList* ElementRuleCollector::nestedRuleList(CSSRule* rule) 180 CSSRuleList* ElementRuleCollector::nestedRuleList(CSSRule* rule)
198 { 181 {
199 switch (rule->type()) { 182 switch (rule->type()) {
200 case CSSRule::MEDIA_RULE: 183 case CSSRule::MEDIA_RULE:
201 return toCSSMediaRule(rule)->cssRules(); 184 return toCSSMediaRule(rule)->cssRules();
202 case CSSRule::KEYFRAMES_RULE: 185 case CSSRule::KEYFRAMES_RULE:
203 return toCSSKeyframesRule(rule)->cssRules(); 186 return toCSSKeyframesRule(rule)->cssRules();
204 case CSSRule::SUPPORTS_RULE: 187 case CSSRule::SUPPORTS_RULE:
205 return toCSSSupportsRule(rule)->cssRules(); 188 return toCSSSupportsRule(rule)->cssRules();
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 // information about "scope". 383 // information about "scope".
401 int firstRuleIndex = -1, lastRuleIndex = -1; 384 int firstRuleIndex = -1, lastRuleIndex = -1;
402 RuleRange ruleRange(firstRuleIndex, lastRuleIndex); 385 RuleRange ruleRange(firstRuleIndex, lastRuleIndex);
403 // FIXME: Verify whether it's ok to ignore CascadeScope here. 386 // FIXME: Verify whether it's ok to ignore CascadeScope here.
404 collectMatchingRules(MatchRequest(ruleSet), ruleRange, SelectorChecker::Stay sWithinTreeScope); 387 collectMatchingRules(MatchRequest(ruleSet), ruleRange, SelectorChecker::Stay sWithinTreeScope);
405 388
406 return m_matchedRules && !m_matchedRules->isEmpty(); 389 return m_matchedRules && !m_matchedRules->isEmpty();
407 } 390 }
408 391
409 } // namespace WebCore 392 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/ElementRuleCollector.h ('k') | Source/core/css/RuleSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698