| 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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 DCHECK(node); | 468 DCHECK(node); |
| 469 return &node->treeScope().rootNode(); | 469 return &node->treeScope().rootNode(); |
| 470 } | 470 } |
| 471 | 471 |
| 472 Node* Internals::parentTreeScope(Node* node) { | 472 Node* Internals::parentTreeScope(Node* node) { |
| 473 DCHECK(node); | 473 DCHECK(node); |
| 474 const TreeScope* parentTreeScope = node->treeScope().parentTreeScope(); | 474 const TreeScope* parentTreeScope = node->treeScope().parentTreeScope(); |
| 475 return parentTreeScope ? &parentTreeScope->rootNode() : 0; | 475 return parentTreeScope ? &parentTreeScope->rootNode() : 0; |
| 476 } | 476 } |
| 477 | 477 |
| 478 bool Internals::hasSelectorForIdInShadow(Element* host, | |
| 479 const AtomicString& idValue, | |
| 480 ExceptionState& exceptionState) { | |
| 481 DCHECK(host); | |
| 482 if (!host->shadow() || host->shadow()->isV1()) { | |
| 483 exceptionState.throwDOMException( | |
| 484 InvalidAccessError, "The host element does not have a v0 shadow."); | |
| 485 return false; | |
| 486 } | |
| 487 | |
| 488 return host->shadow()->v0().ensureSelectFeatureSet().hasSelectorForId( | |
| 489 idValue); | |
| 490 } | |
| 491 | |
| 492 bool Internals::hasSelectorForClassInShadow(Element* host, | |
| 493 const AtomicString& className, | |
| 494 ExceptionState& exceptionState) { | |
| 495 DCHECK(host); | |
| 496 if (!host->shadow() || host->shadow()->isV1()) { | |
| 497 exceptionState.throwDOMException( | |
| 498 InvalidAccessError, "The host element does not have a v0 shadow."); | |
| 499 return false; | |
| 500 } | |
| 501 | |
| 502 return host->shadow()->v0().ensureSelectFeatureSet().hasSelectorForClass( | |
| 503 className); | |
| 504 } | |
| 505 | |
| 506 bool Internals::hasSelectorForAttributeInShadow( | |
| 507 Element* host, | |
| 508 const AtomicString& attributeName, | |
| 509 ExceptionState& exceptionState) { | |
| 510 DCHECK(host); | |
| 511 if (!host->shadow() || host->shadow()->isV1()) { | |
| 512 exceptionState.throwDOMException( | |
| 513 InvalidAccessError, "The host element does not have a v0 shadow."); | |
| 514 return false; | |
| 515 } | |
| 516 | |
| 517 return host->shadow()->v0().ensureSelectFeatureSet().hasSelectorForAttribute( | |
| 518 attributeName); | |
| 519 } | |
| 520 | |
| 521 unsigned short Internals::compareTreeScopePosition( | 478 unsigned short Internals::compareTreeScopePosition( |
| 522 const Node* node1, | 479 const Node* node1, |
| 523 const Node* node2, | 480 const Node* node2, |
| 524 ExceptionState& exceptionState) const { | 481 ExceptionState& exceptionState) const { |
| 525 DCHECK(node1 && node2); | 482 DCHECK(node1 && node2); |
| 526 const TreeScope* treeScope1 = | 483 const TreeScope* treeScope1 = |
| 527 node1->isDocumentNode() | 484 node1->isDocumentNode() |
| 528 ? static_cast<const TreeScope*>(toDocument(node1)) | 485 ? static_cast<const TreeScope*>(toDocument(node1)) |
| 529 : node1->isShadowRoot() | 486 : node1->isShadowRoot() |
| 530 ? static_cast<const TreeScope*>(toShadowRoot(node1)) | 487 ? static_cast<const TreeScope*>(toShadowRoot(node1)) |
| (...skipping 2561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3092 | 3049 |
| 3093 void Internals::crash() { | 3050 void Internals::crash() { |
| 3094 CHECK(false) << "Intentional crash"; | 3051 CHECK(false) << "Intentional crash"; |
| 3095 } | 3052 } |
| 3096 | 3053 |
| 3097 void Internals::setIsLowEndDevice(bool isLowEndDevice) { | 3054 void Internals::setIsLowEndDevice(bool isLowEndDevice) { |
| 3098 MemoryCoordinator::setIsLowEndDeviceForTesting(isLowEndDevice); | 3055 MemoryCoordinator::setIsLowEndDeviceForTesting(isLowEndDevice); |
| 3099 } | 3056 } |
| 3100 | 3057 |
| 3101 } // namespace blink | 3058 } // namespace blink |
| OLD | NEW |