Bug 1112474 part 2 - Fix ruby-position reftests with bsize adjustment. r=dholbert

This commit is contained in:
Xidorn Quan 2015-03-19 19:04:50 +11:00
parent 5c75a5a119
commit 3e9a193e28
7 changed files with 66 additions and 33 deletions

View File

@ -43,8 +43,8 @@ load nested-ruby-1.html
== ruby-align-2.html ruby-align-2-ref.html
== ruby-align-2a.html ruby-align-2-ref.html
== ruby-position-horizontal.html ruby-position-horizontal-ref.html
pref(layout.css.vertical-text.enabled,true) fails == ruby-position-vertical-lr.html ruby-position-vertical-lr-ref.html # bug 1112474
pref(layout.css.vertical-text.enabled,true) fails == ruby-position-vertical-rl.html ruby-position-vertical-rl-ref.html # bug 1112474
pref(layout.css.vertical-text.enabled,true) == ruby-position-vertical-lr.html ruby-position-vertical-lr-ref.html
pref(layout.css.vertical-text.enabled,true) == ruby-position-vertical-rl.html ruby-position-vertical-rl-ref.html
!= ruby-reflow-1-opaqueruby.html ruby-reflow-1-noruby.html
== ruby-reflow-1-transparentruby.html ruby-reflow-1-noruby.html
== ruby-span-1.html ruby-span-1-ref.html

View File

@ -4,10 +4,10 @@
<meta charset="UTF-8">
<title>Bug 1055665 - Test for ruby-position</title>
<link rel="stylesheet" href="common.css">
<script type="text/javascript" src="utils.js"></script>
<style>
body {
font-family: monospace;
line-height: normal;
}
.annotation, .annotation > div {
position: absolute;
@ -16,17 +16,20 @@
</head>
<body>
<div style="height: 8em; line-height: 8em;">
<div style="display: inline-block; line-height: normal;">
<div style="display: inline-block;">
<div class="annotation">
<div style="top: -100%;">over##</div>
<div style="top: 100%;">under#</div>
<div style="top: -200%;">over2#</div>
<div style="top: 200%;">under2</div>
&nbsp; <!-- to give container a nonzero size for
percent values to resolve against -->
<div style="top: -100%;"><span>over##</span></div>
<div style="top: 100%;"><span>under#</span></div>
<div style="top: -200%;"><span>over2#</span></div>
<div style="top: 200%;"><span>under2</span></div>
<!-- to give container the proper block-axis size -->
<span>&nbsp;</span>
</div>
base##
<span>base##</span>
</div>
</div>
<script type="text/javascript">
makeBSizeOfParentMatch(document.getElementsByTagName('span'));
</script>
</body>
</html>

View File

@ -4,11 +4,13 @@
<meta charset="UTF-8">
<title>Bug 1055665 - Test for ruby-position</title>
<link rel="stylesheet" href="common.css">
<script type="text/javascript" src="utils.js"></script>
<style>
html {
writing-mode: vertical-lr;
}
body {
font-family: monospace;
line-height: normal;
writing-mode: vertical-lr;
}
.annotation, .annotation > div {
position: absolute;
@ -17,17 +19,20 @@
</head>
<body>
<div style="width: 8em; line-height: 8em;">
<div style="display: inline-block; line-height: normal;">
<div style="display: inline-block;">
<div class="annotation">
<div style="right: 100%;">left##</div>
<div style="right: -100%;">right#</div>
<div style="right: 200%;">left2#</div>
<div style="right: -200%;">right2</div>
&nbsp; <!-- to give container a nonzero size for
percent values to resolve against -->
<div style="right: 100%;"><span>left##</span></div>
<div style="right: -100%;"><span>right#</span></div>
<div style="right: 200%;"><span>left2#</span></div>
<div style="right: -200%;"><span>right2</span></div>
<!-- to give container the proper block-axis size -->
<span>&nbsp;</span>
</div>
base##
<span>base##</span>
</div>
</div>
<script type="text/javascript">
makeBSizeOfParentMatch(document.getElementsByTagName('span'));
</script>
</body>
</html>

View File

@ -5,11 +5,13 @@
<title>Bug 1055665 - Test for ruby-position</title>
<link rel="stylesheet" href="common.css">
<style>
html {
writing-mode: vertical-lr;
}
body {
font-family: monospace;
/* use a large line-height here to avoid additional leadings */
line-height: 8em;
writing-mode: vertical-lr;
}
rtc, rt {
font-size: 100% !important;

View File

@ -4,11 +4,13 @@
<meta charset="UTF-8">
<title>Bug 1055665 - Test for ruby-position</title>
<link rel="stylesheet" href="common.css">
<script type="text/javascript" src="utils.js"></script>
<style>
html {
writing-mode: vertical-rl;
}
body {
font-family: monospace;
line-height: normal;
writing-mode: vertical-rl;
}
.annotation, .annotation > div {
position: absolute;
@ -17,17 +19,20 @@
</head>
<body>
<div style="width: 8em; line-height: 8em;">
<div style="display: inline-block; line-height: normal;">
<div style="display: inline-block;">
<div class="annotation">
<div style="right: 100%;">left##</div>
<div style="right: -100%;">right#</div>
<div style="right: 200%;">left2#</div>
<div style="right: -200%;">right2</div>
&nbsp; <!-- to give container a nonzero size for
percent values to resolve against -->
<div style="right: 100%;"><span>left##</span></div>
<div style="right: -100%;"><span>right#</span></div>
<div style="right: 200%;"><span>left2#</span></div>
<div style="right: -200%;"><span>right2</span></div>
<!-- to give container the proper block-axis size -->
<span>&nbsp;</span>
</div>
base##
<span>base##</span>
</div>
</div>
<script type="text/javascript">
makeBSizeOfParentMatch(document.getElementsByTagName('span'));
</script>
</body>
</html>

View File

@ -5,11 +5,13 @@
<title>Bug 1055665 - Test for ruby-position</title>
<link rel="stylesheet" href="common.css">
<style>
html {
writing-mode: vertical-rl;
}
body {
font-family: monospace;
/* use a large line-height here to avoid additional leadings */
line-height: 8em;
writing-mode: vertical-rl;
}
rtc, rt {
font-size: 100% !important;

View File

@ -12,6 +12,22 @@ function setBSize(elem, bsize) {
elem.style.lineHeight = bsize;
}
// Ruby annotations are placed based on block-axis size of inline boxes
// instead of line box. Block-axis size of an inline box is the max
// height of the font, while that of line box is line height. Hence we
// sometimes need to explicitly set the block-axis size of an inline
// box to a block to simulate the exact behavior, which is what the
// following two functions do.
function makeBSizeMatchInlineBox(block, inline) {
setBSize(block, getBSize(inline));
}
function makeBSizeOfParentMatch(elems) {
// The size change is divided into two phases to avoid
// triggering reflow for every element.
for (var elem of elems)
elem.dataset.bsize = getBSize(elem);
for (var elem of elems)
setBSize(elem.parentNode, elem.dataset.bsize);
}