Bug 1087872 - Tests for dynamic change of ruby frames. r=bz

--HG--
extra : rebase_source : 0c936ec06cd52f4d4fdd866de4b59f9501e95dae
extra : amend_source : 37d0fd1342c0538ae4cab882f3bc6f1cf72e9dc2
extra : source : c3c886f19e3a6bb7a3bb9de7fb2edaabdf4ffb57
This commit is contained in:
Xidorn Quan 2014-12-10 16:23:21 +11:00
parent 6ec4718259
commit 6105732a11
15 changed files with 430 additions and 0 deletions

View File

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Bug 1087872 - Test for dynamic insertion of ruby frames</title>
<link rel="stylesheet" href="common.css">
</head>
<body>
<p>One space should exist between 'a' and 'b':</p>
<p>a<rbc><rb></rb> <rb></rb></rbc>b</p>
<p>a<ruby><rb></rb> <rb></rb></ruby>b</p>
<p>a<ruby><rbc></rbc> <rbc></rbc></ruby>b</p>
<p>a<rtc><rt></rt> <rt></rt></rtc>b</p>
<p>a<ruby><rt></rt> <rt></rt></ruby>b</p>
<p>a<rbc><rb></rb> <rb></rb></rbc>b</p>
<p>a<ruby><rb></rb> <rb></rb></ruby>b</p>
<p>a<ruby><rbc></rbc> <rbc></rbc></ruby>b</p>
<p>a<rtc><rt></rt> <rt></rt></rtc>b</p>
<p>a<ruby><rt></rt> <rt></rt></ruby>b</p>
<p>a<rb></rb><span></span> <rt></rt>b</p>
<p>a<rb></rb> <span></span><rt></rt>b</p>
<p>a<rb></rb> <rb></rb><rt></rt>b</p>
<p>a<rt></rt><rb></rb> <rb></rb>b</p>
<p>a<rbc></rbc> <rbc></rbc><rt></rt>b</p>
<p>a<rb></rb><rt></rt> <rt></rt>b</p>
<p>a<rt></rt> <rt></rt><rb></rb>b</p>
<p>a<rb></rb> <rb></rb>b</p>
<p>a<rbc></rbc> <rbc></rbc>b</p>
<p>a<rt></rt> <rt></rt>b</p>
</body>
</html>

View File

@ -0,0 +1,55 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Bug 1087872 - Test for dynamic insertion of ruby frames</title>
<link rel="stylesheet" href="common.css">
<script src="dynamic-insertion.js"></script>
</head>
<body>
<p>One space should exist between 'a' and 'b':</p>
<!-- leading white space -->
<!-- => inter-base white space -->
<p>a<rbc data-insert="start" data-tag="rb"> <rb></rb></rbc>b</p>
<p>a<ruby data-insert="start" data-tag="rb"> <rb></rb></ruby>b</p>
<!-- => inter-segment white space -->
<p>a<ruby data-insert="start" data-tag="rbc"> <rbc></rbc></ruby>b</p>
<!-- => inter-annotation white space -->
<p>a<rtc data-insert="start" data-tag="rt"> <rt></rt></rtc>b</p>
<p>a<ruby data-insert="start" data-tag="rt"> <rt></rt></ruby>b</p>
<!-- trailing white space -->
<!-- => inter-base white space -->
<p>a<rbc data-insert="end" data-tag="rb"><rb></rb> </rbc>b</p>
<p>a<ruby data-insert="end" data-tag="rb"><rb></rb> </ruby>b</p>
<!-- => inter-segment white space -->
<p>a<ruby data-insert="end" data-tag="rbc"><rbc></rbc> </ruby>b</p>
<!-- => inter-annotation white space -->
<p>a<rtc data-insert="end" data-tag="rt"><rt></rt> </rtc>b</p>
<p>a<ruby data-insert="end" data-tag="rt"><rt></rt> </ruby>b</p>
<!-- inter-level white space -->
<!-- => normal white space -->
<p>a<rb data-insert="after" data-tag="span"></rb> <rt></rt>b</p>
<p>a<rb></rb> <rt data-insert="before" data-tag="span"></rt>b</p>
<!-- => inter-base white space -->
<p>a<rb></rb> <rt data-insert="before" data-tag="rb"></rt>b</p>
<p>a<rt data-insert="after" data-tag="rb"></rt> <rb></rb>b</p>
<!-- => inter-segment white space -->
<p>a<rbc></rbc> <rt data-insert="before" data-tag="rbc"></rt>b</p>
<!-- => inter-annotation white space -->
<p>a<rb data-insert="after" data-tag="rt"></rb> <rt></rt>b</p>
<p>a<rt></rt> <rb data-insert="before" data-tag="rt"></rb>b</p>
<!-- insert white space -->
<!-- inter-base white space -->
<p>a<rb data-insert="after" data-text=" "></rb><rb></rb>b</p>
<!-- inter-segment white space -->
<p>a<rbc data-insert="after" data-text=" "></rbc><rbc></rbc>b</p>
<!-- inter-annotation white space -->
<p>a<rt data-insert="after" data-text=" "></rt><rt></rt>b</p>
</body>
</html>

View File

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Bug 1087872 - Test for dynamic insertion of ruby frames</title>
<link rel="stylesheet" href="common.css">
</head>
<body>
<p>No space should exist between 'a' and 'b':</p>
<p><span>a</span><rb></rb> <rt></rt>b</p>
<p>a<rb></rb> <rt></rt><span>b</span></p>
<p>a<rb></rb> <rt></rt><rb></rb>b</p>
<p>a<rbc></rbc> <rt></rt><rb></rb>b</p>
<p>a<rt></rt><rb></rb> <rt></rt>b</p>
<p>a<ruby> <rb></rb></ruby>b</p>
<p>a<rbc> <rb></rb></rbc>b</p>
<p>a<rtc> <rt></rt></rtc>b</p>
<p>a<ruby><rb></rb> </ruby>b</p>
<p>a<rbc><rb></rb> </rbc>b</p>
<p>a<rtc><rt></rt> </rtc>b</p>
<p>a<rb></rb> <rt></rt>b</p>
</body>
</html>

View File

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Bug 1087872 - Test for dynamic insertion of ruby frames</title>
<link rel="stylesheet" href="common.css">
<script src="dynamic-insertion.js"></script>
</head>
<body>
<p>No space should exist between 'a' and 'b':</p>
<!-- inter-level white space -->
<!-- <= normal white space -->
<p><span data-insert="after" data-tag="rb">a</span> <rt></rt>b</p>
<p>a<rb></rb> <span data-insert="before" data-tag="rt">b</span></p>
<!-- <= inter-base white space -->
<p>a<rb></rb> <rb data-insert="before" data-tag="rt"></rb>b</p>
<!-- <= inter-segment white space -->
<p>a<rbc></rbc> <rb data-insert="before" data-tag="rt"></rb>b</p>
<!-- <= inter-annotation white space -->
<p>a<rt data-insert="after" data-tag="rb"></rt> <rt></rt>b</p>
<!-- insert white space -->
<!-- leading white space -->
<p>a<ruby data-insert="start" data-text=" "><rb></rb></ruby>b</p>
<p>a<rbc data-insert="start" data-text=" "><rb></rb></rbc>b</p>
<p>a<rtc data-insert="start" data-text=" "><rt></rt></rtc>b</p>
<!-- trailing white space -->
<p>a<ruby data-insert="end" data-text=" "><rb></rb></ruby>b</p>
<p>a<rbc data-insert="end" data-text=" "><rb></rb></rbc>b</p>
<p>a<rtc data-insert="end" data-text=" "><rt></rt></rtc>b</p>
<!-- inter-level white space -->
<p>a<rb data-insert="after" data-text=" "></rb><rt></rt>b</p>
</body>
</html>

View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Bug 1087872 - Test for dynamic insertion of ruby frames</title>
<link rel="stylesheet" href="common.css">
</head>
<body>
<p>'a' and 'b' should be paired with 'x' and 'y' respectively:</p>
<p><rb></rb><span></span><rb>a</rb><rb>b</rb><rt>x</rt><rt>y</rt></p>
<p><rb></rb><rt></rt><rb>a</rb><rb>b</rb><rt>x</rt><rt>y</rt></p>
<p><rb>a</rb><rt>x</rt><rb>b</rb><rt>y</rt></p>
<p><rbc><span>a</span><rb></rb>b</rbc><rt>x</rt><rt></rt><rt>y</rt></p>
<p><rb>a</rb><rb></rb><rb>b</rb><rtc><span>x</span><rt></rt>y</rtc></p>
</body>
</html>

View File

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Bug 1087872 - Test for dynamic insertion of ruby frames</title>
<link rel="stylesheet" href="common.css">
<script src="dynamic-insertion.js"></script>
</head>
<body>
<p>'a' and 'b' should be paired with 'x' and 'y' respectively:</p>
<!-- split -->
<!-- pseudo ruby -->
<p><rb data-insert="after" data-tag="span"></rb><rb>a</rb><rb>b</rb><rt>x</rt><rt>y</rt></p>
<!-- pseudo ruby base container -->
<p><rb data-insert="after" data-tag="rt"></rb><rb>a</rb><rb>b</rb><rt>x</rt><rt>y</rt></p>
<!-- pseudo ruby text container -->
<p><rb>a</rb><rt data-insert="after" data-tag="rb" data-text="b">x</rt><rt>y</rt></p>
<!-- pseudo ruby base -->
<p><rbc><span data-insert="after" data-tag="rb">a</span>b</rbc><rt>x</rt><rt></rt><rt>y</rt></p>
<!-- pseudo ruby text -->
<p><rb>a</rb><rb></rb><rb>b</rb><rtc><span data-insert="after" data-tag="rt">x</span>y</rtc></p>
</body>
</html>

View File

@ -0,0 +1,42 @@
window.onload = function() {
// Force a reflow before any changes.
document.body.clientWidth;
var elems = document.querySelectorAll('[data-insert]');
Array.from(elems).forEach(function(e) {
var parent, ref;
switch (e.dataset.insert) {
case 'start':
parent = e;
ref = e.firstChild;
break;
case 'end':
parent = e;
ref = null;
break;
case 'before':
parent = e.parentNode;
ref = e;
break;
case 'after':
parent = e.parentNode;
ref = e.nextSibling;
break;
}
var elem, textnode;
if ('text' in e.dataset) {
textnode = document.createTextNode(e.dataset.text);
}
if ('tag' in e.dataset) {
elem = document.createElement(e.dataset.tag);
if (textnode) {
elem.appendChild(textnode);
}
}
parent.insertBefore(elem ? elem : textnode, ref);
});
};

View File

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Bug 1087872 - Test for dynamic removal of ruby frames</title>
<link rel="stylesheet" href="common.css">
</head>
<body>
<p>No space should exist between 'a' and 'b':</p>
<p>a<ruby> <rb></rb></ruby>b</p>
<p>a<ruby><rb></rb> </ruby>b</p>
<p>a<ruby><rb></rb> <rt></rt></ruby>b</p>
<p>a<ruby> <rbc></rbc></ruby>b</p>
<p>a<ruby><rbc></rbc> </ruby>b</p>
<p>a<rbc></rbc> <rtc></rtc>b</p>
<p><rb>a</rb><rb>b</rb><rtc> <rt>x</rt></rtc></p>
<p><rb>a</rb><rb>b</rb><rtc><rt>x</rt> </rtc></p>
<p><rb>a</rb><rb>b</rb> <rt>x</rt></p>
</body>
</html>

View File

@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Bug 1087872 - Test for dynamic removal of ruby frames</title>
<link rel="stylesheet" href="common.css">
<script src="dynamic-removal.js"></script>
</head>
<body>
<p>No space should exist between 'a' and 'b':</p>
<!-- inter-base white space -->
<!-- => leading white space -->
<p>a<ruby><rb class="remove"></rb> <rb></rb></ruby>b</p>
<!-- => trailing white space -->
<p>a<ruby><rb></rb> <rb class="remove"></rb></ruby>b</p>
<!-- => inter-level white space -->
<p>a<ruby><rb></rb> <rb class="remove"></rb><rt></rt></ruby>b</p>
<!-- inter-segment white space -->
<!-- => leading white space -->
<p>a<ruby><rbc class="remove"></rbc> <rbc></rbc></ruby>b</p>
<!-- => trailing white space -->
<p>a<ruby><rbc></rbc> <rbc class="remove"></rbc></ruby>b</p>
<!-- => inter-level white space -->
<p>a<rbc></rbc> <rbc class="remove"></rbc><rtc></rtc>b</p>
<!-- inter-annotation white space -->
<!-- => leading white space -->
<p><rb>a</rb><rb>b</rb><rtc><rt class="remove"></rt> <rt>x</rt></rtc></p>
<!-- => trailing white space -->
<p><rb>a</rb><rb>b</rb><rtc><rt>x</rt> <rt class="remove"></rt></rtc></p>
<!-- => inter-level white space -->
<p><rb>a</rb><rb>b</rb><rt class="remove"></rt> <rt>x</rt></p>
</body>
</html>

View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Bug 1087872 - Test for dynamic removal of ruby frames</title>
<link rel="stylesheet" href="common.css">
</head>
<body>
<p>One space should exist between 'a' and 'b':</p>
<p>a <rt></rt>b</p>
<p>a<rb></rb> b</p>
<p>a<rb></rb> <rb></rb>b</p>
<p>a<rbc></rbc> <rbc></rbc>b</p>
<p><rb>a</rb> <rb>b</rb><rt>x</rt> <rt>y</rt></p>
</body>

View File

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Bug 1087872 - Test for dynamic removal of ruby frames</title>
<link rel="stylesheet" href="common.css">
<script src="dynamic-removal.js"></script>
</head>
<body>
<p>One space should exist between 'a' and 'b':</p>
<!-- inter-level white space -->
<!-- => normal white space -->
<p>a<rb class="remove"></rb> <rt></rt>b</p>
<p>a<rb></rb> <rt class="remove"></rt>b</p>
<!-- => inter-base white space -->
<p>a<rb></rb> <rt class="remove"></rt><rb></rb>b</p>
<!-- => inter-segment white space -->
<p>a<rbc></rbc> <rtc class="remove"></rtc><rbc></rbc>b</p>
<!-- => inter-annotation white space -->
<p><rb>a</rb> <rb>b</rb><rt>x</rt><rb class="remove"></rb> <rt>y</rt></p>
</body>

View File

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Bug 1087872 - Test for dynamic removal of ruby frames</title>
<link rel="stylesheet" href="common.css">
</head>
<body>
<p>'a' and 'b' should be paired with 'x' and 'y' respectively:</p>
<p><rb>a</rb><rb>b</rb><rt>x</rt><rt>y</rt></p>
<p><rb>a</rb><rb>b</rb><rt>x</rt><rt>y</rt></p>
<p><rb>a</rb><rb>b</rb><rt>x</rt><rt>y</rt></p>
<p><rb>a</rb><rb>b</rb><rt>x</rt><rt>y</rt></p>
<p><rb>a</rb><rb>b</rb><rt>x</rt><rt>y</rt></p>
<p>'ab' should be paried with 'xy':</p>
<p><rbc>ab</rbc><rt>xy</rt></p>
<p><rb>ab</rb><rtc>xy</rtc></p>
</body>
</html>

View File

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Bug 1087872 - Test for dynamic removal of ruby frames</title>
<link rel="stylesheet" href="common.css">
<script src="dynamic-removal.js"></script>
</head>
<body>
<p>'a' and 'b' should be paired with 'x' and 'y' respectively:</p>
<!-- merge -->
<!-- pseudo ruby -->
<p><rb>a</rb><span class="remove"></span><rb>b</rb><rt>x</rt><rt>y</rt></p>
<!-- pseudo ruby base container -->
<p><rb>a</rb><rt class="remove"></rt><rb>b</rb><rt>x</rt><rt>y</rt></p>
<!-- pseudo ruby text container -->
<p><rb>a</rb><rb>b</rb><rt>x</rt><rb class="remove"></rb><rt>y</rt></p>
<!-- white space removal -->
<!-- inter-base white space -->
<p><rb class="remove-after">a</rb> <rb>b</rb><rt>x</rt><rt>y</rt></p>
<!-- inter-annotation white space -->
<p><rb>a</rb><rb>b</rb><rt class="remove-after">x</rt> <rt>y</rt></p>
<p>'ab' should be paried with 'xy':</p>
<!-- merge -->
<!-- pseudo ruby base -->
<p><rbc>a<rb class="remove"></rb>b</rbc><rt>xy</rt></p>
<!-- pseudo ruby text -->
<p><rb>ab</rb><rtc>x<rt class="remove"></rt>y</rtc></p>
</body>
</html>

View File

@ -0,0 +1,14 @@
function getElements(className) {
return Array.from(document.getElementsByClassName(className));
}
window.onload = function() {
// Force a reflow before any changes.
document.body.clientWidth;
getElements('remove').forEach(function(e) {
e.parentNode.removeChild(e);
});
getElements('remove-after').forEach(function(e) {
e.parentNode.removeChild(e.nextSibling);
});
};

View File

@ -5,6 +5,12 @@ default-preferences pref(layout.css.ruby.enabled,true)
== box-generation-3.html box-generation-3-ref.html
== box-generation-4.html box-generation-4-ref.html
== box-generation-5.html box-generation-5-ref.html
== dynamic-insertion-1.html dynamic-insertion-1-ref.html
== dynamic-insertion-2.html dynamic-insertion-2-ref.html
== dynamic-insertion-3.html dynamic-insertion-3-ref.html
== dynamic-removal-1.html dynamic-removal-1-ref.html
== dynamic-removal-2.html dynamic-removal-2-ref.html
== dynamic-removal-3.html dynamic-removal-3-ref.html
== ruby-whitespace-1.html ruby-whitespace-1-ref.html
== ruby-whitespace-2.html ruby-whitespace-2-ref.html
!= ruby-reflow-1-opaqueruby.html ruby-reflow-1-noruby.html