OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006 Apple Computer, 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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 splitTo = splitTo->traverseNextNode(startBlock.get()); | 369 splitTo = splitTo->traverseNextNode(startBlock.get()); |
370 ASSERT(splitTo); | 370 ASSERT(splitTo); |
371 splitTreeToNode(splitTo, startBlock.get()); | 371 splitTreeToNode(splitTo, startBlock.get()); |
372 | 372 |
373 for (n = startBlock->firstChild(); n; n = n->nextSibling()) { | 373 for (n = startBlock->firstChild(); n; n = n->nextSibling()) { |
374 if (comparePositions(VisiblePosition(insertionPosition), positio
nBeforeNode(n)) <= 0) | 374 if (comparePositions(VisiblePosition(insertionPosition), positio
nBeforeNode(n)) <= 0) |
375 break; | 375 break; |
376 } | 376 } |
377 } | 377 } |
378 | 378 |
379 while (n && n != blockToInsert) { | 379 moveRemainingSiblingsToNewParent(n, blockToInsert.get(), blockToInsert); |
380 Node *next = n->nextSibling(); | |
381 removeNode(n); | |
382 appendNode(n, blockToInsert); | |
383 n = next; | |
384 } | |
385 } | 380 } |
386 | 381 |
387 // Handle whitespace that occurs after the split | 382 // Handle whitespace that occurs after the split |
388 if (splitText) { | 383 if (splitText) { |
389 document()->updateLayoutIgnorePendingStylesheets(); | 384 document()->updateLayoutIgnorePendingStylesheets(); |
390 if (insertionPosition.anchorType() == Position::PositionIsOffsetInAnchor
) | 385 if (insertionPosition.anchorType() == Position::PositionIsOffsetInAnchor
) |
391 insertionPosition.moveToOffset(0); | 386 insertionPosition.moveToOffset(0); |
392 if (!insertionPosition.isRenderedCharacter()) { | 387 if (!insertionPosition.isRenderedCharacter()) { |
393 // Clear out all whitespace and insert one non-breaking space | 388 // Clear out all whitespace and insert one non-breaking space |
394 ASSERT(!insertionPosition.deprecatedNode()->renderer() || insertionP
osition.deprecatedNode()->renderer()->style()->collapseWhiteSpace()); | 389 ASSERT(!insertionPosition.deprecatedNode()->renderer() || insertionP
osition.deprecatedNode()->renderer()->style()->collapseWhiteSpace()); |
395 deleteInsignificantTextDownstream(insertionPosition); | 390 deleteInsignificantTextDownstream(insertionPosition); |
396 if (insertionPosition.deprecatedNode()->isTextNode()) | 391 if (insertionPosition.deprecatedNode()->isTextNode()) |
397 insertTextIntoNode(toText(insertionPosition.deprecatedNode()), 0
, nonBreakingSpaceString()); | 392 insertTextIntoNode(toText(insertionPosition.deprecatedNode()), 0
, nonBreakingSpaceString()); |
398 } | 393 } |
399 } | 394 } |
400 | 395 |
401 setEndingSelection(VisibleSelection(firstPositionInNode(blockToInsert.get())
, DOWNSTREAM, endingSelection().isDirectional())); | 396 setEndingSelection(VisibleSelection(firstPositionInNode(blockToInsert.get())
, DOWNSTREAM, endingSelection().isDirectional())); |
402 applyStyleAfterInsertion(startBlock.get()); | 397 applyStyleAfterInsertion(startBlock.get()); |
403 } | 398 } |
404 | 399 |
405 } // namespace WebCore | 400 } // namespace WebCore |
OLD | NEW |