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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 pool.distributeTo(insertionPoint, this); | 324 pool.distributeTo(insertionPoint, this); |
325 } | 325 } |
326 | 326 |
327 const SelectRuleFeatureSet& ElementShadow::ensureSelectFeatureSet() | 327 const SelectRuleFeatureSet& ElementShadow::ensureSelectFeatureSet() |
328 { | 328 { |
329 if (!m_needsSelectFeatureSet) | 329 if (!m_needsSelectFeatureSet) |
330 return m_selectFeatures; | 330 return m_selectFeatures; |
331 | 331 |
332 m_selectFeatures.clear(); | 332 m_selectFeatures.clear(); |
333 for (ShadowRoot* root = oldestShadowRoot(); root; root = root->youngerShadow
Root()) | 333 for (ShadowRoot* root = oldestShadowRoot(); root; root = root->youngerShadow
Root()) |
334 collectSelectFeatureSetFrom(root); | 334 collectSelectFeatureSetFrom(*root); |
335 m_needsSelectFeatureSet = false; | 335 m_needsSelectFeatureSet = false; |
336 return m_selectFeatures; | 336 return m_selectFeatures; |
337 } | 337 } |
338 | 338 |
339 void ElementShadow::collectSelectFeatureSetFrom(ShadowRoot* root) | 339 void ElementShadow::collectSelectFeatureSetFrom(ShadowRoot& root) |
340 { | 340 { |
341 if (!root->containsShadowRoots() && !root->containsContentElements()) | 341 if (!root.containsShadowRoots() && !root.containsContentElements()) |
342 return; | 342 return; |
343 | 343 |
344 for (Element* element = ElementTraversal::firstWithin(root); element; elemen
t = ElementTraversal::next(*element, root)) { | 344 for (Element* element = ElementTraversal::firstWithin(root); element; elemen
t = ElementTraversal::next(*element, &root)) { |
345 if (ElementShadow* shadow = element->shadow()) | 345 if (ElementShadow* shadow = element->shadow()) |
346 m_selectFeatures.add(shadow->ensureSelectFeatureSet()); | 346 m_selectFeatures.add(shadow->ensureSelectFeatureSet()); |
347 if (!isHTMLContentElement(element)) | 347 if (!isHTMLContentElement(element)) |
348 continue; | 348 continue; |
349 const CSSSelectorList& list = toHTMLContentElement(element)->selectorLis
t(); | 349 const CSSSelectorList& list = toHTMLContentElement(element)->selectorLis
t(); |
350 for (const CSSSelector* selector = list.first(); selector; selector = CS
SSelectorList::next(selector)) { | 350 for (const CSSSelector* selector = list.first(); selector; selector = CS
SSelectorList::next(selector)) { |
351 for (const CSSSelector* component = selector; component; component =
component->tagHistory()) | 351 for (const CSSSelector* component = selector; component; component =
component->tagHistory()) |
352 m_selectFeatures.collectFeaturesFromSelector(component); | 352 m_selectFeatures.collectFeaturesFromSelector(component); |
353 } | 353 } |
354 } | 354 } |
(...skipping 17 matching lines...) Expand all Loading... |
372 | 372 |
373 void ElementShadow::clearDistribution() | 373 void ElementShadow::clearDistribution() |
374 { | 374 { |
375 m_nodeToInsertionPoints.clear(); | 375 m_nodeToInsertionPoints.clear(); |
376 | 376 |
377 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow
Root()) | 377 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow
Root()) |
378 root->setShadowInsertionPointOfYoungerShadowRoot(0); | 378 root->setShadowInsertionPointOfYoungerShadowRoot(0); |
379 } | 379 } |
380 | 380 |
381 } // namespace | 381 } // namespace |
OLD | NEW |