| 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 if (!styleElement->scoped()) | 240 if (!styleElement->scoped()) |
| 241 return styleElement->isInShadowTree() ? styleElement->containingShadowRo
ot() : 0; | 241 return styleElement->isInShadowTree() ? styleElement->containingShadowRo
ot() : 0; |
| 242 | 242 |
| 243 ContainerNode* parent = styleElement->parentNode(); | 243 ContainerNode* parent = styleElement->parentNode(); |
| 244 if (!parent) | 244 if (!parent) |
| 245 return 0; | 245 return 0; |
| 246 | 246 |
| 247 return (parent->isElementNode() || parent->isShadowRoot()) ? parent : 0; | 247 return (parent->isElementNode() || parent->isShadowRoot()) ? parent : 0; |
| 248 } | 248 } |
| 249 | 249 |
| 250 void ScopedStyleResolver::addRulesFromSheet(StyleSheetContents* sheet, const Med
iaQueryEvaluator& medium, StyleResolver* resolver) | 250 inline RuleSet* ScopedStyleResolver::ensureAuthorStyle() |
| 251 { | 251 { |
| 252 if (!m_authorStyle) | 252 if (!m_authorStyle) |
| 253 m_authorStyle = RuleSet::create(); | 253 m_authorStyle = RuleSet::create(); |
| 254 m_authorStyle->addRulesFromSheet(sheet, medium, resolver, &m_scopingNode); | 254 return m_authorStyle.get(); |
| 255 } |
| 256 |
| 257 void ScopedStyleResolver::addRulesFromSheet(StyleSheetContents* sheet, const Med
iaQueryEvaluator& medium, StyleResolver* resolver, bool viewportRuleIsProcessed) |
| 258 { |
| 259 ensureAuthorStyle()->addRulesFromSheet(sheet, medium, resolver, &m_scopingNo
de, viewportRuleIsProcessed); |
| 255 resolver->processScopedRules(*m_authorStyle, sheet->baseURL(), &m_scopingNod
e); | 260 resolver->processScopedRules(*m_authorStyle, sheet->baseURL(), &m_scopingNod
e); |
| 256 } | 261 } |
| 257 | 262 |
| 263 void ScopedStyleResolver::addViewportRule(StyleRuleViewport* rule) |
| 264 { |
| 265 ensureAuthorStyle()->addViewportRule(rule); |
| 266 } |
| 267 |
| 258 inline RuleSet* ScopedStyleResolver::ensureAtHostRuleSetFor(const ShadowRoot* sh
adowRoot) | 268 inline RuleSet* ScopedStyleResolver::ensureAtHostRuleSetFor(const ShadowRoot* sh
adowRoot) |
| 259 { | 269 { |
| 260 HashMap<const ShadowRoot*, OwnPtr<RuleSet> >::AddResult addResult = m_atHost
Rules.add(shadowRoot, nullptr); | 270 HashMap<const ShadowRoot*, OwnPtr<RuleSet> >::AddResult addResult = m_atHost
Rules.add(shadowRoot, nullptr); |
| 261 if (addResult.isNewEntry) | 271 if (addResult.isNewEntry) |
| 262 addResult.iterator->value = RuleSet::create(); | 272 addResult.iterator->value = RuleSet::create(); |
| 263 return addResult.iterator->value.get(); | 273 return addResult.iterator->value.get(); |
| 264 } | 274 } |
| 265 | 275 |
| 266 void ScopedStyleResolver::addHostRule(StyleRuleHost* hostRule, bool hasDocumentS
ecurityOrigin, const ContainerNode* scopingNode) | 276 void ScopedStyleResolver::addHostRule(StyleRuleHost* hostRule, bool hasDocumentS
ecurityOrigin, const ContainerNode* scopingNode) |
| 267 { | 277 { |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 | 438 |
| 429 void ScopedStyleResolver::collectViewportRulesTo(StyleResolver* resolver) const | 439 void ScopedStyleResolver::collectViewportRulesTo(StyleResolver* resolver) const |
| 430 { | 440 { |
| 431 // Only consider the global author RuleSet for @viewport rules. | 441 // Only consider the global author RuleSet for @viewport rules. |
| 432 if (!m_scopingNode.isDocumentNode() || !m_authorStyle) | 442 if (!m_scopingNode.isDocumentNode() || !m_authorStyle) |
| 433 return; | 443 return; |
| 434 resolver->viewportStyleResolver()->collectViewportRules(m_authorStyle.get(),
ViewportStyleResolver::AuthorOrigin); | 444 resolver->viewportStyleResolver()->collectViewportRules(m_authorStyle.get(),
ViewportStyleResolver::AuthorOrigin); |
| 435 } | 445 } |
| 436 | 446 |
| 437 } // namespace WebCore | 447 } // namespace WebCore |
| OLD | NEW |