OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Gunnstein Lye (gunnstein@netcom.no) | 3 * (C) 2000 Gunnstein Lye (gunnstein@netcom.no) |
4 * (C) 2000 Frederik Holljen (frederik.holljen@hig.no) | 4 * (C) 2000 Frederik Holljen (frederik.holljen@hig.no) |
5 * (C) 2001 Peter Kelly (pmk@post.com) | 5 * (C) 2001 Peter Kelly (pmk@post.com) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
7 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 7 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 // FIXME: Generated bindings code never calls with null, and neither sho
uld other callers! | 1081 // FIXME: Generated bindings code never calls with null, and neither sho
uld other callers! |
1082 exceptionState.throwTypeError("The node provided is null."); | 1082 exceptionState.throwTypeError("The node provided is null."); |
1083 return; | 1083 return; |
1084 } | 1084 } |
1085 | 1085 |
1086 if (!refNode->parentNode()) { | 1086 if (!refNode->parentNode()) { |
1087 exceptionState.throwDOMException(InvalidNodeTypeError, "the given Node h
as no parent."); | 1087 exceptionState.throwDOMException(InvalidNodeTypeError, "the given Node h
as no parent."); |
1088 return; | 1088 return; |
1089 } | 1089 } |
1090 | 1090 |
1091 // InvalidNodeTypeError: Raised if an ancestor of refNode is an Entity, Nota
tion or | |
1092 // DocumentType node or if refNode is a Document, DocumentFragment, ShadowRo
ot, Attr, Entity, or Notation | |
1093 // node. | |
1094 for (ContainerNode* anc = refNode->parentNode(); anc; anc = anc->parentNode(
)) { | |
1095 switch (anc->nodeType()) { | |
1096 case Node::ATTRIBUTE_NODE: | |
1097 case Node::CDATA_SECTION_NODE: | |
1098 case Node::COMMENT_NODE: | |
1099 case Node::DOCUMENT_FRAGMENT_NODE: | |
1100 case Node::DOCUMENT_NODE: | |
1101 case Node::ELEMENT_NODE: | |
1102 case Node::PROCESSING_INSTRUCTION_NODE: | |
1103 case Node::TEXT_NODE: | |
1104 break; | |
1105 case Node::DOCUMENT_TYPE_NODE: | |
1106 exceptionState.throwDOMException(InvalidNodeTypeError, "The node pro
vided has an ancestor of type '" + anc->nodeName() + "'."); | |
1107 return; | |
1108 } | |
1109 } | |
1110 | |
1111 switch (refNode->nodeType()) { | 1091 switch (refNode->nodeType()) { |
1112 case Node::CDATA_SECTION_NODE: | 1092 case Node::CDATA_SECTION_NODE: |
1113 case Node::COMMENT_NODE: | 1093 case Node::COMMENT_NODE: |
1114 case Node::DOCUMENT_TYPE_NODE: | 1094 case Node::DOCUMENT_TYPE_NODE: |
1115 case Node::ELEMENT_NODE: | 1095 case Node::ELEMENT_NODE: |
1116 case Node::PROCESSING_INSTRUCTION_NODE: | 1096 case Node::PROCESSING_INSTRUCTION_NODE: |
1117 case Node::TEXT_NODE: | 1097 case Node::TEXT_NODE: |
1118 break; | 1098 break; |
1119 case Node::ATTRIBUTE_NODE: | 1099 case Node::ATTRIBUTE_NODE: |
1120 case Node::DOCUMENT_FRAGMENT_NODE: | 1100 case Node::DOCUMENT_FRAGMENT_NODE: |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1690 { | 1670 { |
1691 if (range && range->boundaryPointsValid()) { | 1671 if (range && range->boundaryPointsValid()) { |
1692 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r
ange->endContainer(), "E"); | 1672 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r
ange->endContainer(), "E"); |
1693 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset
(), range->endOffset()); | 1673 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset
(), range->endOffset()); |
1694 } else { | 1674 } else { |
1695 fprintf(stderr, "Cannot show tree if range is null, or if boundary point
s are invalid.\n"); | 1675 fprintf(stderr, "Cannot show tree if range is null, or if boundary point
s are invalid.\n"); |
1696 } | 1676 } |
1697 } | 1677 } |
1698 | 1678 |
1699 #endif | 1679 #endif |
OLD | NEW |