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 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 | 1135 |
1136 // We upstream() the end and downstream() the start so that we don't include
collapsed whitespace in the move. | 1136 // We upstream() the end and downstream() the start so that we don't include
collapsed whitespace in the move. |
1137 // When we paste a fragment, spaces after the end and before the start are t
reated as though they were rendered. | 1137 // When we paste a fragment, spaces after the end and before the start are t
reated as though they were rendered. |
1138 Position start = startOfParagraphToMove.deepEquivalent().downstream(); | 1138 Position start = startOfParagraphToMove.deepEquivalent().downstream(); |
1139 Position end = startOfParagraphToMove.deepEquivalent() == endOfParagraphToMo
ve.deepEquivalent() ? start : endOfParagraphToMove.deepEquivalent().upstream(); | 1139 Position end = startOfParagraphToMove.deepEquivalent() == endOfParagraphToMo
ve.deepEquivalent() ? start : endOfParagraphToMove.deepEquivalent().upstream(); |
1140 if (comparePositions(start, end) > 0) | 1140 if (comparePositions(start, end) > 0) |
1141 end = start; | 1141 end = start; |
1142 | 1142 |
1143 cloneParagraphUnderNewElement(start, end, outerNode, blockElement); | 1143 cloneParagraphUnderNewElement(start, end, outerNode, blockElement); |
1144 | 1144 |
1145 setEndingSelection(VisibleSelection(start, end, DOWNSTREAM)); | 1145 setEndingSelection(VisibleSelection(start, end)); |
1146 deleteSelection(false, false, false); | 1146 deleteSelection(false, false, false); |
1147 | 1147 |
1148 // There are bugs in deletion when it removes a fully selected table/list. | 1148 // There are bugs in deletion when it removes a fully selected table/list. |
1149 // It expands and removes the entire table/list, but will let content | 1149 // It expands and removes the entire table/list, but will let content |
1150 // before and after the table/list collapse onto one line. | 1150 // before and after the table/list collapse onto one line. |
1151 | 1151 |
1152 cleanupAfterDeletion(); | 1152 cleanupAfterDeletion(); |
1153 | 1153 |
1154 // Add a br if pruning an empty block level element caused a collapse. For
example: | 1154 // Add a br if pruning an empty block level element caused a collapse. For
example: |
1155 // foo^ | 1155 // foo^ |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 RefPtrWillBeRawPtr<EditingStyle> styleInEmptyParagraph = nullptr; | 1224 RefPtrWillBeRawPtr<EditingStyle> styleInEmptyParagraph = nullptr; |
1225 if (startOfParagraphToMove.deepEquivalent() == endOfParagraphToMove.deepEqui
valent() && preserveStyle) { | 1225 if (startOfParagraphToMove.deepEquivalent() == endOfParagraphToMove.deepEqui
valent() && preserveStyle) { |
1226 styleInEmptyParagraph = EditingStyle::create(startOfParagraphToMove.deep
Equivalent()); | 1226 styleInEmptyParagraph = EditingStyle::create(startOfParagraphToMove.deep
Equivalent()); |
1227 styleInEmptyParagraph->mergeTypingStyle(&document()); | 1227 styleInEmptyParagraph->mergeTypingStyle(&document()); |
1228 // The moved paragraph should assume the block style of the destination. | 1228 // The moved paragraph should assume the block style of the destination. |
1229 styleInEmptyParagraph->removeBlockProperties(); | 1229 styleInEmptyParagraph->removeBlockProperties(); |
1230 } | 1230 } |
1231 | 1231 |
1232 // FIXME (5098931): We should add a new insert action "WebViewInsertActionMo
ved" and call shouldInsertFragment here. | 1232 // FIXME (5098931): We should add a new insert action "WebViewInsertActionMo
ved" and call shouldInsertFragment here. |
1233 | 1233 |
1234 setEndingSelection(VisibleSelection(start, end, DOWNSTREAM)); | 1234 setEndingSelection(VisibleSelection(start, end)); |
1235 document().frame()->spellChecker().clearMisspellingsAndBadGrammar(endingSele
ction()); | 1235 document().frame()->spellChecker().clearMisspellingsAndBadGrammar(endingSele
ction()); |
1236 deleteSelection(false, false, false); | 1236 deleteSelection(false, false, false); |
1237 | 1237 |
1238 ASSERT(destination.deepEquivalent().inDocument()); | 1238 ASSERT(destination.deepEquivalent().inDocument()); |
1239 cleanupAfterDeletion(destination); | 1239 cleanupAfterDeletion(destination); |
1240 ASSERT(destination.deepEquivalent().inDocument()); | 1240 ASSERT(destination.deepEquivalent().inDocument()); |
1241 | 1241 |
1242 // Add a br if pruning an empty block level element caused a collapse. For e
xample: | 1242 // Add a br if pruning an empty block level element caused a collapse. For e
xample: |
1243 // foo^ | 1243 // foo^ |
1244 // <div>bar</div> | 1244 // <div>bar</div> |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1502 } | 1502 } |
1503 | 1503 |
1504 DEFINE_TRACE(CompositeEditCommand) | 1504 DEFINE_TRACE(CompositeEditCommand) |
1505 { | 1505 { |
1506 visitor->trace(m_commands); | 1506 visitor->trace(m_commands); |
1507 visitor->trace(m_composition); | 1507 visitor->trace(m_composition); |
1508 EditCommand::trace(visitor); | 1508 EditCommand::trace(visitor); |
1509 } | 1509 } |
1510 | 1510 |
1511 } // namespace blink | 1511 } // namespace blink |
OLD | NEW |