| Index: third_party/WebKit/Source/core/dom/Text.cpp
|
| diff --git a/third_party/WebKit/Source/core/dom/Text.cpp b/third_party/WebKit/Source/core/dom/Text.cpp
|
| index f69b8552c899c41d59a2d26db83f4be95856723f..a24048a3439dd8394a43f7527f7bfe2cd7e41559 100644
|
| --- a/third_party/WebKit/Source/core/dom/Text.cpp
|
| +++ b/third_party/WebKit/Source/core/dom/Text.cpp
|
| @@ -252,6 +252,11 @@ static inline bool canHaveWhitespaceChildren(const LayoutObject& parent) {
|
| return true;
|
| }
|
|
|
| +static inline bool emptyOrEndsWithWhitespace(const WTF::String& string) {
|
| + unsigned len = string.length();
|
| + return !len || isASCIISpace(string[len - 1]);
|
| +}
|
| +
|
| bool Text::textLayoutObjectIsNeeded(const ComputedStyle& style,
|
| const LayoutObject& parent) const {
|
| DCHECK(!document().childNeedsDistributionRecalc());
|
| @@ -293,6 +298,11 @@ bool Text::textLayoutObjectIsNeeded(const ComputedStyle& style,
|
| if (prev && prev->isBR()) // <span><br/> <br/></span>
|
| return false;
|
|
|
| + // Collapse whitespace away.
|
| + if (prev && prev->isText() &&
|
| + emptyOrEndsWithWhitespace(toLayoutText(prev)->text()))
|
| + return false;
|
| +
|
| if (parent.isLayoutInline()) {
|
| // <span><div/> <div/></span>
|
| if (prev && !prev->isInline() && !prev->isOutOfFlowPositioned())
|
|
|