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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 appendChild(node, exceptionState); | 517 appendChild(node, exceptionState); |
518 } | 518 } |
519 | 519 |
520 void Node::before(const HeapVector<NodeOrString>& nodes, | 520 void Node::before(const HeapVector<NodeOrString>& nodes, |
521 ExceptionState& exceptionState) { | 521 ExceptionState& exceptionState) { |
522 Node* parent = parentNode(); | 522 Node* parent = parentNode(); |
523 if (!parent) | 523 if (!parent) |
524 return; | 524 return; |
525 Node* viablePreviousSibling = findViablePreviousSibling(*this, nodes); | 525 Node* viablePreviousSibling = findViablePreviousSibling(*this, nodes); |
526 if (Node* node = convertNodesIntoNode(nodes, document(), exceptionState)) | 526 if (Node* node = convertNodesIntoNode(nodes, document(), exceptionState)) |
527 parent->insertBefore(node, viablePreviousSibling | 527 parent->insertBefore(node, |
528 ? viablePreviousSibling->nextSibling() | 528 viablePreviousSibling |
529 : parent->firstChild(), | 529 ? viablePreviousSibling->nextSibling() |
| 530 : parent->firstChild(), |
530 exceptionState); | 531 exceptionState); |
531 } | 532 } |
532 | 533 |
533 void Node::after(const HeapVector<NodeOrString>& nodes, | 534 void Node::after(const HeapVector<NodeOrString>& nodes, |
534 ExceptionState& exceptionState) { | 535 ExceptionState& exceptionState) { |
535 Node* parent = parentNode(); | 536 Node* parent = parentNode(); |
536 if (!parent) | 537 if (!parent) |
537 return; | 538 return; |
538 Node* viableNextSibling = findViableNextSibling(*this, nodes); | 539 Node* viableNextSibling = findViableNextSibling(*this, nodes); |
539 if (Node* node = convertNodesIntoNode(nodes, document(), exceptionState)) | 540 if (Node* node = convertNodesIntoNode(nodes, document(), exceptionState)) |
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1490 child = child->previousSibling()) { | 1491 child = child->previousSibling()) { |
1491 if (child == child1) | 1492 if (child == child1) |
1492 return kDocumentPositionFollowing | connection; | 1493 return kDocumentPositionFollowing | connection; |
1493 } | 1494 } |
1494 return kDocumentPositionPreceding | connection; | 1495 return kDocumentPositionPreceding | connection; |
1495 } | 1496 } |
1496 } | 1497 } |
1497 | 1498 |
1498 // There was no difference between the two parent chains, i.e., one was a | 1499 // There was no difference between the two parent chains, i.e., one was a |
1499 // subset of the other. The shorter chain is the ancestor. | 1500 // subset of the other. The shorter chain is the ancestor. |
1500 return index1 < index2 | 1501 return index1 < index2 ? kDocumentPositionFollowing | |
1501 ? kDocumentPositionFollowing | kDocumentPositionContainedBy | | 1502 kDocumentPositionContainedBy | connection |
1502 connection | 1503 : kDocumentPositionPreceding | |
1503 : kDocumentPositionPreceding | kDocumentPositionContains | | 1504 kDocumentPositionContains | connection; |
1504 connection; | |
1505 } | 1505 } |
1506 | 1506 |
1507 String Node::debugName() const { | 1507 String Node::debugName() const { |
1508 StringBuilder name; | 1508 StringBuilder name; |
1509 appendUnsafe(name, debugNodeName()); | 1509 appendUnsafe(name, debugNodeName()); |
1510 if (isElementNode()) { | 1510 if (isElementNode()) { |
1511 const Element& thisElement = toElement(*this); | 1511 const Element& thisElement = toElement(*this); |
1512 if (thisElement.hasID()) { | 1512 if (thisElement.hasID()) { |
1513 name.append(" id=\'"); | 1513 name.append(" id=\'"); |
1514 appendUnsafe(name, thisElement.getIdAttribute()); | 1514 appendUnsafe(name, thisElement.getIdAttribute()); |
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2566 if (node) { | 2566 if (node) { |
2567 std::stringstream stream; | 2567 std::stringstream stream; |
2568 node->printNodePathTo(stream); | 2568 node->printNodePathTo(stream); |
2569 LOG(INFO) << stream.str(); | 2569 LOG(INFO) << stream.str(); |
2570 } else { | 2570 } else { |
2571 LOG(INFO) << "Cannot showNodePath for <null>"; | 2571 LOG(INFO) << "Cannot showNodePath for <null>"; |
2572 } | 2572 } |
2573 } | 2573 } |
2574 | 2574 |
2575 #endif | 2575 #endif |
OLD | NEW |