Bug 1496219 [wpt PR 13344] - [LayoutNG] Correct getClientRects for inlines in vertical-rl., a=testonly

Automatic update from web-platform-tests[LayoutNG] Correct getClientRects for inlines in vertical-rl.

In LayoutInline::GenerateLineBoxRects(), when collecting rectangles, for
each rectangle, we need to flip its block axis offset, to make it
relative to the block-start of the container, because this is what's
expected by the callback.

GenerateLineBoxRects() is used to implement Element.getClientRects()
(among other things). Added a test that used to fail with LayoutNG,
since this obviously lacked test coverage.

Also had to fix LayoutText::AbsoluteQuadsForRange(), or
fast/writing-mode/flipped-blocks-text-map-local-to-container.html
would regress. It used to pass because getClientRects for a text node
and getClientRects for an inline (separate code paths) had the same bug.

Also had to update NGPhysicalBoxFragment::AddSelfOutlineRects(). Now
that GenerateLineBoxRects() (called from LayoutInline::AddOutlineRects())
behaves consistently and always produces rectangles with the block offset
relative to the block-start of the container (rather than physical top or
left for NG), we need to flip vertical-rl rects to become purely physical
on our own.

Cq-Include-Trybots: luci.chromium.try​:linux_layout_tests_layout_ng
Change-Id: I6a5d6ab6012c20b3a2fd943cb9cd3c6ee53bf052
Reviewed-on: https://chromium-review.googlesource.com/c/1257917
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Reviewed-by: Koji Ishii <kojii@chromium.org>
Reviewed-by: Aleks Totic <atotic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#596576}

--

wpt-commits: a13506a26c944343ab0c51f6c13d8489b1df53d9
wpt-pr: 13344
This commit is contained in:
Morten Stenshorne 2018-10-09 04:14:18 +00:00 коммит произвёл moz-wptsync-bot
Родитель 770f0c1536
Коммит 0a4b4fe449
1 изменённых файлов: 55 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,55 @@
<!DOCTYPE html>
<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org">
<link rel="help" href="https://drafts.csswg.org/cssom-view-1/#dom-element-getclientrects">
<link rel="match" href="../reference/nothing.html">
<style>
.container {
float: left;
width: 8em;
height: 7em;
padding: 1em;
color: red;
}
.correctionFluid {
position: absolute;
background: white;
/* Add some fluff to cover text ink-overflow. */
outline:2px solid white;
}
</style>
<p>There should be nothing below.</p>
<div class="container" style="writing-mode:horizontal-tb;">
<br><span class="child">FAIL</span>
</div>
<div class="container" style="writing-mode:vertical-lr;">
<br><span class="child">FAIL</span>
</div>
<div class="container" style="writing-mode:vertical-rl;">
<br><span class="child">FAIL</span>
</div>
<div class="container" style="writing-mode:horizontal-tb; direction:rtl;">
<br><span class="child">FAIL</span>
</div>
<div class="container" style="writing-mode:vertical-lr; direction:rtl;">
<br><span class="child">FAIL</span>
</div>
<div class="container" style="writing-mode:vertical-rl; direction:rtl;">
<br><span class="child">FAIL</span>
</div>
<script>
// Create a white absolutely positioned box for each span.child
// element and cover it.
let elements = document.querySelectorAll("span.child");
elements.forEach((element)=> {
let correctionFluid = document.createElement("div");
correctionFluid.className = "correctionFluid";
var r = element.getClientRects()[0];
correctionFluid.style.left = r.left + "px";
correctionFluid.style.top = r.top + "px";
correctionFluid.style.width = r.width + "px";
correctionFluid.style.height = r.height + "px";
document.body.appendChild(correctionFluid);
});
</script>