| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, cascadeScope, ca
scadeOrder); |
| 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) |
| 132 { |
| 133 RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange(); |
| 134 ASSERT(!collector.scopeContainsLastMatchedElement()); |
| 135 collector.setScopeContainsLastMatchedElement(true); |
| 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); |
| 138 collector.collectMatchingShadowHostRules(matchRequest, ruleRange, cascad
eScope, cascadeOrder); |
| 139 } |
| 140 collector.setScopeContainsLastMatchedElement(false); |
| 141 } |
| 142 |
| 131 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector) | 143 void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector) |
| 132 { | 144 { |
| 133 // 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. |
| 134 ASSERT(m_scope->rootNode().isDocumentNode()); | 146 ASSERT(m_scope->rootNode().isDocumentNode()); |
| 135 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) | 147 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) |
| 136 collector.matchPageRules(&m_authorStyleSheets[i]->contents()->ruleSet())
; | 148 collector.matchPageRules(&m_authorStyleSheets[i]->contents()->ruleSet())
; |
| 137 } | 149 } |
| 138 | 150 |
| 139 void ScopedStyleResolver::collectViewportRulesTo(StyleResolver* resolver) const | 151 void ScopedStyleResolver::collectViewportRulesTo(StyleResolver* resolver) const |
| 140 { | 152 { |
| 141 if (!m_scope->rootNode().isDocumentNode()) | 153 if (!m_scope->rootNode().isDocumentNode()) |
| 142 return; | 154 return; |
| 143 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) | 155 for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) |
| 144 resolver->viewportStyleResolver()->collectViewportRules(&m_authorStyleSh
eets[i]->contents()->ruleSet(), ViewportStyleResolver::AuthorOrigin); | 156 resolver->viewportStyleResolver()->collectViewportRules(&m_authorStyleSh
eets[i]->contents()->ruleSet(), ViewportStyleResolver::AuthorOrigin); |
| 145 } | 157 } |
| 146 | 158 |
| 147 void ScopedStyleResolver::trace(Visitor* visitor) | 159 void ScopedStyleResolver::trace(Visitor* visitor) |
| 148 { | 160 { |
| 149 #if ENABLE(OILPAN) | 161 #if ENABLE(OILPAN) |
| 150 visitor->trace(m_scope); | 162 visitor->trace(m_scope); |
| 151 visitor->trace(m_authorStyleSheets); | 163 visitor->trace(m_authorStyleSheets); |
| 152 visitor->trace(m_keyframesRuleMap); | 164 visitor->trace(m_keyframesRuleMap); |
| 153 #endif | 165 #endif |
| 154 } | 166 } |
| 155 | 167 |
| 156 } // namespace blink | 168 } // namespace blink |
| OLD | NEW |