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

Side by Side Diff: Source/core/css/resolver/ScopedStyleResolver.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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
4 * Copyright (C) 2012 Google Inc. All rights reserved. 4 * Copyright (C) 2012 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) 83 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i)
84 features.add(m_authorStyleSheets[i]->contents()->ruleSet().features()); 84 features.add(m_authorStyleSheets[i]->contents()->ruleSet().features());
85 } 85 }
86 86
87 void ScopedStyleResolver::resetAuthorStyle() 87 void ScopedStyleResolver::resetAuthorStyle()
88 { 88 {
89 m_authorStyleSheets.clear(); 89 m_authorStyleSheets.clear();
90 m_keyframesRuleMap.clear(); 90 m_keyframesRuleMap.clear();
91 } 91 }
92 92
93 bool ScopedStyleResolver::checkRegionStyle(Element* regionElement)
94 {
95 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) {
96 const RuleSet& ruleSet = m_authorStyleSheets[i]->contents()->ruleSet();
97 for (unsigned i = 0; i < ruleSet.m_regionSelectorsAndRuleSets.size(); ++ i) {
98 ASSERT(ruleSet.m_regionSelectorsAndRuleSets.at(i).ruleSet.get());
99 if (checkRegionSelector(ruleSet.m_regionSelectorsAndRuleSets.at(i).s elector, regionElement))
100 return true;
101 }
102 }
103 return false;
104 }
105
106 const StyleRuleKeyframes* ScopedStyleResolver::keyframeStylesForAnimation(const StringImpl* animationName) 93 const StyleRuleKeyframes* ScopedStyleResolver::keyframeStylesForAnimation(const StringImpl* animationName)
107 { 94 {
108 if (m_keyframesRuleMap.isEmpty()) 95 if (m_keyframesRuleMap.isEmpty())
109 return 0; 96 return 0;
110 97
111 KeyframesRuleMap::iterator it = m_keyframesRuleMap.find(animationName); 98 KeyframesRuleMap::iterator it = m_keyframesRuleMap.find(animationName);
112 if (it == m_keyframesRuleMap.end()) 99 if (it == m_keyframesRuleMap.end())
113 return 0; 100 return 0;
114 101
115 return it->value.get(); 102 return it->value.get();
(...skipping 23 matching lines...) Expand all
139 126
140 if (m_scopingNode.isShadowRoot()) { 127 if (m_scopingNode.isShadowRoot()) {
141 scopingNode = toShadowRoot(m_scopingNode).host(); 128 scopingNode = toShadowRoot(m_scopingNode).host();
142 behaviorAtBoundary |= SelectorChecker::ScopeIsShadowHost; 129 behaviorAtBoundary |= SelectorChecker::ScopeIsShadowHost;
143 } 130 }
144 131
145 RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange(); 132 RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange();
146 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { 133 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) {
147 MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet() , includeEmptyRules, scopingNode, applyAuthorStyles, i, m_authorStyleSheets[i]); 134 MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet() , includeEmptyRules, scopingNode, applyAuthorStyles, i, m_authorStyleSheets[i]);
148 collector.collectMatchingRules(matchRequest, ruleRange, static_cast<Sele ctorChecker::BehaviorAtBoundary>(behaviorAtBoundary), cascadeScope, cascadeOrder ); 135 collector.collectMatchingRules(matchRequest, ruleRange, static_cast<Sele ctorChecker::BehaviorAtBoundary>(behaviorAtBoundary), cascadeScope, cascadeOrder );
149 collector.collectMatchingRulesForRegion(matchRequest, ruleRange, static_ cast<SelectorChecker::BehaviorAtBoundary>(behaviorAtBoundary), cascadeScope, cas cadeOrder);
150 } 136 }
151 } 137 }
152 138
153 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector) 139 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector)
154 { 140 {
155 // Only consider the global author RuleSet for @page rules, as per the HTML5 spec. 141 // Only consider the global author RuleSet for @page rules, as per the HTML5 spec.
156 ASSERT(m_scopingNode.isDocumentNode()); 142 ASSERT(m_scopingNode.isDocumentNode());
157 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) 143 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i)
158 collector.matchPageRules(&m_authorStyleSheets[i]->contents()->ruleSet()) ; 144 collector.matchPageRules(&m_authorStyleSheets[i]->contents()->ruleSet()) ;
159 } 145 }
160 146
161 void ScopedStyleResolver::collectViewportRulesTo(StyleResolver* resolver) const 147 void ScopedStyleResolver::collectViewportRulesTo(StyleResolver* resolver) const
162 { 148 {
163 if (!m_scopingNode.isDocumentNode()) 149 if (!m_scopingNode.isDocumentNode())
164 return; 150 return;
165 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) 151 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i)
166 resolver->viewportStyleResolver()->collectViewportRules(&m_authorStyleSh eets[i]->contents()->ruleSet(), ViewportStyleResolver::AuthorOrigin); 152 resolver->viewportStyleResolver()->collectViewportRules(&m_authorStyleSh eets[i]->contents()->ruleSet(), ViewportStyleResolver::AuthorOrigin);
167 } 153 }
168 154
169 } // namespace WebCore 155 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/resolver/ScopedStyleResolver.h ('k') | Source/core/css/resolver/StyleAdjuster.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698