OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011, 2013 Apple Inc. All rights reserved. |
3 * Copyright (C) 2014 Samsung Electronics. All rights reserved. | 3 * Copyright (C) 2014 Samsung Electronics. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 // FIXME: Move the following helper functions, authorShadowRootOf, firstWithinTr
aversingShadowTree, | 346 // FIXME: Move the following helper functions, authorShadowRootOf, firstWithinTr
aversingShadowTree, |
347 // nextTraversingShadowTree to the best place, e.g. NodeTraversal. | 347 // nextTraversingShadowTree to the best place, e.g. NodeTraversal. |
348 static ShadowRoot* authorShadowRootOf(const ContainerNode& node) | 348 static ShadowRoot* authorShadowRootOf(const ContainerNode& node) |
349 { | 349 { |
350 if (!node.isElementNode() || !isShadowHost(&node)) | 350 if (!node.isElementNode() || !isShadowHost(&node)) |
351 return 0; | 351 return 0; |
352 | 352 |
353 ElementShadow* shadow = toElement(node).shadow(); | 353 ElementShadow* shadow = toElement(node).shadow(); |
354 ASSERT(shadow); | 354 ASSERT(shadow); |
355 for (ShadowRoot* shadowRoot = shadow->oldestShadowRoot(); shadowRoot; shadow
Root = shadowRoot->youngerShadowRoot()) { | 355 for (ShadowRoot* shadowRoot = shadow->oldestShadowRoot(); shadowRoot; shadow
Root = shadowRoot->youngerShadowRoot()) { |
356 if (shadowRoot->type() == ShadowRoot::AuthorShadowRoot) | 356 if (shadowRoot->type() == ShadowRoot::OpenShadowRoot) |
357 return shadowRoot; | 357 return shadowRoot; |
358 } | 358 } |
359 return 0; | 359 return 0; |
360 } | 360 } |
361 | 361 |
362 static ContainerNode* firstWithinTraversingShadowTree(const ContainerNode& rootN
ode) | 362 static ContainerNode* firstWithinTraversingShadowTree(const ContainerNode& rootN
ode) |
363 { | 363 { |
364 if (ShadowRoot* shadowRoot = authorShadowRootOf(rootNode)) | 364 if (ShadowRoot* shadowRoot = authorShadowRootOf(rootNode)) |
365 return shadowRoot; | 365 return shadowRoot; |
366 return ElementTraversal::firstWithin(rootNode); | 366 return ElementTraversal::firstWithin(rootNode); |
(...skipping 10 matching lines...) Expand all Loading... |
377 return next; | 377 return next; |
378 | 378 |
379 if (!current->isInShadowTree()) | 379 if (!current->isInShadowTree()) |
380 return 0; | 380 return 0; |
381 | 381 |
382 ShadowRoot* shadowRoot = current->containingShadowRoot(); | 382 ShadowRoot* shadowRoot = current->containingShadowRoot(); |
383 if (shadowRoot == rootNode) | 383 if (shadowRoot == rootNode) |
384 return 0; | 384 return 0; |
385 if (ShadowRoot* youngerShadowRoot = shadowRoot->youngerShadowRoot()) { | 385 if (ShadowRoot* youngerShadowRoot = shadowRoot->youngerShadowRoot()) { |
386 // Should not obtain any elements in user-agent shadow root. | 386 // Should not obtain any elements in user-agent shadow root. |
387 ASSERT(youngerShadowRoot->type() == ShadowRoot::AuthorShadowRoot); | 387 ASSERT(youngerShadowRoot->type() == ShadowRoot::OpenShadowRoot); |
388 return youngerShadowRoot; | 388 return youngerShadowRoot; |
389 } | 389 } |
390 | 390 |
391 current = shadowRoot->host(); | 391 current = shadowRoot->host(); |
392 } | 392 } |
393 return 0; | 393 return 0; |
394 } | 394 } |
395 | 395 |
396 template <typename SelectorQueryTrait> | 396 template <typename SelectorQueryTrait> |
397 void SelectorDataList::executeSlowTraversingShadowTree(ContainerNode& rootNode,
typename SelectorQueryTrait::OutputType& output) const | 397 void SelectorDataList::executeSlowTraversingShadowTree(ContainerNode& rootNode,
typename SelectorQueryTrait::OutputType& output) const |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 | 535 |
536 return m_entries.add(selectors, SelectorQuery::adopt(selectorList)).storedVa
lue->value.get(); | 536 return m_entries.add(selectors, SelectorQuery::adopt(selectorList)).storedVa
lue->value.get(); |
537 } | 537 } |
538 | 538 |
539 void SelectorQueryCache::invalidate() | 539 void SelectorQueryCache::invalidate() |
540 { | 540 { |
541 m_entries.clear(); | 541 m_entries.clear(); |
542 } | 542 } |
543 | 543 |
544 } | 544 } |
OLD | NEW |