| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 void ScopedStyleResolver::addTreeBoundaryCrossingRules(const RuleSet& authorRule
s, CSSStyleSheet* parentStyleSheet, unsigned sheetIndex) | 210 void ScopedStyleResolver::addTreeBoundaryCrossingRules(const RuleSet& authorRule
s, CSSStyleSheet* parentStyleSheet, unsigned sheetIndex) |
| 211 { | 211 { |
| 212 bool isDocumentScope = treeScope().rootNode().isDocumentNode(); | 212 bool isDocumentScope = treeScope().rootNode().isDocumentNode(); |
| 213 if (authorRules.deepCombinatorOrShadowPseudoRules().isEmpty() | 213 if (authorRules.deepCombinatorOrShadowPseudoRules().isEmpty() |
| 214 && (isDocumentScope || (authorRules.contentPseudoElementRules().isEmpty(
) && authorRules.slottedPseudoElementRules().isEmpty()))) | 214 && (isDocumentScope || (authorRules.contentPseudoElementRules().isEmpty(
) && authorRules.slottedPseudoElementRules().isEmpty()))) |
| 215 return; | 215 return; |
| 216 | 216 |
| 217 if (!authorRules.deepCombinatorOrShadowPseudoRules().isEmpty()) | 217 if (!authorRules.deepCombinatorOrShadowPseudoRules().isEmpty()) |
| 218 m_hasDeepOrShadowSelector = true; | 218 m_hasDeepOrShadowSelector = true; |
| 219 | 219 |
| 220 RawPtr<RuleSet> ruleSetForScope = RuleSet::create(); | 220 RuleSet* ruleSetForScope = RuleSet::create(); |
| 221 addRules(ruleSetForScope.get(), authorRules.deepCombinatorOrShadowPseudoRule
s()); | 221 addRules(ruleSetForScope, authorRules.deepCombinatorOrShadowPseudoRules()); |
| 222 | 222 |
| 223 if (!isDocumentScope) { | 223 if (!isDocumentScope) { |
| 224 addRules(ruleSetForScope.get(), authorRules.contentPseudoElementRules())
; | 224 addRules(ruleSetForScope, authorRules.contentPseudoElementRules()); |
| 225 addRules(ruleSetForScope.get(), authorRules.slottedPseudoElementRules())
; | 225 addRules(ruleSetForScope, authorRules.slottedPseudoElementRules()); |
| 226 } | 226 } |
| 227 | 227 |
| 228 if (!m_treeBoundaryCrossingRuleSet) { | 228 if (!m_treeBoundaryCrossingRuleSet) { |
| 229 m_treeBoundaryCrossingRuleSet = new CSSStyleSheetRuleSubSet(); | 229 m_treeBoundaryCrossingRuleSet = new CSSStyleSheetRuleSubSet(); |
| 230 treeScope().document().styleResolver()->addTreeBoundaryCrossingScope(tre
eScope().rootNode()); | 230 treeScope().document().styleResolver()->addTreeBoundaryCrossingScope(tre
eScope().rootNode()); |
| 231 } | 231 } |
| 232 | 232 |
| 233 m_treeBoundaryCrossingRuleSet->append(RuleSubSet::create(parentStyleSheet, s
heetIndex, ruleSetForScope.release())); | 233 m_treeBoundaryCrossingRuleSet->append(RuleSubSet::create(parentStyleSheet, s
heetIndex, ruleSetForScope)); |
| 234 } | 234 } |
| 235 | 235 |
| 236 DEFINE_TRACE(ScopedStyleResolver::RuleSubSet) | 236 DEFINE_TRACE(ScopedStyleResolver::RuleSubSet) |
| 237 { | 237 { |
| 238 visitor->trace(m_parentStyleSheet); | 238 visitor->trace(m_parentStyleSheet); |
| 239 visitor->trace(m_ruleSet); | 239 visitor->trace(m_ruleSet); |
| 240 } | 240 } |
| 241 | 241 |
| 242 } // namespace blink | 242 } // namespace blink |
| OLD | NEW |