| 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 0ee207e66957876b84cb5180c3794fa65e837715..882316329913eeecf9d5551bf0af3b1bb50c8cce 100644
|
| --- a/third_party/WebKit/Source/core/dom/Text.cpp
|
| +++ b/third_party/WebKit/Source/core/dom/Text.cpp
|
| @@ -307,9 +307,15 @@ bool Text::textLayoutObjectIsNeeded(const ComputedStyle& style, const LayoutObje
|
| while (first && first->isFloatingOrOutOfFlowPositioned() && maxSiblingsToVisit--)
|
| first = first->nextSibling();
|
| if (!first || first == layoutObject() || LayoutTreeBuilderTraversal::nextSiblingLayoutObject(*this) == first) {
|
| + // If we're adding children to this flow our previous siblings are not in the layout tree yet so we
|
| + // cannot know if we will be the first child in the line and collapse away. We have to assume we need a layout object.
|
| + Node* firstChildNode = parent.node() ? LayoutTreeBuilderTraversal::firstChild(*parent.node()) : nullptr;
|
| + if (first && first == layoutObject() && firstChildNode && !firstChildNode->layoutObject())
|
| + return true;
|
| +
|
| // Whitespace at the start of a block just goes away. Don't even
|
| // make a layout object for this text.
|
| - return false;
|
| + return !firstChildNode;
|
| }
|
| }
|
| return true;
|
|
|