diff options
author | robhogan <robhogan@gmail.com> | 2015-12-21 23:54:43 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-22 07:55:44 +0000 |
commit | 622e42ea052437c0d7ce4e66ea5f781b3b6bfb96 (patch) | |
tree | 39ffb7bbb48d396912601f79b79b7e4af6a7167a | |
parent | cb76caa4c5d065991a03c54f80e3e6ae239d7a59 (diff) | |
download | chromium_src-622e42ea052437c0d7ce4e66ea5f781b3b6bfb96.zip chromium_src-622e42ea052437c0d7ce4e66ea5f781b3b6bfb96.tar.gz chromium_src-622e42ea052437c0d7ce4e66ea5f781b3b6bfb96.tar.bz2 |
Insert an anonymous inline-table when inserting a table part under an inline.
Another go at https://codereview.chromium.org/895953003
BUG=327832
Review URL: https://codereview.chromium.org/1474813002
Cr-Commit-Position: refs/heads/master@{#366564}
23 files changed, 361 insertions, 170 deletions
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index e7239b7..2834566 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations @@ -340,6 +340,9 @@ crbug.com/352405 virtual/threaded/animations/transition-and-animation-1.html [ P crbug.com/461179 virtual/spv2/paint/invalidation/invalidate-when-receiving-paint-layer.html [ Failure ] +crbug.com/327832 tables/mozilla/bugs/bug3037-1.html [ NeedsRebaseline ] +crbug.com/327832 fast/dynamic/insert-before-table-part-in-continuation.html [ NeedsRebaseline ] + crbug.com/542541 [ Debug ] fast/events/click-count.html [ Pass Failure ] crbug.com/542541 [ Debug ] virtual/trustedeventsdefaultaction/fast/events/click-count.html [ Pass Failure ] crbug.com/542541 [ Debug ] virtual/pointerevent/fast/events/click-count.html [ Pass Failure ] @@ -458,6 +461,8 @@ crbug.com/240374 compositing/overlap-blending/reflection-opacity-huge.html [ Fai crbug.com/240374 compositing/overlap-blending/children-opacity-huge.html [ Failure ] crbug.com/240374 compositing/overlap-blending/children-opacity-no-overlap.html [ Failure ] +crbug.com/410145 [ Win ] fast/table/column-in-inline.html [ Failure ] + crbug.com/411164 [ Win ] http/tests/security/powerfulFeatureRestrictions/serviceworker-on-insecure-origin.html [ Pass Slow ] # This batch is flaky: diff --git a/third_party/WebKit/LayoutTests/fast/block/float/float-not-removed-from-pre-block-expected.txt b/third_party/WebKit/LayoutTests/fast/block/float/float-not-removed-from-pre-block-expected.txt index 9c1b291..086d4ec 100644 --- a/third_party/WebKit/LayoutTests/fast/block/float/float-not-removed-from-pre-block-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/block/float/float-not-removed-from-pre-block-expected.txt @@ -1,3 +1,3 @@ Bug 101970: Heap-use-after-free in WebCore::LayoutLayerModelObject::hasSelfPaintingLayer Test passes if it does not crash. - + diff --git a/third_party/WebKit/LayoutTests/fast/table/caption-in-inline-expected.txt b/third_party/WebKit/LayoutTests/fast/table/caption-in-inline-expected.txt new file mode 100644 index 0000000..2ae6d04 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/table/caption-in-inline-expected.txt @@ -0,0 +1,17 @@ +Test that a table-caption with a table-cell sibling is wrapped inside an inline-table when the parent is inline. + + + There should be a blue square to the left of this line. +PASS firstRects.length is 1 +PASS secondRects.length is 1 +PASS lastRects.length is 1 +PASS secondRects[0].top is firstRects[0].top + 40 +PASS secondRects[0].left is firstRects[0].left +PASS secondRects[0].bottom is secondRects[0].top + 40 +PASS lastRects[0].right is >= secondRects[0].left +PASS lastRects[0].top is >= firstRects[0].top +PASS secondRects[0].bottom is >= lastRects[0].bottom +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/third_party/WebKit/LayoutTests/fast/table/caption-in-inline.html b/third_party/WebKit/LayoutTests/fast/table/caption-in-inline.html new file mode 100644 index 0000000..57d9c6a --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/table/caption-in-inline.html @@ -0,0 +1,23 @@ +<!DOCTYPE html> +<script src="../../resources/js-test.js"></script> +<p>Test that a table-caption with a table-cell sibling is wrapped inside an inline-table when the parent is inline.</p> +<span> + <div id="first" style="display:table-caption; width:100%; height:40px; background:blue;"> </div> + <div id="second" style="display:table-cell; width:80px; height:40px; background:blue;"> </div> + <span id="last">There should be a blue square to the left of this line.</span> +</span> +<div id="console"></div> +<script> + var firstRects = document.getElementById('first').getClientRects(); + var secondRects = document.getElementById('second').getClientRects(); + var lastRects = document.getElementById('last').getClientRects(); + shouldBe("firstRects.length", "1"); + shouldBe("secondRects.length", "1"); + shouldBe("lastRects.length", "1"); + shouldBe("secondRects[0].top", "firstRects[0].top + 40"); + shouldBe("secondRects[0].left", "firstRects[0].left"); + shouldBe("secondRects[0].bottom", "secondRects[0].top + 40"); + shouldBeGreaterThanOrEqual("lastRects[0].right", "secondRects[0].left"); + shouldBeGreaterThanOrEqual("lastRects[0].top", "firstRects[0].top"); + shouldBeGreaterThanOrEqual("secondRects[0].bottom", "lastRects[0].bottom"); +</script> diff --git a/third_party/WebKit/LayoutTests/fast/table/column-in-inline-expected.html b/third_party/WebKit/LayoutTests/fast/table/column-in-inline-expected.html new file mode 100644 index 0000000..dcf988c --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/table/column-in-inline-expected.html @@ -0,0 +1,4 @@ +<!DOCTYPE html> +<p>Test that a table-column with a table-cell sibling are wrapped inside an inline-table when the parent is inline.</p> +<div style="float:left; width:4em; height:4em; background:blue;"></div> + There should be a blue square to the left of this line. diff --git a/third_party/WebKit/LayoutTests/fast/table/column-in-inline.html b/third_party/WebKit/LayoutTests/fast/table/column-in-inline.html new file mode 100644 index 0000000..713b854 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/table/column-in-inline.html @@ -0,0 +1,7 @@ +<!DOCTYPE html> +<p>Test that a table-column with a table-cell sibling are wrapped inside an inline-table when the parent is inline.</p> +<span style="vertical-align:top;"> + <div style="display:table-column; width:4em; background:blue;"></div> + <div style="vertical-align:top; display:table-cell; height:4em;"> </div> + There should be a blue square to the left of this line. +</span> diff --git a/third_party/WebKit/LayoutTests/fast/table/convert-inline-anonoymous-wrapper-to-block-expected.txt b/third_party/WebKit/LayoutTests/fast/table/convert-inline-anonoymous-wrapper-to-block-expected.txt new file mode 100644 index 0000000..cd4eb4a --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/table/convert-inline-anonoymous-wrapper-to-block-expected.txt @@ -0,0 +1,2 @@ + PASS +crbug.com/372832: The div should be inserted before the anonymous table wrapper surrounding the table-row and the anonymous table wrapper should be in the last anonymous block, not the middle one. diff --git a/third_party/WebKit/LayoutTests/fast/table/convert-inline-anonoymous-wrapper-to-block.html b/third_party/WebKit/LayoutTests/fast/table/convert-inline-anonoymous-wrapper-to-block.html new file mode 100644 index 0000000..ae27448 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/table/convert-inline-anonoymous-wrapper-to-block.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<style> +.green { + width: 50px; + height: 20px; + background-color: green; +} +div, span { + font: 10px/1 Ahem; +} +</style> +<div id="container" style="float:left" data-expected-height=50 data-expected-width=50> + <span id="span"> + <div class="green"></div> + <div style="display: table-cell;" id="cell"></div> + <span></span> + </span> +</div> +<p>crbug.com/372832: The div should be inserted before the anonymous table wrapper surrounding the table-row and the anonymous table wrapper + should be in the last anonymous block, not the middle one.</p> +<script src="../../resources/check-layout.js"></script> +<script> + document.body.offsetTop; + div = document.createElement("div"); + div.setAttribute("class", "green"); + cell = document.getElementById("cell"); + span.insertBefore(div, cell); + checkLayout("#container"); +</script> diff --git a/third_party/WebKit/LayoutTests/fast/table/convert-inline-to-table-cell-expected.txt b/third_party/WebKit/LayoutTests/fast/table/convert-inline-to-table-cell-expected.txt new file mode 100644 index 0000000..3e35bd2 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/table/convert-inline-to-table-cell-expected.txt @@ -0,0 +1,2 @@ +This text should be on the same line +crbug.com/372832: Test that adding an inline anonymous table before a div inside a block continuation gets added to the pre-block not the middle block. diff --git a/third_party/WebKit/LayoutTests/fast/table/convert-inline-to-table-cell.html b/third_party/WebKit/LayoutTests/fast/table/convert-inline-to-table-cell.html new file mode 100644 index 0000000..85d0276 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/table/convert-inline-to-table-cell.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<style> +.green { + width: 50px; + height: 25px; + background-color: green; +} +</style> +<span> + This text should be on + <div id="elm" style="display:none;">the same line</div><div></div> +</span> +<p>crbug.com/372832: Test that adding an inline anonymous table before a div inside a block continuation gets added to the pre-block not the middle block.</p> +<script> + if (window.testRunner) + testRunner.dumpAsText(); + document.body.offsetTop; + elm.style.display = "table-cell"; +</script> diff --git a/third_party/WebKit/LayoutTests/fast/table/display-as-inline-expected.txt b/third_party/WebKit/LayoutTests/fast/table/display-as-inline-expected.txt new file mode 100644 index 0000000..cea5e46 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/table/display-as-inline-expected.txt @@ -0,0 +1,8 @@ +Test that a table row inside a TABLE that's displayed as inline gets wrapped inside an anonymous inline-table. + +This text should be on one line. +PASS firstTop is lastTop +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/third_party/WebKit/LayoutTests/fast/table/display-as-inline.html b/third_party/WebKit/LayoutTests/fast/table/display-as-inline.html new file mode 100644 index 0000000..dff54f1 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/table/display-as-inline.html @@ -0,0 +1,17 @@ +<!DOCTYPE html> +<script src="../../resources/js-test.js"></script> +<p>Test that a table row inside a TABLE that's displayed as inline + gets wrapped inside an anonymous inline-table.</p> +<span id="first">This</span> text +<table style="display:inline; border-spacing:0;"> + <tr> + <td style="vertical-align:baseline; padding:0;">should be</td> + </tr> +</table> +on one <span id="last">line.</span> +<div id="console"></div> +<script> + var firstTop = document.getElementById('first').getClientRects()[0].top; + var lastTop = document.getElementById('last').getClientRects()[0].top; + shouldBe("firstTop", "lastTop"); +</script> diff --git a/third_party/WebKit/LayoutTests/fast/table/inline-table-added-to-continuation-expected.txt b/third_party/WebKit/LayoutTests/fast/table/inline-table-added-to-continuation-expected.txt new file mode 100644 index 0000000..7cf4c61 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/table/inline-table-added-to-continuation-expected.txt @@ -0,0 +1,4 @@ +crbug.com/372832: There should be a green square below. In the layout tree the anonymous table should be under the LayoutInline in the last anonymous block, not in the middle anonymous block. + + +PASS diff --git a/third_party/WebKit/LayoutTests/fast/table/inline-table-added-to-continuation.html b/third_party/WebKit/LayoutTests/fast/table/inline-table-added-to-continuation.html new file mode 100644 index 0000000..1398fa4 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/table/inline-table-added-to-continuation.html @@ -0,0 +1,17 @@ +<!DOCTYPE html> +<style> +.block { width:50px; height:25px; background:green; } +.cell { display:table-cell; width:25px; height:25px; background:green; } +.inline-block { display: inline-block; width:25px; height:25px; background:green; } +</style> +<p>crbug.com/372832: There should be a green square below. In the layout tree the anonymous table should be under the LayoutInline in the last anonymous block, not in the middle anonymous block.</p> +<div id="container" style="float:left" data-expected-height=50 data-expected-width=50> + <span> + <div class="block"></div> + <div class="cell"> </div><div class="inline-block"> </div> + </span> +</div> +<script src="../../resources/check-layout.js"></script> +<script> + checkLayout("#container"); +</script> diff --git a/third_party/WebKit/LayoutTests/fast/table/row-in-inline-block-expected.txt b/third_party/WebKit/LayoutTests/fast/table/row-in-inline-block-expected.txt new file mode 100644 index 0000000..4baa7f4 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/table/row-in-inline-block-expected.txt @@ -0,0 +1,8 @@ +Test that a table-row child of an inline is wrapped inside an inline-table (and table-row-group). + +There should be one blue box above and one below this line. + PASS lastTop is > firstBottom +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/third_party/WebKit/LayoutTests/fast/table/row-in-inline-block.html b/third_party/WebKit/LayoutTests/fast/table/row-in-inline-block.html new file mode 100644 index 0000000..8de229f --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/table/row-in-inline-block.html @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<script src="../../resources/js-test.js"></script> +<p>Test that a table-row child of an inline is wrapped inside an inline-table (and table-row-group).</p> +<span style="display:inline-block;"> + <div id="first" style="display:table-row; color:blue; background:blue;"><div style="width:1em; height:1em;"></div></div> + There should be one blue box above and one below this line. + <div id="last" style="display:table-row; color:blue; background:blue;"><div style="width:1em; height:1em;"></div></div> +</span> +<div id="console"></div> +<script> + var firstBottom = document.getElementById('first').getClientRects()[0].bottom; + var lastTop = document.getElementById('last').getClientRects()[0].top; + shouldBeGreaterThan("lastTop", "firstBottom"); +</script> diff --git a/third_party/WebKit/LayoutTests/fast/table/table-parts-in-inline-expected.txt b/third_party/WebKit/LayoutTests/fast/table/table-parts-in-inline-expected.txt new file mode 100644 index 0000000..b3cb9d2 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/table/table-parts-in-inline-expected.txt @@ -0,0 +1,15 @@ +Test that a table part child of an inline is wrapped inside an inline-table. + +This text should be on one line. +This text should be on one line. +This text should be on one line. +Testing cell: +PASS firstTop is lastTop +Testing row: +PASS firstTop is lastTop +Testing row-group: +PASS firstTop is lastTop +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/third_party/WebKit/LayoutTests/fast/table/table-parts-in-inline.html b/third_party/WebKit/LayoutTests/fast/table/table-parts-in-inline.html new file mode 100644 index 0000000..f0caf36 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/table/table-parts-in-inline.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<script src="../../resources/js-test.js"></script> +<p>Test that a table part child of an inline is wrapped inside an inline-table.</p> +<div id="cell" class="test"> + <span class="first">This</span> text + <span> + should be + <div style="display:table-cell;">on</div> + one + </span> + <span class="last">line.</span> +</div> +<div id="row" class="test"> + <span class="first">This</span> text + <span> + should be + <div style="display:table-row;">on</div> + one + </span> + <span class="last">line.</span> +</div> +<div id="row-group" class="test"> + <span class="first">This</span> text + <span> + should be + <div style="display:table-row-group;">on</div> + one + </span> + <span class="last">line.</span> +</div> +<div id="console"></div> +<script> + var tests = document.querySelectorAll(".test"); + for (var i = 0; i < tests.length; i++) { + debug("Testing " + tests[i].id + ":"); + var id = "#" + tests[i].id; + var firstTop = document.querySelector(id + ' > .first').getClientRects()[0].top; + var lastTop = document.querySelector(id + ' > .last').getClientRects()[0].top; + shouldBe("firstTop", "lastTop"); + } +</script> diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/dynamic/insert-before-table-part-in-continuation-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/dynamic/insert-before-table-part-in-continuation-expected.png Binary files differindex f486489..31451c9fd 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/dynamic/insert-before-table-part-in-continuation-expected.png +++ b/third_party/WebKit/LayoutTests/platform/linux/fast/dynamic/insert-before-table-part-in-continuation-expected.png diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/dynamic/insert-before-table-part-in-continuation-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/dynamic/insert-before-table-part-in-continuation-expected.txt index 5a11f74..b5d8614 100644 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/dynamic/insert-before-table-part-in-continuation-expected.txt +++ b/third_party/WebKit/LayoutTests/platform/linux/fast/dynamic/insert-before-table-part-in-continuation-expected.txt @@ -1,9 +1,9 @@ -layer at (0,0) size 800x600 clip at (0,0) size 785x600 scrollHeight 748 +layer at (0,0) size 800x600 LayoutView at (0,0) size 800x600 -layer at (0,0) size 785x748 backgroundClip at (0,0) size 785x600 clip at (0,0) size 785x600 - LayoutBlockFlow {HTML} at (0,0) size 785x748 - LayoutBlockFlow {BODY} at (8,8) size 769x732 - LayoutBlockFlow {P} at (0,0) size 769x20 +layer at (0,0) size 800x600 + LayoutBlockFlow {HTML} at (0,0) size 800x600 + LayoutBlockFlow {BODY} at (8,8) size 784x584 + LayoutBlockFlow {P} at (0,0) size 784x20 LayoutText {#text} at (0,0) size 50x19 text run at (0,0) width 50: "Test for " LayoutInline {I} at (0,0) size 637x19 @@ -15,111 +15,88 @@ layer at (0,0) size 785x748 backgroundClip at (0,0) size 785x600 clip at (0,0) s text run at (358,0) width 328: "Safari Crashes when opening a JS TreeGrid widget" LayoutText {#text} at (685,0) size 5x19 text run at (685,0) width 5: "." - LayoutBlockFlow {P} at (0,36) size 769x80 - LayoutText {#text} at (0,0) size 744x79 + LayoutBlockFlow {P} at (0,36) size 784x60 + LayoutText {#text} at (0,0) size 783x59 text run at (0,0) width 739: "The test sets up an inline parent with a child that is some kind of table part. The child gets broken off into a continuation and" text run at (0,20) width 744: "anonymous table parts get created below and/or above the table parts. Then the test tries to insert a new child into the inline," - text run at (0,40) width 741: "specifying the table part as the \"before child\". The resulting render tree should look just like it would look if the parent was a" - text run at (0,60) width 38: "block." - LayoutBlockFlow {DIV} at (0,132) size 769x40 - LayoutBlockFlow (anonymous) at (0,0) size 769x20 - LayoutInline {SPAN} at (0,0) size 122x19 - LayoutText {#text} at (0,0) size 38x19 - text run at (0,0) width 38: "Text..." - LayoutText {#text} at (37,0) size 85x19 - text run at (37,0) width 85: "goes here and" - LayoutBlockFlow (anonymous) at (0,20) size 769x20 - LayoutTable (anonymous) at (0,0) size 98x20 + text run at (0,40) width 783: "specifying the table part as the \"before child\". The resulting render tree should look just like it would look if the parent was a block." + LayoutBlockFlow {DIV} at (0,112) size 784x20 + LayoutInline {SPAN} at (0,0) size 220x19 + LayoutText {#text} at (0,0) size 38x19 + text run at (0,0) width 38: "Text..." + LayoutText {#text} at (37,0) size 85x19 + text run at (37,0) width 85: "goes here and" + LayoutTable (anonymous) at (121.88,0) size 98x20 LayoutTableSection (anonymous) at (0,0) size 98x20 LayoutTableRow (anonymous) at (0,0) size 98x20 LayoutTableCell {DIV} at (0,0) size 98x20 [r=0 c=0 rs=1 cs=1] LayoutText {#text} at (0,0) size 98x19 text run at (0,0) width 98: "...continues here" - LayoutBlockFlow (anonymous) at (0,40) size 769x0 - LayoutInline {SPAN} at (0,0) size 0x0 - LayoutBlockFlow {DIV} at (0,172) size 769x40 - LayoutBlockFlow (anonymous) at (0,0) size 769x20 - LayoutInline {SPAN} at (0,0) size 38x19 - LayoutText {#text} at (0,0) size 38x19 - text run at (0,0) width 38: "Text..." - LayoutBlockFlow (anonymous) at (0,20) size 769x20 - LayoutTable (anonymous) at (0,0) size 98x20 + LayoutBlockFlow {DIV} at (0,132) size 784x20 + LayoutInline {SPAN} at (0,0) size 136x19 + LayoutText {#text} at (0,0) size 38x19 + text run at (0,0) width 38: "Text..." + LayoutTable (anonymous) at (37.88,0) size 98x20 LayoutTableSection (anonymous) at (0,0) size 98x20 LayoutTableRow (anonymous) at (0,0) size 98x20 LayoutTableCell {TD} at (0,0) size 0x0 [r=0 c=0 rs=1 cs=1] LayoutTableCell {DIV} at (0,0) size 98x20 [r=0 c=1 rs=1 cs=1] LayoutText {#text} at (0,0) size 98x19 text run at (0,0) width 98: "...continues here" - LayoutBlockFlow (anonymous) at (0,40) size 769x0 - LayoutInline {SPAN} at (0,0) size 0x0 - LayoutBlockFlow {DIV} at (0,212) size 769x40 - LayoutBlockFlow (anonymous) at (0,0) size 769x20 - LayoutInline {SPAN} at (0,0) size 38x19 - LayoutText {#text} at (0,0) size 38x19 - text run at (0,0) width 38: "Text..." - LayoutBlockFlow (anonymous) at (0,20) size 769x20 - LayoutTable (anonymous) at (0,0) size 98x20 + LayoutBlockFlow {DIV} at (0,152) size 784x35 + LayoutInline {SPAN} at (0,0) size 136x19 + LayoutText {#text} at (0,0) size 38x19 + text run at (0,0) width 38: "Text..." + LayoutTable (anonymous) at (37.88,15) size 98x20 LayoutTableSection (anonymous) at (0,0) size 98x20 LayoutTableRow {TR} at (0,0) size 98x0 LayoutTableRow (anonymous) at (0,0) size 98x20 LayoutTableCell {DIV} at (0,0) size 98x20 [r=1 c=0 rs=1 cs=1] LayoutText {#text} at (0,0) size 98x19 text run at (0,0) width 98: "...continues here" - LayoutBlockFlow (anonymous) at (0,40) size 769x0 - LayoutInline {SPAN} at (0,0) size 0x0 - LayoutBlockFlow {DIV} at (0,252) size 769x40 - LayoutBlockFlow (anonymous) at (0,0) size 769x20 - LayoutInline {SPAN} at (0,0) size 38x19 - LayoutText {#text} at (0,0) size 38x19 - text run at (0,0) width 38: "Text..." - LayoutInline {SPAN} at (0,0) size 1x19 - LayoutBlockFlow (anonymous) at (0,20) size 769x20 - LayoutTable (anonymous) at (0,0) size 98x20 + LayoutBlockFlow {DIV} at (0,187) size 784x20 + LayoutInline {SPAN} at (0,0) size 136x19 + LayoutText {#text} at (0,0) size 38x19 + text run at (0,0) width 38: "Text..." + LayoutInline {SPAN} at (0,0) size 1x19 + LayoutTable (anonymous) at (37.88,0) size 98x20 LayoutTableSection (anonymous) at (0,0) size 98x20 LayoutTableRow (anonymous) at (0,0) size 98x20 LayoutTableCell {DIV} at (0,0) size 98x20 [r=0 c=0 rs=1 cs=1] LayoutText {#text} at (0,0) size 98x19 text run at (0,0) width 98: "...continues here" - LayoutBlockFlow (anonymous) at (0,40) size 769x0 - LayoutInline {SPAN} at (0,0) size 0x0 - LayoutBlockFlow {DIV} at (0,292) size 769x40 - LayoutBlockFlow (anonymous) at (0,0) size 769x20 + LayoutBlockFlow {DIV} at (0,207) size 784x40 + LayoutBlockFlow (anonymous) at (0,0) size 784x20 LayoutInline {SPAN} at (0,0) size 38x19 LayoutText {#text} at (0,0) size 38x19 text run at (0,0) width 38: "Text..." - LayoutBlockFlow (anonymous) at (0,20) size 769x20 - LayoutBlockFlow {DIV} at (0,0) size 769x0 - LayoutTable (anonymous) at (0,0) size 98x20 - LayoutTableSection (anonymous) at (0,0) size 98x20 - LayoutTableRow (anonymous) at (0,0) size 98x20 - LayoutTableCell {DIV} at (0,0) size 98x20 [r=0 c=0 rs=1 cs=1] - LayoutText {#text} at (0,0) size 98x19 - text run at (0,0) width 98: "...continues here" - LayoutBlockFlow (anonymous) at (0,40) size 769x0 - LayoutInline {SPAN} at (0,0) size 0x0 - LayoutBlockFlow {DIV} at (0,332) size 769x40 - LayoutBlockFlow (anonymous) at (0,0) size 769x20 - LayoutInline {SPAN} at (0,0) size 122x19 - LayoutText {#text} at (0,0) size 38x19 - text run at (0,0) width 38: "Text..." - LayoutText {#text} at (37,0) size 85x19 - text run at (37,0) width 85: "goes here and" - LayoutBlockFlow (anonymous) at (0,20) size 769x20 - LayoutTable (anonymous) at (0,0) size 98x20 + LayoutBlockFlow (anonymous) at (0,20) size 784x0 + LayoutBlockFlow {DIV} at (0,0) size 784x0 + LayoutBlockFlow (anonymous) at (0,20) size 784x20 + LayoutInline {SPAN} at (0,0) size 98x19 + LayoutTable (anonymous) at (0,0) size 98x20 + LayoutTableSection (anonymous) at (0,0) size 98x20 + LayoutTableRow (anonymous) at (0,0) size 98x20 + LayoutTableCell {DIV} at (0,0) size 98x20 [r=0 c=0 rs=1 cs=1] + LayoutText {#text} at (0,0) size 98x19 + text run at (0,0) width 98: "...continues here" + LayoutBlockFlow {DIV} at (0,247) size 784x20 + LayoutInline {SPAN} at (0,0) size 220x19 + LayoutText {#text} at (0,0) size 38x19 + text run at (0,0) width 38: "Text..." + LayoutText {#text} at (37,0) size 85x19 + text run at (37,0) width 85: "goes here and" + LayoutTable (anonymous) at (121.88,0) size 98x20 LayoutTableSection (anonymous) at (0,0) size 98x20 LayoutTableRow {DIV} at (0,0) size 98x20 LayoutTableCell (anonymous) at (0,0) size 98x20 [r=0 c=0 rs=1 cs=1] LayoutText {#text} at (0,0) size 98x19 text run at (0,0) width 98: "...continues here" - LayoutBlockFlow (anonymous) at (0,40) size 769x0 - LayoutInline {SPAN} at (0,0) size 0x0 - LayoutBlockFlow {DIV} at (0,372) size 769x40 - LayoutBlockFlow (anonymous) at (0,0) size 769x20 - LayoutInline {SPAN} at (0,0) size 38x19 - LayoutText {#text} at (0,0) size 38x19 - text run at (0,0) width 38: "Text..." - LayoutBlockFlow (anonymous) at (0,20) size 769x20 - LayoutTable (anonymous) at (0,0) size 98x20 + LayoutBlockFlow {DIV} at (0,267) size 784x35 + LayoutInline {SPAN} at (0,0) size 136x19 + LayoutText {#text} at (0,0) size 38x19 + text run at (0,0) width 38: "Text..." + LayoutTable (anonymous) at (37.88,15) size 98x20 LayoutTableSection (anonymous) at (0,0) size 98x20 LayoutTableRow (anonymous) at (0,0) size 98x0 LayoutTableCell {TD} at (0,0) size 98x0 [r=0 c=0 rs=1 cs=1] @@ -127,76 +104,60 @@ layer at (0,0) size 785x748 backgroundClip at (0,0) size 785x600 clip at (0,0) s LayoutTableCell (anonymous) at (0,0) size 98x20 [r=1 c=0 rs=1 cs=1] LayoutText {#text} at (0,0) size 98x19 text run at (0,0) width 98: "...continues here" - LayoutBlockFlow (anonymous) at (0,40) size 769x0 - LayoutInline {SPAN} at (0,0) size 0x0 - LayoutBlockFlow {DIV} at (0,412) size 769x40 - LayoutBlockFlow (anonymous) at (0,0) size 769x20 - LayoutInline {SPAN} at (0,0) size 38x19 - LayoutText {#text} at (0,0) size 38x19 - text run at (0,0) width 38: "Text..." - LayoutBlockFlow (anonymous) at (0,20) size 769x20 - LayoutTable (anonymous) at (0,0) size 98x20 + LayoutBlockFlow {DIV} at (0,302) size 784x35 + LayoutInline {SPAN} at (0,0) size 136x19 + LayoutText {#text} at (0,0) size 38x19 + text run at (0,0) width 38: "Text..." + LayoutTable (anonymous) at (37.88,15) size 98x20 LayoutTableSection (anonymous) at (0,0) size 98x20 LayoutTableRow {TR} at (0,0) size 98x0 LayoutTableRow {DIV} at (0,0) size 98x20 LayoutTableCell (anonymous) at (0,0) size 98x20 [r=1 c=0 rs=1 cs=1] LayoutText {#text} at (0,0) size 98x19 text run at (0,0) width 98: "...continues here" - LayoutBlockFlow (anonymous) at (0,40) size 769x0 - LayoutInline {SPAN} at (0,0) size 0x0 - LayoutBlockFlow {DIV} at (0,452) size 769x40 - LayoutBlockFlow (anonymous) at (0,0) size 769x20 - LayoutInline {SPAN} at (0,0) size 38x19 - LayoutText {#text} at (0,0) size 38x19 - text run at (0,0) width 38: "Text..." - LayoutInline {SPAN} at (0,0) size 1x19 - LayoutBlockFlow (anonymous) at (0,20) size 769x20 - LayoutTable (anonymous) at (0,0) size 98x20 + LayoutBlockFlow {DIV} at (0,337) size 784x20 + LayoutInline {SPAN} at (0,0) size 136x19 + LayoutText {#text} at (0,0) size 38x19 + text run at (0,0) width 38: "Text..." + LayoutInline {SPAN} at (0,0) size 1x19 + LayoutTable (anonymous) at (37.88,0) size 98x20 LayoutTableSection (anonymous) at (0,0) size 98x20 LayoutTableRow {DIV} at (0,0) size 98x20 LayoutTableCell (anonymous) at (0,0) size 98x20 [r=0 c=0 rs=1 cs=1] LayoutText {#text} at (0,0) size 98x19 text run at (0,0) width 98: "...continues here" - LayoutBlockFlow (anonymous) at (0,40) size 769x0 - LayoutInline {SPAN} at (0,0) size 0x0 - LayoutBlockFlow {DIV} at (0,492) size 769x40 - LayoutBlockFlow (anonymous) at (0,0) size 769x20 + LayoutBlockFlow {DIV} at (0,357) size 784x40 + LayoutBlockFlow (anonymous) at (0,0) size 784x20 LayoutInline {SPAN} at (0,0) size 38x19 LayoutText {#text} at (0,0) size 38x19 text run at (0,0) width 38: "Text..." - LayoutBlockFlow (anonymous) at (0,20) size 769x20 - LayoutBlockFlow {DIV} at (0,0) size 769x0 - LayoutTable (anonymous) at (0,0) size 98x20 - LayoutTableSection (anonymous) at (0,0) size 98x20 - LayoutTableRow {DIV} at (0,0) size 98x20 - LayoutTableCell (anonymous) at (0,0) size 98x20 [r=0 c=0 rs=1 cs=1] - LayoutText {#text} at (0,0) size 98x19 - text run at (0,0) width 98: "...continues here" - LayoutBlockFlow (anonymous) at (0,40) size 769x0 - LayoutInline {SPAN} at (0,0) size 0x0 - LayoutBlockFlow {DIV} at (0,532) size 769x40 - LayoutBlockFlow (anonymous) at (0,0) size 769x20 - LayoutInline {SPAN} at (0,0) size 122x19 - LayoutText {#text} at (0,0) size 38x19 - text run at (0,0) width 38: "Text..." - LayoutText {#text} at (37,0) size 85x19 - text run at (37,0) width 85: "goes here and" - LayoutBlockFlow (anonymous) at (0,20) size 769x20 - LayoutTable (anonymous) at (0,0) size 98x20 + LayoutBlockFlow (anonymous) at (0,20) size 784x0 + LayoutBlockFlow {DIV} at (0,0) size 784x0 + LayoutBlockFlow (anonymous) at (0,20) size 784x20 + LayoutInline {SPAN} at (0,0) size 98x19 + LayoutTable (anonymous) at (0,0) size 98x20 + LayoutTableSection (anonymous) at (0,0) size 98x20 + LayoutTableRow {DIV} at (0,0) size 98x20 + LayoutTableCell (anonymous) at (0,0) size 98x20 [r=0 c=0 rs=1 cs=1] + LayoutText {#text} at (0,0) size 98x19 + text run at (0,0) width 98: "...continues here" + LayoutBlockFlow {DIV} at (0,397) size 784x20 + LayoutInline {SPAN} at (0,0) size 220x19 + LayoutText {#text} at (0,0) size 38x19 + text run at (0,0) width 38: "Text..." + LayoutText {#text} at (37,0) size 85x19 + text run at (37,0) width 85: "goes here and" + LayoutTable (anonymous) at (121.88,0) size 98x20 LayoutTableSection {DIV} at (0,0) size 98x20 LayoutTableRow (anonymous) at (0,0) size 98x20 LayoutTableCell (anonymous) at (0,0) size 98x20 [r=0 c=0 rs=1 cs=1] LayoutText {#text} at (0,0) size 98x19 text run at (0,0) width 98: "...continues here" - LayoutBlockFlow (anonymous) at (0,40) size 769x0 - LayoutInline {SPAN} at (0,0) size 0x0 - LayoutBlockFlow {DIV} at (0,572) size 769x40 - LayoutBlockFlow (anonymous) at (0,0) size 769x20 - LayoutInline {SPAN} at (0,0) size 38x19 - LayoutText {#text} at (0,0) size 38x19 - text run at (0,0) width 38: "Text..." - LayoutBlockFlow (anonymous) at (0,20) size 769x20 - LayoutTable (anonymous) at (0,0) size 98x20 + LayoutBlockFlow {DIV} at (0,417) size 784x35 + LayoutInline {SPAN} at (0,0) size 136x19 + LayoutText {#text} at (0,0) size 38x19 + text run at (0,0) width 38: "Text..." + LayoutTable (anonymous) at (37.88,15) size 98x20 LayoutTableSection (anonymous) at (0,0) size 98x0 LayoutTableRow (anonymous) at (0,0) size 98x0 LayoutTableCell {TD} at (0,0) size 98x0 [r=0 c=0 rs=1 cs=1] @@ -205,15 +166,11 @@ layer at (0,0) size 785x748 backgroundClip at (0,0) size 785x600 clip at (0,0) s LayoutTableCell (anonymous) at (0,0) size 98x20 [r=0 c=0 rs=1 cs=1] LayoutText {#text} at (0,0) size 98x19 text run at (0,0) width 98: "...continues here" - LayoutBlockFlow (anonymous) at (0,40) size 769x0 - LayoutInline {SPAN} at (0,0) size 0x0 - LayoutBlockFlow {DIV} at (0,612) size 769x40 - LayoutBlockFlow (anonymous) at (0,0) size 769x20 - LayoutInline {SPAN} at (0,0) size 38x19 - LayoutText {#text} at (0,0) size 38x19 - text run at (0,0) width 38: "Text..." - LayoutBlockFlow (anonymous) at (0,20) size 769x20 - LayoutTable (anonymous) at (0,0) size 98x20 + LayoutBlockFlow {DIV} at (0,452) size 784x35 + LayoutInline {SPAN} at (0,0) size 136x19 + LayoutText {#text} at (0,0) size 38x19 + text run at (0,0) width 38: "Text..." + LayoutTable (anonymous) at (37.88,15) size 98x20 LayoutTableSection (anonymous) at (0,0) size 98x0 LayoutTableRow {TR} at (0,0) size 98x0 LayoutTableSection {DIV} at (0,0) size 98x20 @@ -221,35 +178,29 @@ layer at (0,0) size 785x748 backgroundClip at (0,0) size 785x600 clip at (0,0) s LayoutTableCell (anonymous) at (0,0) size 98x20 [r=0 c=0 rs=1 cs=1] LayoutText {#text} at (0,0) size 98x19 text run at (0,0) width 98: "...continues here" - LayoutBlockFlow (anonymous) at (0,40) size 769x0 - LayoutInline {SPAN} at (0,0) size 0x0 - LayoutBlockFlow {DIV} at (0,652) size 769x40 - LayoutBlockFlow (anonymous) at (0,0) size 769x20 - LayoutInline {SPAN} at (0,0) size 38x19 - LayoutText {#text} at (0,0) size 38x19 - text run at (0,0) width 38: "Text..." - LayoutInline {SPAN} at (0,0) size 1x19 - LayoutBlockFlow (anonymous) at (0,20) size 769x20 - LayoutTable (anonymous) at (0,0) size 98x20 + LayoutBlockFlow {DIV} at (0,487) size 784x20 + LayoutInline {SPAN} at (0,0) size 136x19 + LayoutText {#text} at (0,0) size 38x19 + text run at (0,0) width 38: "Text..." + LayoutInline {SPAN} at (0,0) size 1x19 + LayoutTable (anonymous) at (37.88,0) size 98x20 LayoutTableSection {DIV} at (0,0) size 98x20 LayoutTableRow (anonymous) at (0,0) size 98x20 LayoutTableCell (anonymous) at (0,0) size 98x20 [r=0 c=0 rs=1 cs=1] LayoutText {#text} at (0,0) size 98x19 text run at (0,0) width 98: "...continues here" - LayoutBlockFlow (anonymous) at (0,40) size 769x0 - LayoutInline {SPAN} at (0,0) size 0x0 - LayoutBlockFlow {DIV} at (0,692) size 769x40 - LayoutBlockFlow (anonymous) at (0,0) size 769x20 + LayoutBlockFlow {DIV} at (0,507) size 784x40 + LayoutBlockFlow (anonymous) at (0,0) size 784x20 LayoutInline {SPAN} at (0,0) size 38x19 LayoutText {#text} at (0,0) size 38x19 text run at (0,0) width 38: "Text..." - LayoutBlockFlow (anonymous) at (0,20) size 769x20 - LayoutBlockFlow {DIV} at (0,0) size 769x0 - LayoutTable (anonymous) at (0,0) size 98x20 - LayoutTableSection {DIV} at (0,0) size 98x20 - LayoutTableRow (anonymous) at (0,0) size 98x20 - LayoutTableCell (anonymous) at (0,0) size 98x20 [r=0 c=0 rs=1 cs=1] - LayoutText {#text} at (0,0) size 98x19 - text run at (0,0) width 98: "...continues here" - LayoutBlockFlow (anonymous) at (0,40) size 769x0 - LayoutInline {SPAN} at (0,0) size 0x0 + LayoutBlockFlow (anonymous) at (0,20) size 784x0 + LayoutBlockFlow {DIV} at (0,0) size 784x0 + LayoutBlockFlow (anonymous) at (0,20) size 784x20 + LayoutInline {SPAN} at (0,0) size 98x19 + LayoutTable (anonymous) at (0,0) size 98x20 + LayoutTableSection {DIV} at (0,0) size 98x20 + LayoutTableRow (anonymous) at (0,0) size 98x20 + LayoutTableCell (anonymous) at (0,0) size 98x20 [r=0 c=0 rs=1 cs=1] + LayoutText {#text} at (0,0) size 98x19 + text run at (0,0) width 98: "...continues here" diff --git a/third_party/WebKit/Source/core/layout/LayoutInline.cpp b/third_party/WebKit/Source/core/layout/LayoutInline.cpp index 80c9ec1..3f38d05 100644 --- a/third_party/WebKit/Source/core/layout/LayoutInline.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutInline.cpp @@ -258,6 +258,11 @@ LayoutRect LayoutInline::localCaretRect(InlineBox* inlineBox, int, LayoutUnit* e void LayoutInline::addChild(LayoutObject* newChild, LayoutObject* beforeChild) { + // Any table-part dom child of an inline element has anonymous wrappers in the layout tree + // so we need to climb up to the enclosing anonymous table wrapper and add the new child before that. + // TODO(rhogan): If newChild is a table part we want to insert it into the same table as beforeChild. + while (beforeChild && beforeChild->isTablePart()) + beforeChild = beforeChild->parent(); if (continuation()) return addChildToContinuation(newChild, beforeChild); return addChildIgnoringContinuation(newChild, beforeChild); @@ -301,7 +306,7 @@ void LayoutInline::addChildIgnoringContinuation(LayoutObject* newChild, LayoutOb if (!beforeChild && isAfterContent(lastChild())) beforeChild = lastChild(); - if (!newChild->isInline() && !newChild->isFloatingOrOutOfFlowPositioned()) { + if (!newChild->isInline() && !newChild->isFloatingOrOutOfFlowPositioned() && !newChild->isTablePart()) { // We are placing a block inside an inline. We have to perform a split of this // inline into continuations. This involves creating an anonymous block box to hold // |newChild|. We then make that block box a continuation of this inline. We take all of @@ -486,8 +491,10 @@ void LayoutInline::splitFlow(LayoutObject* beforeChild, LayoutBlock* newBlockBox void LayoutInline::addChildToContinuation(LayoutObject* newChild, LayoutObject* beforeChild) { + // A continuation always consists of two potential candidates: an inline or an anonymous + // block box holding block children. LayoutBoxModelObject* flow = continuationBefore(beforeChild); - ASSERT(!beforeChild || beforeChild->parent()->isLayoutBlock() || beforeChild->parent()->isLayoutInline()); + ASSERT(!beforeChild || beforeChild->parent()->isAnonymousBlock() || beforeChild->parent()->isLayoutInline()); LayoutBoxModelObject* beforeChildParent = nullptr; if (beforeChild) { beforeChildParent = toLayoutBoxModelObject(beforeChild->parent()); @@ -499,12 +506,13 @@ void LayoutInline::addChildToContinuation(LayoutObject* newChild, LayoutObject* beforeChildParent = flow; } + // TODO(rhogan): Should we treat out-of-flows and floats as through they're inline below? if (newChild->isFloatingOrOutOfFlowPositioned()) return beforeChildParent->addChildIgnoringContinuation(newChild, beforeChild); - // A continuation always consists of two potential candidates: an inline or an anonymous - // block box holding block children. - bool childInline = newChild->isInline(); + // A table part will be wrapped by an inline anonymous table when it is added to the layout + // tree, so treat it as inline when deciding where to add it. + bool childInline = newChild->isInline() || newChild->isTablePart(); bool bcpInline = beforeChildParent->isInline(); bool flowInline = flow->isInline(); diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp index fe7120a..9b54b8c 100644 --- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp @@ -348,7 +348,7 @@ void LayoutObject::addChild(LayoutObject* newChild, LayoutObject* beforeChild) table = toLayoutTable(afterChild); } else { table = LayoutTable::createAnonymousWithParent(this); - addChild(table, beforeChild); + children->insertChildNode(this, table, beforeChild); } table->addChild(newChild); } else { diff --git a/third_party/WebKit/Source/core/layout/LayoutTable.cpp b/third_party/WebKit/Source/core/layout/LayoutTable.cpp index 6188720..ee60327 100644 --- a/third_party/WebKit/Source/core/layout/LayoutTable.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutTable.cpp @@ -1365,7 +1365,7 @@ bool LayoutTable::nodeAtPoint(HitTestResult& result, const HitTestLocation& loca LayoutTable* LayoutTable::createAnonymousWithParent(const LayoutObject* parent) { - RefPtr<ComputedStyle> newStyle = ComputedStyle::createAnonymousStyleWithDisplay(parent->styleRef(), TABLE); + RefPtr<ComputedStyle> newStyle = ComputedStyle::createAnonymousStyleWithDisplay(parent->styleRef(), parent->isLayoutInline() ? INLINE_TABLE : TABLE); LayoutTable* newTable = new LayoutTable(nullptr); newTable->setDocumentForAnonymous(&parent->document()); newTable->setStyle(newStyle.release()); |