OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2008, 2009 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1302 return false; | 1302 return false; |
1303 | 1303 |
1304 endNode = end.deprecatedNode()->parentNode(); | 1304 endNode = end.deprecatedNode()->parentNode(); |
1305 } | 1305 } |
1306 | 1306 |
1307 if (!endNode->isElementNode() || endNode->hasTagName(brTag)) | 1307 if (!endNode->isElementNode() || endNode->hasTagName(brTag)) |
1308 return false; | 1308 return false; |
1309 | 1309 |
1310 Node* nextSibling = endNode->nextSibling(); | 1310 Node* nextSibling = endNode->nextSibling(); |
1311 if (nextSibling && areIdenticalElements(endNode, nextSibling)) { | 1311 if (nextSibling && areIdenticalElements(endNode, nextSibling)) { |
1312 Element* nextElement = static_cast<Element *>(nextSibling); | 1312 Element* nextElement = toElement(nextSibling); |
1313 Element* element = static_cast<Element *>(endNode); | 1313 Element* element = toElement(endNode); |
1314 Node* nextChild = nextElement->firstChild(); | 1314 Node* nextChild = nextElement->firstChild(); |
1315 | 1315 |
1316 mergeIdenticalElements(element, nextElement); | 1316 mergeIdenticalElements(element, nextElement); |
1317 | 1317 |
1318 bool shouldUpdateStart = start.containerNode() == endNode; | 1318 bool shouldUpdateStart = start.containerNode() == endNode; |
1319 int endOffset = nextChild ? nextChild->nodeIndex() : nextElement->childN
odes()->length(); | 1319 int endOffset = nextChild ? nextChild->nodeIndex() : nextElement->childN
odes()->length(); |
1320 updateStartEnd(shouldUpdateStart ? Position(nextElement, start.offsetInC
ontainerNode(), Position::PositionIsOffsetInAnchor) : start, | 1320 updateStartEnd(shouldUpdateStart ? Position(nextElement, start.offsetInC
ontainerNode(), Position::PositionIsOffsetInAnchor) : start, |
1321 Position(nextElement, endOffset, Position::PositionIsOffs
etInAnchor)); | 1321 Position(nextElement, endOffset, Position::PositionIsOffs
etInAnchor)); |
1322 return true; | 1322 return true; |
1323 } | 1323 } |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1540 String textToMove = nextText->data(); | 1540 String textToMove = nextText->data(); |
1541 insertTextIntoNode(childText, childText->length(), textToMove); | 1541 insertTextIntoNode(childText, childText->length(), textToMove); |
1542 removeNode(next); | 1542 removeNode(next); |
1543 // don't move child node pointer. it may want to merge with more text no
des. | 1543 // don't move child node pointer. it may want to merge with more text no
des. |
1544 } | 1544 } |
1545 | 1545 |
1546 updateStartEnd(newStart, newEnd); | 1546 updateStartEnd(newStart, newEnd); |
1547 } | 1547 } |
1548 | 1548 |
1549 } | 1549 } |
OLD | NEW |