| 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..959bd8a4547dd51f46c1ae874121527cf9940d08 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());
|
| @@ -290,12 +295,25 @@ bool Text::textLayoutObjectIsNeeded(const ComputedStyle& style,
|
| const LayoutObject* prev =
|
| LayoutTreeBuilderTraversal::previousSiblingLayoutObject(
|
| *this, maxSiblingsToVisit);
|
| +
|
| + while (prev && prev->isFloatingOrOutOfFlowPositioned() &&
|
| + --maxSiblingsToVisit)
|
| + prev = prev->previousSibling();
|
| +
|
| + if (!maxSiblingsToVisit)
|
| + return true;
|
| +
|
| 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())
|
| + if (prev && !prev->isInline())
|
| return false;
|
| } else {
|
| if (parent.isLayoutBlock() && !parent.childrenInline() &&
|
|
|