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

Side by Side Diff: Source/core/css/resolver/ScopedStyleResolver.cpp

Issue 843773002: Only match style from element's TreeScope for normal rules. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed custom pseudo and ::cue regressions 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 unified diff | Download patch
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 KeyframesRuleMap::iterator it = m_keyframesRuleMap.find(rule->name().imp l()); 109 KeyframesRuleMap::iterator it = m_keyframesRuleMap.find(rule->name().imp l());
110 if (it == m_keyframesRuleMap.end()) 110 if (it == m_keyframesRuleMap.end())
111 m_keyframesRuleMap.set(s.impl(), rule); 111 m_keyframesRuleMap.set(s.impl(), rule);
112 else if (it->value->isVendorPrefixed()) 112 else if (it->value->isVendorPrefixed())
113 m_keyframesRuleMap.set(s.impl(), rule); 113 m_keyframesRuleMap.set(s.impl(), rule);
114 } else { 114 } else {
115 m_keyframesRuleMap.set(s.impl(), rule); 115 m_keyframesRuleMap.set(s.impl(), rule);
116 } 116 }
117 } 117 }
118 118
119 void ScopedStyleResolver::collectMatchingAuthorRules(ElementRuleCollector& colle ctor, bool includeEmptyRules, CascadeScope cascadeScope, CascadeOrder cascadeOrd er) 119 void ScopedStyleResolver::collectMatchingAuthorRules(ElementRuleCollector& colle ctor, bool includeEmptyRules, CascadeOrder cascadeOrder)
120 { 120 {
121 RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange(); 121 RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange();
122 ASSERT(!collector.scopeContainsLastMatchedElement()); 122 ASSERT(!collector.scopeContainsLastMatchedElement());
123 collector.setScopeContainsLastMatchedElement(true); 123 collector.setScopeContainsLastMatchedElement(true);
124 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { 124 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) {
125 MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet() , includeEmptyRules, &m_scope->rootNode(), m_authorStyleSheets[i], i); 125 MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet() , includeEmptyRules, &m_scope->rootNode(), m_authorStyleSheets[i], i);
126 collector.collectMatchingRules(matchRequest, ruleRange, cascadeScope, ca scadeOrder); 126 collector.collectMatchingRules(matchRequest, ruleRange, cascadeOrder);
127 } 127 }
128 collector.setScopeContainsLastMatchedElement(false); 128 collector.setScopeContainsLastMatchedElement(false);
129 } 129 }
130 130
131 void ScopedStyleResolver::collectMatchingShadowHostRules(ElementRuleCollector& c ollector, bool includeEmptyRules, CascadeScope cascadeScope, CascadeOrder cascad eOrder) 131 void ScopedStyleResolver::collectMatchingShadowHostRules(ElementRuleCollector& c ollector, bool includeEmptyRules, CascadeOrder cascadeOrder)
132 { 132 {
133 RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange(); 133 RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange();
134 ASSERT(!collector.scopeContainsLastMatchedElement()); 134 ASSERT(!collector.scopeContainsLastMatchedElement());
135 collector.setScopeContainsLastMatchedElement(true); 135 collector.setScopeContainsLastMatchedElement(true);
136 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { 136 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) {
137 MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet() , includeEmptyRules, &m_scope->rootNode(), m_authorStyleSheets[i], i); 137 MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet() , includeEmptyRules, &m_scope->rootNode(), m_authorStyleSheets[i], i);
138 collector.collectMatchingShadowHostRules(matchRequest, ruleRange, cascad eScope, cascadeOrder); 138 collector.collectMatchingShadowHostRules(matchRequest, ruleRange, cascad eOrder);
139 } 139 }
140 collector.setScopeContainsLastMatchedElement(false); 140 collector.setScopeContainsLastMatchedElement(false);
141 } 141 }
142 142
143 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector) 143 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector)
144 { 144 {
145 // Only consider the global author RuleSet for @page rules, as per the HTML5 spec. 145 // Only consider the global author RuleSet for @page rules, as per the HTML5 spec.
146 ASSERT(m_scope->rootNode().isDocumentNode()); 146 ASSERT(m_scope->rootNode().isDocumentNode());
147 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) 147 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i)
148 collector.matchPageRules(&m_authorStyleSheets[i]->contents()->ruleSet()) ; 148 collector.matchPageRules(&m_authorStyleSheets[i]->contents()->ruleSet()) ;
(...skipping 10 matching lines...) Expand all
159 void ScopedStyleResolver::trace(Visitor* visitor) 159 void ScopedStyleResolver::trace(Visitor* visitor)
160 { 160 {
161 #if ENABLE(OILPAN) 161 #if ENABLE(OILPAN)
162 visitor->trace(m_scope); 162 visitor->trace(m_scope);
163 visitor->trace(m_authorStyleSheets); 163 visitor->trace(m_authorStyleSheets);
164 visitor->trace(m_keyframesRuleMap); 164 visitor->trace(m_keyframesRuleMap);
165 #endif 165 #endif
166 } 166 }
167 167
168 } // namespace blink 168 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/resolver/ScopedStyleResolver.h ('k') | Source/core/css/resolver/StyleResolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698