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

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

Issue 189773005: Revert of Have Position deal with more references (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/editing/TextIterator.cpp ('k') | Source/core/editing/VisibleSelection.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 451
452 // If the caret is at the start of a paragraph after a table, move conte nt into the last table cell. 452 // If the caret is at the start of a paragraph after a table, move conte nt into the last table cell.
453 if (isStartOfParagraph(visibleStart) && isFirstPositionAfterTable(visibl eStart.previous(CannotCrossEditingBoundary))) { 453 if (isStartOfParagraph(visibleStart) && isFirstPositionAfterTable(visibl eStart.previous(CannotCrossEditingBoundary))) {
454 // Unless the caret is just before a table. We don't want to move a table into the last table cell. 454 // Unless the caret is just before a table. We don't want to move a table into the last table cell.
455 if (isLastPositionBeforeTable(visibleStart)) 455 if (isLastPositionBeforeTable(visibleStart))
456 return; 456 return;
457 // Extend the selection backward into the last cell, then deletion w ill handle the move. 457 // Extend the selection backward into the last cell, then deletion w ill handle the move.
458 selection.modify(FrameSelection::AlterationExtend, DirectionBackward , granularity); 458 selection.modify(FrameSelection::AlterationExtend, DirectionBackward , granularity);
459 // If the caret is just after a table, select the table and don't delete anything. 459 // If the caret is just after a table, select the table and don't delete anything.
460 } else if (Node* table = isFirstPositionAfterTable(visibleStart)) { 460 } else if (Node* table = isFirstPositionAfterTable(visibleStart)) {
461 setEndingSelection(VisibleSelection(positionBeforeNode(*table), endi ngSelection().start(), DOWNSTREAM, endingSelection().isDirectional())); 461 setEndingSelection(VisibleSelection(positionBeforeNode(table), endin gSelection().start(), DOWNSTREAM, endingSelection().isDirectional()));
462 typingAddedToOpenCommand(DeleteKey); 462 typingAddedToOpenCommand(DeleteKey);
463 return; 463 return;
464 } 464 }
465 465
466 selectionToDelete = selection.selection(); 466 selectionToDelete = selection.selection();
467 467
468 if (granularity == CharacterGranularity && selectionToDelete.end().conta inerNode() == selectionToDelete.start().containerNode() 468 if (granularity == CharacterGranularity && selectionToDelete.end().conta inerNode() == selectionToDelete.start().containerNode()
469 && selectionToDelete.end().computeOffsetInContainerNode() - selectio nToDelete.start().computeOffsetInContainerNode() > 1) { 469 && selectionToDelete.end().computeOffsetInContainerNode() - selectio nToDelete.start().computeOffsetInContainerNode() > 1) {
470 // If there are multiple Unicode code points to be deleted, adjust t he range to match platform conventions. 470 // If there are multiple Unicode code points to be deleted, adjust t he range to match platform conventions.
471 selectionToDelete.setWithoutValidation(selectionToDelete.end(), sele ctionToDelete.end().previous(BackwardDeletion)); 471 selectionToDelete.setWithoutValidation(selectionToDelete.end(), sele ctionToDelete.end().previous(BackwardDeletion));
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 534
535 Position downstreamEnd = endingSelection().end().downstream(); 535 Position downstreamEnd = endingSelection().end().downstream();
536 VisiblePosition visibleEnd = endingSelection().visibleEnd(); 536 VisiblePosition visibleEnd = endingSelection().visibleEnd();
537 Node* enclosingTableCell = enclosingNodeOfType(visibleEnd.deepEquivalent (), &isTableCell); 537 Node* enclosingTableCell = enclosingNodeOfType(visibleEnd.deepEquivalent (), &isTableCell);
538 if (enclosingTableCell && visibleEnd == VisiblePosition(lastPositionInNo de(enclosingTableCell))) 538 if (enclosingTableCell && visibleEnd == VisiblePosition(lastPositionInNo de(enclosingTableCell)))
539 return; 539 return;
540 if (visibleEnd == endOfParagraph(visibleEnd)) 540 if (visibleEnd == endOfParagraph(visibleEnd))
541 downstreamEnd = visibleEnd.next(CannotCrossEditingBoundary).deepEqui valent().downstream(); 541 downstreamEnd = visibleEnd.next(CannotCrossEditingBoundary).deepEqui valent().downstream();
542 // When deleting tables: Select the table first, then perform the deleti on 542 // When deleting tables: Select the table first, then perform the deleti on
543 if (isRenderedTable(downstreamEnd.containerNode()) && downstreamEnd.comp uteOffsetInContainerNode() <= caretMinOffset(downstreamEnd.containerNode())) { 543 if (isRenderedTable(downstreamEnd.containerNode()) && downstreamEnd.comp uteOffsetInContainerNode() <= caretMinOffset(downstreamEnd.containerNode())) {
544 setEndingSelection(VisibleSelection(endingSelection().end(), positio nAfterNode(*downstreamEnd.containerNode()), DOWNSTREAM, endingSelection().isDire ctional())); 544 setEndingSelection(VisibleSelection(endingSelection().end(), positio nAfterNode(downstreamEnd.containerNode()), DOWNSTREAM, endingSelection().isDirec tional()));
545 typingAddedToOpenCommand(ForwardDeleteKey); 545 typingAddedToOpenCommand(ForwardDeleteKey);
546 return; 546 return;
547 } 547 }
548 548
549 // deleting to end of paragraph when at end of paragraph needs to merge the next paragraph (if any) 549 // deleting to end of paragraph when at end of paragraph needs to merge the next paragraph (if any)
550 if (granularity == ParagraphBoundary && selection.selection().isCaret() && isEndOfParagraph(selection.selection().visibleEnd())) 550 if (granularity == ParagraphBoundary && selection.selection().isCaret() && isEndOfParagraph(selection.selection().visibleEnd()))
551 selection.modify(FrameSelection::AlterationExtend, DirectionForward, CharacterGranularity); 551 selection.modify(FrameSelection::AlterationExtend, DirectionForward, CharacterGranularity);
552 552
553 selectionToDelete = selection.selection(); 553 selectionToDelete = selection.selection();
554 if (!startingSelection().isRange() || selectionToDelete.base() != starti ngSelection().start()) 554 if (!startingSelection().isRange() || selectionToDelete.base() != starti ngSelection().start())
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 ASSERT_NOT_REACHED(); 618 ASSERT_NOT_REACHED();
619 m_preservesTypingStyle = false; 619 m_preservesTypingStyle = false;
620 } 620 }
621 621
622 bool TypingCommand::isTypingCommand() const 622 bool TypingCommand::isTypingCommand() const
623 { 623 {
624 return true; 624 return true;
625 } 625 }
626 626
627 } // namespace WebCore 627 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/editing/TextIterator.cpp ('k') | Source/core/editing/VisibleSelection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698