| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2013 Apple Inc. 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 #include "core/dom/ExceptionCode.h" | 53 #include "core/dom/ExceptionCode.h" |
| 54 #include "core/dom/Iterator.h" | 54 #include "core/dom/Iterator.h" |
| 55 #include "core/dom/NodeComputedStyle.h" | 55 #include "core/dom/NodeComputedStyle.h" |
| 56 #include "core/dom/PseudoElement.h" | 56 #include "core/dom/PseudoElement.h" |
| 57 #include "core/dom/Range.h" | 57 #include "core/dom/Range.h" |
| 58 #include "core/dom/StaticNodeList.h" | 58 #include "core/dom/StaticNodeList.h" |
| 59 #include "core/dom/StyleEngine.h" | 59 #include "core/dom/StyleEngine.h" |
| 60 #include "core/dom/TreeScope.h" | 60 #include "core/dom/TreeScope.h" |
| 61 #include "core/dom/ViewportDescription.h" | 61 #include "core/dom/ViewportDescription.h" |
| 62 #include "core/dom/shadow/ElementShadow.h" | 62 #include "core/dom/shadow/ElementShadow.h" |
| 63 #include "core/dom/shadow/ElementShadowV0.h" |
| 63 #include "core/dom/shadow/FlatTreeTraversal.h" | 64 #include "core/dom/shadow/FlatTreeTraversal.h" |
| 64 #include "core/dom/shadow/SelectRuleFeatureSet.h" | 65 #include "core/dom/shadow/SelectRuleFeatureSet.h" |
| 65 #include "core/dom/shadow/ShadowRoot.h" | 66 #include "core/dom/shadow/ShadowRoot.h" |
| 66 #include "core/editing/Editor.h" | 67 #include "core/editing/Editor.h" |
| 67 #include "core/editing/PlainTextRange.h" | 68 #include "core/editing/PlainTextRange.h" |
| 68 #include "core/editing/SurroundingText.h" | 69 #include "core/editing/SurroundingText.h" |
| 69 #include "core/editing/iterators/TextIterator.h" | 70 #include "core/editing/iterators/TextIterator.h" |
| 70 #include "core/editing/markers/DocumentMarker.h" | 71 #include "core/editing/markers/DocumentMarker.h" |
| 71 #include "core/editing/markers/DocumentMarkerController.h" | 72 #include "core/editing/markers/DocumentMarkerController.h" |
| 72 #include "core/editing/serializers/Serialization.h" | 73 #include "core/editing/serializers/Serialization.h" |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 Node* Internals::parentTreeScope(Node* node) | 434 Node* Internals::parentTreeScope(Node* node) |
| 434 { | 435 { |
| 435 ASSERT(node); | 436 ASSERT(node); |
| 436 const TreeScope* parentTreeScope = node->treeScope().parentTreeScope(); | 437 const TreeScope* parentTreeScope = node->treeScope().parentTreeScope(); |
| 437 return parentTreeScope ? &parentTreeScope->rootNode() : 0; | 438 return parentTreeScope ? &parentTreeScope->rootNode() : 0; |
| 438 } | 439 } |
| 439 | 440 |
| 440 bool Internals::hasSelectorForIdInShadow(Element* host, const AtomicString& idVa
lue, ExceptionState& exceptionState) | 441 bool Internals::hasSelectorForIdInShadow(Element* host, const AtomicString& idVa
lue, ExceptionState& exceptionState) |
| 441 { | 442 { |
| 442 ASSERT(host); | 443 ASSERT(host); |
| 443 if (!host->shadow()) { | 444 if (!host->shadow() || host->shadow()->isV1()) { |
| 444 exceptionState.throwDOMException(InvalidAccessError, "The host element d
oes not have a shadow."); | 445 exceptionState.throwDOMException(InvalidAccessError, "The host element d
oes not have a v0 shadow."); |
| 445 return false; | 446 return false; |
| 446 } | 447 } |
| 447 | 448 |
| 448 return host->shadow()->ensureSelectFeatureSet().hasSelectorForId(idValue); | 449 return host->shadow()->v0().ensureSelectFeatureSet().hasSelectorForId(idValu
e); |
| 449 } | 450 } |
| 450 | 451 |
| 451 bool Internals::hasSelectorForClassInShadow(Element* host, const AtomicString& c
lassName, ExceptionState& exceptionState) | 452 bool Internals::hasSelectorForClassInShadow(Element* host, const AtomicString& c
lassName, ExceptionState& exceptionState) |
| 452 { | 453 { |
| 453 ASSERT(host); | 454 ASSERT(host); |
| 454 if (!host->shadow()) { | 455 if (!host->shadow() || host->shadow()->isV1()) { |
| 455 exceptionState.throwDOMException(InvalidAccessError, "The host element d
oes not have a shadow."); | 456 exceptionState.throwDOMException(InvalidAccessError, "The host element d
oes not have a v0 shadow."); |
| 456 return false; | 457 return false; |
| 457 } | 458 } |
| 458 | 459 |
| 459 return host->shadow()->ensureSelectFeatureSet().hasSelectorForClass(classNam
e); | 460 return host->shadow()->v0().ensureSelectFeatureSet().hasSelectorForClass(cla
ssName); |
| 460 } | 461 } |
| 461 | 462 |
| 462 bool Internals::hasSelectorForAttributeInShadow(Element* host, const AtomicStrin
g& attributeName, ExceptionState& exceptionState) | 463 bool Internals::hasSelectorForAttributeInShadow(Element* host, const AtomicStrin
g& attributeName, ExceptionState& exceptionState) |
| 463 { | 464 { |
| 464 ASSERT(host); | 465 ASSERT(host); |
| 465 if (!host->shadow()) { | 466 if (!host->shadow() || host->shadow()->isV1()) { |
| 466 exceptionState.throwDOMException(InvalidAccessError, "The host element d
oes not have a shadow."); | 467 exceptionState.throwDOMException(InvalidAccessError, "The host element d
oes not have a v0 shadow."); |
| 467 return false; | 468 return false; |
| 468 } | 469 } |
| 469 | 470 |
| 470 return host->shadow()->ensureSelectFeatureSet().hasSelectorForAttribute(attr
ibuteName); | 471 return host->shadow()->v0().ensureSelectFeatureSet().hasSelectorForAttribute
(attributeName); |
| 471 } | 472 } |
| 472 | 473 |
| 473 unsigned short Internals::compareTreeScopePosition(const Node* node1, const Node
* node2, ExceptionState& exceptionState) const | 474 unsigned short Internals::compareTreeScopePosition(const Node* node1, const Node
* node2, ExceptionState& exceptionState) const |
| 474 { | 475 { |
| 475 ASSERT(node1 && node2); | 476 ASSERT(node1 && node2); |
| 476 const TreeScope* treeScope1 = node1->isDocumentNode() ? static_cast<const Tr
eeScope*>(toDocument(node1)) : | 477 const TreeScope* treeScope1 = node1->isDocumentNode() ? static_cast<const Tr
eeScope*>(toDocument(node1)) : |
| 477 node1->isShadowRoot() ? static_cast<const TreeScope*>(toShadowRoot(node1
)) : 0; | 478 node1->isShadowRoot() ? static_cast<const TreeScope*>(toShadowRoot(node1
)) : 0; |
| 478 const TreeScope* treeScope2 = node2->isDocumentNode() ? static_cast<const Tr
eeScope*>(toDocument(node2)) : | 479 const TreeScope* treeScope2 = node2->isDocumentNode() ? static_cast<const Tr
eeScope*>(toDocument(node2)) : |
| 479 node2->isShadowRoot() ? static_cast<const TreeScope*>(toShadowRoot(node2
)) : 0; | 480 node2->isShadowRoot() ? static_cast<const TreeScope*>(toShadowRoot(node2
)) : 0; |
| 480 if (!treeScope1 || !treeScope2) { | 481 if (!treeScope1 || !treeScope2) { |
| (...skipping 2170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2651 | 2652 |
| 2652 return ClientRect::create(FloatRect(node->layoutObject()->visualRect())); | 2653 return ClientRect::create(FloatRect(node->layoutObject()->visualRect())); |
| 2653 } | 2654 } |
| 2654 | 2655 |
| 2655 void Internals::crash() | 2656 void Internals::crash() |
| 2656 { | 2657 { |
| 2657 CHECK(false) << "Intentional crash"; | 2658 CHECK(false) << "Intentional crash"; |
| 2658 } | 2659 } |
| 2659 | 2660 |
| 2660 } // namespace blink | 2661 } // namespace blink |
| OLD | NEW |