From aad16695daa87d2689155b430014638927814827 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Tue, 3 Mar 2015 16:06:36 +1100 Subject: [PATCH] Bug 1138527 part 1 - Make ruby annotations have the same font inflation as its containing ruby frame. r=roc --- layout/base/nsLayoutUtils.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 1c11be18219..ae08f1edc40 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -7227,14 +7227,25 @@ nsLayoutUtils::FontSizeInflationInner(const nsIFrame *aFrame, f = f->GetParent()) { nsIContent* content = f->GetContent(); nsIAtom* fType = f->GetType(); + nsIFrame* parent = f->GetParent(); // 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 (!(parent && parent->GetContent() == content) && // ignore width/height on inlines since they don't apply fType != nsGkAtoms::inlineFrame && // ignore width on radios and checkboxes since we enlarge them and // they have width/height in ua.css fType != nsGkAtoms::formControlFrame) { + // ruby annotations should have the same inflation as its + // grandparent, which is the ruby frame contains the annotation. + if (fType == nsGkAtoms::rubyTextFrame) { + MOZ_ASSERT(parent && + parent->GetType() == nsGkAtoms::rubyTextContainerFrame); + nsIFrame* grandparent = parent->GetParent(); + MOZ_ASSERT(grandparent && + grandparent->GetType() == nsGkAtoms::rubyFrame); + return FontSizeInflationFor(grandparent); + } nsStyleCoord stylePosWidth = f->StylePosition()->mWidth; nsStyleCoord stylePosHeight = f->StylePosition()->mHeight; if (stylePosWidth.GetUnit() != eStyleUnit_Auto ||