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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 } | 227 } |
228 | 228 |
229 if (firstActiveShadowInsertionPoint) | 229 if (firstActiveShadowInsertionPoint) |
230 activeShadowInsertionPoints.append(firstActiveShadowInsertionPoint); | 230 activeShadowInsertionPoints.append(firstActiveShadowInsertionPoint); |
231 } | 231 } |
232 | 232 |
233 for (size_t i = activeShadowInsertionPoints.size(); i > 0; --i) { | 233 for (size_t i = activeShadowInsertionPoints.size(); i > 0; --i) { |
234 HTMLShadowElement* shadowElement = activeShadowInsertionPoints[i - 1]; | 234 HTMLShadowElement* shadowElement = activeShadowInsertionPoints[i - 1]; |
235 ShadowRoot* root = shadowElement->containingShadowRoot(); | 235 ShadowRoot* root = shadowElement->containingShadowRoot(); |
236 ASSERT(root); | 236 ASSERT(root); |
237 if (!shadowElement->shouldSelect()) { | 237 if (root->olderShadowRoot() && root->olderShadowRoot()->type() == root->
type()) { |
238 if (root->olderShadowRoot()) | 238 // Only allow reprojecting older shadow roots between the same type
to |
239 root->olderShadowRoot()->ensureScopeDistribution()->setInsertion
PointAssignedTo(shadowElement); | 239 // disallow reprojecting UA elements into author shadows. |
240 } else if (root->olderShadowRoot()) { | |
241 distributeNodeChildrenTo(shadowElement, root->olderShadowRoot()); | 240 distributeNodeChildrenTo(shadowElement, root->olderShadowRoot()); |
242 root->olderShadowRoot()->ensureScopeDistribution()->setInsertionPoin
tAssignedTo(shadowElement); | 241 root->olderShadowRoot()->ensureScopeDistribution()->setInsertionPoin
tAssignedTo(shadowElement); |
243 } else { | 242 } else if (!root->olderShadowRoot()) { |
| 243 // There's assumed to always be a UA shadow that selects all nodes. |
| 244 // We don't actually add it, instead we just distribute the pool to
the |
| 245 // <shadow> in the oldest shadow root. |
244 distributeSelectionsTo(shadowElement, pool, distributed); | 246 distributeSelectionsTo(shadowElement, pool, distributed); |
245 } | 247 } |
246 if (ElementShadow* shadow = shadowOfParentForDistribution(shadowElement)
) | 248 if (ElementShadow* shadow = shadowOfParentForDistribution(shadowElement)
) |
247 shadow->setNeedsDistributionRecalc(); | 249 shadow->setNeedsDistributionRecalc(); |
248 } | 250 } |
249 | 251 |
250 // Detach all nodes that were not distributed and have a renderer. | 252 // Detach all nodes that were not distributed and have a renderer. |
251 for (size_t i = 0; i < pool.size(); ++i) { | 253 for (size_t i = 0; i < pool.size(); ++i) { |
252 if (distributed[i]) | 254 if (distributed[i]) |
253 continue; | 255 continue; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 { | 354 { |
353 m_nodeToInsertionPoint.clear(); | 355 m_nodeToInsertionPoint.clear(); |
354 | 356 |
355 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow
Root()) { | 357 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow
Root()) { |
356 if (ScopeContentDistribution* scope = root->scopeDistribution()) | 358 if (ScopeContentDistribution* scope = root->scopeDistribution()) |
357 scope->setInsertionPointAssignedTo(0); | 359 scope->setInsertionPointAssignedTo(0); |
358 } | 360 } |
359 } | 361 } |
360 | 362 |
361 } // namespace | 363 } // namespace |
OLD | NEW |