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

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

Issue 2368903002: Ensure valid VisiblePosition input for character{Before,After} (Closed)
Patch Set: Ensure valid VisiblePosition input for character{Before,After} Created 4 years, 3 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: third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp b/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp
index f21d21a182bb057c7149e13211f738823bdbaf0f..d28d624f5483989d73df26dd491d15ff3dd4e641 100644
--- a/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp
@@ -1469,9 +1469,7 @@ static bool isCharacterSmartReplaceExemptConsideringNonBreakingSpace(UChar32 cha
void ReplaceSelectionCommand::addSpacesForSmartReplace(EditingState* editingState)
{
- VisiblePosition startOfInsertedContent = positionAtStartOfInsertedContent();
VisiblePosition endOfInsertedContent = positionAtEndOfInsertedContent();
-
Position endUpstream = mostBackwardCaretPosition(endOfInsertedContent.deepEquivalent());
Node* endNode = endUpstream.computeNodeBeforePosition();
int endOffset = endNode && endNode->isTextNode() ? toText(endNode)->length() : 0;
@@ -1498,6 +1496,7 @@ void ReplaceSelectionCommand::addSpacesForSmartReplace(EditingState* editingStat
document().updateStyleAndLayout();
+ VisiblePosition startOfInsertedContent = positionAtStartOfInsertedContent();
yosin_UTC9 2016/09/27 08:30:53 This moving may change behavior due by DOM tree mo
Xiaocheng 2016/09/27 08:48:51 DCHECK has been added to make sure that |m_startOf
Position startDownstream = mostForwardCaretPosition(startOfInsertedContent.deepEquivalent());
Node* startNode = startDownstream.computeNodeAfterPosition();
unsigned startOffset = 0;

Powered by Google App Engine
This is Rietveld 408576698