Skip to content

Commit

Permalink
[LayoutNG] Make table captions calculate their own margins
Browse files Browse the repository at this point in the history
Before this, auto margins were always resolved as 0

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: I38f45a656d993aa12ee5afff720d4db3239bbb45
Reviewed-on: https://chromium-review.googlesource.com/1220398
Commit-Queue: David Grogan <dgrogan@chromium.org>
Reviewed-by: Morten Stenshorne <mstensho@chromium.org>
Reviewed-by: Christian Biesinger <cbiesinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594018}
  • Loading branch information
davidsgrogan authored and chromium-wpt-export-bot committed Sep 25, 2018
1 parent e6c8f04 commit 770fcb8
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions css/css-tables/caption-writing-mode-001.html
@@ -0,0 +1,40 @@
<!DOCTYPE html>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<link rel="author" title="David Grogan" href="dgrogan@chromium.org">
<link rel="help" href="https://www.w3.org/TR/css-writing-modes-3/#orthogonal-flows">
<meta name="flags" content="" />
<meta name="assert" content="caption margins are resolved against table's height when table has vertical flow" />
<style>
x-table {
display: table;
width: 300px;
height: 200px;
writing-mode: vertical-lr;
outline: 2px dashed blue;
}
x-caption {
display: table-caption;
height: 50px;
width: 120px;
writing-mode: horizontal-tb;
outline: 1px solid black;
}
</style>

<x-table>
<x-caption id=captionMarginLeft style="margin-left:20%">caption</x-caption>
</x-table>
<x-table>
<x-caption id=captionMarginTop style="margin:auto 0">caption</x-caption>
</x-table>
<p>This is a script test because of how ridiculously differently the current
engines render these cases.</p>


<script>
let caption_margin_left = getComputedStyle(id=captionMarginLeft).marginLeft;
test(() => assert_equals(caption_margin_left, "40px"), "Caption percent margins are resolved against table's height for vertical-lr tables");
let caption_margin_top = getComputedStyle(captionMarginTop).marginTop;
test(() => assert_equals(caption_margin_top, "75px"), "Caption with auto top/bottom margins is centered vertically for vertical-lr tables");
</script>

0 comments on commit 770fcb8

Please sign in to comment.