Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: Source/core/editing/commands/TypingCommand.cpp

Issue 1302353002: Get rid of redundant member function PositionAlgorithm<Strategy>::{upstream,downstream} (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-22T04:51:20 Rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « Source/core/editing/commands/ReplaceSelectionCommand.cpp ('k') | Source/core/editing/serializers/StyledMarkupSerializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698