OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } | 168 } |
169 } | 169 } |
170 | 170 |
171 Node::InsertionNotificationRequest InsertionPoint::insertedInto(ContainerNode* i
nsertionPoint) | 171 Node::InsertionNotificationRequest InsertionPoint::insertedInto(ContainerNode* i
nsertionPoint) |
172 { | 172 { |
173 HTMLElement::insertedInto(insertionPoint); | 173 HTMLElement::insertedInto(insertionPoint); |
174 | 174 |
175 if (ShadowRoot* root = containingShadowRoot()) { | 175 if (ShadowRoot* root = containingShadowRoot()) { |
176 if (ElementShadow* rootOwner = root->owner()) { | 176 if (ElementShadow* rootOwner = root->owner()) { |
177 rootOwner->setNeedsDistributionRecalc(); | 177 rootOwner->setNeedsDistributionRecalc(); |
178 if (isActive() && !m_registeredWithShadowRoot && insertionPoint->tre
eScope().rootNode() == root) { | 178 if (isActive() && !m_registeredWithShadowRoot && insertionPoint->tre
eScope()->rootNode() == root) { |
179 m_registeredWithShadowRoot = true; | 179 m_registeredWithShadowRoot = true; |
180 root->addInsertionPoint(this); | 180 root->addInsertionPoint(this); |
181 rootOwner->didAffectApplyAuthorStyles(); | 181 rootOwner->didAffectApplyAuthorStyles(); |
182 if (canAffectSelector()) | 182 if (canAffectSelector()) |
183 rootOwner->willAffectSelector(); | 183 rootOwner->willAffectSelector(); |
184 } | 184 } |
185 } | 185 } |
186 } | 186 } |
187 | 187 |
188 return InsertionDone; | 188 return InsertionDone; |
189 } | 189 } |
190 | 190 |
191 void InsertionPoint::removedFrom(ContainerNode* insertionPoint) | 191 void InsertionPoint::removedFrom(ContainerNode* insertionPoint) |
192 { | 192 { |
193 ShadowRoot* root = containingShadowRoot(); | 193 ShadowRoot* root = containingShadowRoot(); |
194 if (!root) | 194 if (!root) |
195 root = insertionPoint->containingShadowRoot(); | 195 root = insertionPoint->containingShadowRoot(); |
196 | 196 |
197 if (root) { | 197 if (root) { |
198 if (ElementShadow* rootOwner = root->owner()) | 198 if (ElementShadow* rootOwner = root->owner()) |
199 rootOwner->setNeedsDistributionRecalc(); | 199 rootOwner->setNeedsDistributionRecalc(); |
200 } | 200 } |
201 | 201 |
202 // host can be null when removedFrom() is called from ElementShadow destruct
or. | 202 // host can be null when removedFrom() is called from ElementShadow destruct
or. |
203 ElementShadow* rootOwner = root ? root->owner() : 0; | 203 ElementShadow* rootOwner = root ? root->owner() : 0; |
204 | 204 |
205 // Since this insertion point is no longer visible from the shadow subtree,
it need to clean itself up. | 205 // Since this insertion point is no longer visible from the shadow subtree,
it need to clean itself up. |
206 clearDistribution(); | 206 clearDistribution(); |
207 | 207 |
208 if (m_registeredWithShadowRoot && insertionPoint->treeScope().rootNode() ==
root) { | 208 if (m_registeredWithShadowRoot && insertionPoint->treeScope()->rootNode() ==
root) { |
209 ASSERT(root); | 209 ASSERT(root); |
210 m_registeredWithShadowRoot = false; | 210 m_registeredWithShadowRoot = false; |
211 root->removeInsertionPoint(this); | 211 root->removeInsertionPoint(this); |
212 if (rootOwner) { | 212 if (rootOwner) { |
213 rootOwner->didAffectApplyAuthorStyles(); | 213 rootOwner->didAffectApplyAuthorStyles(); |
214 if (canAffectSelector()) | 214 if (canAffectSelector()) |
215 rootOwner->willAffectSelector(); | 215 rootOwner->willAffectSelector(); |
216 } | 216 } |
217 } | 217 } |
218 | 218 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 current = insertedTo; | 283 current = insertedTo; |
284 results.append(insertedTo); | 284 results.append(insertedTo); |
285 continue; | 285 continue; |
286 } | 286 } |
287 } | 287 } |
288 return; | 288 return; |
289 } | 289 } |
290 } | 290 } |
291 | 291 |
292 } // namespace WebCore | 292 } // namespace WebCore |
OLD | NEW |