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

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

Issue 2399633003: reflow comments in core/css/resolver (Closed)
Patch Set: Created 4 years, 2 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.
4 * All rights reserved.
4 * Copyright (C) 2012 Google Inc. All rights reserved. 5 * Copyright (C) 2012 Google Inc. All rights reserved.
5 * 6 *
6 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
8 * are met: 9 * are met:
9 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 } 59 }
59 60
60 void ScopedStyleResolver::addKeyframeRules(const RuleSet& ruleSet) { 61 void ScopedStyleResolver::addKeyframeRules(const RuleSet& ruleSet) {
61 const HeapVector<Member<StyleRuleKeyframes>> keyframesRules = 62 const HeapVector<Member<StyleRuleKeyframes>> keyframesRules =
62 ruleSet.keyframesRules(); 63 ruleSet.keyframesRules();
63 for (unsigned i = 0; i < keyframesRules.size(); ++i) 64 for (unsigned i = 0; i < keyframesRules.size(); ++i)
64 addKeyframeStyle(keyframesRules[i]); 65 addKeyframeStyle(keyframesRules[i]);
65 } 66 }
66 67
67 void ScopedStyleResolver::addFontFaceRules(const RuleSet& ruleSet) { 68 void ScopedStyleResolver::addFontFaceRules(const RuleSet& ruleSet) {
68 // FIXME(BUG 72461): We don't add @font-face rules of scoped style sheets for the moment. 69 // FIXME(BUG 72461): We don't add @font-face rules of scoped style sheets for
70 // the moment.
69 if (!treeScope().rootNode().isDocumentNode()) 71 if (!treeScope().rootNode().isDocumentNode())
70 return; 72 return;
71 73
72 Document& document = treeScope().document(); 74 Document& document = treeScope().document();
73 CSSFontSelector* cssFontSelector = document.styleEngine().fontSelector(); 75 CSSFontSelector* cssFontSelector = document.styleEngine().fontSelector();
74 const HeapVector<Member<StyleRuleFontFace>> fontFaceRules = 76 const HeapVector<Member<StyleRuleFontFace>> fontFaceRules =
75 ruleSet.fontFaceRules(); 77 ruleSet.fontFaceRules();
76 for (auto& fontFaceRule : fontFaceRules) { 78 for (auto& fontFaceRule : fontFaceRules) {
77 if (FontFace* fontFace = FontFace::create(&document, fontFaceRule)) 79 if (FontFace* fontFace = FontFace::create(&document, fontFaceRule))
78 cssFontSelector->fontFaceCache()->add(cssFontSelector, fontFaceRule, 80 cssFontSelector->fontFaceCache()->add(cssFontSelector, fontFaceRule,
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 return; 229 return;
228 230
229 for (const auto& rules : *m_treeBoundaryCrossingRuleSet) { 231 for (const auto& rules : *m_treeBoundaryCrossingRuleSet) {
230 MatchRequest request(rules->m_ruleSet.get(), &treeScope().rootNode(), 232 MatchRequest request(rules->m_ruleSet.get(), &treeScope().rootNode(),
231 rules->m_parentStyleSheet, rules->m_parentIndex); 233 rules->m_parentStyleSheet, rules->m_parentIndex);
232 collector.collectMatchingRules(request, cascadeOrder, true); 234 collector.collectMatchingRules(request, cascadeOrder, true);
233 } 235 }
234 } 236 }
235 237
236 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector) { 238 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector) {
237 // Only consider the global author RuleSet for @page rules, as per the HTML5 s pec. 239 // Only consider the global author RuleSet for @page rules, as per the HTML5
240 // spec.
238 ASSERT(m_scope->rootNode().isDocumentNode()); 241 ASSERT(m_scope->rootNode().isDocumentNode());
239 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) 242 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i)
240 collector.matchPageRules(&m_authorStyleSheets[i]->contents()->ruleSet()); 243 collector.matchPageRules(&m_authorStyleSheets[i]->contents()->ruleSet());
241 } 244 }
242 245
243 void ScopedStyleResolver::collectViewportRulesTo( 246 void ScopedStyleResolver::collectViewportRulesTo(
244 ViewportStyleResolver* resolver) const { 247 ViewportStyleResolver* resolver) const {
245 if (!m_scope->rootNode().isDocumentNode()) 248 if (!m_scope->rootNode().isDocumentNode())
246 return; 249 return;
247 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) 250 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i)
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 m_treeBoundaryCrossingRuleSet->append( 298 m_treeBoundaryCrossingRuleSet->append(
296 RuleSubSet::create(parentStyleSheet, sheetIndex, ruleSetForScope)); 299 RuleSubSet::create(parentStyleSheet, sheetIndex, ruleSetForScope));
297 } 300 }
298 301
299 DEFINE_TRACE(ScopedStyleResolver::RuleSubSet) { 302 DEFINE_TRACE(ScopedStyleResolver::RuleSubSet) {
300 visitor->trace(m_parentStyleSheet); 303 visitor->trace(m_parentStyleSheet);
301 visitor->trace(m_ruleSet); 304 visitor->trace(m_ruleSet);
302 } 305 }
303 306
304 } // namespace blink 307 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698