OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007 Rob Buis | 2 * Copyright (C) 2006, 2007 Rob Buis |
3 * Copyright (C) 2008 Apple, Inc. All rights reserved. | 3 * Copyright (C) 2008 Apple, Inc. All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 DCHECK(element.isConnected()); | 63 DCHECK(element.isConnected()); |
64 | 64 |
65 m_registeredAsCandidate = true; | 65 m_registeredAsCandidate = true; |
66 document.styleEngine().addStyleSheetCandidateNode(element); | 66 document.styleEngine().addStyleSheetCandidateNode(element); |
67 if (m_createdByParser) | 67 if (m_createdByParser) |
68 return ProcessingSuccessful; | 68 return ProcessingSuccessful; |
69 | 69 |
70 return process(element); | 70 return process(element); |
71 } | 71 } |
72 | 72 |
73 void StyleElement::insertedInto(const Element& element, | |
74 ContainerNode* insertionPoint) { | |
75 if (!insertionPoint->isConnected() || !element.isInShadowTree()) | |
76 return; | |
77 if (ShadowRoot* scope = element.containingShadowRoot()) | |
78 scope->registerScopedHTMLStyleChild(); | |
79 } | |
80 | |
81 void StyleElement::removedFrom(Element& element, | 73 void StyleElement::removedFrom(Element& element, |
82 ContainerNode* insertionPoint) { | 74 ContainerNode* insertionPoint) { |
83 if (!insertionPoint->isConnected()) | 75 if (!insertionPoint->isConnected()) |
84 return; | 76 return; |
85 | 77 |
86 ShadowRoot* shadowRoot = element.containingShadowRoot(); | |
87 if (!shadowRoot) | |
88 shadowRoot = insertionPoint->containingShadowRoot(); | |
89 | |
90 if (shadowRoot) | |
91 shadowRoot->unregisterScopedHTMLStyleChild(); | |
92 | |
93 Document& document = element.document(); | 78 Document& document = element.document(); |
94 if (m_registeredAsCandidate) { | 79 if (m_registeredAsCandidate) { |
| 80 ShadowRoot* shadowRoot = element.containingShadowRoot(); |
| 81 if (!shadowRoot) |
| 82 shadowRoot = insertionPoint->containingShadowRoot(); |
| 83 |
95 document.styleEngine().removeStyleSheetCandidateNode( | 84 document.styleEngine().removeStyleSheetCandidateNode( |
96 element, shadowRoot ? *toTreeScope(shadowRoot) : toTreeScope(document)); | 85 element, shadowRoot ? *toTreeScope(shadowRoot) : toTreeScope(document)); |
97 m_registeredAsCandidate = false; | 86 m_registeredAsCandidate = false; |
98 } | 87 } |
99 | 88 |
100 StyleSheet* removedSheet = m_sheet.get(); | 89 StyleSheet* removedSheet = m_sheet.get(); |
101 | 90 |
102 if (m_sheet) | 91 if (m_sheet) |
103 clearSheet(element); | 92 clearSheet(element); |
104 if (removedSheet) | 93 if (removedSheet) |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 204 |
216 void StyleElement::startLoadingDynamicSheet(Document& document) { | 205 void StyleElement::startLoadingDynamicSheet(Document& document) { |
217 document.styleEngine().addPendingSheet(m_styleEngineContext); | 206 document.styleEngine().addPendingSheet(m_styleEngineContext); |
218 } | 207 } |
219 | 208 |
220 DEFINE_TRACE(StyleElement) { | 209 DEFINE_TRACE(StyleElement) { |
221 visitor->trace(m_sheet); | 210 visitor->trace(m_sheet); |
222 } | 211 } |
223 | 212 |
224 } // namespace blink | 213 } // namespace blink |
OLD | NEW |