OLD | NEW |
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 void ScopedStyleResolver::addFontFaceRules(const RuleSet& ruleSet) | 64 void ScopedStyleResolver::addFontFaceRules(const RuleSet& ruleSet) |
65 { | 65 { |
66 // FIXME(BUG 72461): We don't add @font-face rules of scoped style sheets fo
r the moment. | 66 // FIXME(BUG 72461): We don't add @font-face rules of scoped style sheets fo
r the moment. |
67 if (!treeScope().rootNode().isDocumentNode()) | 67 if (!treeScope().rootNode().isDocumentNode()) |
68 return; | 68 return; |
69 | 69 |
70 Document& document = treeScope().document(); | 70 Document& document = treeScope().document(); |
71 CSSFontSelector* cssFontSelector = document.styleEngine().fontSelector(); | 71 CSSFontSelector* cssFontSelector = document.styleEngine().fontSelector(); |
72 const HeapVector<Member<StyleRuleFontFace>> fontFaceRules = ruleSet.fontFace
Rules(); | 72 const HeapVector<Member<StyleRuleFontFace>> fontFaceRules = ruleSet.fontFace
Rules(); |
73 for (auto& fontFaceRule : fontFaceRules) { | 73 for (auto& fontFaceRule : fontFaceRules) { |
74 if (RawPtr<FontFace> fontFace = FontFace::create(&document, fontFaceRule
)) | 74 if (FontFace* fontFace = FontFace::create(&document, fontFaceRule)) |
75 cssFontSelector->fontFaceCache()->add(cssFontSelector, fontFaceRule,
fontFace); | 75 cssFontSelector->fontFaceCache()->add(cssFontSelector, fontFaceRule,
fontFace); |
76 } | 76 } |
77 if (fontFaceRules.size()) | 77 if (fontFaceRules.size()) |
78 document.styleResolver()->invalidateMatchedPropertiesCache(); | 78 document.styleResolver()->invalidateMatchedPropertiesCache(); |
79 } | 79 } |
80 | 80 |
81 void ScopedStyleResolver::appendCSSStyleSheet(CSSStyleSheet& cssSheet, const Med
iaQueryEvaluator& medium) | 81 void ScopedStyleResolver::appendCSSStyleSheet(CSSStyleSheet& cssSheet, const Med
iaQueryEvaluator& medium) |
82 { | 82 { |
83 unsigned index = m_authorStyleSheets.size(); | 83 unsigned index = m_authorStyleSheets.size(); |
84 m_authorStyleSheets.append(&cssSheet); | 84 m_authorStyleSheets.append(&cssSheet); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 if (m_keyframesRuleMap.isEmpty()) | 122 if (m_keyframesRuleMap.isEmpty()) |
123 return nullptr; | 123 return nullptr; |
124 | 124 |
125 KeyframesRuleMap::iterator it = m_keyframesRuleMap.find(animationName); | 125 KeyframesRuleMap::iterator it = m_keyframesRuleMap.find(animationName); |
126 if (it == m_keyframesRuleMap.end()) | 126 if (it == m_keyframesRuleMap.end()) |
127 return nullptr; | 127 return nullptr; |
128 | 128 |
129 return it->value.get(); | 129 return it->value.get(); |
130 } | 130 } |
131 | 131 |
132 void ScopedStyleResolver::addKeyframeStyle(RawPtr<StyleRuleKeyframes> rule) | 132 void ScopedStyleResolver::addKeyframeStyle(StyleRuleKeyframes* rule) |
133 { | 133 { |
134 AtomicString s(rule->name()); | 134 AtomicString s(rule->name()); |
135 | 135 |
136 if (rule->isVendorPrefixed()) { | 136 if (rule->isVendorPrefixed()) { |
137 KeyframesRuleMap::iterator it = m_keyframesRuleMap.find(s.impl()); | 137 KeyframesRuleMap::iterator it = m_keyframesRuleMap.find(s.impl()); |
138 if (it == m_keyframesRuleMap.end()) | 138 if (it == m_keyframesRuleMap.end()) |
139 m_keyframesRuleMap.set(s.impl(), rule); | 139 m_keyframesRuleMap.set(s.impl(), rule); |
140 else if (it->value->isVendorPrefixed()) | 140 else if (it->value->isVendorPrefixed()) |
141 m_keyframesRuleMap.set(s.impl(), rule); | 141 m_keyframesRuleMap.set(s.impl(), rule); |
142 } else { | 142 } else { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 void ScopedStyleResolver::addTreeBoundaryCrossingRules(const RuleSet& authorRule
s, CSSStyleSheet* parentStyleSheet, unsigned sheetIndex) | 208 void ScopedStyleResolver::addTreeBoundaryCrossingRules(const RuleSet& authorRule
s, CSSStyleSheet* parentStyleSheet, unsigned sheetIndex) |
209 { | 209 { |
210 bool isDocumentScope = treeScope().rootNode().isDocumentNode(); | 210 bool isDocumentScope = treeScope().rootNode().isDocumentNode(); |
211 if (authorRules.deepCombinatorOrShadowPseudoRules().isEmpty() | 211 if (authorRules.deepCombinatorOrShadowPseudoRules().isEmpty() |
212 && (isDocumentScope || (authorRules.contentPseudoElementRules().isEmpty(
) && authorRules.slottedPseudoElementRules().isEmpty()))) | 212 && (isDocumentScope || (authorRules.contentPseudoElementRules().isEmpty(
) && authorRules.slottedPseudoElementRules().isEmpty()))) |
213 return; | 213 return; |
214 | 214 |
215 if (!authorRules.deepCombinatorOrShadowPseudoRules().isEmpty()) | 215 if (!authorRules.deepCombinatorOrShadowPseudoRules().isEmpty()) |
216 m_hasDeepOrShadowSelector = true; | 216 m_hasDeepOrShadowSelector = true; |
217 | 217 |
218 RawPtr<RuleSet> ruleSetForScope = RuleSet::create(); | 218 RuleSet* ruleSetForScope = RuleSet::create(); |
219 addRules(ruleSetForScope.get(), authorRules.deepCombinatorOrShadowPseudoRule
s()); | 219 addRules(ruleSetForScope, authorRules.deepCombinatorOrShadowPseudoRules()); |
220 | 220 |
221 if (!isDocumentScope) { | 221 if (!isDocumentScope) { |
222 addRules(ruleSetForScope.get(), authorRules.contentPseudoElementRules())
; | 222 addRules(ruleSetForScope, authorRules.contentPseudoElementRules()); |
223 addRules(ruleSetForScope.get(), authorRules.slottedPseudoElementRules())
; | 223 addRules(ruleSetForScope, authorRules.slottedPseudoElementRules()); |
224 } | 224 } |
225 | 225 |
226 if (!m_treeBoundaryCrossingRuleSet) { | 226 if (!m_treeBoundaryCrossingRuleSet) { |
227 m_treeBoundaryCrossingRuleSet = new CSSStyleSheetRuleSubSet(); | 227 m_treeBoundaryCrossingRuleSet = new CSSStyleSheetRuleSubSet(); |
228 treeScope().document().styleResolver()->addTreeBoundaryCrossingScope(tre
eScope().rootNode()); | 228 treeScope().document().styleResolver()->addTreeBoundaryCrossingScope(tre
eScope().rootNode()); |
229 } | 229 } |
230 | 230 |
231 m_treeBoundaryCrossingRuleSet->append(RuleSubSet::create(parentStyleSheet, s
heetIndex, ruleSetForScope.release())); | 231 m_treeBoundaryCrossingRuleSet->append(RuleSubSet::create(parentStyleSheet, s
heetIndex, ruleSetForScope)); |
232 } | 232 } |
233 | 233 |
234 DEFINE_TRACE(ScopedStyleResolver::RuleSubSet) | 234 DEFINE_TRACE(ScopedStyleResolver::RuleSubSet) |
235 { | 235 { |
236 visitor->trace(m_parentStyleSheet); | 236 visitor->trace(m_parentStyleSheet); |
237 visitor->trace(m_ruleSet); | 237 visitor->trace(m_ruleSet); |
238 } | 238 } |
239 | 239 |
240 } // namespace blink | 240 } // namespace blink |
OLD | NEW |