| 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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 // FIXME: Move the following helper functions, authorShadowRootOf, firstWithinTr
aversingShadowTree, | 381 // FIXME: Move the following helper functions, authorShadowRootOf, firstWithinTr
aversingShadowTree, |
| 382 // nextTraversingShadowTree to the best place, e.g. NodeTraversal. | 382 // nextTraversingShadowTree to the best place, e.g. NodeTraversal. |
| 383 static ShadowRoot* authorShadowRootOf(const ContainerNode& node) | 383 static ShadowRoot* authorShadowRootOf(const ContainerNode& node) |
| 384 { | 384 { |
| 385 if (!node.isElementNode() || !isShadowHost(&node)) | 385 if (!node.isElementNode() || !isShadowHost(&node)) |
| 386 return nullptr; | 386 return nullptr; |
| 387 | 387 |
| 388 ElementShadow* shadow = toElement(node).shadow(); | 388 ElementShadow* shadow = toElement(node).shadow(); |
| 389 ASSERT(shadow); | 389 ASSERT(shadow); |
| 390 for (ShadowRoot* shadowRoot = shadow->oldestShadowRoot(); shadowRoot; shadow
Root = shadowRoot->youngerShadowRoot()) { | 390 for (ShadowRoot* shadowRoot = shadow->oldestShadowRoot(); shadowRoot; shadow
Root = shadowRoot->youngerShadowRoot()) { |
| 391 if (shadowRoot->type() == ShadowRootType::OpenByDefault || shadowRoot->t
ype() == ShadowRootType::Open) | 391 if (shadowRoot->type() == ShadowRootType::V0 || shadowRoot->type() == Sh
adowRootType::Open) |
| 392 return shadowRoot; | 392 return shadowRoot; |
| 393 } | 393 } |
| 394 return nullptr; | 394 return nullptr; |
| 395 } | 395 } |
| 396 | 396 |
| 397 static ContainerNode* firstWithinTraversingShadowTree(const ContainerNode& rootN
ode) | 397 static ContainerNode* firstWithinTraversingShadowTree(const ContainerNode& rootN
ode) |
| 398 { | 398 { |
| 399 if (ShadowRoot* shadowRoot = authorShadowRootOf(rootNode)) | 399 if (ShadowRoot* shadowRoot = authorShadowRootOf(rootNode)) |
| 400 return shadowRoot; | 400 return shadowRoot; |
| 401 return ElementTraversal::firstWithin(rootNode); | 401 return ElementTraversal::firstWithin(rootNode); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 412 return next; | 412 return next; |
| 413 | 413 |
| 414 if (!current->isInShadowTree()) | 414 if (!current->isInShadowTree()) |
| 415 return nullptr; | 415 return nullptr; |
| 416 | 416 |
| 417 ShadowRoot* shadowRoot = current->containingShadowRoot(); | 417 ShadowRoot* shadowRoot = current->containingShadowRoot(); |
| 418 if (shadowRoot == rootNode) | 418 if (shadowRoot == rootNode) |
| 419 return nullptr; | 419 return nullptr; |
| 420 if (ShadowRoot* youngerShadowRoot = shadowRoot->youngerShadowRoot()) { | 420 if (ShadowRoot* youngerShadowRoot = shadowRoot->youngerShadowRoot()) { |
| 421 // Should not obtain any elements in closed or user-agent shadow roo
t. | 421 // Should not obtain any elements in closed or user-agent shadow roo
t. |
| 422 ASSERT(youngerShadowRoot->type() == ShadowRootType::OpenByDefault ||
youngerShadowRoot->type() == ShadowRootType::Open); | 422 ASSERT(youngerShadowRoot->type() == ShadowRootType::V0 || youngerSha
dowRoot->type() == ShadowRootType::Open); |
| 423 return youngerShadowRoot; | 423 return youngerShadowRoot; |
| 424 } | 424 } |
| 425 | 425 |
| 426 current = shadowRoot->host(); | 426 current = shadowRoot->host(); |
| 427 } | 427 } |
| 428 return nullptr; | 428 return nullptr; |
| 429 } | 429 } |
| 430 | 430 |
| 431 template <typename SelectorQueryTrait> | 431 template <typename SelectorQueryTrait> |
| 432 void SelectorDataList::executeSlowTraversingShadowTree(ContainerNode& rootNode,
typename SelectorQueryTrait::OutputType& output) const | 432 void SelectorDataList::executeSlowTraversingShadowTree(ContainerNode& rootNode,
typename SelectorQueryTrait::OutputType& output) const |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 | 570 |
| 571 return m_entries.add(selectors, SelectorQuery::adopt(selectorList)).storedVa
lue->value.get(); | 571 return m_entries.add(selectors, SelectorQuery::adopt(selectorList)).storedVa
lue->value.get(); |
| 572 } | 572 } |
| 573 | 573 |
| 574 void SelectorQueryCache::invalidate() | 574 void SelectorQueryCache::invalidate() |
| 575 { | 575 { |
| 576 m_entries.clear(); | 576 m_entries.clear(); |
| 577 } | 577 } |
| 578 | 578 |
| 579 } | 579 } |
| OLD | NEW |