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