Don't look for the primary frame unless we have to on broken images. Bug

239262, r+sr=dbaron, a=chofmann
This commit is contained in:
bzbarsky%mit.edu 2004-04-02 03:07:39 +00:00
Родитель 5f7de0089d
Коммит 46389cab0e
2 изменённых файлов: 28 добавлений и 10 удалений

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

@ -490,12 +490,21 @@ nsImageFrame::HandleLoadError(nsresult aStatus, nsIPresShell* aPresShell)
if (!useSizedBox) {
// let the presShell handle converting this into the inline alt
// text frame
// We have to try to get the primary frame for mContent, since for
// <object> the frame CantRenderReplacedElement wants is the
// ObjectFrame, not us (we're an anonymous frame then)....
nsIFrame* primaryFrame = nsnull;
aPresShell->GetPrimaryFrameFor(mContent, &primaryFrame);
aPresShell->CantRenderReplacedElement(primaryFrame ? primaryFrame : this);
if (mContent->IsContentOfType(nsIContent::eHTML) &&
(mContent->Tag() == nsHTMLAtoms::object ||
mContent->Tag() == nsHTMLAtoms::embed)) {
// We have to try to get the primary frame for mContent, since for
// <object> the frame CantRenderReplacedElement wants is the
// ObjectFrame, not us (we're an anonymous frame then)....
aPresShell->GetPrimaryFrameFor(mContent, &primaryFrame);
}
if (!primaryFrame) {
primaryFrame = this;
}
aPresShell->CantRenderReplacedElement(primaryFrame);
return NS_ERROR_FRAME_REPLACED;
}

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

@ -490,12 +490,21 @@ nsImageFrame::HandleLoadError(nsresult aStatus, nsIPresShell* aPresShell)
if (!useSizedBox) {
// let the presShell handle converting this into the inline alt
// text frame
// We have to try to get the primary frame for mContent, since for
// <object> the frame CantRenderReplacedElement wants is the
// ObjectFrame, not us (we're an anonymous frame then)....
nsIFrame* primaryFrame = nsnull;
aPresShell->GetPrimaryFrameFor(mContent, &primaryFrame);
aPresShell->CantRenderReplacedElement(primaryFrame ? primaryFrame : this);
if (mContent->IsContentOfType(nsIContent::eHTML) &&
(mContent->Tag() == nsHTMLAtoms::object ||
mContent->Tag() == nsHTMLAtoms::embed)) {
// We have to try to get the primary frame for mContent, since for
// <object> the frame CantRenderReplacedElement wants is the
// ObjectFrame, not us (we're an anonymous frame then)....
aPresShell->GetPrimaryFrameFor(mContent, &primaryFrame);
}
if (!primaryFrame) {
primaryFrame = this;
}
aPresShell->CantRenderReplacedElement(primaryFrame);
return NS_ERROR_FRAME_REPLACED;
}