OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2007, 2008 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 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 // We upstream() the end and downstream() the start so that we don't include
collapsed whitespace in the move. | 1121 // We upstream() the end and downstream() the start so that we don't include
collapsed whitespace in the move. |
1122 // When we paste a fragment, spaces after the end and before the start are t
reated as though they were rendered. | 1122 // When we paste a fragment, spaces after the end and before the start are t
reated as though they were rendered. |
1123 Position start = startOfParagraphToMove.deepEquivalent().downstream(); | 1123 Position start = startOfParagraphToMove.deepEquivalent().downstream(); |
1124 Position end = startOfParagraphToMove == endOfParagraphToMove ? start : endO
fParagraphToMove.deepEquivalent().upstream(); | 1124 Position end = startOfParagraphToMove == endOfParagraphToMove ? start : endO
fParagraphToMove.deepEquivalent().upstream(); |
1125 if (comparePositions(start, end) > 0) | 1125 if (comparePositions(start, end) > 0) |
1126 end = start; | 1126 end = start; |
1127 | 1127 |
1128 cloneParagraphUnderNewElement(start, end, outerNode, blockElement); | 1128 cloneParagraphUnderNewElement(start, end, outerNode, blockElement); |
1129 | 1129 |
1130 setEndingSelection(VisibleSelection(start, end, DOWNSTREAM)); | 1130 setEndingSelection(VisibleSelection(start, end, DOWNSTREAM)); |
1131 deleteSelection(false, false, false, false); | 1131 deleteSelection(false, false, false); |
1132 | 1132 |
1133 // There are bugs in deletion when it removes a fully selected table/list. | 1133 // There are bugs in deletion when it removes a fully selected table/list. |
1134 // It expands and removes the entire table/list, but will let content | 1134 // It expands and removes the entire table/list, but will let content |
1135 // before and after the table/list collapse onto one line. | 1135 // before and after the table/list collapse onto one line. |
1136 | 1136 |
1137 cleanupAfterDeletion(); | 1137 cleanupAfterDeletion(); |
1138 | 1138 |
1139 // Add a br if pruning an empty block level element caused a collapse. For
example: | 1139 // Add a br if pruning an empty block level element caused a collapse. For
example: |
1140 // foo^ | 1140 // foo^ |
1141 // <div>bar</div> | 1141 // <div>bar</div> |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1220 styleInEmptyParagraph = EditingStyle::create(startOfParagraphToMove.deep
Equivalent()); | 1220 styleInEmptyParagraph = EditingStyle::create(startOfParagraphToMove.deep
Equivalent()); |
1221 styleInEmptyParagraph->mergeTypingStyle(&document()); | 1221 styleInEmptyParagraph->mergeTypingStyle(&document()); |
1222 // The moved paragraph should assume the block style of the destination. | 1222 // The moved paragraph should assume the block style of the destination. |
1223 styleInEmptyParagraph->removeBlockProperties(); | 1223 styleInEmptyParagraph->removeBlockProperties(); |
1224 } | 1224 } |
1225 | 1225 |
1226 // FIXME (5098931): We should add a new insert action "WebViewInsertActionMo
ved" and call shouldInsertFragment here. | 1226 // FIXME (5098931): We should add a new insert action "WebViewInsertActionMo
ved" and call shouldInsertFragment here. |
1227 | 1227 |
1228 setEndingSelection(VisibleSelection(start, end, DOWNSTREAM)); | 1228 setEndingSelection(VisibleSelection(start, end, DOWNSTREAM)); |
1229 document().frame()->spellChecker().clearMisspellingsAndBadGrammar(endingSele
ction()); | 1229 document().frame()->spellChecker().clearMisspellingsAndBadGrammar(endingSele
ction()); |
1230 deleteSelection(false, false, false, false); | 1230 deleteSelection(false, false, false); |
1231 | 1231 |
1232 ASSERT(destination.deepEquivalent().inDocument()); | 1232 ASSERT(destination.deepEquivalent().inDocument()); |
1233 cleanupAfterDeletion(destination); | 1233 cleanupAfterDeletion(destination); |
1234 ASSERT(destination.deepEquivalent().inDocument()); | 1234 ASSERT(destination.deepEquivalent().inDocument()); |
1235 | 1235 |
1236 // Add a br if pruning an empty block level element caused a collapse. For e
xample: | 1236 // Add a br if pruning an empty block level element caused a collapse. For e
xample: |
1237 // foo^ | 1237 // foo^ |
1238 // <div>bar</div> | 1238 // <div>bar</div> |
1239 // baz | 1239 // baz |
1240 // Imagine moving 'bar' to ^. 'bar' will be deleted and its div pruned. That
would | 1240 // Imagine moving 'bar' to ^. 'bar' will be deleted and its div pruned. That
would |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1497 } | 1497 } |
1498 | 1498 |
1499 void CompositeEditCommand::trace(Visitor* visitor) | 1499 void CompositeEditCommand::trace(Visitor* visitor) |
1500 { | 1500 { |
1501 visitor->trace(m_commands); | 1501 visitor->trace(m_commands); |
1502 visitor->trace(m_composition); | 1502 visitor->trace(m_composition); |
1503 EditCommand::trace(visitor); | 1503 EditCommand::trace(visitor); |
1504 } | 1504 } |
1505 | 1505 |
1506 } // namespace WebCore | 1506 } // namespace WebCore |
OLD | NEW |