Bug 1138527 part 1 - Make ruby annotations have the same font inflation as its containing ruby frame. r=roc

This commit is contained in:
Xidorn Quan 2015-03-03 16:06:36 +11:00
parent 47af3965e1
commit aad16695da

View File

@ -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 ||