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 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 DistributionPool pool(*host()); | 269 DistributionPool pool(*host()); |
270 | 270 |
271 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow
Root()) { | 271 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow
Root()) { |
272 HTMLShadowElement* shadowInsertionPoint = 0; | 272 HTMLShadowElement* shadowInsertionPoint = 0; |
273 const Vector<RefPtr<InsertionPoint> >& insertionPoints = root->descendan
tInsertionPoints(); | 273 const Vector<RefPtr<InsertionPoint> >& insertionPoints = root->descendan
tInsertionPoints(); |
274 for (size_t i = 0; i < insertionPoints.size(); ++i) { | 274 for (size_t i = 0; i < insertionPoints.size(); ++i) { |
275 InsertionPoint* point = insertionPoints[i].get(); | 275 InsertionPoint* point = insertionPoints[i].get(); |
276 if (!point->isActive()) | 276 if (!point->isActive()) |
277 continue; | 277 continue; |
278 if (point->hasTagName(HTMLNames::shadowTag)) { | 278 if (point->hasTagName(HTMLNames::shadowTag)) { |
279 if (!shadowInsertionPoint) | 279 ASSERT(!shadowInsertionPoint); |
280 shadowInsertionPoint = toHTMLShadowElement(point); | 280 shadowInsertionPoint = toHTMLShadowElement(point); |
| 281 shadowInsertionPoints.append(shadowInsertionPoint); |
281 } else { | 282 } else { |
282 pool.distributeTo(point, this); | 283 pool.distributeTo(point, this); |
283 if (ElementShadow* shadow = shadowWhereNodeCanBeDistributed(*poi
nt)) | 284 if (ElementShadow* shadow = shadowWhereNodeCanBeDistributed(*poi
nt)) |
284 shadow->setNeedsDistributionRecalc(); | 285 shadow->setNeedsDistributionRecalc(); |
285 } | 286 } |
286 } | 287 } |
287 if (shadowInsertionPoint) { | |
288 shadowInsertionPoints.append(shadowInsertionPoint); | |
289 if (shadowInsertionPoint->hasChildNodes()) | |
290 pool.populateChildren(*shadowInsertionPoint); | |
291 } else { | |
292 pool.clear(); | |
293 } | |
294 } | 288 } |
295 | 289 |
296 for (size_t i = shadowInsertionPoints.size(); i > 0; --i) { | 290 for (size_t i = shadowInsertionPoints.size(); i > 0; --i) { |
297 HTMLShadowElement* shadowInsertionPoint = shadowInsertionPoints[i - 1]; | 291 HTMLShadowElement* shadowInsertionPoint = shadowInsertionPoints[i - 1]; |
298 ShadowRoot* root = shadowInsertionPoint->containingShadowRoot(); | 292 ShadowRoot* root = shadowInsertionPoint->containingShadowRoot(); |
299 ASSERT(root); | 293 ASSERT(root); |
300 if (root->isOldest()) { | 294 if (root->isOldest()) { |
301 pool.distributeTo(shadowInsertionPoint, this); | 295 pool.distributeTo(shadowInsertionPoint, this); |
302 } else if (root->olderShadowRoot()->type() == root->type()) { | 296 } else if (root->olderShadowRoot()->type() == root->type()) { |
303 // Only allow reprojecting older shadow roots between the same type
to | 297 // Only allow reprojecting older shadow roots between the same type
to |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 | 359 |
366 void ElementShadow::clearDistribution() | 360 void ElementShadow::clearDistribution() |
367 { | 361 { |
368 m_nodeToInsertionPoints.clear(); | 362 m_nodeToInsertionPoints.clear(); |
369 | 363 |
370 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow
Root()) | 364 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow
Root()) |
371 root->setShadowInsertionPointOfYoungerShadowRoot(0); | 365 root->setShadowInsertionPointOfYoungerShadowRoot(0); |
372 } | 366 } |
373 | 367 |
374 } // namespace | 368 } // namespace |
OLD | NEW |