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

Unified Diff: Source/core/editing/commands/TypingCommand.cpp

Issue 1310043003: Introduce previousPositionOf() for VisiblePosition (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-28T16:28:03 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/editing/commands/TypingCommand.cpp
diff --git a/Source/core/editing/commands/TypingCommand.cpp b/Source/core/editing/commands/TypingCommand.cpp
index 6b6ba7d510c592e2d6b2f6b3f26cc43f7e92ff71..5ac739a5374e94a5fc7c90b476b0e637eae8e747 100644
--- a/Source/core/editing/commands/TypingCommand.cpp
+++ b/Source/core/editing/commands/TypingCommand.cpp
@@ -303,7 +303,7 @@ void TypingCommand::markMisspellingsAfterTyping(ETypingCommand commandType)
// see if typing made a new word that is not in the current selection. Basically, you
// get this by being at the end of a word and typing a space.
VisiblePosition start(endingSelection().start(), endingSelection().affinity());
- VisiblePosition previous = start.previous();
+ VisiblePosition previous = previousPositionOf(start);
VisiblePosition p1 = startOfWord(previous, LeftWordIfOnBoundary);
@@ -438,7 +438,7 @@ void TypingCommand::deleteKeyPressed(TextGranularity granularity, bool killRing)
selection->modify(FrameSelection::AlterationExtend, DirectionBackward, CharacterGranularity);
VisiblePosition visibleStart(endingSelection().visibleStart());
- if (visibleStart.previous(CannotCrossEditingBoundary).isNull()) {
+ if (previousPositionOf(visibleStart, CannotCrossEditingBoundary).isNull()) {
// When the caret is at the start of the editable area in an empty list item, break out of the list item.
if (breakOutOfEmptyListItem()) {
typingAddedToOpenCommand(DeleteKey);
@@ -457,7 +457,7 @@ void TypingCommand::deleteKeyPressed(TextGranularity granularity, bool killRing)
return;
// If the caret is at the start of a paragraph after a table, move content into the last table cell.
- if (isStartOfParagraph(visibleStart) && isFirstPositionAfterTable(visibleStart.previous(CannotCrossEditingBoundary))) {
+ if (isStartOfParagraph(visibleStart) && isFirstPositionAfterTable(previousPositionOf(visibleStart, CannotCrossEditingBoundary))) {
// Unless the caret is just before a table. We don't want to move a table into the last table cell.
if (isLastPositionBeforeTable(visibleStart))
return;
« 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