| 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 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1285 Position(end.deprecatedNode(), end.deprecatedEditingOffse
t() + endOffsetAdjustment, Position::PositionIsOffsetInAnchor)); | 1285 Position(end.deprecatedNode(), end.deprecatedEditingOffse
t() + endOffsetAdjustment, Position::PositionIsOffsetInAnchor)); |
| 1286 return true; | 1286 return true; |
| 1287 } | 1287 } |
| 1288 | 1288 |
| 1289 return false; | 1289 return false; |
| 1290 } | 1290 } |
| 1291 | 1291 |
| 1292 bool ApplyStyleCommand::mergeEndWithNextIfIdentical(const Position& start, const
Position& end) | 1292 bool ApplyStyleCommand::mergeEndWithNextIfIdentical(const Position& start, const
Position& end) |
| 1293 { | 1293 { |
| 1294 Node* endNode = end.containerNode(); | 1294 Node* endNode = end.containerNode(); |
| 1295 int endOffset = end.computeOffsetInContainerNode(); | |
| 1296 | 1295 |
| 1297 if (isAtomicNode(endNode)) { | 1296 if (isAtomicNode(endNode)) { |
| 1297 int endOffset = end.computeOffsetInContainerNode(); |
| 1298 if (offsetIsBeforeLastNodeOffset(endOffset, endNode)) | 1298 if (offsetIsBeforeLastNodeOffset(endOffset, endNode)) |
| 1299 return false; | 1299 return false; |
| 1300 | 1300 |
| 1301 unsigned parentLastOffset = end.deprecatedNode()->parentNode()->childNod
es()->length() - 1; | |
| 1302 if (end.deprecatedNode()->nextSibling()) | 1301 if (end.deprecatedNode()->nextSibling()) |
| 1303 return false; | 1302 return false; |
| 1304 | 1303 |
| 1305 endNode = end.deprecatedNode()->parentNode(); | 1304 endNode = end.deprecatedNode()->parentNode(); |
| 1306 endOffset = parentLastOffset; | |
| 1307 } | 1305 } |
| 1308 | 1306 |
| 1309 if (!endNode->isElementNode() || endNode->hasTagName(brTag)) | 1307 if (!endNode->isElementNode() || endNode->hasTagName(brTag)) |
| 1310 return false; | 1308 return false; |
| 1311 | 1309 |
| 1312 Node* nextSibling = endNode->nextSibling(); | 1310 Node* nextSibling = endNode->nextSibling(); |
| 1313 if (nextSibling && areIdenticalElements(endNode, nextSibling)) { | 1311 if (nextSibling && areIdenticalElements(endNode, nextSibling)) { |
| 1314 Element* nextElement = static_cast<Element *>(nextSibling); | 1312 Element* nextElement = static_cast<Element *>(nextSibling); |
| 1315 Element* element = static_cast<Element *>(endNode); | 1313 Element* element = static_cast<Element *>(endNode); |
| 1316 Node* nextChild = nextElement->firstChild(); | 1314 Node* nextChild = nextElement->firstChild(); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1542 String textToMove = nextText->data(); | 1540 String textToMove = nextText->data(); |
| 1543 insertTextIntoNode(childText, childText->length(), textToMove); | 1541 insertTextIntoNode(childText, childText->length(), textToMove); |
| 1544 removeNode(next); | 1542 removeNode(next); |
| 1545 // 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. |
| 1546 } | 1544 } |
| 1547 | 1545 |
| 1548 updateStartEnd(newStart, newEnd); | 1546 updateStartEnd(newStart, newEnd); |
| 1549 } | 1547 } |
| 1550 | 1548 |
| 1551 } | 1549 } |
| OLD | NEW |