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

Unified Diff: third_party/WebKit/Source/core/editing/commands/InsertTextCommand.cpp

Issue 2404183002: Prune deprecated functions from InsertTextCommand (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/commands/InsertTextCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/InsertTextCommand.cpp b/third_party/WebKit/Source/core/editing/commands/InsertTextCommand.cpp
index d3d6cc7799199cc289fa1e818ebb631d87ce82f3..031cebb53e744ba121981ef9f66b7c89e79e61e6 100644
--- a/third_party/WebKit/Source/core/editing/commands/InsertTextCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/InsertTextCommand.cpp
@@ -101,10 +101,11 @@ bool InsertTextCommand::performTrivialReplace(const String& text,
return false;
setEndingSelectionWithoutValidation(start, endPosition);
- if (!selectInsertedText)
- setEndingSelection(createVisibleSelectionDeprecated(
- endingSelection().visibleEndDeprecated(),
- endingSelection().isDirectional()));
+ if (!selectInsertedText) {
+ document().updateStyleAndLayoutIgnorePendingStylesheets();
+ setEndingSelection(createVisibleSelection(
+ endingSelection().visibleEnd(), endingSelection().isDirectional()));
+ }
return true;
}
@@ -129,10 +130,11 @@ bool InsertTextCommand::performOverwrite(const String& text,
Position endPosition =
Position(textNode, start.offsetInContainerNode() + text.length());
setEndingSelectionWithoutValidation(start, endPosition);
- if (!selectInsertedText)
- setEndingSelection(createVisibleSelectionDeprecated(
- endingSelection().visibleEndDeprecated(),
- endingSelection().isDirectional()));
+ if (!selectInsertedText) {
+ document().updateStyleAndLayoutIgnorePendingStylesheets();
+ setEndingSelection(createVisibleSelection(
+ endingSelection().visibleEnd(), endingSelection().isDirectional()));
+ }
return true;
}
@@ -148,8 +150,9 @@ void InsertTextCommand::doApply(EditingState* editingState) {
if (endingSelection().isRange()) {
if (performTrivialReplace(m_text, m_selectInsertedText))
return;
+ document().updateStyleAndLayoutIgnorePendingStylesheets();
bool endOfSelectionWasAtStartOfBlock =
- isStartOfBlock(endingSelection().visibleEndDeprecated());
+ isStartOfBlock(endingSelection().visibleEnd());
deleteSelection(editingState, false, true, false, false);
if (editingState->isAborted())
return;
@@ -170,6 +173,8 @@ void InsertTextCommand::doApply(EditingState* editingState) {
return;
}
+ document().updateStyleAndLayoutIgnorePendingStylesheets();
+
Position startPosition(endingSelection().start());
Position placeholder;
@@ -182,8 +187,8 @@ void InsertTextCommand::doApply(EditingState* editingState) {
Position downstream(mostForwardCaretPosition(startPosition));
if (lineBreakExistsAtPosition(downstream)) {
// FIXME: This doesn't handle placeholders at the end of anonymous blocks.
- VisiblePosition caret = createVisiblePositionDeprecated(startPosition);
- if (isEndOfBlock(caret) && isStartOfParagraphDeprecated(caret))
+ VisiblePosition caret = createVisiblePosition(startPosition);
+ if (isEndOfBlock(caret) && isStartOfParagraph(caret))
placeholder = downstream;
// Don't remove the placeholder yet, otherwise the block we're inserting
// into would collapse before we get a chance to insert into it. We check
@@ -270,15 +275,19 @@ void InsertTextCommand::doApply(EditingState* editingState) {
}
}
- if (!m_selectInsertedText)
- setEndingSelection(createVisibleSelectionDeprecated(
+ if (!m_selectInsertedText) {
+ document().updateStyleAndLayoutIgnorePendingStylesheets();
+ setEndingSelection(createVisibleSelection(
endingSelection().end(), endingSelection().affinity(),
endingSelection().isDirectional()));
+ }
}
Position InsertTextCommand::insertTab(const Position& pos,
EditingState* editingState) {
- Position insertPos = createVisiblePositionDeprecated(pos).deepEquivalent();
+ document().updateStyleAndLayoutIgnorePendingStylesheets();
+
+ Position insertPos = createVisiblePosition(pos).deepEquivalent();
if (insertPos.isNull())
return pos;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698