OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All |
7 * rights reserved. | 7 * rights reserved. |
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 TreeScopeStyleSheetCollection* collection = | 213 TreeScopeStyleSheetCollection* collection = |
214 ensureStyleSheetCollectionFor(treeScope); | 214 ensureStyleSheetCollectionFor(treeScope); |
215 DCHECK(collection); | 215 DCHECK(collection); |
216 collection->addStyleSheetCandidateNode(node); | 216 collection->addStyleSheetCandidateNode(node); |
217 | 217 |
218 markTreeScopeDirty(treeScope); | 218 markTreeScopeDirty(treeScope); |
219 if (treeScope != m_document) | 219 if (treeScope != m_document) |
220 m_activeTreeScopes.add(&treeScope); | 220 m_activeTreeScopes.add(&treeScope); |
221 } | 221 } |
222 | 222 |
223 void StyleEngine::removeStyleSheetCandidateNode(Node& node) { | 223 void StyleEngine::removeStyleSheetCandidateNode(Node& node, |
224 removeStyleSheetCandidateNode(node, *m_document); | 224 ContainerNode& insertionPoint) { |
225 } | 225 DCHECK(!isXSLStyleSheet(node)); |
| 226 DCHECK(insertionPoint.isConnected()); |
226 | 227 |
227 void StyleEngine::removeStyleSheetCandidateNode(Node& node, | 228 ShadowRoot* shadowRoot = node.containingShadowRoot(); |
228 TreeScope& treeScope) { | 229 if (!shadowRoot) |
229 DCHECK(!isXSLStyleSheet(node)); | 230 shadowRoot = insertionPoint.containingShadowRoot(); |
230 | 231 |
| 232 TreeScope& treeScope = |
| 233 shadowRoot ? *toTreeScope(shadowRoot) : toTreeScope(document()); |
231 TreeScopeStyleSheetCollection* collection = | 234 TreeScopeStyleSheetCollection* collection = |
232 styleSheetCollectionFor(treeScope); | 235 styleSheetCollectionFor(treeScope); |
233 // After detaching document, collection could be null. In the case, | 236 // After detaching document, collection could be null. In the case, |
234 // we should not update anything. Instead, just return. | 237 // we should not update anything. Instead, just return. |
235 if (!collection) | 238 if (!collection) |
236 return; | 239 return; |
237 collection->removeStyleSheetCandidateNode(node); | 240 collection->removeStyleSheetCandidateNode(node); |
238 | 241 |
239 markTreeScopeDirty(treeScope); | 242 markTreeScopeDirty(treeScope); |
240 } | 243 } |
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1241 } | 1244 } |
1242 | 1245 |
1243 DEFINE_TRACE_WRAPPERS(StyleEngine) { | 1246 DEFINE_TRACE_WRAPPERS(StyleEngine) { |
1244 for (auto sheet : m_injectedAuthorStyleSheets) { | 1247 for (auto sheet : m_injectedAuthorStyleSheets) { |
1245 visitor->traceWrappers(sheet); | 1248 visitor->traceWrappers(sheet); |
1246 } | 1249 } |
1247 visitor->traceWrappers(m_documentStyleSheetCollection); | 1250 visitor->traceWrappers(m_documentStyleSheetCollection); |
1248 } | 1251 } |
1249 | 1252 |
1250 } // namespace blink | 1253 } // namespace blink |
OLD | NEW |