| 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 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1280 // instead of nbsps for some spaces that were rendered (11475), which causes | 1280 // instead of nbsps for some spaces that were rendered (11475), which causes |
| 1281 // spaces to be collapsed during the move operation. This results in a call | 1281 // spaces to be collapsed during the move operation. This results in a call |
| 1282 // to rangeFromLocationAndLength with a location past the end of the | 1282 // to rangeFromLocationAndLength with a location past the end of the |
| 1283 // document (which will return null). | 1283 // document (which will return null). |
| 1284 EphemeralRange startRange = PlainTextRange(destinationIndex + startIndex).cr
eateRangeForSelection(*documentElement); | 1284 EphemeralRange startRange = PlainTextRange(destinationIndex + startIndex).cr
eateRangeForSelection(*documentElement); |
| 1285 if (startRange.isNull()) | 1285 if (startRange.isNull()) |
| 1286 return; | 1286 return; |
| 1287 EphemeralRange endRange = PlainTextRange(destinationIndex + endIndex).create
RangeForSelection(*documentElement); | 1287 EphemeralRange endRange = PlainTextRange(destinationIndex + endIndex).create
RangeForSelection(*documentElement); |
| 1288 if (endRange.isNull()) | 1288 if (endRange.isNull()) |
| 1289 return; | 1289 return; |
| 1290 setEndingSelection(VisibleSelection(startRange.startPosition(), endRange.sta
rtPosition(), DOWNSTREAM, originalIsDirectional)); | 1290 setEndingSelection(VisibleSelection(startRange.startPosition(), endRange.sta
rtPosition(), TextAffinity::Downstream, originalIsDirectional)); |
| 1291 } | 1291 } |
| 1292 | 1292 |
| 1293 // FIXME: Send an appropriate shouldDeleteRange call. | 1293 // FIXME: Send an appropriate shouldDeleteRange call. |
| 1294 bool CompositeEditCommand::breakOutOfEmptyListItem() | 1294 bool CompositeEditCommand::breakOutOfEmptyListItem() |
| 1295 { | 1295 { |
| 1296 RefPtrWillBeRawPtr<Node> emptyListItem = enclosingEmptyListItem(endingSelect
ion().visibleStart()); | 1296 RefPtrWillBeRawPtr<Node> emptyListItem = enclosingEmptyListItem(endingSelect
ion().visibleStart()); |
| 1297 if (!emptyListItem) | 1297 if (!emptyListItem) |
| 1298 return false; | 1298 return false; |
| 1299 | 1299 |
| 1300 RefPtrWillBeRawPtr<EditingStyle> style = EditingStyle::create(endingSelectio
n().start()); | 1300 RefPtrWillBeRawPtr<EditingStyle> style = EditingStyle::create(endingSelectio
n().start()); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1341 insertNodeBefore(newBlock, listNode); | 1341 insertNodeBefore(newBlock, listNode); |
| 1342 removeNode(emptyListItem); | 1342 removeNode(emptyListItem); |
| 1343 } else { | 1343 } else { |
| 1344 // When emptyListItem does not follow any list item or nested list, inse
rt newBlock after the enclosing list node. | 1344 // When emptyListItem does not follow any list item or nested list, inse
rt newBlock after the enclosing list node. |
| 1345 // Remove the enclosing node if emptyListItem is the only child; otherwi
se just remove emptyListItem. | 1345 // Remove the enclosing node if emptyListItem is the only child; otherwi
se just remove emptyListItem. |
| 1346 insertNodeAfter(newBlock, listNode); | 1346 insertNodeAfter(newBlock, listNode); |
| 1347 removeNode(isListItem(previousListNode.get()) || isHTMLListElement(previ
ousListNode.get()) ? emptyListItem.get() : listNode.get()); | 1347 removeNode(isListItem(previousListNode.get()) || isHTMLListElement(previ
ousListNode.get()) ? emptyListItem.get() : listNode.get()); |
| 1348 } | 1348 } |
| 1349 | 1349 |
| 1350 appendBlockPlaceholder(newBlock); | 1350 appendBlockPlaceholder(newBlock); |
| 1351 setEndingSelection(VisibleSelection(firstPositionInNode(newBlock.get()), DOW
NSTREAM, endingSelection().isDirectional())); | 1351 setEndingSelection(VisibleSelection(firstPositionInNode(newBlock.get()), Tex
tAffinity::Downstream, endingSelection().isDirectional())); |
| 1352 | 1352 |
| 1353 style->prepareToApplyAt(endingSelection().start()); | 1353 style->prepareToApplyAt(endingSelection().start()); |
| 1354 if (!style->isEmpty()) | 1354 if (!style->isEmpty()) |
| 1355 applyStyle(style.get()); | 1355 applyStyle(style.get()); |
| 1356 | 1356 |
| 1357 return true; | 1357 return true; |
| 1358 } | 1358 } |
| 1359 | 1359 |
| 1360 // If the caret is in an empty quoted paragraph, and either there is nothing bef
ore that | 1360 // If the caret is in an empty quoted paragraph, and either there is nothing bef
ore that |
| 1361 // paragraph, or what is before is unquoted, and the user presses delete, unquot
e that paragraph. | 1361 // paragraph, or what is before is unquoted, and the user presses delete, unquot
e that paragraph. |
| (...skipping 140 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 |