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

Unified Diff: third_party/WebKit/Source/core/editing/EditingUtilities.cpp

Issue 2175163004: Add a plain space instead of   between text nodes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use of assert_selection() and introduce |shouldEmitNBSPbeforeEnd| Created 4 years, 5 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/EditingUtilities.cpp
diff --git a/third_party/WebKit/Source/core/editing/EditingUtilities.cpp b/third_party/WebKit/Source/core/editing/EditingUtilities.cpp
index f49d88fa5cb99062c29e0146ace994920cc096a7..44a8a9a4f722673085e570e5ceb0f30edebd2670 100644
--- a/third_party/WebKit/Source/core/editing/EditingUtilities.cpp
+++ b/third_party/WebKit/Source/core/editing/EditingUtilities.cpp
@@ -851,7 +851,7 @@ TextDirection primaryDirectionOf(const Node& node)
return primaryDirection;
}
-String stringWithRebalancedWhitespace(const String& string, bool startIsStartOfParagraph, bool endIsEndOfParagraph)
+String stringWithRebalancedWhitespace(const String& string, bool startIsStartOfParagraph, bool shouldEmitNBSPbeforeEnd)
{
unsigned length = string.length();
@@ -867,7 +867,8 @@ String stringWithRebalancedWhitespace(const String& string, bool startIsStartOfP
continue;
}
- if (previousCharacterWasSpace || (!i && startIsStartOfParagraph) || (i + 1 == length && endIsEndOfParagraph)) {
+ // We need to ensure there is no next sibling text node. See http://crbug.com/310149
+ if (previousCharacterWasSpace || (!i && startIsStartOfParagraph) || (i + 1 == length && shouldEmitNBSPbeforeEnd)) {
rebalancedString.append(noBreakSpaceCharacter);
previousCharacterWasSpace = false;
} else {

Powered by Google App Engine
This is Rietveld 408576698