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 742755960833b21ed25818d812686d968695b74c..6fa865480d8236199c4b9738c09b3b9f2d5c3e22 100644 |
--- a/third_party/WebKit/Source/core/editing/EditingUtilities.cpp |
+++ b/third_party/WebKit/Source/core/editing/EditingUtilities.cpp |
@@ -959,7 +959,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(); |
@@ -975,7 +975,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 { |