Fix FindFrameWithContent to properly walk out-of-flows. Bug 405186, r+sr=roc, a=beltzner

This commit is contained in:
bzbarsky@mit.edu 2007-11-28 11:58:04 -08:00
Родитель 374412446b
Коммит 1d35345354
3 изменённых файлов: 56 добавлений и 9 удалений

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

@ -661,6 +661,16 @@ MarkIBSpecialPrevSibling(nsIFrame *aAnonymousFrame,
// -----------------------------------------------------------
static PRBool
IsOutOfFlowList(nsIAtom* aListName)
{
return
aListName == nsGkAtoms::floatList ||
aListName == nsGkAtoms::absoluteList ||
aListName == nsGkAtoms::overflowOutOfFlowList ||
aListName == nsGkAtoms::fixedList;
}
// Helper function that recursively removes content to frame mappings and
// undisplayed content mappings.
// This differs from DeletingFrameSubtree() because the frames have not yet been
@ -8420,9 +8430,8 @@ nsCSSFrameConstructor::FindFrameForContentSibling(nsIContent* aContent,
sibling = placeholderFrame;
}
// GetPrimaryFrameFor can unfortunately return a non-primary frame
// for a textnode if we have a floating first-letter.
sibling = sibling->GetFirstContinuation();
// The frame we have now should never be a continuation
NS_ASSERTION(!sibling->GetPrevContinuation(), "How did that happen?");
if (aPrevSibling) {
// The frame may be a special frame (a split inline frame that
@ -9438,10 +9447,7 @@ DoDeletingFrameSubtree(nsFrameManager* aFrameManager,
// a placeholder for.
do {
childListName = aFrame->GetAdditionalChildListName(childListIndex++);
} while (childListName == nsGkAtoms::floatList ||
childListName == nsGkAtoms::absoluteList ||
childListName == nsGkAtoms::overflowOutOfFlowList ||
childListName == nsGkAtoms::fixedList);
} while (IsOutOfFlowList(childListName));
} while (childListName);
return NS_OK;
@ -10933,7 +10939,8 @@ nsCSSFrameConstructor::FindFrameWithContent(nsFrameManager* aFrameManager,
kidFrame, aParentContent);
#endif
nsIFrame* matchingFrame =
FindFrameWithContent(aFrameManager, kidFrame,
FindFrameWithContent(aFrameManager,
nsPlaceholderFrame::GetRealFrameFor(kidFrame),
aParentContent, aContent, nsnull);
if (matchingFrame) {
@ -10964,7 +10971,9 @@ nsCSSFrameConstructor::FindFrameWithContent(nsFrameManager* aFrameManager,
aHint = nsnull;
searchAgain = PR_TRUE;
} else {
listName = aParentFrame->GetAdditionalChildListName(listIndex++);
do {
listName = aParentFrame->GetAdditionalChildListName(listIndex++);
} while (IsOutOfFlowList(listName));
}
} while(listName || searchAgain);

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

@ -0,0 +1,37 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<bindings xmlns="http://www.mozilla.org/xbl">
<binding id="foo">
<content>
<div xmlns="http://www.w3.org/1999/xhtml" style="position: fixed;">
<children xmlns="http://www.mozilla.org/xbl"/>
</div>
</content>
</binding>
</bindings>
<script type="text/javascript">
function boom()
{
var tr = document.getElementById("tr");
var td = document.getElementById("td");
tr.removeChild(td);
}
</script>
</head>
<body onload="boom();">
<table id="table" style="-moz-binding: url(#foo);">
<tr id="tr">
<td id="td">Text</td>
</tr>
</table>
</body>
</html>

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

@ -476,3 +476,4 @@ random == 403134-1.html 403134-1-ref.html # bug 405377
== 404301-1.html 404301-1-ref.html
== 405584-1.html 405584-1-ref.html
!= data:application/xml,<foo/> data:text/plain, # bug 404419
== 405186-1.xhtml about:blank