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 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 // This switch statement must be consistent with that of Range::processConte
ntsBetweenOffsets. | 652 // This switch statement must be consistent with that of Range::processConte
ntsBetweenOffsets. |
653 switch (node->nodeType()) { | 653 switch (node->nodeType()) { |
654 case Node::TEXT_NODE: | 654 case Node::TEXT_NODE: |
655 case Node::CDATA_SECTION_NODE: | 655 case Node::CDATA_SECTION_NODE: |
656 case Node::COMMENT_NODE: | 656 case Node::COMMENT_NODE: |
657 return static_cast<CharacterData*>(node)->length(); | 657 return static_cast<CharacterData*>(node)->length(); |
658 case Node::PROCESSING_INSTRUCTION_NODE: | 658 case Node::PROCESSING_INSTRUCTION_NODE: |
659 return static_cast<ProcessingInstruction*>(node)->data().length(); | 659 return static_cast<ProcessingInstruction*>(node)->data().length(); |
660 case Node::ELEMENT_NODE: | 660 case Node::ELEMENT_NODE: |
661 case Node::ATTRIBUTE_NODE: | 661 case Node::ATTRIBUTE_NODE: |
662 case Node::ENTITY_REFERENCE_NODE: | |
663 case Node::ENTITY_NODE: | 662 case Node::ENTITY_NODE: |
664 case Node::DOCUMENT_NODE: | 663 case Node::DOCUMENT_NODE: |
665 case Node::DOCUMENT_TYPE_NODE: | 664 case Node::DOCUMENT_TYPE_NODE: |
666 case Node::DOCUMENT_FRAGMENT_NODE: | 665 case Node::DOCUMENT_FRAGMENT_NODE: |
667 case Node::NOTATION_NODE: | 666 case Node::NOTATION_NODE: |
668 case Node::XPATH_NAMESPACE_NODE: | 667 case Node::XPATH_NAMESPACE_NODE: |
669 return node->childNodeCount(); | 668 return node->childNodeCount(); |
670 } | 669 } |
671 ASSERT_NOT_REACHED(); | 670 ASSERT_NOT_REACHED(); |
672 return 0; | 671 return 0; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 } | 813 } |
815 if (action == EXTRACT_CONTENTS || action == DELETE_CONTENTS) { | 814 if (action == EXTRACT_CONTENTS || action == DELETE_CONTENTS) { |
816 ProcessingInstruction* pi = static_cast<ProcessingInstruction*>(cont
ainer); | 815 ProcessingInstruction* pi = static_cast<ProcessingInstruction*>(cont
ainer); |
817 String data(pi->data()); | 816 String data(pi->data()); |
818 data.remove(startOffset, endOffset - startOffset); | 817 data.remove(startOffset, endOffset - startOffset); |
819 pi->setData(data, ec); | 818 pi->setData(data, ec); |
820 } | 819 } |
821 break; | 820 break; |
822 case Node::ELEMENT_NODE: | 821 case Node::ELEMENT_NODE: |
823 case Node::ATTRIBUTE_NODE: | 822 case Node::ATTRIBUTE_NODE: |
824 case Node::ENTITY_REFERENCE_NODE: | |
825 case Node::ENTITY_NODE: | 823 case Node::ENTITY_NODE: |
826 case Node::DOCUMENT_NODE: | 824 case Node::DOCUMENT_NODE: |
827 case Node::DOCUMENT_TYPE_NODE: | 825 case Node::DOCUMENT_TYPE_NODE: |
828 case Node::DOCUMENT_FRAGMENT_NODE: | 826 case Node::DOCUMENT_FRAGMENT_NODE: |
829 case Node::NOTATION_NODE: | 827 case Node::NOTATION_NODE: |
830 case Node::XPATH_NAMESPACE_NODE: | 828 case Node::XPATH_NAMESPACE_NODE: |
831 // FIXME: Should we assert that some nodes never appear here? | 829 // FIXME: Should we assert that some nodes never appear here? |
832 if (action == EXTRACT_CONTENTS || action == CLONE_CONTENTS) { | 830 if (action == EXTRACT_CONTENTS || action == CLONE_CONTENTS) { |
833 if (fragment) | 831 if (fragment) |
834 result = fragment; | 832 result = fragment; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 if (!m_start.container()) { | 948 if (!m_start.container()) { |
951 ec = INVALID_STATE_ERR; | 949 ec = INVALID_STATE_ERR; |
952 return; | 950 return; |
953 } | 951 } |
954 | 952 |
955 if (!newNode) { | 953 if (!newNode) { |
956 ec = NOT_FOUND_ERR; | 954 ec = NOT_FOUND_ERR; |
957 return; | 955 return; |
958 } | 956 } |
959 | 957 |
960 // NO_MODIFICATION_ALLOWED_ERR: Raised if an ancestor container of either bo
undary-point of | |
961 // the Range is read-only. | |
962 if (containedByReadOnly()) { | |
963 ec = NO_MODIFICATION_ALLOWED_ERR; | |
964 return; | |
965 } | |
966 | |
967 // HIERARCHY_REQUEST_ERR: Raised if the container of the start of the Range
is of a type that | 958 // HIERARCHY_REQUEST_ERR: Raised if the container of the start of the Range
is of a type that |
968 // does not allow children of the type of newNode or if newNode is an ancest
or of the container. | 959 // does not allow children of the type of newNode or if newNode is an ancest
or of the container. |
969 | 960 |
970 // an extra one here - if a text node is going to split, it must have a pare
nt to insert into | 961 // an extra one here - if a text node is going to split, it must have a pare
nt to insert into |
971 bool startIsText = m_start.container()->isTextNode(); | 962 bool startIsText = m_start.container()->isTextNode(); |
972 if (startIsText && !m_start.container()->parentNode()) { | 963 if (startIsText && !m_start.container()->parentNode()) { |
973 ec = HIERARCHY_REQUEST_ERR; | 964 ec = HIERARCHY_REQUEST_ERR; |
974 return; | 965 return; |
975 } | 966 } |
976 | 967 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 ec = INDEX_SIZE_ERR; | 1141 ec = INDEX_SIZE_ERR; |
1151 return 0; | 1142 return 0; |
1152 case Node::PROCESSING_INSTRUCTION_NODE: | 1143 case Node::PROCESSING_INSTRUCTION_NODE: |
1153 if (static_cast<unsigned>(offset) > static_cast<ProcessingInstructio
n*>(n)->data().length()) | 1144 if (static_cast<unsigned>(offset) > static_cast<ProcessingInstructio
n*>(n)->data().length()) |
1154 ec = INDEX_SIZE_ERR; | 1145 ec = INDEX_SIZE_ERR; |
1155 return 0; | 1146 return 0; |
1156 case Node::ATTRIBUTE_NODE: | 1147 case Node::ATTRIBUTE_NODE: |
1157 case Node::DOCUMENT_FRAGMENT_NODE: | 1148 case Node::DOCUMENT_FRAGMENT_NODE: |
1158 case Node::DOCUMENT_NODE: | 1149 case Node::DOCUMENT_NODE: |
1159 case Node::ELEMENT_NODE: | 1150 case Node::ELEMENT_NODE: |
1160 case Node::ENTITY_REFERENCE_NODE: | |
1161 case Node::XPATH_NAMESPACE_NODE: { | 1151 case Node::XPATH_NAMESPACE_NODE: { |
1162 if (!offset) | 1152 if (!offset) |
1163 return 0; | 1153 return 0; |
1164 Node* childBefore = n->childNode(offset - 1); | 1154 Node* childBefore = n->childNode(offset - 1); |
1165 if (!childBefore) | 1155 if (!childBefore) |
1166 ec = INDEX_SIZE_ERR; | 1156 ec = INDEX_SIZE_ERR; |
1167 return childBefore; | 1157 return childBefore; |
1168 } | 1158 } |
1169 } | 1159 } |
1170 ASSERT_NOT_REACHED(); | 1160 ASSERT_NOT_REACHED(); |
(...skipping 11 matching lines...) Expand all Loading... |
1182 case Node::DOCUMENT_FRAGMENT_NODE: | 1172 case Node::DOCUMENT_FRAGMENT_NODE: |
1183 case Node::DOCUMENT_NODE: | 1173 case Node::DOCUMENT_NODE: |
1184 case Node::ENTITY_NODE: | 1174 case Node::ENTITY_NODE: |
1185 case Node::NOTATION_NODE: | 1175 case Node::NOTATION_NODE: |
1186 ec = INVALID_NODE_TYPE_ERR; | 1176 ec = INVALID_NODE_TYPE_ERR; |
1187 return; | 1177 return; |
1188 case Node::CDATA_SECTION_NODE: | 1178 case Node::CDATA_SECTION_NODE: |
1189 case Node::COMMENT_NODE: | 1179 case Node::COMMENT_NODE: |
1190 case Node::DOCUMENT_TYPE_NODE: | 1180 case Node::DOCUMENT_TYPE_NODE: |
1191 case Node::ELEMENT_NODE: | 1181 case Node::ELEMENT_NODE: |
1192 case Node::ENTITY_REFERENCE_NODE: | |
1193 case Node::PROCESSING_INSTRUCTION_NODE: | 1182 case Node::PROCESSING_INSTRUCTION_NODE: |
1194 case Node::TEXT_NODE: | 1183 case Node::TEXT_NODE: |
1195 case Node::XPATH_NAMESPACE_NODE: | 1184 case Node::XPATH_NAMESPACE_NODE: |
1196 break; | 1185 break; |
1197 } | 1186 } |
1198 | 1187 |
1199 Node* root = n; | 1188 Node* root = n; |
1200 while (ContainerNode* parent = root->parentNode()) | 1189 while (ContainerNode* parent = root->parentNode()) |
1201 root = parent; | 1190 root = parent; |
1202 | 1191 |
1203 switch (root->nodeType()) { | 1192 switch (root->nodeType()) { |
1204 case Node::ATTRIBUTE_NODE: | 1193 case Node::ATTRIBUTE_NODE: |
1205 case Node::DOCUMENT_NODE: | 1194 case Node::DOCUMENT_NODE: |
1206 case Node::DOCUMENT_FRAGMENT_NODE: | 1195 case Node::DOCUMENT_FRAGMENT_NODE: |
1207 break; | 1196 break; |
1208 case Node::CDATA_SECTION_NODE: | 1197 case Node::CDATA_SECTION_NODE: |
1209 case Node::COMMENT_NODE: | 1198 case Node::COMMENT_NODE: |
1210 case Node::DOCUMENT_TYPE_NODE: | 1199 case Node::DOCUMENT_TYPE_NODE: |
1211 case Node::ELEMENT_NODE: | 1200 case Node::ELEMENT_NODE: |
1212 case Node::ENTITY_NODE: | 1201 case Node::ENTITY_NODE: |
1213 case Node::ENTITY_REFERENCE_NODE: | |
1214 case Node::NOTATION_NODE: | 1202 case Node::NOTATION_NODE: |
1215 case Node::PROCESSING_INSTRUCTION_NODE: | 1203 case Node::PROCESSING_INSTRUCTION_NODE: |
1216 case Node::TEXT_NODE: | 1204 case Node::TEXT_NODE: |
1217 case Node::XPATH_NAMESPACE_NODE: | 1205 case Node::XPATH_NAMESPACE_NODE: |
1218 ec = INVALID_NODE_TYPE_ERR; | 1206 ec = INVALID_NODE_TYPE_ERR; |
1219 return; | 1207 return; |
1220 } | 1208 } |
1221 } | 1209 } |
1222 | 1210 |
1223 PassRefPtr<Range> Range::cloneRange(ExceptionCode& ec) const | 1211 PassRefPtr<Range> Range::cloneRange(ExceptionCode& ec) const |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 // DocumentType node or if refNode is a Document, DocumentFragment, ShadowRo
ot, Attr, Entity, or Notation | 1294 // DocumentType node or if refNode is a Document, DocumentFragment, ShadowRo
ot, Attr, Entity, or Notation |
1307 // node. | 1295 // node. |
1308 for (ContainerNode* anc = refNode->parentNode(); anc; anc = anc->parentNode(
)) { | 1296 for (ContainerNode* anc = refNode->parentNode(); anc; anc = anc->parentNode(
)) { |
1309 switch (anc->nodeType()) { | 1297 switch (anc->nodeType()) { |
1310 case Node::ATTRIBUTE_NODE: | 1298 case Node::ATTRIBUTE_NODE: |
1311 case Node::CDATA_SECTION_NODE: | 1299 case Node::CDATA_SECTION_NODE: |
1312 case Node::COMMENT_NODE: | 1300 case Node::COMMENT_NODE: |
1313 case Node::DOCUMENT_FRAGMENT_NODE: | 1301 case Node::DOCUMENT_FRAGMENT_NODE: |
1314 case Node::DOCUMENT_NODE: | 1302 case Node::DOCUMENT_NODE: |
1315 case Node::ELEMENT_NODE: | 1303 case Node::ELEMENT_NODE: |
1316 case Node::ENTITY_REFERENCE_NODE: | |
1317 case Node::PROCESSING_INSTRUCTION_NODE: | 1304 case Node::PROCESSING_INSTRUCTION_NODE: |
1318 case Node::TEXT_NODE: | 1305 case Node::TEXT_NODE: |
1319 case Node::XPATH_NAMESPACE_NODE: | 1306 case Node::XPATH_NAMESPACE_NODE: |
1320 break; | 1307 break; |
1321 case Node::DOCUMENT_TYPE_NODE: | 1308 case Node::DOCUMENT_TYPE_NODE: |
1322 case Node::ENTITY_NODE: | 1309 case Node::ENTITY_NODE: |
1323 case Node::NOTATION_NODE: | 1310 case Node::NOTATION_NODE: |
1324 ec = INVALID_NODE_TYPE_ERR; | 1311 ec = INVALID_NODE_TYPE_ERR; |
1325 return; | 1312 return; |
1326 } | 1313 } |
1327 } | 1314 } |
1328 | 1315 |
1329 switch (refNode->nodeType()) { | 1316 switch (refNode->nodeType()) { |
1330 case Node::CDATA_SECTION_NODE: | 1317 case Node::CDATA_SECTION_NODE: |
1331 case Node::COMMENT_NODE: | 1318 case Node::COMMENT_NODE: |
1332 case Node::DOCUMENT_TYPE_NODE: | 1319 case Node::DOCUMENT_TYPE_NODE: |
1333 case Node::ELEMENT_NODE: | 1320 case Node::ELEMENT_NODE: |
1334 case Node::ENTITY_REFERENCE_NODE: | |
1335 case Node::PROCESSING_INSTRUCTION_NODE: | 1321 case Node::PROCESSING_INSTRUCTION_NODE: |
1336 case Node::TEXT_NODE: | 1322 case Node::TEXT_NODE: |
1337 case Node::XPATH_NAMESPACE_NODE: | 1323 case Node::XPATH_NAMESPACE_NODE: |
1338 break; | 1324 break; |
1339 case Node::ATTRIBUTE_NODE: | 1325 case Node::ATTRIBUTE_NODE: |
1340 case Node::DOCUMENT_FRAGMENT_NODE: | 1326 case Node::DOCUMENT_FRAGMENT_NODE: |
1341 case Node::DOCUMENT_NODE: | 1327 case Node::DOCUMENT_NODE: |
1342 case Node::ENTITY_NODE: | 1328 case Node::ENTITY_NODE: |
1343 case Node::NOTATION_NODE: | 1329 case Node::NOTATION_NODE: |
1344 ec = INVALID_NODE_TYPE_ERR; | 1330 ec = INVALID_NODE_TYPE_ERR; |
(...skipping 25 matching lines...) Expand all Loading... |
1370 // INVALID_NODE_TYPE_ERR: Raised if refNode or an ancestor of refNode is an
Entity, Notation | 1356 // INVALID_NODE_TYPE_ERR: Raised if refNode or an ancestor of refNode is an
Entity, Notation |
1371 // or DocumentType node. | 1357 // or DocumentType node. |
1372 for (Node* n = refNode; n; n = n->parentNode()) { | 1358 for (Node* n = refNode; n; n = n->parentNode()) { |
1373 switch (n->nodeType()) { | 1359 switch (n->nodeType()) { |
1374 case Node::ATTRIBUTE_NODE: | 1360 case Node::ATTRIBUTE_NODE: |
1375 case Node::CDATA_SECTION_NODE: | 1361 case Node::CDATA_SECTION_NODE: |
1376 case Node::COMMENT_NODE: | 1362 case Node::COMMENT_NODE: |
1377 case Node::DOCUMENT_FRAGMENT_NODE: | 1363 case Node::DOCUMENT_FRAGMENT_NODE: |
1378 case Node::DOCUMENT_NODE: | 1364 case Node::DOCUMENT_NODE: |
1379 case Node::ELEMENT_NODE: | 1365 case Node::ELEMENT_NODE: |
1380 case Node::ENTITY_REFERENCE_NODE: | |
1381 case Node::PROCESSING_INSTRUCTION_NODE: | 1366 case Node::PROCESSING_INSTRUCTION_NODE: |
1382 case Node::TEXT_NODE: | 1367 case Node::TEXT_NODE: |
1383 case Node::XPATH_NAMESPACE_NODE: | 1368 case Node::XPATH_NAMESPACE_NODE: |
1384 break; | 1369 break; |
1385 case Node::DOCUMENT_TYPE_NODE: | 1370 case Node::DOCUMENT_TYPE_NODE: |
1386 case Node::ENTITY_NODE: | 1371 case Node::ENTITY_NODE: |
1387 case Node::NOTATION_NODE: | 1372 case Node::NOTATION_NODE: |
1388 ec = INVALID_NODE_TYPE_ERR; | 1373 ec = INVALID_NODE_TYPE_ERR; |
1389 return; | 1374 return; |
1390 } | 1375 } |
(...skipping 27 matching lines...) Expand all Loading... |
1418 case Node::DOCUMENT_FRAGMENT_NODE: | 1403 case Node::DOCUMENT_FRAGMENT_NODE: |
1419 case Node::DOCUMENT_NODE: | 1404 case Node::DOCUMENT_NODE: |
1420 case Node::DOCUMENT_TYPE_NODE: | 1405 case Node::DOCUMENT_TYPE_NODE: |
1421 case Node::ENTITY_NODE: | 1406 case Node::ENTITY_NODE: |
1422 case Node::NOTATION_NODE: | 1407 case Node::NOTATION_NODE: |
1423 ec = INVALID_NODE_TYPE_ERR; | 1408 ec = INVALID_NODE_TYPE_ERR; |
1424 return; | 1409 return; |
1425 case Node::CDATA_SECTION_NODE: | 1410 case Node::CDATA_SECTION_NODE: |
1426 case Node::COMMENT_NODE: | 1411 case Node::COMMENT_NODE: |
1427 case Node::ELEMENT_NODE: | 1412 case Node::ELEMENT_NODE: |
1428 case Node::ENTITY_REFERENCE_NODE: | |
1429 case Node::PROCESSING_INSTRUCTION_NODE: | 1413 case Node::PROCESSING_INSTRUCTION_NODE: |
1430 case Node::TEXT_NODE: | 1414 case Node::TEXT_NODE: |
1431 case Node::XPATH_NAMESPACE_NODE: | 1415 case Node::XPATH_NAMESPACE_NODE: |
1432 break; | 1416 break; |
1433 } | 1417 } |
1434 | 1418 |
1435 // NO_MODIFICATION_ALLOWED_ERR: Raised if an ancestor container of either bo
undary-point of | |
1436 // the Range is read-only. | |
1437 if (containedByReadOnly()) { | |
1438 ec = NO_MODIFICATION_ALLOWED_ERR; | |
1439 return; | |
1440 } | |
1441 | |
1442 // Raise a HIERARCHY_REQUEST_ERR if m_start.container() doesn't accept child
ren like newParent. | 1419 // Raise a HIERARCHY_REQUEST_ERR if m_start.container() doesn't accept child
ren like newParent. |
1443 Node* parentOfNewParent = m_start.container(); | 1420 Node* parentOfNewParent = m_start.container(); |
1444 | 1421 |
1445 // If m_start.container() is a character data node, it will be split and it
will be its parent that will | 1422 // If m_start.container() is a character data node, it will be split and it
will be its parent that will |
1446 // need to accept newParent (or in the case of a comment, it logically "woul
d" be inserted into the parent, | 1423 // need to accept newParent (or in the case of a comment, it logically "woul
d" be inserted into the parent, |
1447 // although this will fail below for another reason). | 1424 // although this will fail below for another reason). |
1448 if (parentOfNewParent->isCharacterDataNode()) | 1425 if (parentOfNewParent->isCharacterDataNode()) |
1449 parentOfNewParent = parentOfNewParent->parentNode(); | 1426 parentOfNewParent = parentOfNewParent->parentNode(); |
1450 if (!parentOfNewParent || !parentOfNewParent->childTypeAllowed(newParent->no
deType())) { | 1427 if (!parentOfNewParent || !parentOfNewParent->childTypeAllowed(newParent->no
deType())) { |
1451 ec = HIERARCHY_REQUEST_ERR; | 1428 ec = HIERARCHY_REQUEST_ERR; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1516 ec = INVALID_STATE_ERR; | 1493 ec = INVALID_STATE_ERR; |
1517 return; | 1494 return; |
1518 } | 1495 } |
1519 | 1496 |
1520 ec = 0; | 1497 ec = 0; |
1521 if (!commonAncestorContainer(ec) || ec) | 1498 if (!commonAncestorContainer(ec) || ec) |
1522 return; | 1499 return; |
1523 | 1500 |
1524 Node* pastLast = pastLastNode(); | 1501 Node* pastLast = pastLastNode(); |
1525 for (Node* n = firstNode(); n != pastLast; n = NodeTraversal::next(n)) { | 1502 for (Node* n = firstNode(); n != pastLast; n = NodeTraversal::next(n)) { |
1526 if (n->isReadOnlyNode()) { | |
1527 ec = NO_MODIFICATION_ALLOWED_ERR; | |
1528 return; | |
1529 } | |
1530 if (n->nodeType() == Node::DOCUMENT_TYPE_NODE) { | 1503 if (n->nodeType() == Node::DOCUMENT_TYPE_NODE) { |
1531 ec = HIERARCHY_REQUEST_ERR; | 1504 ec = HIERARCHY_REQUEST_ERR; |
1532 return; | 1505 return; |
1533 } | 1506 } |
1534 } | 1507 } |
1535 | |
1536 if (containedByReadOnly()) { | |
1537 ec = NO_MODIFICATION_ALLOWED_ERR; | |
1538 return; | |
1539 } | |
1540 } | |
1541 | |
1542 bool Range::containedByReadOnly() const | |
1543 { | |
1544 for (Node* n = m_start.container(); n; n = n->parentNode()) { | |
1545 if (n->isReadOnlyNode()) | |
1546 return true; | |
1547 } | |
1548 for (Node* n = m_end.container(); n; n = n->parentNode()) { | |
1549 if (n->isReadOnlyNode()) | |
1550 return true; | |
1551 } | |
1552 return false; | |
1553 } | 1508 } |
1554 | 1509 |
1555 Node* Range::firstNode() const | 1510 Node* Range::firstNode() const |
1556 { | 1511 { |
1557 if (!m_start.container()) | 1512 if (!m_start.container()) |
1558 return 0; | 1513 return 0; |
1559 if (m_start.container()->offsetInCharacters()) | 1514 if (m_start.container()->offsetInCharacters()) |
1560 return m_start.container(); | 1515 return m_start.container(); |
1561 if (Node* child = m_start.container()->childNode(m_start.offset())) | 1516 if (Node* child = m_start.container()->childNode(m_start.offset())) |
1562 return child; | 1517 return child; |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1971 | 1926 |
1972 void showTree(const WebCore::Range* range) | 1927 void showTree(const WebCore::Range* range) |
1973 { | 1928 { |
1974 if (range && range->boundaryPointsValid()) { | 1929 if (range && range->boundaryPointsValid()) { |
1975 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r
ange->endContainer(), "E"); | 1930 range->startContainer()->showTreeAndMark(range->startContainer(), "S", r
ange->endContainer(), "E"); |
1976 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset
(), range->endOffset()); | 1931 fprintf(stderr, "start offset: %d, end offset: %d\n", range->startOffset
(), range->endOffset()); |
1977 } | 1932 } |
1978 } | 1933 } |
1979 | 1934 |
1980 #endif | 1935 #endif |
OLD | NEW |