Bug 713427. Don't assume things about lazy frame construction bits that just aren't true when doing IsVisible() testing. r=tnikkel

This commit is contained in:
Boris Zbarsky 2012-01-18 16:10:06 -05:00
parent 5cbd100b34
commit 5d70c080d6
4 changed files with 63 additions and 19 deletions

View File

@ -0,0 +1,9 @@
<span>
<script contenteditable="true"></script>
<blockquote>
<input>
<code style="display: table-row;">
<html contenteditable="true">
</blockquote>

View File

@ -0,0 +1,28 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>
<![CDATA[
function boom()
{
while (document.documentElement.firstChild) {
document.documentElement.removeChild(document.documentElement.firstChild);
}
var td = document.createElementNS("http://www.w3.org/1999/xhtml", "td");
td.setAttributeNS(null, "contenteditable", "true");
(document.documentElement).appendChild(td);
var head = document.createElementNS("http://www.w3.org/1999/xhtml", "head");
(document.documentElement).appendChild(head);
head.appendChild(td);
}
window.addEventListener("load", boom, false);
]]>
</script>
</head>
<body></body>
</html>

View File

@ -8,3 +8,5 @@ load 459613.html
load 475132-1.xhtml
asserts-if(!Android,1) load 633709.xhtml # Bug 695364
asserts-if(!Android,6) load 636074-1.html # Bug 439258, charged to the wrong test due to bug 635550
load 713427-1.html
load 713427-2.xhtml

View File

@ -3605,32 +3605,37 @@ IsElementVisible(dom::Element* aElement)
nsIContent *cur = aElement;
for (; ;) {
// Walk up the tree looking for the nearest ancestor with a frame.
// The state of the child right below it will determine whether
// we might possibly have a frame or not.
bool haveLazyBitOnChild = cur->HasFlag(NODE_NEEDS_FRAME);
cur = cur->GetFlattenedTreeParent();
if (!cur) {
// None of our ancestors have lazy bits set, so we shouldn't have a frame
return false;
if (!haveLazyBitOnChild) {
// None of our ancestors have lazy bits set, so we shouldn't
// have a frame
return false;
}
// The root has a lazy frame construction bit. We need to check
// our style.
break;
}
if (cur->GetPrimaryFrame()) {
// None of our ancestors up to the nearest ancestor with a frame have
// lazy bits; that means we won't get a frame
return false;
}
if (cur->HasFlag(NODE_NEEDS_FRAME)) {
// Double-check that the parent doesn't have a leaf frame
nsIContent *parent = cur->GetFlattenedTreeParent();
if (parent) {
NS_ASSERTION(parent->GetPrimaryFrame(),
"Why does our parent not have a frame?");
if (parent->GetPrimaryFrame()->IsLeaf()) {
// No frame for us
return false;
}
if (!haveLazyBitOnChild) {
// Our ancestor directly under |cur| doesn't have lazy bits;
// that means we won't get a frame
return false;
}
// |cur| will get a frame sometime. What does that mean for us?
// |We have to figure that out!
if (cur->GetPrimaryFrame()->IsLeaf()) {
// Nothing under here will ever get frames
return false;
}
// Otherwise, we might end up with a frame when that lazy bit is
// processed. Figure out our actual style.
break;
}
}