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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 typingAddedToOpenCommand(DeleteKey); | 419 typingAddedToOpenCommand(DeleteKey); |
420 | 420 |
421 m_smartDelete = false; | 421 m_smartDelete = false; |
422 | 422 |
423 FrameSelection selection; | 423 FrameSelection selection; |
424 selection.setSelection(endingSelection()); | 424 selection.setSelection(endingSelection()); |
425 selection.modify(FrameSelection::AlterationExtend, DirectionBackward, gr
anularity); | 425 selection.modify(FrameSelection::AlterationExtend, DirectionBackward, gr
anularity); |
426 if (killRing && selection.isCaret() && granularity != CharacterGranulari
ty) | 426 if (killRing && selection.isCaret() && granularity != CharacterGranulari
ty) |
427 selection.modify(FrameSelection::AlterationExtend, DirectionBackward
, CharacterGranularity); | 427 selection.modify(FrameSelection::AlterationExtend, DirectionBackward
, CharacterGranularity); |
428 | 428 |
429 if (endingSelection().visibleStart().previous(CannotCrossEditingBoundary
).isNull()) { | 429 VisiblePosition visibleStart(endingSelection().visibleStart()); |
| 430 if (visibleStart.previous(CannotCrossEditingBoundary).isNull()) { |
430 // When the caret is at the start of the editable area in an empty l
ist item, break out of the list item. | 431 // When the caret is at the start of the editable area in an empty l
ist item, break out of the list item. |
431 if (breakOutOfEmptyListItem()) { | 432 if (breakOutOfEmptyListItem()) { |
432 typingAddedToOpenCommand(DeleteKey); | 433 typingAddedToOpenCommand(DeleteKey); |
433 return; | 434 return; |
434 } | 435 } |
435 // When there are no visible positions in the editing root, delete i
ts entire contents. | 436 // When there are no visible positions in the editing root, delete i
ts entire contents. |
436 if (endingSelection().visibleStart().next(CannotCrossEditingBoundary
).isNull() && makeEditableRootEmpty()) { | 437 if (visibleStart.next(CannotCrossEditingBoundary).isNull() && makeEd
itableRootEmpty()) { |
437 typingAddedToOpenCommand(DeleteKey); | 438 typingAddedToOpenCommand(DeleteKey); |
438 return; | 439 return; |
439 } | 440 } |
440 } | 441 } |
441 | 442 |
442 VisiblePosition visibleStart(endingSelection().visibleStart()); | |
443 // If we have a caret selection at the beginning of a cell, we have noth
ing to do. | 443 // If we have a caret selection at the beginning of a cell, we have noth
ing to do. |
444 Node* enclosingTableCell = enclosingNodeOfType(visibleStart.deepEquivale
nt(), &isTableCell); | 444 Node* enclosingTableCell = enclosingNodeOfType(visibleStart.deepEquivale
nt(), &isTableCell); |
445 if (enclosingTableCell && visibleStart == firstPositionInNode(enclosingT
ableCell)) | 445 if (enclosingTableCell && visibleStart == firstPositionInNode(enclosingT
ableCell)) |
446 return; | 446 return; |
447 | 447 |
448 // If the caret is at the start of a paragraph after a table, move conte
nt into the last table cell. | 448 // If the caret is at the start of a paragraph after a table, move conte
nt into the last table cell. |
449 if (isStartOfParagraph(visibleStart) && isFirstPositionAfterTable(visibl
eStart.previous(CannotCrossEditingBoundary))) { | 449 if (isStartOfParagraph(visibleStart) && isFirstPositionAfterTable(visibl
eStart.previous(CannotCrossEditingBoundary))) { |
450 // Unless the caret is just before a table. We don't want to move a
table into the last table cell. | 450 // Unless the caret is just before a table. We don't want to move a
table into the last table cell. |
451 if (isLastPositionBeforeTable(visibleStart)) | 451 if (isLastPositionBeforeTable(visibleStart)) |
452 return; | 452 return; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 ASSERT_NOT_REACHED(); | 614 ASSERT_NOT_REACHED(); |
615 m_preservesTypingStyle = false; | 615 m_preservesTypingStyle = false; |
616 } | 616 } |
617 | 617 |
618 bool TypingCommand::isTypingCommand() const | 618 bool TypingCommand::isTypingCommand() const |
619 { | 619 { |
620 return true; | 620 return true; |
621 } | 621 } |
622 | 622 |
623 } // namespace WebCore | 623 } // namespace WebCore |
OLD | NEW |