Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Unified Diff: third_party/WebKit/Source/core/dom/Text.cpp

Issue 1461773002: Ensure text nodes get an object if we're unsure that they will be collapsed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/linux/css3/flexbox/repaint-on-layout-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/linux/css3/flexbox/repaint-on-layout-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698