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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 | 533 |
534 // Handle delete at beginning-of-block case. | 534 // Handle delete at beginning-of-block case. |
535 // Do nothing in the case that the caret is at the start of a | 535 // Do nothing in the case that the caret is at the start of a |
536 // root editable element or at the start of a document. | 536 // root editable element or at the start of a document. |
537 OwnPtrWillBeRawPtr<FrameSelection> selection = FrameSelection::create(); | 537 OwnPtrWillBeRawPtr<FrameSelection> selection = FrameSelection::create(); |
538 selection->setSelection(endingSelection()); | 538 selection->setSelection(endingSelection()); |
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 = endingSelection().end().downstream(); | 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 = visibleEnd.next(CannotCrossEditingBoundary).deepEqui
valent().downstream(); | 549 downstreamEnd = mostForwardCaretPosition(visibleEnd.next(CannotCross
EditingBoundary).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 |