gecko-dev/testing/web-platform/tests/css/cssom-view/offsetTopLeft-trailing-space-inline.html
Xianzhu Wang 464967d0dd Bug 1550205 [wpt PR 16390] - Add more offsetLeft/offsetTop for tests empty/space inline elements, a=testonly
Automatic update from web-platform-tests
Add more offsetLeft/offsetTop for tests empty/space inline elements

Besides the test for empty inline elements, this CL also adds tests
for inline elements containing spaces that are leading/trailing of the
lines, to test that offsetLeft/offsetTop still works regardless of
space collapsing.

Also rename the tests to follow the common naming convention.

Bug: 953479
Change-Id: I1c447e205b48b7cc54b358e6e9c66dced05f4684
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1572538
Reviewed-by: Koji Ishii <kojii@chromium.org>
Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Auto-Submit: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#652167}

--

wpt-commits: ebf30da797aaac8bc429dbc6c01297399223f8fe
wpt-pr: 16390


--HG--
rename : testing/web-platform/tests/css/cssom-view/offsetTopLeftEmptyInline.html => testing/web-platform/tests/css/cssom-view/offsetTopLeft-empty-inline-offset.html
rename : testing/web-platform/tests/css/cssom-view/offsetTopLeftInline.html => testing/web-platform/tests/css/cssom-view/offsetTopLeft-inline.html
2019-06-05 10:26:46 +01:00

36 lines
1.2 KiB
HTML

<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/cssom-view-1/#extensions-to-the-htmlelement-interface">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<style>
.container {
position: relative;
width: 8em;
height: 7em;
padding: 1em;
}
</style>
<div class="container" style="writing-mode:horizontal-tb;">
<br><span>ref</span><span class="target"> </span>
</div>
<div class="container" style="writing-mode:vertical-lr;">
<br><span>ref</span><span class="target"> </span>
</div>
<div class="container" style="writing-mode:vertical-rl;">
<br><span>ref</span><span class="target"> </span>
</div>
<script>
var i = 0;
document.querySelectorAll('span.target').forEach((target) => {
var ref = target.previousSibling;
test(() => {
assert_equals(target.offsetLeft,
ref.offsetLeft + (i ? 0 : ref.offsetWidth),
'offsetLeft');
assert_equals(target.offsetTop,
ref.offsetTop + (i ? ref.offsetHeight : 0),
'offsetTop');
}, 'offsetTop/Left of empty inline elements should work as if they were not empty: ' + i);
i++;
});
</script>