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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 selection->modify(FrameSelection::AlterationExtend, DirectionBackwar
d, CharacterGranularity); | 438 selection->modify(FrameSelection::AlterationExtend, DirectionBackwar
d, CharacterGranularity); |
439 | 439 |
440 VisiblePosition visibleStart(endingSelection().visibleStart()); | 440 VisiblePosition visibleStart(endingSelection().visibleStart()); |
441 if (previousPositionOf(visibleStart, CannotCrossEditingBoundary).isNull(
)) { | 441 if (previousPositionOf(visibleStart, CannotCrossEditingBoundary).isNull(
)) { |
442 // When the caret is at the start of the editable area in an empty l
ist item, break out of the list item. | 442 // When the caret is at the start of the editable area in an empty l
ist item, break out of the list item. |
443 if (breakOutOfEmptyListItem()) { | 443 if (breakOutOfEmptyListItem()) { |
444 typingAddedToOpenCommand(DeleteKey); | 444 typingAddedToOpenCommand(DeleteKey); |
445 return; | 445 return; |
446 } | 446 } |
447 // When there are no visible positions in the editing root, delete i
ts entire contents. | 447 // When there are no visible positions in the editing root, delete i
ts entire contents. |
448 if (visibleStart.next(CannotCrossEditingBoundary).isNull() && makeEd
itableRootEmpty()) { | 448 if (nextPositionOf(visibleStart, CannotCrossEditingBoundary).isNull(
) && makeEditableRootEmpty()) { |
449 typingAddedToOpenCommand(DeleteKey); | 449 typingAddedToOpenCommand(DeleteKey); |
450 return; | 450 return; |
451 } | 451 } |
452 } | 452 } |
453 | 453 |
454 // If we have a caret selection at the beginning of a cell, we have noth
ing to do. | 454 // If we have a caret selection at the beginning of a cell, we have noth
ing to do. |
455 Node* enclosingTableCell = enclosingNodeOfType(visibleStart.deepEquivale
nt(), &isTableCell); | 455 Node* enclosingTableCell = enclosingNodeOfType(visibleStart.deepEquivale
nt(), &isTableCell); |
456 if (enclosingTableCell && visibleStart.deepEquivalent() == VisiblePositi
on(firstPositionInNode(enclosingTableCell)).deepEquivalent()) | 456 if (enclosingTableCell && visibleStart.deepEquivalent() == VisiblePositi
on(firstPositionInNode(enclosingTableCell)).deepEquivalent()) |
457 return; | 457 return; |
458 | 458 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 selection->modify(FrameSelection::AlterationExtend, DirectionForward, gr
anularity); | 539 selection->modify(FrameSelection::AlterationExtend, DirectionForward, gr
anularity); |
540 if (killRing && selection->isCaret() && granularity != CharacterGranular
ity) | 540 if (killRing && selection->isCaret() && granularity != CharacterGranular
ity) |
541 selection->modify(FrameSelection::AlterationExtend, DirectionForward
, CharacterGranularity); | 541 selection->modify(FrameSelection::AlterationExtend, DirectionForward
, CharacterGranularity); |
542 | 542 |
543 Position downstreamEnd = mostForwardCaretPosition(endingSelection().end(
)); | 543 Position downstreamEnd = mostForwardCaretPosition(endingSelection().end(
)); |
544 VisiblePosition visibleEnd = endingSelection().visibleEnd(); | 544 VisiblePosition visibleEnd = endingSelection().visibleEnd(); |
545 Node* enclosingTableCell = enclosingNodeOfType(visibleEnd.deepEquivalent
(), &isTableCell); | 545 Node* enclosingTableCell = enclosingNodeOfType(visibleEnd.deepEquivalent
(), &isTableCell); |
546 if (enclosingTableCell && visibleEnd.deepEquivalent() == VisiblePosition
(lastPositionInNode(enclosingTableCell)).deepEquivalent()) | 546 if (enclosingTableCell && visibleEnd.deepEquivalent() == VisiblePosition
(lastPositionInNode(enclosingTableCell)).deepEquivalent()) |
547 return; | 547 return; |
548 if (visibleEnd.deepEquivalent() == endOfParagraph(visibleEnd).deepEquiva
lent()) | 548 if (visibleEnd.deepEquivalent() == endOfParagraph(visibleEnd).deepEquiva
lent()) |
549 downstreamEnd = mostForwardCaretPosition(visibleEnd.next(CannotCross
EditingBoundary).deepEquivalent()); | 549 downstreamEnd = mostForwardCaretPosition(nextPositionOf(visibleEnd,
CannotCrossEditingBoundary).deepEquivalent()); |
550 // When deleting tables: Select the table first, then perform the deleti
on | 550 // When deleting tables: Select the table first, then perform the deleti
on |
551 if (isRenderedTableElement(downstreamEnd.computeContainerNode()) && down
streamEnd.computeOffsetInContainerNode() <= caretMinOffset(downstreamEnd.compute
ContainerNode())) { | 551 if (isRenderedTableElement(downstreamEnd.computeContainerNode()) && down
streamEnd.computeOffsetInContainerNode() <= caretMinOffset(downstreamEnd.compute
ContainerNode())) { |
552 setEndingSelection(VisibleSelection(endingSelection().end(), positio
nAfterNode(downstreamEnd.computeContainerNode()), TextAffinity::Downstream, endi
ngSelection().isDirectional())); | 552 setEndingSelection(VisibleSelection(endingSelection().end(), positio
nAfterNode(downstreamEnd.computeContainerNode()), TextAffinity::Downstream, endi
ngSelection().isDirectional())); |
553 typingAddedToOpenCommand(ForwardDeleteKey); | 553 typingAddedToOpenCommand(ForwardDeleteKey); |
554 return; | 554 return; |
555 } | 555 } |
556 | 556 |
557 // deleting to end of paragraph when at end of paragraph needs to merge
the next paragraph (if any) | 557 // deleting to end of paragraph when at end of paragraph needs to merge
the next paragraph (if any) |
558 if (granularity == ParagraphBoundary && selection->selection().isCaret()
&& isEndOfParagraph(selection->selection().visibleEnd())) | 558 if (granularity == ParagraphBoundary && selection->selection().isCaret()
&& isEndOfParagraph(selection->selection().visibleEnd())) |
559 selection->modify(FrameSelection::AlterationExtend, DirectionForward
, CharacterGranularity); | 559 selection->modify(FrameSelection::AlterationExtend, DirectionForward
, CharacterGranularity); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 ASSERT_NOT_REACHED(); | 626 ASSERT_NOT_REACHED(); |
627 m_preservesTypingStyle = false; | 627 m_preservesTypingStyle = false; |
628 } | 628 } |
629 | 629 |
630 bool TypingCommand::isTypingCommand() const | 630 bool TypingCommand::isTypingCommand() const |
631 { | 631 { |
632 return true; | 632 return true; |
633 } | 633 } |
634 | 634 |
635 } // namespace blink | 635 } // namespace blink |
OLD | NEW |