Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(530)

Side by Side Diff: Source/core/css/resolver/ScopedStyleTree.cpp

Issue 315173002: Revert of Remove scoped styles. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « Source/core/css/resolver/ScopedStyleResolver.cpp ('k') | Source/core/css/resolver/SharedStyleFinder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698