зеркало из https://github.com/mozilla/pjs.git
Bug 591619. Don't create frames for non-option kids of <optgroup> or non-option and non-optgroup kids of <select>. r=dbaron
This commit is contained in:
Родитель
d9cb6a985e
Коммит
3f2695d930
|
@ -5161,6 +5161,30 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
|
|||
}
|
||||
|
||||
PRBool isText = aContent->IsNodeOfType(nsINode::eTEXT);
|
||||
|
||||
// never create frames for non-option/optgroup kids of <select> and
|
||||
// non-option kids of <optgroup> inside a <select>.
|
||||
// XXXbz it's not clear how this should best work with XBL.
|
||||
nsIContent *parent = aContent->GetParent();
|
||||
if (parent) {
|
||||
// Check tag first, since that check will usually fail
|
||||
nsIAtom* parentTag = parent->Tag();
|
||||
if ((parentTag == nsGkAtoms::select || parentTag == nsGkAtoms::optgroup) &&
|
||||
parent->IsHTML() &&
|
||||
// <option> is ok no matter what
|
||||
!aContent->IsHTML(nsGkAtoms::option) &&
|
||||
// <optgroup> is OK in <select> but not in <optgroup>
|
||||
(!aContent->IsHTML(nsGkAtoms::optgroup) ||
|
||||
parentTag != nsGkAtoms::select)) {
|
||||
// No frame for aContent
|
||||
if (!isText) {
|
||||
SetAsUndisplayedContent(aState.mFrameManager, aContent, styleContext,
|
||||
isGeneratedContent);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
PRBool isPopup = PR_FALSE;
|
||||
// Try to find frame construction data for this content
|
||||
const FrameConstructionData* data;
|
||||
|
|
|
@ -45,6 +45,8 @@ skip-if(winWidget) == textarea-resize-background.html textarea-resize-background
|
|||
!= radio-checked-native-notref.html about:blank
|
||||
|
||||
== select-multiple.html select-multiple-ref.html
|
||||
== select-boguskids.html select-boguskids-ref.html
|
||||
== select-dynamic-boguskids.html select-boguskids-ref.html
|
||||
|
||||
# placeholder
|
||||
include placeholder/reftest.list
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<select size="10">
|
||||
<option>one</option>
|
||||
<option>two</option>
|
||||
<optgroup>
|
||||
<option>three</option>
|
||||
<option>four</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<select size="10">
|
||||
Shouldn't see me
|
||||
<option>one</option>
|
||||
Or me
|
||||
<option>two</option>
|
||||
<optgroup>
|
||||
I should hide too
|
||||
<option>three</option>
|
||||
And me too
|
||||
<option>four</option>
|
||||
</optgroup>
|
||||
And I
|
||||
</select>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
function doIt() {
|
||||
var insertions = [
|
||||
[ "opt1", "Shouldn't see me" ],
|
||||
[ "opt2", "Or me" ],
|
||||
[ "opt3", "I should hide too" ],
|
||||
[ "opt4", "And me too" ]
|
||||
];
|
||||
for (var i = 0; i < insertions.length; ++i) {
|
||||
var next = document.getElementById(insertions[i][0]);
|
||||
next.parentNode.insertBefore(document.createTextNode(insertions[i][1]),
|
||||
next);
|
||||
}
|
||||
document.getElementById("sel").appendChild(document.createTextNode("And I"));
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="doIt()">
|
||||
<select size="10" id="sel">
|
||||
<option id="opt1">one</option>
|
||||
<option id="opt2">two</option>
|
||||
<optgroup>
|
||||
<option id="opt3">three</option>
|
||||
<option id="opt4">four</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче