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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 bool isNewEntry; | 47 bool isNewEntry; |
48 ScopedStyleResolver* scopedStyleResolver = addScopedStyleResolver(scopingNod
e, isNewEntry); | 48 ScopedStyleResolver* scopedStyleResolver = addScopedStyleResolver(scopingNod
e, isNewEntry); |
49 if (isNewEntry) | 49 if (isNewEntry) |
50 setupScopedStylesTree(scopedStyleResolver); | 50 setupScopedStylesTree(scopedStyleResolver); |
51 return scopedStyleResolver; | 51 return scopedStyleResolver; |
52 } | 52 } |
53 | 53 |
54 ScopedStyleResolver* ScopedStyleTree::scopedStyleResolverFor(const ContainerNode
& scopingNode) | 54 ScopedStyleResolver* ScopedStyleTree::scopedStyleResolverFor(const ContainerNode
& scopingNode) |
55 { | 55 { |
56 if (!scopingNode.hasScopedHTMLStyleChild() | 56 if (!scopingNode.hasScopedHTMLStyleChild() |
57 && !(scopingNode.isElementNode() && toElement(scopingNode).shadow()) | 57 && !isShadowHost(&scopingNode) |
58 && !scopingNode.isDocumentNode() | 58 && !scopingNode.isDocumentNode() |
59 && !scopingNode.isShadowRoot()) | 59 && !scopingNode.isShadowRoot()) |
60 return 0; | 60 return 0; |
61 HashMap<const ContainerNode*, OwnPtr<ScopedStyleResolver> >::iterator it = m
_authorStyles.find(&scopingNode); | 61 return lookupScopedStyleResolverFor(&scopingNode); |
62 return it != m_authorStyles.end() ? it->value.get() : 0; | |
63 } | 62 } |
64 | 63 |
65 ScopedStyleResolver* ScopedStyleTree::addScopedStyleResolver(const ContainerNode
& scopingNode, bool& isNewEntry) | 64 ScopedStyleResolver* ScopedStyleTree::addScopedStyleResolver(const ContainerNode
& scopingNode, bool& isNewEntry) |
66 { | 65 { |
67 HashMap<const ContainerNode*, OwnPtr<ScopedStyleResolver> >::AddResult addRe
sult = m_authorStyles.add(&scopingNode, nullptr); | 66 HashMap<const ContainerNode*, OwnPtr<ScopedStyleResolver> >::AddResult addRe
sult = m_authorStyles.add(&scopingNode, nullptr); |
68 | 67 |
69 if (addResult.isNewEntry) { | 68 if (addResult.isNewEntry) { |
70 addResult.iterator->value = ScopedStyleResolver::create(scopingNode); | 69 addResult.iterator->value = ScopedStyleResolver::create(scopingNode); |
71 if (scopingNode.isDocumentNode()) | 70 if (scopingNode.isDocumentNode()) |
72 m_scopedResolverForDocument = addResult.iterator->value.get(); | 71 m_scopedResolverForDocument = addResult.iterator->value.get(); |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 | 426 |
428 void ScopedStyleResolver::collectViewportRulesTo(StyleResolver* resolver) const | 427 void ScopedStyleResolver::collectViewportRulesTo(StyleResolver* resolver) const |
429 { | 428 { |
430 // Only consider the global author RuleSet for @viewport rules. | 429 // Only consider the global author RuleSet for @viewport rules. |
431 ASSERT(m_scopingNode.isDocumentNode()); | 430 ASSERT(m_scopingNode.isDocumentNode()); |
432 if (m_authorStyle) | 431 if (m_authorStyle) |
433 resolver->viewportStyleResolver()->collectViewportRules(m_authorStyle.ge
t(), ViewportStyleResolver::AuthorOrigin); | 432 resolver->viewportStyleResolver()->collectViewportRules(m_authorStyle.ge
t(), ViewportStyleResolver::AuthorOrigin); |
434 } | 433 } |
435 | 434 |
436 } // namespace WebCore | 435 } // namespace WebCore |
OLD | NEW |