Commit 395e56f1 authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

Early out for empty text nodes, both reattach and visit.

The WhitespaceAttacher should just ignore empty text nodes as if they
weren't there in order to consider correct text node siblings for
figuring out which whitespace nodes need a LayoutText.

Bug: 894674
Change-Id: I27a96779678c972093dec6e5f2e19d6a40939065
Reviewed-on: https://chromium-review.googlesource.com/c/1288351
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600724}
parent d5f79a75
This is a testharness.js-based test.
FAIL Ensure multiple text nodes get rendered properly assert_equals: expected "X Y" but got "XY"
Harness: the test ran to completion.
......@@ -40,6 +40,8 @@ void WhitespaceAttacher::DidReattach(Node* node, LayoutObject* prev_in_flow) {
void WhitespaceAttacher::DidReattachText(Text* text) {
DCHECK(text);
if (text->data().IsEmpty())
return;
DidReattach(text, text->GetLayoutObject());
SetLastTextNode(text);
if (!text->GetLayoutObject())
......@@ -54,9 +56,9 @@ void WhitespaceAttacher::DidReattachElement(Element* element,
void WhitespaceAttacher::DidVisitText(Text* text) {
DCHECK(text);
if (text->data().IsEmpty())
return;
if (!last_text_node_ || !last_text_node_needs_reattach_) {
if (text->data().IsEmpty())
return;
SetLastTextNode(text);
if (reattach_all_whitespace_nodes_ && text->ContainsOnlyWhitespaceOrEmpty())
last_text_node_needs_reattach_ = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment