Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1288)

Side by Side Diff: third_party/WebKit/Source/core/dom/Range.cpp

Issue 1738613002: Rename enums/functions that collide in chromium style in core/dom/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@get-names-3
Patch Set: get-names-4: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 } 614 }
615 615
616 PassRefPtrWillBeRawPtr<Node> Range::processContentsBetweenOffsets(ActionType act ion, PassRefPtrWillBeRawPtr<DocumentFragment> fragment, 616 PassRefPtrWillBeRawPtr<Node> Range::processContentsBetweenOffsets(ActionType act ion, PassRefPtrWillBeRawPtr<DocumentFragment> fragment,
617 Node* container, unsigned startOffset, unsigned endOffset, ExceptionState& e xceptionState) 617 Node* container, unsigned startOffset, unsigned endOffset, ExceptionState& e xceptionState)
618 { 618 {
619 ASSERT(container); 619 ASSERT(container);
620 ASSERT(startOffset <= endOffset); 620 ASSERT(startOffset <= endOffset);
621 621
622 // This switch statement must be consistent with that of Node::lengthOfConte nts. 622 // This switch statement must be consistent with that of Node::lengthOfConte nts.
623 RefPtrWillBeRawPtr<Node> result = nullptr; 623 RefPtrWillBeRawPtr<Node> result = nullptr;
624 switch (container->nodeType()) { 624 switch (container->getNodeType()) {
625 case Node::TEXT_NODE: 625 case Node::TEXT_NODE:
626 case Node::CDATA_SECTION_NODE: 626 case Node::CDATA_SECTION_NODE:
627 case Node::COMMENT_NODE: 627 case Node::COMMENT_NODE:
628 case Node::PROCESSING_INSTRUCTION_NODE: 628 case Node::PROCESSING_INSTRUCTION_NODE:
629 endOffset = std::min(endOffset, toCharacterData(container)->length()); 629 endOffset = std::min(endOffset, toCharacterData(container)->length());
630 if (action == EXTRACT_CONTENTS || action == CLONE_CONTENTS) { 630 if (action == EXTRACT_CONTENTS || action == CLONE_CONTENTS) {
631 RefPtrWillBeRawPtr<CharacterData> c = static_pointer_cast<CharacterD ata>(container->cloneNode(true)); 631 RefPtrWillBeRawPtr<CharacterData> c = static_pointer_cast<CharacterD ata>(container->cloneNode(true));
632 deleteCharacterData(c, startOffset, endOffset, exceptionState); 632 deleteCharacterData(c, startOffset, endOffset, exceptionState);
633 if (fragment) { 633 if (fragment) {
634 result = fragment; 634 result = fragment;
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 } 776 }
777 777
778 // In the case where the container is a text node, we check against the cont ainer's parent, because 778 // In the case where the container is a text node, we check against the cont ainer's parent, because
779 // text nodes get split up upon insertion. 779 // text nodes get split up upon insertion.
780 Node* checkAgainst; 780 Node* checkAgainst;
781 if (startIsText) 781 if (startIsText)
782 checkAgainst = m_start.container()->parentNode(); 782 checkAgainst = m_start.container()->parentNode();
783 else 783 else
784 checkAgainst = m_start.container(); 784 checkAgainst = m_start.container();
785 785
786 Node::NodeType newNodeType = newNode->nodeType(); 786 Node::NodeType newNodeType = newNode->getNodeType();
787 int numNewChildren; 787 int numNewChildren;
788 if (newNodeType == Node::DOCUMENT_FRAGMENT_NODE && !newNode->isShadowRoot()) { 788 if (newNodeType == Node::DOCUMENT_FRAGMENT_NODE && !newNode->isShadowRoot()) {
789 // check each child node, not the DocumentFragment itself 789 // check each child node, not the DocumentFragment itself
790 numNewChildren = 0; 790 numNewChildren = 0;
791 for (Node* c = toDocumentFragment(newNode)->firstChild(); c; c = c->next Sibling()) { 791 for (Node* c = toDocumentFragment(newNode)->firstChild(); c; c = c->next Sibling()) {
792 if (!checkAgainst->childTypeAllowed(c->nodeType())) { 792 if (!checkAgainst->childTypeAllowed(c->getNodeType())) {
793 exceptionState.throwDOMException(HierarchyRequestError, "The nod e to be inserted contains a '" + c->nodeName() + "' node, which may not be inser ted here."); 793 exceptionState.throwDOMException(HierarchyRequestError, "The nod e to be inserted contains a '" + c->nodeName() + "' node, which may not be inser ted here.");
794 return; 794 return;
795 } 795 }
796 ++numNewChildren; 796 ++numNewChildren;
797 } 797 }
798 } else { 798 } else {
799 numNewChildren = 1; 799 numNewChildren = 1;
800 if (!checkAgainst->childTypeAllowed(newNodeType)) { 800 if (!checkAgainst->childTypeAllowed(newNodeType)) {
801 exceptionState.throwDOMException(HierarchyRequestError, "The node to be inserted is a '" + newNode->nodeName() + "' node, which may not be inserted here."); 801 exceptionState.throwDOMException(HierarchyRequestError, "The node to be inserted is a '" + newNode->nodeName() + "' node, which may not be inserted here.");
802 return; 802 return;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 m_end.set(m_start.container(), m_start.offset() + numNewChildren, la stChild.get()); 870 m_end.set(m_start.container(), m_start.offset() + numNewChildren, la stChild.get());
871 } 871 }
872 } 872 }
873 873
874 String Range::toString() const 874 String Range::toString() const
875 { 875 {
876 StringBuilder builder; 876 StringBuilder builder;
877 877
878 Node* pastLast = pastLastNode(); 878 Node* pastLast = pastLastNode();
879 for (Node* n = firstNode(); n != pastLast; n = NodeTraversal::next(*n)) { 879 for (Node* n = firstNode(); n != pastLast; n = NodeTraversal::next(*n)) {
880 Node::NodeType type = n->nodeType(); 880 Node::NodeType type = n->getNodeType();
881 if (type == Node::TEXT_NODE || type == Node::CDATA_SECTION_NODE) { 881 if (type == Node::TEXT_NODE || type == Node::CDATA_SECTION_NODE) {
882 String data = toCharacterData(n)->data(); 882 String data = toCharacterData(n)->data();
883 int length = data.length(); 883 int length = data.length();
884 int start = (n == m_start.container()) ? std::min(std::max(0, m_star t.offset()), length) : 0; 884 int start = (n == m_start.container()) ? std::min(std::max(0, m_star t.offset()), length) : 0;
885 int end = (n == m_end.container()) ? std::min(std::max(start, m_end. offset()), length) : length; 885 int end = (n == m_end.container()) ? std::min(std::max(start, m_end. offset()), length) : length;
886 builder.append(data, start, end - start); 886 builder.append(data, start, end - start);
887 } 887 }
888 } 888 }
889 889
890 return builder.toString(); 890 return builder.toString();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 } 940 }
941 941
942 942
943 void Range::detach() 943 void Range::detach()
944 { 944 {
945 // This is now a no-op as per the DOM specification. 945 // This is now a no-op as per the DOM specification.
946 } 946 }
947 947
948 Node* Range::checkNodeWOffset(Node* n, int offset, ExceptionState& exceptionStat e) const 948 Node* Range::checkNodeWOffset(Node* n, int offset, ExceptionState& exceptionStat e) const
949 { 949 {
950 switch (n->nodeType()) { 950 switch (n->getNodeType()) {
951 case Node::DOCUMENT_TYPE_NODE: 951 case Node::DOCUMENT_TYPE_NODE:
952 exceptionState.throwDOMException(InvalidNodeTypeError, "The node provide d is of type '" + n->nodeName() + "'."); 952 exceptionState.throwDOMException(InvalidNodeTypeError, "The node provide d is of type '" + n->nodeName() + "'.");
953 return nullptr; 953 return nullptr;
954 case Node::CDATA_SECTION_NODE: 954 case Node::CDATA_SECTION_NODE:
955 case Node::COMMENT_NODE: 955 case Node::COMMENT_NODE:
956 case Node::TEXT_NODE: 956 case Node::TEXT_NODE:
957 if (static_cast<unsigned>(offset) > toCharacterData(n)->length()) 957 if (static_cast<unsigned>(offset) > toCharacterData(n)->length())
958 exceptionState.throwDOMException(IndexSizeError, "The offset " + Str ing::number(offset) + " is larger than or equal to the node's length (" + String ::number(toCharacterData(n)->length()) + ")."); 958 exceptionState.throwDOMException(IndexSizeError, "The offset " + Str ing::number(offset) + " is larger than or equal to the node's length (" + String ::number(toCharacterData(n)->length()) + ").");
959 return nullptr; 959 return nullptr;
960 case Node::PROCESSING_INSTRUCTION_NODE: 960 case Node::PROCESSING_INSTRUCTION_NODE:
(...skipping 26 matching lines...) Expand all
987 987
988 // InvalidNodeTypeError: Raised if the root container of refNode is not an 988 // InvalidNodeTypeError: Raised if the root container of refNode is not an
989 // Attr, Document, DocumentFragment or ShadowRoot node, or part of a SVG sha dow DOM tree, 989 // Attr, Document, DocumentFragment or ShadowRoot node, or part of a SVG sha dow DOM tree,
990 // or if refNode is a Document, DocumentFragment, ShadowRoot, Attr, Entity, or Notation node. 990 // or if refNode is a Document, DocumentFragment, ShadowRoot, Attr, Entity, or Notation node.
991 991
992 if (!n->parentNode()) { 992 if (!n->parentNode()) {
993 exceptionState.throwDOMException(InvalidNodeTypeError, "the given Node h as no parent."); 993 exceptionState.throwDOMException(InvalidNodeTypeError, "the given Node h as no parent.");
994 return; 994 return;
995 } 995 }
996 996
997 switch (n->nodeType()) { 997 switch (n->getNodeType()) {
998 case Node::ATTRIBUTE_NODE: 998 case Node::ATTRIBUTE_NODE:
999 case Node::DOCUMENT_FRAGMENT_NODE: 999 case Node::DOCUMENT_FRAGMENT_NODE:
1000 case Node::DOCUMENT_NODE: 1000 case Node::DOCUMENT_NODE:
1001 exceptionState.throwDOMException(InvalidNodeTypeError, "The node provide d is of type '" + n->nodeName() + "'."); 1001 exceptionState.throwDOMException(InvalidNodeTypeError, "The node provide d is of type '" + n->nodeName() + "'.");
1002 return; 1002 return;
1003 case Node::CDATA_SECTION_NODE: 1003 case Node::CDATA_SECTION_NODE:
1004 case Node::COMMENT_NODE: 1004 case Node::COMMENT_NODE:
1005 case Node::DOCUMENT_TYPE_NODE: 1005 case Node::DOCUMENT_TYPE_NODE:
1006 case Node::ELEMENT_NODE: 1006 case Node::ELEMENT_NODE:
1007 case Node::PROCESSING_INSTRUCTION_NODE: 1007 case Node::PROCESSING_INSTRUCTION_NODE:
1008 case Node::TEXT_NODE: 1008 case Node::TEXT_NODE:
1009 break; 1009 break;
1010 } 1010 }
1011 1011
1012 Node* root = n; 1012 Node* root = n;
1013 while (ContainerNode* parent = root->parentNode()) 1013 while (ContainerNode* parent = root->parentNode())
1014 root = parent; 1014 root = parent;
1015 1015
1016 switch (root->nodeType()) { 1016 switch (root->getNodeType()) {
1017 case Node::ATTRIBUTE_NODE: 1017 case Node::ATTRIBUTE_NODE:
1018 case Node::DOCUMENT_NODE: 1018 case Node::DOCUMENT_NODE:
1019 case Node::DOCUMENT_FRAGMENT_NODE: 1019 case Node::DOCUMENT_FRAGMENT_NODE:
1020 case Node::ELEMENT_NODE: 1020 case Node::ELEMENT_NODE:
1021 break; 1021 break;
1022 case Node::CDATA_SECTION_NODE: 1022 case Node::CDATA_SECTION_NODE:
1023 case Node::COMMENT_NODE: 1023 case Node::COMMENT_NODE:
1024 case Node::DOCUMENT_TYPE_NODE: 1024 case Node::DOCUMENT_TYPE_NODE:
1025 case Node::PROCESSING_INSTRUCTION_NODE: 1025 case Node::PROCESSING_INSTRUCTION_NODE:
1026 case Node::TEXT_NODE: 1026 case Node::TEXT_NODE:
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 // FIXME: Generated bindings code never calls with null, and neither sho uld other callers! 1067 // FIXME: Generated bindings code never calls with null, and neither sho uld other callers!
1068 exceptionState.throwTypeError("The node provided is null."); 1068 exceptionState.throwTypeError("The node provided is null.");
1069 return; 1069 return;
1070 } 1070 }
1071 1071
1072 if (!refNode->parentNode()) { 1072 if (!refNode->parentNode()) {
1073 exceptionState.throwDOMException(InvalidNodeTypeError, "the given Node h as no parent."); 1073 exceptionState.throwDOMException(InvalidNodeTypeError, "the given Node h as no parent.");
1074 return; 1074 return;
1075 } 1075 }
1076 1076
1077 switch (refNode->nodeType()) { 1077 switch (refNode->getNodeType()) {
1078 case Node::CDATA_SECTION_NODE: 1078 case Node::CDATA_SECTION_NODE:
1079 case Node::COMMENT_NODE: 1079 case Node::COMMENT_NODE:
1080 case Node::DOCUMENT_TYPE_NODE: 1080 case Node::DOCUMENT_TYPE_NODE:
1081 case Node::ELEMENT_NODE: 1081 case Node::ELEMENT_NODE:
1082 case Node::PROCESSING_INSTRUCTION_NODE: 1082 case Node::PROCESSING_INSTRUCTION_NODE:
1083 case Node::TEXT_NODE: 1083 case Node::TEXT_NODE:
1084 break; 1084 break;
1085 case Node::ATTRIBUTE_NODE: 1085 case Node::ATTRIBUTE_NODE:
1086 case Node::DOCUMENT_FRAGMENT_NODE: 1086 case Node::DOCUMENT_FRAGMENT_NODE:
1087 case Node::DOCUMENT_NODE: 1087 case Node::DOCUMENT_NODE:
(...skipping 12 matching lines...) Expand all
1100 { 1100 {
1101 if (!refNode) { 1101 if (!refNode) {
1102 // FIXME: Generated bindings code never calls with null, and neither sho uld other callers! 1102 // FIXME: Generated bindings code never calls with null, and neither sho uld other callers!
1103 exceptionState.throwTypeError("The node provided is null."); 1103 exceptionState.throwTypeError("The node provided is null.");
1104 return; 1104 return;
1105 } 1105 }
1106 1106
1107 // InvalidNodeTypeError: Raised if refNode or an ancestor of refNode is an E ntity, Notation 1107 // InvalidNodeTypeError: Raised if refNode or an ancestor of refNode is an E ntity, Notation
1108 // or DocumentType node. 1108 // or DocumentType node.
1109 for (Node* n = refNode; n; n = n->parentNode()) { 1109 for (Node* n = refNode; n; n = n->parentNode()) {
1110 switch (n->nodeType()) { 1110 switch (n->getNodeType()) {
1111 case Node::ATTRIBUTE_NODE: 1111 case Node::ATTRIBUTE_NODE:
1112 case Node::CDATA_SECTION_NODE: 1112 case Node::CDATA_SECTION_NODE:
1113 case Node::COMMENT_NODE: 1113 case Node::COMMENT_NODE:
1114 case Node::DOCUMENT_FRAGMENT_NODE: 1114 case Node::DOCUMENT_FRAGMENT_NODE:
1115 case Node::DOCUMENT_NODE: 1115 case Node::DOCUMENT_NODE:
1116 case Node::ELEMENT_NODE: 1116 case Node::ELEMENT_NODE:
1117 case Node::PROCESSING_INSTRUCTION_NODE: 1117 case Node::PROCESSING_INSTRUCTION_NODE:
1118 case Node::TEXT_NODE: 1118 case Node::TEXT_NODE:
1119 break; 1119 break;
1120 case Node::DOCUMENT_TYPE_NODE: 1120 case Node::DOCUMENT_TYPE_NODE:
1121 exceptionState.throwDOMException(InvalidNodeTypeError, "The node pro vided is of type '" + refNode->nodeName() + "'."); 1121 exceptionState.throwDOMException(InvalidNodeTypeError, "The node pro vided is of type '" + refNode->nodeName() + "'.");
1122 return; 1122 return;
1123 } 1123 }
1124 } 1124 }
1125 1125
1126 if (m_ownerDocument != refNode->document()) 1126 if (m_ownerDocument != refNode->document())
1127 setDocument(refNode->document()); 1127 setDocument(refNode->document());
1128 1128
1129 m_start.setToStartOfNode(*refNode); 1129 m_start.setToStartOfNode(*refNode);
1130 m_end.setToEndOfNode(*refNode); 1130 m_end.setToEndOfNode(*refNode);
1131 } 1131 }
1132 1132
1133 bool Range::selectNodeContents(Node* refNode, Position& start, Position& end) 1133 bool Range::selectNodeContents(Node* refNode, Position& start, Position& end)
1134 { 1134 {
1135 if (!refNode) { 1135 if (!refNode) {
1136 return false; 1136 return false;
1137 } 1137 }
1138 1138
1139 for (Node* n = refNode; n; n = n->parentNode()) { 1139 for (Node* n = refNode; n; n = n->parentNode()) {
1140 switch (n->nodeType()) { 1140 switch (n->getNodeType()) {
1141 case Node::ATTRIBUTE_NODE: 1141 case Node::ATTRIBUTE_NODE:
1142 case Node::CDATA_SECTION_NODE: 1142 case Node::CDATA_SECTION_NODE:
1143 case Node::COMMENT_NODE: 1143 case Node::COMMENT_NODE:
1144 case Node::DOCUMENT_FRAGMENT_NODE: 1144 case Node::DOCUMENT_FRAGMENT_NODE:
1145 case Node::DOCUMENT_NODE: 1145 case Node::DOCUMENT_NODE:
1146 case Node::ELEMENT_NODE: 1146 case Node::ELEMENT_NODE:
1147 case Node::PROCESSING_INSTRUCTION_NODE: 1147 case Node::PROCESSING_INSTRUCTION_NODE:
1148 case Node::TEXT_NODE: 1148 case Node::TEXT_NODE:
1149 break; 1149 break;
1150 case Node::DOCUMENT_TYPE_NODE: 1150 case Node::DOCUMENT_TYPE_NODE:
(...skipping 14 matching lines...) Expand all
1165 { 1165 {
1166 RefPtrWillBeRawPtr<Node> newParent = passNewParent; 1166 RefPtrWillBeRawPtr<Node> newParent = passNewParent;
1167 if (!newParent) { 1167 if (!newParent) {
1168 // FIXME: Generated bindings code never calls with null, and neither sho uld other callers! 1168 // FIXME: Generated bindings code never calls with null, and neither sho uld other callers!
1169 exceptionState.throwTypeError("The node provided is null."); 1169 exceptionState.throwTypeError("The node provided is null.");
1170 return; 1170 return;
1171 } 1171 }
1172 1172
1173 // InvalidStateError: Raised if the Range partially selects a non-Text node. 1173 // InvalidStateError: Raised if the Range partially selects a non-Text node.
1174 Node* startNonTextContainer = m_start.container(); 1174 Node* startNonTextContainer = m_start.container();
1175 if (startNonTextContainer->nodeType() == Node::TEXT_NODE) 1175 if (startNonTextContainer->getNodeType() == Node::TEXT_NODE)
1176 startNonTextContainer = startNonTextContainer->parentNode(); 1176 startNonTextContainer = startNonTextContainer->parentNode();
1177 Node* endNonTextContainer = m_end.container(); 1177 Node* endNonTextContainer = m_end.container();
1178 if (endNonTextContainer->nodeType() == Node::TEXT_NODE) 1178 if (endNonTextContainer->getNodeType() == Node::TEXT_NODE)
1179 endNonTextContainer = endNonTextContainer->parentNode(); 1179 endNonTextContainer = endNonTextContainer->parentNode();
1180 if (startNonTextContainer != endNonTextContainer) { 1180 if (startNonTextContainer != endNonTextContainer) {
1181 exceptionState.throwDOMException(InvalidStateError, "The Range has parti ally selected a non-Text node."); 1181 exceptionState.throwDOMException(InvalidStateError, "The Range has parti ally selected a non-Text node.");
1182 return; 1182 return;
1183 } 1183 }
1184 1184
1185 // InvalidNodeTypeError: Raised if node is an Attr, Entity, DocumentType, No tation, 1185 // InvalidNodeTypeError: Raised if node is an Attr, Entity, DocumentType, No tation,
1186 // Document, or DocumentFragment node. 1186 // Document, or DocumentFragment node.
1187 switch (newParent->nodeType()) { 1187 switch (newParent->getNodeType()) {
1188 case Node::ATTRIBUTE_NODE: 1188 case Node::ATTRIBUTE_NODE:
1189 case Node::DOCUMENT_FRAGMENT_NODE: 1189 case Node::DOCUMENT_FRAGMENT_NODE:
1190 case Node::DOCUMENT_NODE: 1190 case Node::DOCUMENT_NODE:
1191 case Node::DOCUMENT_TYPE_NODE: 1191 case Node::DOCUMENT_TYPE_NODE:
1192 exceptionState.throwDOMException(InvalidNodeTypeError, "The node provide d is of type '" + newParent->nodeName() + "'."); 1192 exceptionState.throwDOMException(InvalidNodeTypeError, "The node provide d is of type '" + newParent->nodeName() + "'.");
1193 return; 1193 return;
1194 case Node::CDATA_SECTION_NODE: 1194 case Node::CDATA_SECTION_NODE:
1195 case Node::COMMENT_NODE: 1195 case Node::COMMENT_NODE:
1196 case Node::ELEMENT_NODE: 1196 case Node::ELEMENT_NODE:
1197 case Node::PROCESSING_INSTRUCTION_NODE: 1197 case Node::PROCESSING_INSTRUCTION_NODE:
1198 case Node::TEXT_NODE: 1198 case Node::TEXT_NODE:
1199 break; 1199 break;
1200 } 1200 }
1201 1201
1202 // Raise a HierarchyRequestError if m_start.container() doesn't accept child ren like newParent. 1202 // Raise a HierarchyRequestError if m_start.container() doesn't accept child ren like newParent.
1203 Node* parentOfNewParent = m_start.container(); 1203 Node* parentOfNewParent = m_start.container();
1204 1204
1205 // If m_start.container() is a character data node, it will be split and it will be its parent that will 1205 // If m_start.container() is a character data node, it will be split and it will be its parent that will
1206 // need to accept newParent (or in the case of a comment, it logically "woul d" be inserted into the parent, 1206 // need to accept newParent (or in the case of a comment, it logically "woul d" be inserted into the parent,
1207 // although this will fail below for another reason). 1207 // although this will fail below for another reason).
1208 if (parentOfNewParent->isCharacterDataNode()) 1208 if (parentOfNewParent->isCharacterDataNode())
1209 parentOfNewParent = parentOfNewParent->parentNode(); 1209 parentOfNewParent = parentOfNewParent->parentNode();
1210 1210
1211 if (!parentOfNewParent) { 1211 if (!parentOfNewParent) {
1212 exceptionState.throwDOMException(HierarchyRequestError, "The container n ode is a detached character data node; no parent node is available for insertion ."); 1212 exceptionState.throwDOMException(HierarchyRequestError, "The container n ode is a detached character data node; no parent node is available for insertion .");
1213 return; 1213 return;
1214 } 1214 }
1215 1215
1216 if (!parentOfNewParent->childTypeAllowed(newParent->nodeType())) { 1216 if (!parentOfNewParent->childTypeAllowed(newParent->getNodeType())) {
1217 exceptionState.throwDOMException(HierarchyRequestError, "The node provid ed is of type '" + newParent->nodeName() + "', which may not be inserted here.") ; 1217 exceptionState.throwDOMException(HierarchyRequestError, "The node provid ed is of type '" + newParent->nodeName() + "', which may not be inserted here.") ;
1218 return; 1218 return;
1219 } 1219 }
1220 1220
1221 if (newParent->containsIncludingShadowDOM(m_start.container())) { 1221 if (newParent->containsIncludingShadowDOM(m_start.container())) {
1222 exceptionState.throwDOMException(HierarchyRequestError, "The node provid ed contains the insertion point; it may not be inserted into itself."); 1222 exceptionState.throwDOMException(HierarchyRequestError, "The node provid ed contains the insertion point; it may not be inserted into itself.");
1223 return; 1223 return;
1224 } 1224 }
1225 1225
1226 // FIXME: Do we need a check if the node would end up with a child node of a type not 1226 // FIXME: Do we need a check if the node would end up with a child node of a type not
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
1664 { 1664 {
1665 if (range && range->boundaryPointsValid()) { 1665 if (range && range->boundaryPointsValid()) {
1666 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r ange->endContainer(), "E"); 1666 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r ange->endContainer(), "E");
1667 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset (), range->endOffset()); 1667 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset (), range->endOffset());
1668 } else { 1668 } else {
1669 fprintf(stderr, "Cannot show tree if range is null, or if boundary point s are invalid.\n"); 1669 fprintf(stderr, "Cannot show tree if range is null, or if boundary point s are invalid.\n");
1670 } 1670 }
1671 } 1671 }
1672 1672
1673 #endif 1673 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698