Bug 749186: Make the root frame always be an inflation container to prevent a crash during font inflation. [r=dbaron]

This commit is contained in:
Scott Johnson 2012-05-04 12:08:23 -05:00
parent f80ce2f947
commit 77bfda7fb2
2 changed files with 9 additions and 6 deletions

View File

@ -4725,8 +4725,7 @@ nsLayoutUtils::FontSizeInflationInner(const nsIFrame *aFrame,
nsIContent* content = f->GetContent();
// Also, if there is more than one frame corresponding to a single
// content node, we want the outermost one.
if (!(f->GetParent() &&
f->GetParent()->GetContent() == content) &&
if (!(f->GetParent() && f->GetParent()->GetContent() == content) &&
f->GetType() != nsGkAtoms::inlineFrame) {
nsStyleCoord stylePosWidth = f->GetStylePosition()->mWidth;
nsStyleCoord stylePosHeight = f->GetStylePosition()->mHeight;

View File

@ -463,6 +463,12 @@ IsFontSizeInflationContainer(nsIFrame* aFrame,
* thing to count as a container, so we don't try, and blocks are
* always containers.
*/
// The root frame should always be an inflation container.
if (!aFrame->GetParent()) {
return true;
}
nsIContent *content = aFrame->GetContent();
bool isInline = (aStyleDisplay->mDisplay == NS_STYLE_DISPLAY_INLINE ||
(aStyleDisplay->IsFloating() &&
@ -470,13 +476,11 @@ IsFontSizeInflationContainer(nsIFrame* aFrame,
// Given multiple frames for the same node, only the
// outer one should be considered a container.
// (Important, e.g., for nsSelectsAreaFrame.)
(aFrame->GetParent() &&
aFrame->GetParent()->GetContent() == content) ||
(aFrame->GetParent()->GetContent() == content) ||
(content && (content->IsHTML(nsGkAtoms::option) ||
content->IsHTML(nsGkAtoms::optgroup) ||
content->IsInNativeAnonymousSubtree()))) &&
!(aFrame->IsBoxFrame() && aFrame->GetParent() &&
aFrame->GetParent()->IsBoxFrame());
!(aFrame->IsBoxFrame() && aFrame->GetParent()->IsBoxFrame());
NS_ASSERTION(!aFrame->IsFrameOfType(nsIFrame::eLineParticipant) ||
isInline ||
// br frames and mathml frames report being line