Bug 492014. Wrap the display list for a subdocument in a wrapper which associates it all with the subdocument's owning element, so sorting-by-content doesn't try to reorder it. r=roc

This commit is contained in:
Timothy Nikkel 2009-05-15 15:11:59 +12:00
Родитель 2d82c27e96
Коммит d7d1f2450b
3 изменённых файлов: 34 добавлений и 22 удалений

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

@ -0,0 +1,4 @@
<html xmlns="http://www.w3.org/1999/xhtml"><body onload="document.getElementsByTagName('td')[0].appendChild(document.createElement('iframe'));">
<caption></caption><td></td>
</body>
</html>

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

@ -233,5 +233,6 @@ load 488390-1.xhtml
load 489691.html
load 490376-1.xhtml
load 490747.html
load 492014.xhtml
load 492112-1.xhtml
load 492163-1.xhtml

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

@ -339,40 +339,47 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
nsIFrame* f = static_cast<nsIFrame*>(subdocView->GetClientData());
if ((!f || suppressed) && !aBuilder->IsForEventDelivery()) {
nsDisplayList childItems;
nsRect dirty;
if (f) {
dirty = aDirtyRect - f->GetOffsetTo(this);
aBuilder->EnterPresShell(f, dirty);
NS_ASSERTION(presShell == f->PresContext()->PresShell(),
"these presshells should be the same");
rv = f->BuildDisplayListForStackingContext(aBuilder, dirty, &childItems);
}
// Get the bounds of subdocView relative to the reference frame.
nsRect shellBounds = subdocView->GetBounds() +
mInnerView->GetPosition() +
GetOffsetTo(aBuilder->ReferenceFrame());
if (NS_SUCCEEDED(rv) && (!f || suppressed) &&
!aBuilder->IsForEventDelivery()) {
// If we don't have a frame or painting of the PresShell is suppressed,
// try to draw the default background color. (Bug 485275)
// Get the bounds of subdocView relative to the reference frame.
nsRect shellBounds = subdocView->GetBounds() +
mInnerView->GetPosition() +
GetOffsetTo(aBuilder->ReferenceFrame());
rv = aLists.Content()->AppendNewToBottom(
rv = childItems.AppendNewToBottom(
new (aBuilder) nsDisplaySolidColor(
f ? f : this,
shellBounds,
presShell->GetCanvasBackground()));
}
if (!f)
return NS_OK;
nsRect dirty = aDirtyRect - f->GetOffsetTo(this);
aBuilder->EnterPresShell(f, dirty);
// Clip children to the child root frame's rectangle
nsDisplayList childItems;
rv = f->BuildDisplayListForStackingContext(aBuilder, dirty, &childItems);
if (NS_SUCCEEDED(rv)) {
// Clip children to the child root frame's rectangle
rv = aLists.Content()->AppendNewToTop(
new (aBuilder) nsDisplayClip(nsnull, this, &childItems,
nsRect(aBuilder->ToReferenceFrame(f), f->GetSize())));
// delete childItems in case of OOM
childItems.DeleteAll();
new (aBuilder) nsDisplayClip(this, this, &childItems,
shellBounds));
}
// delete childItems in case of OOM
childItems.DeleteAll();
if (f) {
aBuilder->LeavePresShell(f, dirty);
}
aBuilder->LeavePresShell(f, dirty);
return rv;
}