OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 recalcChildStyle(change); | 143 recalcChildStyle(change); |
144 clearChildNeedsStyleRecalc(); | 144 clearChildNeedsStyleRecalc(); |
145 } | 145 } |
146 | 146 |
147 void ShadowRoot::attach(const AttachContext& context) | 147 void ShadowRoot::attach(const AttachContext& context) |
148 { | 148 { |
149 StyleSharingDepthScope sharingScope(*this); | 149 StyleSharingDepthScope sharingScope(*this); |
150 DocumentFragment::attach(context); | 150 DocumentFragment::attach(context); |
151 } | 151 } |
152 | 152 |
| 153 void ShadowRoot::detach(const AttachContext& context) |
| 154 { |
| 155 if (context.clearInvalidation) |
| 156 document().styleEngine().styleInvalidator().clearInvalidation(*this); |
| 157 DocumentFragment::detach(context); |
| 158 } |
| 159 |
153 Node::InsertionNotificationRequest ShadowRoot::insertedInto(ContainerNode* inser
tionPoint) | 160 Node::InsertionNotificationRequest ShadowRoot::insertedInto(ContainerNode* inser
tionPoint) |
154 { | 161 { |
155 DocumentFragment::insertedInto(insertionPoint); | 162 DocumentFragment::insertedInto(insertionPoint); |
156 | 163 |
157 if (!insertionPoint->inShadowIncludingDocument() || !isOldest()) | 164 if (!insertionPoint->inShadowIncludingDocument() || !isOldest()) |
158 return InsertionDone; | 165 return InsertionDone; |
159 | 166 |
160 // FIXME: When parsing <video controls>, insertedInto() is called many times
without invoking removedFrom. | 167 // FIXME: When parsing <video controls>, insertedInto() is called many times
without invoking removedFrom. |
161 // For now, we check m_registeredWithParentShadowroot. We would like to DCHE
CK(!m_registeredShadowRoot) here. | 168 // For now, we check m_registeredWithParentShadowroot. We would like to DCHE
CK(!m_registeredShadowRoot) here. |
162 // https://bugs.webkit.org/show_bug.cig?id=101316 | 169 // https://bugs.webkit.org/show_bug.cig?id=101316 |
(...skipping 13 matching lines...) Expand all Loading... |
176 if (insertionPoint->inShadowIncludingDocument()) { | 183 if (insertionPoint->inShadowIncludingDocument()) { |
177 document().styleEngine().shadowRootRemovedFromDocument(this); | 184 document().styleEngine().shadowRootRemovedFromDocument(this); |
178 if (m_registeredWithParentShadowRoot) { | 185 if (m_registeredWithParentShadowRoot) { |
179 ShadowRoot* root = host().containingShadowRoot(); | 186 ShadowRoot* root = host().containingShadowRoot(); |
180 if (!root) | 187 if (!root) |
181 root = insertionPoint->containingShadowRoot(); | 188 root = insertionPoint->containingShadowRoot(); |
182 if (root) | 189 if (root) |
183 root->removeChildShadowRoot(); | 190 root->removeChildShadowRoot(); |
184 m_registeredWithParentShadowRoot = false; | 191 m_registeredWithParentShadowRoot = false; |
185 } | 192 } |
| 193 if (needsStyleInvalidation()) |
| 194 document().styleEngine().styleInvalidator().clearInvalidation(*this)
; |
186 } | 195 } |
187 | 196 |
188 DocumentFragment::removedFrom(insertionPoint); | 197 DocumentFragment::removedFrom(insertionPoint); |
189 } | 198 } |
190 | 199 |
191 void ShadowRoot::childrenChanged(const ChildrenChange& change) | 200 void ShadowRoot::childrenChanged(const ChildrenChange& change) |
192 { | 201 { |
193 ContainerNode::childrenChanged(change); | 202 ContainerNode::childrenChanged(change); |
194 | 203 |
195 if (change.isChildElementChange()) | 204 if (change.isChildElementChange()) |
196 checkForSiblingStyleChanges(change.type == ElementRemoved ? SiblingEleme
ntRemoved : SiblingElementInserted, change.siblingBeforeChange, change.siblingAf
terChange); | 205 checkForSiblingStyleChanges(change.type == ElementRemoved ? SiblingEleme
ntRemoved : SiblingElementInserted, change.siblingChanged, change.siblingBeforeC
hange, change.siblingAfterChange); |
197 | 206 |
198 if (InsertionPoint* point = shadowInsertionPointOfYoungerShadowRoot()) { | 207 if (InsertionPoint* point = shadowInsertionPointOfYoungerShadowRoot()) { |
199 if (ShadowRoot* root = point->containingShadowRoot()) | 208 if (ShadowRoot* root = point->containingShadowRoot()) |
200 root->owner()->setNeedsDistributionRecalc(); | 209 root->owner()->setNeedsDistributionRecalc(); |
201 } | 210 } |
202 } | 211 } |
203 | 212 |
204 void ShadowRoot::registerScopedHTMLStyleChild() | 213 void ShadowRoot::registerScopedHTMLStyleChild() |
205 { | 214 { |
206 ++m_numberOfStyles; | 215 ++m_numberOfStyles; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 ostream << "ShadowRootType::Open"; | 335 ostream << "ShadowRootType::Open"; |
327 break; | 336 break; |
328 case ShadowRootType::Closed: | 337 case ShadowRootType::Closed: |
329 ostream << "ShadowRootType::Closed"; | 338 ostream << "ShadowRootType::Closed"; |
330 break; | 339 break; |
331 } | 340 } |
332 return ostream; | 341 return ostream; |
333 } | 342 } |
334 | 343 |
335 } // namespace blink | 344 } // namespace blink |
OLD | NEW |