diff options
author | robhogan <robhogan@gmail.com> | 2015-12-11 11:11:59 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-11 19:13:30 +0000 |
commit | 2748c5cea72b053e64920d9bce3bd0440ba5d22d (patch) | |
tree | baad08dbbe1a037f338dd866a5d3b91a555bcd83 | |
parent | 44df461bc4915ca52e017131dcfc001e9d63e2ee (diff) | |
download | chromium_src-2748c5cea72b053e64920d9bce3bd0440ba5d22d.zip chromium_src-2748c5cea72b053e64920d9bce3bd0440ba5d22d.tar.gz chromium_src-2748c5cea72b053e64920d9bce3bd0440ba5d22d.tar.bz2 |
Ensure text nodes get an object if we're unsure that they will be collapsed
BUG=556733
Review URL: https://codereview.chromium.org/1461773002
Cr-Commit-Position: refs/heads/master@{#364765}
8 files changed, 51 insertions, 7 deletions
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index f469a4c..f57da4d 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations @@ -160,6 +160,11 @@ crbug.com/410974 virtual/threaded_animation_timelines/fast/scroll-behavior/scrol crbug.com/410974 virtual/threaded_animation_timelines/fast/scroll-behavior/scroll-customization/scrollstate-distribute-to-scroll-chain-descendant.html [ Pass Failure ] crbug.com/410974 virtual/threaded_animation_timelines/fast/scroll-behavior/scroll-customization/touch-scroll-customization.html [ Pass Failure ] +crbug.com/556733 fast/forms/select/select-listbox-focus-displaynone.html [ NeedsRebaseline ] +crbug.com/556733 fast/repaint/remove-inline-block-descendant-of-flex.html [ NeedsRebaseline ] +crbug.com/556733 fast/repaint/text-in-relative-positioned-inline.html [ NeedsRebaseline ] +crbug.com/556733 css3/flexbox/repaint-on-layout.html [ NeedsRebaseline ] + crbug.com/518972 [ Linux XP ] http/tests/navigation/navigation-redirect-schedule-crash.html [ Failure Pass ] crbug.com/381730 http/tests/navigation/pending-location-change-assert.html [ Failure Pass ] crbug.com/518974 http/tests/navigatorconnect/postmessage.html [ Failure Pass Timeout ] diff --git a/third_party/WebKit/LayoutTests/fast/forms/select/select-listbox-focus-displaynone-expected.txt b/third_party/WebKit/LayoutTests/fast/forms/select/select-listbox-focus-displaynone-expected.txt index 660b40f..5df6241 100644 --- a/third_party/WebKit/LayoutTests/fast/forms/select/select-listbox-focus-displaynone-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/forms/select/select-listbox-focus-displaynone-expected.txt @@ -1 +1 @@ - PASS + PASS diff --git a/third_party/WebKit/LayoutTests/fast/repaint/remove-inline-block-descendant-of-flex-expected.txt b/third_party/WebKit/LayoutTests/fast/repaint/remove-inline-block-descendant-of-flex-expected.txt index 8de0031..365500d 100644 --- a/third_party/WebKit/LayoutTests/fast/repaint/remove-inline-block-descendant-of-flex-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/repaint/remove-inline-block-descendant-of-flex-expected.txt @@ -17,7 +17,6 @@ "RootInlineBox", "LayoutBlockFlow DIV id='inline-block-1' class='item'", "InlineBox", - "LayoutText #text", "RootInlineBox", "InlineBox", "RootInlineBox", diff --git a/third_party/WebKit/LayoutTests/fast/repaint/text-in-relative-positioned-inline-expected.txt b/third_party/WebKit/LayoutTests/fast/repaint/text-in-relative-positioned-inline-expected.txt index ce320c0..a2afc2e 100644 --- a/third_party/WebKit/LayoutTests/fast/repaint/text-in-relative-positioned-inline-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/repaint/text-in-relative-positioned-inline-expected.txt @@ -6,6 +6,7 @@ "contentsOpaque": true, "drawsContent": true, "repaintRects": [ + [108, 8, 684, 100], [8, 8, 200, 100], [8, 8, 200, 100] ], @@ -14,8 +15,8 @@ "LayoutText #text", "InlineFlowBox", "LayoutInline (relative positioned) SPAN id='target'", - "LayoutText #text", - "RootInlineBox" + "RootInlineBox", + "LayoutBlockFlow DIV" ] } ] diff --git a/third_party/WebKit/LayoutTests/fast/text/whitespace-created-when-siblings-added-back-to-front-expected.html b/third_party/WebKit/LayoutTests/fast/text/whitespace-created-when-siblings-added-back-to-front-expected.html new file mode 100644 index 0000000..d429b29 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/text/whitespace-created-when-siblings-added-back-to-front-expected.html @@ -0,0 +1,4 @@ +<!DOCTYPE html> +<p id="p">ext t</p> +<p>crbug.com/556733: Ensure whitespace gets created when we attached siblings from back to front. There should be a space between the t and the t.</p> + diff --git a/third_party/WebKit/LayoutTests/fast/text/whitespace-created-when-siblings-added-back-to-front.html b/third_party/WebKit/LayoutTests/fast/text/whitespace-created-when-siblings-added-back-to-front.html new file mode 100644 index 0000000..d8a4340 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/text/whitespace-created-when-siblings-added-back-to-front.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<style> +.float-left { + float: left; +} +</style> +<p id="p"></p> +<script> +window.onload = function (e) { + document.body.offsetTop; + var p = document.getElementById('p'); + var firstSpan = document.createElement("span"); + firstSpan.setAttribute("class", "float-left"); + firstSpan.appendChild(document.createTextNode("e")); + var secondSpan = document.createElement("span"); + secondSpan.setAttribute("class", "float-left"); + secondSpan.appendChild(document.createTextNode("x")); + + p.appendChild(document.createTextNode("t")); + p.appendChild(firstSpan); + p.appendChild(document.createTextNode(" ")); + p.appendChild(secondSpan); + p.appendChild(document.createTextNode("t")); + + +}; +</script> +<p>crbug.com/556733: Ensure whitespace gets created when we attached siblings from back to front. There should be a space between the t and the t.</p> + diff --git a/third_party/WebKit/LayoutTests/platform/linux/css3/flexbox/repaint-on-layout-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/css3/flexbox/repaint-on-layout-expected.txt index 8f86e6e..82d3ce0 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/css3/flexbox/repaint-on-layout-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/css3/flexbox/repaint-on-layout-expected.txt @@ -12,9 +12,9 @@ "paintInvalidationClients": [ "LayoutBlockFlow DIV id='badge'", "InlineBox", - "LayoutText #text", "RootInlineBox", - "LayoutBlockFlow (floating) DIV class='state'" + "LayoutBlockFlow (floating) DIV class='state'", + "LayoutText #text" ] } ] diff --git a/third_party/WebKit/Source/core/dom/Text.cpp b/third_party/WebKit/Source/core/dom/Text.cpp index 0ee207e..8823163 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; |