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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 pool.distributeTo(insertionPoint, this); | 315 pool.distributeTo(insertionPoint, this); |
316 } | 316 } |
317 | 317 |
318 const SelectRuleFeatureSet& ElementShadow::ensureSelectFeatureSet() | 318 const SelectRuleFeatureSet& ElementShadow::ensureSelectFeatureSet() |
319 { | 319 { |
320 if (!m_needsSelectFeatureSet) | 320 if (!m_needsSelectFeatureSet) |
321 return m_selectFeatures; | 321 return m_selectFeatures; |
322 | 322 |
323 m_selectFeatures.clear(); | 323 m_selectFeatures.clear(); |
324 for (ShadowRoot* root = oldestShadowRoot(); root; root = root->youngerShadow
Root()) | 324 for (ShadowRoot* root = oldestShadowRoot(); root; root = root->youngerShadow
Root()) |
325 collectSelectFeatureSetFrom(root); | 325 collectSelectFeatureSetFrom(*root); |
326 m_needsSelectFeatureSet = false; | 326 m_needsSelectFeatureSet = false; |
327 return m_selectFeatures; | 327 return m_selectFeatures; |
328 } | 328 } |
329 | 329 |
330 void ElementShadow::collectSelectFeatureSetFrom(ShadowRoot* root) | 330 void ElementShadow::collectSelectFeatureSetFrom(ShadowRoot& root) |
331 { | 331 { |
332 if (!root->containsShadowRoots() && !root->containsContentElements()) | 332 if (!root.containsShadowRoots() && !root.containsContentElements()) |
333 return; | 333 return; |
334 | 334 |
335 for (Element* element = ElementTraversal::firstWithin(root); element; elemen
t = ElementTraversal::next(*element, root)) { | 335 for (Element* element = ElementTraversal::firstWithin(root); element; elemen
t = ElementTraversal::next(*element, &root)) { |
336 if (ElementShadow* shadow = element->shadow()) | 336 if (ElementShadow* shadow = element->shadow()) |
337 m_selectFeatures.add(shadow->ensureSelectFeatureSet()); | 337 m_selectFeatures.add(shadow->ensureSelectFeatureSet()); |
338 if (!isHTMLContentElement(element)) | 338 if (!isHTMLContentElement(element)) |
339 continue; | 339 continue; |
340 const CSSSelectorList& list = toHTMLContentElement(element)->selectorLis
t(); | 340 const CSSSelectorList& list = toHTMLContentElement(element)->selectorLis
t(); |
341 for (const CSSSelector* selector = list.first(); selector; selector = CS
SSelectorList::next(selector)) { | 341 for (const CSSSelector* selector = list.first(); selector; selector = CS
SSelectorList::next(selector)) { |
342 for (const CSSSelector* component = selector; component; component =
component->tagHistory()) | 342 for (const CSSSelector* component = selector; component; component =
component->tagHistory()) |
343 m_selectFeatures.collectFeaturesFromSelector(component); | 343 m_selectFeatures.collectFeaturesFromSelector(component); |
344 } | 344 } |
345 } | 345 } |
(...skipping 17 matching lines...) Expand all Loading... |
363 | 363 |
364 void ElementShadow::clearDistribution() | 364 void ElementShadow::clearDistribution() |
365 { | 365 { |
366 m_nodeToInsertionPoints.clear(); | 366 m_nodeToInsertionPoints.clear(); |
367 | 367 |
368 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow
Root()) | 368 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow
Root()) |
369 root->setShadowInsertionPointOfYoungerShadowRoot(0); | 369 root->setShadowInsertionPointOfYoungerShadowRoot(0); |
370 } | 370 } |
371 | 371 |
372 } // namespace | 372 } // namespace |
OLD | NEW |