OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
6 * rights reserved. | 6 * rights reserved. |
7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. |
9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
10 * | 10 * |
(...skipping 2475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2486 | 2486 |
2487 DEFINE_TRACE_WRAPPERS(Node) { | 2487 DEFINE_TRACE_WRAPPERS(Node) { |
2488 visitor->traceWrappersWithManualWriteBarrier(m_parentOrShadowHostNode); | 2488 visitor->traceWrappersWithManualWriteBarrier(m_parentOrShadowHostNode); |
2489 visitor->traceWrappersWithManualWriteBarrier(m_previous); | 2489 visitor->traceWrappersWithManualWriteBarrier(m_previous); |
2490 visitor->traceWrappersWithManualWriteBarrier(m_next); | 2490 visitor->traceWrappersWithManualWriteBarrier(m_next); |
2491 if (hasRareData()) | 2491 if (hasRareData()) |
2492 visitor->traceWrappers(rareData()); | 2492 visitor->traceWrappers(rareData()); |
2493 EventTarget::traceWrappers(visitor); | 2493 EventTarget::traceWrappers(visitor); |
2494 } | 2494 } |
2495 | 2495 |
2496 unsigned Node::lengthOfContents() const { | |
2497 // This switch statement must be consistent with that of | |
2498 // Range::processContentsBetweenOffsets. | |
2499 switch (getNodeType()) { | |
2500 case Node::kTextNode: | |
2501 case Node::kCdataSectionNode: | |
2502 case Node::kCommentNode: | |
2503 case Node::kProcessingInstructionNode: | |
2504 return toCharacterData(this)->length(); | |
2505 case Node::kElementNode: | |
2506 case Node::kDocumentNode: | |
2507 case Node::kDocumentFragmentNode: | |
2508 return toContainerNode(this)->countChildren(); | |
2509 case Node::kAttributeNode: | |
2510 case Node::kDocumentTypeNode: | |
2511 return 0; | |
2512 } | |
2513 NOTREACHED(); | |
2514 return 0; | |
2515 } | |
2516 | |
2517 } // namespace blink | 2496 } // namespace blink |
2518 | 2497 |
2519 #ifndef NDEBUG | 2498 #ifndef NDEBUG |
2520 | 2499 |
2521 void showNode(const blink::Node* node) { | 2500 void showNode(const blink::Node* node) { |
2522 if (node) | 2501 if (node) |
2523 LOG(INFO) << *node; | 2502 LOG(INFO) << *node; |
2524 else | 2503 else |
2525 LOG(INFO) << "Cannot showNode for <null>"; | 2504 LOG(INFO) << "Cannot showNode for <null>"; |
2526 } | 2505 } |
2527 | 2506 |
2528 void showTree(const blink::Node* node) { | 2507 void showTree(const blink::Node* node) { |
2529 if (node) | 2508 if (node) |
2530 LOG(INFO) << "\n" << node->toTreeStringForThis().utf8().data(); | 2509 LOG(INFO) << "\n" << node->toTreeStringForThis().utf8().data(); |
2531 else | 2510 else |
2532 LOG(INFO) << "Cannot showTree for <null>"; | 2511 LOG(INFO) << "Cannot showTree for <null>"; |
2533 } | 2512 } |
2534 | 2513 |
2535 void showNodePath(const blink::Node* node) { | 2514 void showNodePath(const blink::Node* node) { |
2536 if (node) { | 2515 if (node) { |
2537 std::stringstream stream; | 2516 std::stringstream stream; |
2538 node->printNodePathTo(stream); | 2517 node->printNodePathTo(stream); |
2539 LOG(INFO) << stream.str(); | 2518 LOG(INFO) << stream.str(); |
2540 } else { | 2519 } else { |
2541 LOG(INFO) << "Cannot showNodePath for <null>"; | 2520 LOG(INFO) << "Cannot showNodePath for <null>"; |
2542 } | 2521 } |
2543 } | 2522 } |
2544 | 2523 |
2545 #endif | 2524 #endif |
OLD | NEW |