| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 void ShadowRoot::attach(const AttachContext& context) | 153 void ShadowRoot::attach(const AttachContext& context) |
| 154 { | 154 { |
| 155 StyleSharingDepthScope sharingScope(*this); | 155 StyleSharingDepthScope sharingScope(*this); |
| 156 DocumentFragment::attach(context); | 156 DocumentFragment::attach(context); |
| 157 } | 157 } |
| 158 | 158 |
| 159 Node::InsertionNotificationRequest ShadowRoot::insertedInto(ContainerNode* inser
tionPoint) | 159 Node::InsertionNotificationRequest ShadowRoot::insertedInto(ContainerNode* inser
tionPoint) |
| 160 { | 160 { |
| 161 DocumentFragment::insertedInto(insertionPoint); | 161 DocumentFragment::insertedInto(insertionPoint); |
| 162 | 162 |
| 163 if (!insertionPoint->inDocument() || !isOldest()) | 163 if (!insertionPoint->inShadowIncludingDocument() || !isOldest()) |
| 164 return InsertionDone; | 164 return InsertionDone; |
| 165 | 165 |
| 166 // FIXME: When parsing <video controls>, insertedInto() is called many times
without invoking removedFrom. | 166 // FIXME: When parsing <video controls>, insertedInto() is called many times
without invoking removedFrom. |
| 167 // For now, we check m_registeredWithParentShadowroot. We would like to ASSE
RT(!m_registeredShadowRoot) here. | 167 // For now, we check m_registeredWithParentShadowroot. We would like to ASSE
RT(!m_registeredShadowRoot) here. |
| 168 // https://bugs.webkit.org/show_bug.cig?id=101316 | 168 // https://bugs.webkit.org/show_bug.cig?id=101316 |
| 169 if (m_registeredWithParentShadowRoot) | 169 if (m_registeredWithParentShadowRoot) |
| 170 return InsertionDone; | 170 return InsertionDone; |
| 171 | 171 |
| 172 if (ShadowRoot* root = host()->containingShadowRoot()) { | 172 if (ShadowRoot* root = host()->containingShadowRoot()) { |
| 173 root->addChildShadowRoot(); | 173 root->addChildShadowRoot(); |
| 174 m_registeredWithParentShadowRoot = true; | 174 m_registeredWithParentShadowRoot = true; |
| 175 } | 175 } |
| 176 | 176 |
| 177 return InsertionDone; | 177 return InsertionDone; |
| 178 } | 178 } |
| 179 | 179 |
| 180 void ShadowRoot::removedFrom(ContainerNode* insertionPoint) | 180 void ShadowRoot::removedFrom(ContainerNode* insertionPoint) |
| 181 { | 181 { |
| 182 if (insertionPoint->inDocument()) { | 182 if (insertionPoint->inShadowIncludingDocument()) { |
| 183 document().styleEngine().shadowRootRemovedFromDocument(this); | 183 document().styleEngine().shadowRootRemovedFromDocument(this); |
| 184 if (m_registeredWithParentShadowRoot) { | 184 if (m_registeredWithParentShadowRoot) { |
| 185 ShadowRoot* root = host()->containingShadowRoot(); | 185 ShadowRoot* root = host()->containingShadowRoot(); |
| 186 if (!root) | 186 if (!root) |
| 187 root = insertionPoint->containingShadowRoot(); | 187 root = insertionPoint->containingShadowRoot(); |
| 188 if (root) | 188 if (root) |
| 189 root->removeChildShadowRoot(); | 189 root->removeChildShadowRoot(); |
| 190 m_registeredWithParentShadowRoot = false; | 190 m_registeredWithParentShadowRoot = false; |
| 191 } | 191 } |
| 192 } | 192 } |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 DEFINE_TRACE(ShadowRoot) | 370 DEFINE_TRACE(ShadowRoot) |
| 371 { | 371 { |
| 372 visitor->trace(m_prev); | 372 visitor->trace(m_prev); |
| 373 visitor->trace(m_next); | 373 visitor->trace(m_next); |
| 374 visitor->trace(m_shadowRootRareData); | 374 visitor->trace(m_shadowRootRareData); |
| 375 TreeScope::trace(visitor); | 375 TreeScope::trace(visitor); |
| 376 DocumentFragment::trace(visitor); | 376 DocumentFragment::trace(visitor); |
| 377 } | 377 } |
| 378 | 378 |
| 379 } // namespace blink | 379 } // namespace blink |
| OLD | NEW |