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..226ffe39ac00b54926eb6553294b31910776ac45 100644 |
--- a/third_party/WebKit/Source/core/dom/Text.cpp |
+++ b/third_party/WebKit/Source/core/dom/Text.cpp |
@@ -307,6 +307,12 @@ 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 |
rhogan
2015/11/20 19:33:13
More specifically, when we're doing an .innerHTML=
rhogan
2015/11/20 19:50:25
I knew as soon as I typed it that was daft. This a
|
+ // 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* firstChild = parent.node() ? LayoutTreeBuilderTraversal::firstChild(*parent.node()) : nullptr; |
leviw_travelin_and_unemployed
2015/11/20 21:18:34
Nit: I'd probably call this firstChildNode
|
+ if (first && first == layoutObject() && firstChild && !firstChild->layoutObject() && firstChild->isTextNode()) |
leviw_travelin_and_unemployed
2015/11/20 21:18:34
Why are you checking firstChild->isTextNode() here
rhogan
2015/11/21 16:55:42
Right, it doesn't matter does it?
|
+ return true; |
+ |
// Whitespace at the start of a block just goes away. Don't even |
// make a layout object for this text. |
return false; |