Bug 1140579 - Make <legend>s have a legend frame when nearest ancestor frame is a fieldset frame. r=roc

IOW, drop the requirement that the parent *content* is a <fieldset>,
thus allowing a <legend> to become the fieldset legend also when it's
wrapped in one or more nodes that are styled with display:contents.
This commit is contained in:
Mats Palmgren 2015-03-07 14:53:46 +00:00
Родитель 4c74b7ca6b
Коммит b1a684cc86
2 изменённых файлов: 7 добавлений и 8 удалений

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

@ -3471,8 +3471,6 @@ nsCSSFrameConstructor::FindHTMLData(Element* aElement,
if (aTag == nsGkAtoms::legend &&
(!aParentFrame ||
!IsFrameForFieldSet(aParentFrame, aParentFrame->GetType()) ||
!aElement->GetParent() ||
!aElement->GetParent()->IsHTMLElement(nsGkAtoms::fieldset) ||
aStyleContext->StyleDisplay()->IsFloatingStyle() ||
aStyleContext->StyleDisplay()->IsAbsolutelyPositionedStyle())) {
// <legend> is only special inside fieldset, check both the frame tree

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

@ -14,6 +14,7 @@ legend { border: 1px solid; }
.before::before { content:"::before"; }
.nb legend.static { border: 1px solid; }
.nb legend { border-style:none; }
.p0 legend { padding:0; }
</style>
</head>
<body>
@ -23,17 +24,17 @@ legend { border: 1px solid; }
<fieldset><div class="test contents before"></div></fieldset>
<fieldset><div class="test contents before after"></div></fieldset>
<fieldset><legend class="test contents"></legend></fieldset>
<fieldset><div class="contents nb"><legend class="test contents"></legend></div></fieldset>
<fieldset><legend class="test contents" style="padding:0"></legend></fieldset>
<fieldset><legend class="contents"><div class="test contents"></div></legend></fieldset>
<fieldset class="test2"></fieldset>
<fieldset class="test2 after"></fieldset>
<fieldset class="test2"><legend class="static"></legend></fieldset>
<fieldset class="test2"><legend class="static contents"></legend></fieldset>
<fieldset class="test2"><div class="contents"><legend class="static"></legend></div></fieldset>
<fieldset><div class="test2 contents nb"></div></fieldset>
<fieldset><div class="test3 contents"></div></fieldset>
<fieldset><div class="test2 contents nb"><legend class="static"></legend></div></fieldset>
<fieldset><div class="test3 contents"><legend class="static"></legend></div></fieldset>
<fieldset class="test2"><legend class="static" style="padding:0"></legend></fieldset>
<fieldset class="test2 p0"></fieldset>
<fieldset class="test2 p0"></fieldset>
<fieldset class="test2 p0"><legend class="static"></legend></fieldset>
<fieldset class="test2 p0"><legend class="static"></legend></fieldset>
<script>
document.body.offsetHeight;
var tests = document.querySelectorAll('.test');