| 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 29 matching lines...) Expand all Loading... |
| 40 { | 40 { |
| 41 bool isNewEntry; | 41 bool isNewEntry; |
| 42 ScopedStyleResolver* scopedStyleResolver = addScopedStyleResolver(scopingNod
e, isNewEntry); | 42 ScopedStyleResolver* scopedStyleResolver = addScopedStyleResolver(scopingNod
e, isNewEntry); |
| 43 if (isNewEntry) | 43 if (isNewEntry) |
| 44 setupScopedStylesTree(scopedStyleResolver); | 44 setupScopedStylesTree(scopedStyleResolver); |
| 45 return scopedStyleResolver; | 45 return scopedStyleResolver; |
| 46 } | 46 } |
| 47 | 47 |
| 48 ScopedStyleResolver* ScopedStyleTree::scopedStyleResolverFor(const ContainerNode
& scopingNode) | 48 ScopedStyleResolver* ScopedStyleTree::scopedStyleResolverFor(const ContainerNode
& scopingNode) |
| 49 { | 49 { |
| 50 if (!isShadowHost(&scopingNode) | 50 if (!scopingNode.hasScopedHTMLStyleChild() |
| 51 && !isShadowHost(&scopingNode) |
| 51 && !scopingNode.isDocumentNode() | 52 && !scopingNode.isDocumentNode() |
| 52 && !scopingNode.isShadowRoot()) | 53 && !scopingNode.isShadowRoot()) |
| 53 return 0; | 54 return 0; |
| 54 return lookupScopedStyleResolverFor(&scopingNode); | 55 return lookupScopedStyleResolverFor(&scopingNode); |
| 55 } | 56 } |
| 56 | 57 |
| 57 ScopedStyleResolver* ScopedStyleTree::addScopedStyleResolver(ContainerNode& scop
ingNode, bool& isNewEntry) | 58 ScopedStyleResolver* ScopedStyleTree::addScopedStyleResolver(ContainerNode& scop
ingNode, bool& isNewEntry) |
| 58 { | 59 { |
| 59 HashMap<const ContainerNode*, OwnPtr<ScopedStyleResolver> >::AddResult addRe
sult = m_authorStyles.add(&scopingNode, nullptr); | 60 HashMap<const ContainerNode*, OwnPtr<ScopedStyleResolver> >::AddResult addRe
sult = m_authorStyles.add(&scopingNode, nullptr); |
| 60 | 61 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 118 } |
| 118 | 119 |
| 119 void ScopedStyleTree::collectScopedResolversForHostedShadowTrees(const Element*
element, Vector<ScopedStyleResolver*, 8>& resolvers) | 120 void ScopedStyleTree::collectScopedResolversForHostedShadowTrees(const Element*
element, Vector<ScopedStyleResolver*, 8>& resolvers) |
| 120 { | 121 { |
| 121 ElementShadow* shadow = element->shadow(); | 122 ElementShadow* shadow = element->shadow(); |
| 122 if (!shadow) | 123 if (!shadow) |
| 123 return; | 124 return; |
| 124 | 125 |
| 125 // Adding scoped resolver for active shadow roots for shadow host styling. | 126 // Adding scoped resolver for active shadow roots for shadow host styling. |
| 126 for (ShadowRoot* shadowRoot = shadow->youngestShadowRoot(); shadowRoot; shad
owRoot = shadowRoot->olderShadowRoot()) { | 127 for (ShadowRoot* shadowRoot = shadow->youngestShadowRoot(); shadowRoot; shad
owRoot = shadowRoot->olderShadowRoot()) { |
| 127 if (shadowRoot->numberOfStyles() > 0) { | 128 if (shadowRoot->hasScopedHTMLStyleChild()) { |
| 128 if (ScopedStyleResolver* resolver = scopedStyleResolverFor(*shadowRo
ot)) | 129 if (ScopedStyleResolver* resolver = scopedStyleResolverFor(*shadowRo
ot)) |
| 129 resolvers.append(resolver); | 130 resolvers.append(resolver); |
| 130 } | 131 } |
| 131 } | 132 } |
| 132 } | 133 } |
| 133 | 134 |
| 134 void ScopedStyleTree::resolveScopedKeyframesRules(const Element* element, Vector
<ScopedStyleResolver*, 8>& resolvers) | 135 void ScopedStyleTree::resolveScopedKeyframesRules(const Element* element, Vector
<ScopedStyleResolver*, 8>& resolvers) |
| 135 { | 136 { |
| 136 Document& document = element->document(); | 137 Document& document = element->document(); |
| 137 TreeScope& treeScope = element->treeScope(); | 138 TreeScope& treeScope = element->treeScope(); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 return; | 215 return; |
| 215 | 216 |
| 216 reparentNodes(resolverRemoved, resolverRemoved->parent()); | 217 reparentNodes(resolverRemoved, resolverRemoved->parent()); |
| 217 if (m_cache.scopedResolver == resolverRemoved) | 218 if (m_cache.scopedResolver == resolverRemoved) |
| 218 m_cache.clear(); | 219 m_cache.clear(); |
| 219 | 220 |
| 220 m_authorStyles.remove(scopingNode); | 221 m_authorStyles.remove(scopingNode); |
| 221 } | 222 } |
| 222 | 223 |
| 223 } // namespace WebCore | 224 } // namespace WebCore |
| OLD | NEW |