Bug 1140579 - Additional tests and code comment update.

This commit is contained in:
Mats Palmgren 2015-03-09 17:29:00 +00:00
Родитель 6a41f02618
Коммит 73069181c8
7 изменённых файлов: 199 добавлений и 7 удалений

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

@ -0,0 +1,26 @@
<html xmlns="http://www.w3.org/1999/xhtml" style="-moz-binding: url(#foo)">
<head>
<xbl:bindings xmlns:xbl="http://www.mozilla.org/xbl">
<xbl:binding id="foo"><xbl:content><fieldset><xbl:children/></fieldset></xbl:content></xbl:binding>
</xbl:bindings>
<script type="text/javascript">
function boom()
{
var dE = document.documentElement;
var leg = document.createElementNS("http://www.w3.org/1999/xhtml", "legend");
leg.appendChild(document.createTextNode("legend"));
dE.appendChild(leg);
document.documentElement.offsetHeight;
dE.removeChild(leg);
}
</script>
</head>
<body onload="boom();"></body>
</html>

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

@ -0,0 +1,26 @@
<html xmlns="http://www.w3.org/1999/xhtml" style="-moz-binding: url(#foo)">
<head>
<xbl:bindings xmlns:xbl="http://www.mozilla.org/xbl">
<xbl:binding id="foo"><xbl:content><fieldset><xbl:children/></fieldset></xbl:content></xbl:binding>
</xbl:bindings>
<script type="text/javascript">
function boom()
{
var dE = document.documentElement;
var leg = document.createElementNS("http://www.w3.org/1999/xhtml", "legend");
leg.style.position = "absolute";
dE.appendChild(leg);
document.documentElement.offsetHeight;
dE.removeChild(leg);
}
</script>
</head>
<body onload="boom();"></body>
</html>

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

@ -318,6 +318,8 @@ load 495350-1.html
load 496011-1.xhtml
load 497519-1.xhtml
load 497519-2.xhtml
load 497519-3.xhtml
load 497519-4.xhtml
load 499741-1.xhtml
load 499841-1.xhtml
load 499858-1.xhtml

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

@ -3473,14 +3473,11 @@ nsCSSFrameConstructor::FindHTMLData(Element* aElement,
!IsFrameForFieldSet(aParentFrame, aParentFrame->GetType()) ||
aStyleContext->StyleDisplay()->IsFloatingStyle() ||
aStyleContext->StyleDisplay()->IsAbsolutelyPositionedStyle())) {
// <legend> is only special inside fieldset, check both the frame tree
// parent and content tree parent due to XBL issues. For floated or
// absolutely positioned legends we want to construct by display type and
// <legend> is only special inside fieldset, we only check the frame tree
// parent because the content tree parent may not be a <fieldset> due to
// display:contents, Shadow DOM, or XBL. For floated or absolutely
// positioned legends we want to construct by display type and
// not do special legend stuff.
// XXXbz it would be nice if we could just decide this based on the parent
// tag, and hence just use a SIMPLE_TAG_CHAIN for legend below, but the
// fact that with XBL we could end up with this legend element in some
// totally weird insertion point makes that chancy, I think.
return nullptr;
}

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

@ -1 +1,2 @@
skip-if(B2G) == legend.html legend-ref.html
pref(dom.webcomponents.enabled,true) == shadow-dom.html shadow-dom-ref.html

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

@ -0,0 +1,29 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html lang="en-US">
<head>
<title>Test LEGEND placed into FIELDSET shadow DOM</title>
<link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1140579">
<style>
html,body {
color:black; background-color:white; font-size:16px; padding:0; margin:0;
}
.inline { display:inline; }
z,.b { color:blue; }
</style>
</head>
<body>
<fieldset id="host1"><legend>1</legend>a c</fieldset>
<fieldset id="host2"><legend>2</legend>a c</fieldset>
<fieldset id="host3"><legend>3</legend>a c</fieldset>
<fieldset id="host4"><legend>4</legend>a c</fieldset>
<fieldset id="host5"><legend>5</legend>a c</fieldset>
<fieldset id="host6"><legend class="b">6</legend>a c</fieldset>
<fieldset id="host7"><legend>7</legend>a <legend class="inline">L</legend> B</fieldset>
<fieldset id="host8"><legend>a 8</legend>A <legend class="inline">L c</legend> B</fieldset>
<fieldset id="host9"><legend>a 9</legend>A <legend class="inline p0">a L2 c</legend><z>a<legend>L3</legend>c</z> B</fieldset>
</body>
</html>

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

@ -0,0 +1,111 @@
<!DOCTYPE html>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html class="reftest-wait" lang="en-US">
<head>
<title>Test LEGEND placed into FIELDSET shadow DOM</title>
<link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1140579">
<link rel="match" href="shadow-dom-ref.html">
<style>
html,body {
color:black; background-color:white; font-size:16px; padding:0; margin:0;
}
.before::before {content: "a ";}
.after::after {content: " c";}
div.before::before {content: "X ";}
div.after::after {content: " Y";}
.b,.c { display:contents; }
</style>
</head>
<body>
<fieldset id="host1" class="before"></fieldset>
<fieldset id="host2"></fieldset>
<fieldset id="host3" class="after"></fieldset>
<fieldset id="host4" class="before after"></fieldset>
<fieldset id="host5" class="after"></fieldset>
<fieldset id="host6" class="before"></fieldset>
<fieldset id="host7"></fieldset>
<fieldset id="host8"></fieldset>
<fieldset id="host9"></fieldset>
<script>
function shadow(id) {
return document.getElementById(id).createShadowRoot();
}
function legend(s) {
var e = document.createElement("legend");
var t = document.createTextNode(s);
e.appendChild(t);
return e;
}
function contents(n) {
var e = document.createElement("z");
e.style.display = "contents";
e.style.color = "blue";
if (n) e.appendChild(n);
return e;
}
document.body.offsetHeight;
shadow("host1").innerHTML = '<content></content> c';
shadow("host2").innerHTML = 'a <content></content> c';
shadow("host3").innerHTML = 'a <content></content>';
shadow("host4").innerHTML = '<content></content>';
shadow("host5").innerHTML = 'a <content></content>';
shadow("host6").innerHTML = '<z style="color:blue; display:contents"><content></content></z> c';
shadow("host7").innerHTML = 'a <content select=".c"></content> <content select=".b"></content> B';
shadow("host8").innerHTML = 'A <content select=".c"></content> <content select=".b"></content> B';
shadow("host9").innerHTML = 'A <content select=".c"></content> <content select=".b"></content> B <content select=".b"></content>';
function tweak() {
document.body.offsetHeight;
host1.appendChild(legend("1"));
host2.appendChild(legend("2"));
host3.appendChild(legend("3"));
host4.appendChild(legend("4"));
var e = legend("5");
e.style.display = "contents";
host5.appendChild(e);
host6.appendChild(legend("6"));
var e = legend("L");
e.className = "b";
host7.appendChild(e);
var e = legend("7");
e.className = "c";
host7.appendChild(e);
var e = legend("L");
e.className = "b after";
host8.appendChild(e);
var e = legend("8");
e.className = "c before";
host8.appendChild(e);
var e = legend("L2");
e.className = "b before after";
host9.appendChild(e);
var e = contents(legend(" L3"));
e.className = "b before after";
host9.appendChild(e);
var e = legend("9");
e.className = "c before";
host9.appendChild(e);
document.body.offsetHeight;
setTimeout(function() {
document.body.offsetHeight;
document.documentElement.removeAttribute("class");
},0);
}
window.addEventListener("MozReftestInvalidate", tweak, false);
</script>
</body>
</html>