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