Bug 1257121 part 3 - Add GetInflatedFontMetricsForFrame function to simplify a common use pattern. draft
authorXidorn Quan <quanxunzhen@gmail.com>
Thu, 17 Mar 2016 12:07:47 +0800
changeset 342844 bcd7a780fa7dcb0d7402b3e54dc2ca1d59c9b32b
parent 342843 aac8f91c512f6858407eb825bb1effebe46b70e0
child 342845 de459a079c8a9e638234957e45f2b22b41c76a0e
push id13465
push userxquan@mozilla.com
push dateMon, 21 Mar 2016 11:33:17 +0000
bugs1257121
milestone48.0a1
Bug 1257121 part 3 - Add GetInflatedFontMetricsForFrame function to simplify a common use pattern. MozReview-Commit-ID: 4KMLCz6wQHQ
accessible/base/TextAttrs.cpp
accessible/windows/sdn/sdnTextAccessible.cpp
dom/events/ContentEventHandler.cpp
dom/events/EventStateManager.cpp
layout/base/PositionedEventTargeting.cpp
layout/base/nsCaret.cpp
layout/base/nsLayoutUtils.cpp
layout/base/nsLayoutUtils.h
layout/forms/nsMeterFrame.cpp
layout/forms/nsProgressFrame.cpp
layout/generic/TextOverflow.cpp
layout/generic/nsBRFrame.cpp
layout/generic/nsBlockFrame.cpp
layout/generic/nsGfxScrollFrame.cpp
layout/generic/nsImageFrame.cpp
layout/mathml/nsMathMLContainerFrame.cpp
layout/mathml/nsMathMLTokenFrame.cpp
layout/mathml/nsMathMLmtableFrame.cpp
layout/xul/nsListBoxBodyFrame.cpp
layout/xul/nsTextBoxFrame.cpp
--- a/accessible/base/TextAttrs.cpp
+++ b/accessible/base/TextAttrs.cpp
@@ -456,17 +456,17 @@ TextAttrsMgr::FontFamilyTextAttr::
   nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::font_family, aValue);
 }
 
 bool
 TextAttrsMgr::FontFamilyTextAttr::
   GetFontFamily(nsIFrame* aFrame, nsString& aFamily)
 {
   RefPtr<nsFontMetrics> fm;
-  nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm));
+  nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm), 1.0f);
 
   gfxFontGroup* fontGroup = fm->GetThebesFontGroup();
   gfxFont* font = fontGroup->GetFirstValidFont();
   gfxFontEntry* fontEntry = font->GetFontEntry();
   aFamily = fontEntry->FamilyName();
   return true;
 }
 
@@ -614,17 +614,17 @@ TextAttrsMgr::FontWeightTextAttr::
 
 int32_t
 TextAttrsMgr::FontWeightTextAttr::
   GetFontWeight(nsIFrame* aFrame)
 {
   // nsFont::width isn't suitable here because it's necessary to expose real
   // value of font weight (used font might not have some font weight values).
   RefPtr<nsFontMetrics> fm;
-  nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm));
+  nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm), 1.0f);
 
   gfxFontGroup *fontGroup = fm->GetThebesFontGroup();
   gfxFont *font = fontGroup->GetFirstValidFont();
 
   // When there doesn't exist a bold font in the family and so the rendering of
   // a non-bold font face is changed so that the user sees what looks like a
   // bold font, i.e. synthetic bolding is used. IsSyntheticBold method is only
   // needed on Mac, but it is "safe" to use on all platforms.  (For non-Mac
--- a/accessible/windows/sdn/sdnTextAccessible.cpp
+++ b/accessible/windows/sdn/sdnTextAccessible.cpp
@@ -175,17 +175,17 @@ sdnTextAccessible::get_fontFamily(BSTR _
   if (mAccessible->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsIFrame* frame = mAccessible->GetFrame();
   if (!frame)
     return E_FAIL;
 
   RefPtr<nsFontMetrics> fm;
-  nsLayoutUtils::GetFontMetricsForFrame(frame, getter_AddRefs(fm));
+  nsLayoutUtils::GetFontMetricsForFrame(frame, getter_AddRefs(fm), 1.0f);
 
   const nsString& name =
     fm->GetThebesFontGroup()->GetFirstValidFont()->GetName();
   if (name.IsEmpty())
     return S_FALSE;
 
   *aFontFamily = ::SysAllocStringLen(name.get(), name.Length());
   return *aFontFamily ? S_OK : E_OUTOFMEMORY;
--- a/dom/events/ContentEventHandler.cpp
+++ b/dom/events/ContentEventHandler.cpp
@@ -1449,20 +1449,19 @@ ContentEventHandler::OnQueryCaretRect(Wi
   aEvent->mReply.mWritingMode = frame->GetWritingMode();
   bool isVertical = aEvent->mReply.mWritingMode.IsVertical();
 
   nsRect rect;
   rect.x = posInFrame.x;
   rect.y = posInFrame.y;
 
   nscoord fontHeight = 0;
-  float inflation = nsLayoutUtils::FontSizeInflationFor(frame);
   RefPtr<nsFontMetrics> fontMetrics;
-  rv = nsLayoutUtils::GetFontMetricsForFrame(frame, getter_AddRefs(fontMetrics),
-                                             inflation);
+  rv = nsLayoutUtils::
+    GetInflatedFontMetricsForFrame(frame, getter_AddRefs(fontMetrics));
   if (NS_WARN_IF(!fontMetrics)) {
     // If we cannot get font height, use frame size instead.
     fontHeight = isVertical ? frame->GetSize().width : frame->GetSize().height;
   } else {
     fontHeight = fontMetrics->MaxAscent() + fontMetrics->MaxDescent();
   }
   if (isVertical) {
     rect.width = fontHeight;
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -2509,18 +2509,17 @@ EventStateManager::GetScrollAmount(nsPre
   }
 
   // If there is no scrollable frame, we should use root frame's information.
   nsIFrame* rootFrame = aPresContext->PresShell()->GetRootFrame();
   if (!rootFrame) {
     return nsSize(0, 0);
   }
   RefPtr<nsFontMetrics> fm;
-  nsLayoutUtils::GetFontMetricsForFrame(rootFrame, getter_AddRefs(fm),
-    nsLayoutUtils::FontSizeInflationFor(rootFrame));
+  nsLayoutUtils::GetInflatedFontMetricsForFrame(rootFrame, getter_AddRefs(fm));
   NS_ENSURE_TRUE(fm, nsSize(0, 0));
   return nsSize(fm->AveCharWidth(), fm->MaxHeight());
 }
 
 void
 EventStateManager::DoScrollText(nsIScrollableFrame* aScrollableFrame,
                                 WidgetWheelEvent* aEvent)
 {
--- a/layout/base/PositionedEventTargeting.cpp
+++ b/layout/base/PositionedEventTargeting.cpp
@@ -521,18 +521,17 @@ IsElementClickableAndReadable(nsIFrame* 
       //   With such libraries, the font size of the text elements is not relevant to detect small elements.
 
       testFontSize = true;
     }
   }
 
   if (testFontSize) {
     RefPtr<nsFontMetrics> fm;
-    nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm),
-      nsLayoutUtils::FontSizeInflationFor(aFrame));
+    nsLayoutUtils::GetInflatedFontMetricsForFrame(aFrame, getter_AddRefs(fm));
     if (fm && fm->EmHeight() > 0 && // See bug 1171731
         (pc->AppUnitsToGfxUnits(fm->EmHeight()) * cumulativeResolution) < limitReadableSize) {
       return false;
     }
   }
 
   return true;
 }
--- a/layout/base/nsCaret.cpp
+++ b/layout/base/nsCaret.cpp
@@ -317,18 +317,17 @@ nsCaret::GetGeometryForFrame(nsIFrame* a
   if (!frame) {
     frame = aFrame;
   }
   NS_ASSERTION(!(frame->GetStateBits() & NS_FRAME_IN_REFLOW),
                "We should not be in the middle of reflow");
   nscoord baseline = frame->GetCaretBaseline();
   nscoord ascent = 0, descent = 0;
   RefPtr<nsFontMetrics> fm;
-  nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm),
-    nsLayoutUtils::FontSizeInflationFor(aFrame));
+  nsLayoutUtils::GetInflatedFontMetricsForFrame(aFrame, getter_AddRefs(fm));
   NS_ASSERTION(fm, "We should be able to get the font metrics");
   if (fm) {
     ascent = fm->MaxAscent();
     descent = fm->MaxDescent();
   }
   nscoord height = ascent + descent;
   WritingMode wm = aFrame->GetWritingMode();
   bool vertical = wm.IsVertical();
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -8528,18 +8528,17 @@ nsLayoutUtils::IsOutlineStyleAutoEnabled
 /* static */ void
 nsLayoutUtils::SetBSizeFromFontMetrics(const nsIFrame* aFrame,
                                        nsHTMLReflowMetrics& aMetrics,
                                        const LogicalMargin& aFramePadding,
                                        WritingMode aLineWM,
                                        WritingMode aFrameWM)
 {
   RefPtr<nsFontMetrics> fm;
-  float inflation = nsLayoutUtils::FontSizeInflationFor(aFrame);
-  nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm), inflation);
+  nsLayoutUtils::GetInflatedFontMetricsForFrame(aFrame, getter_AddRefs(fm));
 
   if (fm) {
     // Compute final height of the frame.
     //
     // Do things the standard css2 way -- though it's hard to find it
     // in the css2 spec! It's actually found in the css1 spec section
     // 4.4 (you will have to read between the lines to really see
     // it).
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -1223,17 +1223,24 @@ public:
    * Get the font metrics corresponding to the frame's style data.
    * @param aFrame the frame
    * @param aFontMetrics the font metrics result
    * @param aSizeInflation number to multiply font size by
    * @return success or failure code
    */
   static nsresult GetFontMetricsForFrame(const nsIFrame* aFrame,
                                          nsFontMetrics** aFontMetrics,
-                                         float aSizeInflation = 1.0f);
+                                         float aSizeInflation);
+
+  static nsresult GetInflatedFontMetricsForFrame(const nsIFrame* aFrame,
+                                                 nsFontMetrics** aFontMetrics)
+  {
+    return GetFontMetricsForFrame(aFrame, aFontMetrics,
+                                  FontSizeInflationFor(aFrame));
+  }
 
   /**
    * Get the font metrics corresponding to the given style data.
    * @param aStyleContext the style data
    * @param aFontMetrics the font metrics result
    * @param aSizeInflation number to multiply font size by
    * @return success or failure code
    */
--- a/layout/forms/nsMeterFrame.cpp
+++ b/layout/forms/nsMeterFrame.cpp
@@ -227,17 +227,17 @@ nsMeterFrame::ComputeAutoSize(nsRenderin
                               nscoord aAvailableISize,
                               const LogicalSize& aMargin,
                               const LogicalSize& aBorder,
                               const LogicalSize& aPadding,
                               bool aShrinkWrap)
 {
   RefPtr<nsFontMetrics> fontMet;
   NS_ENSURE_SUCCESS(nsLayoutUtils::GetFontMetricsForFrame(this,
-                                                          getter_AddRefs(fontMet)),
+                                                          getter_AddRefs(fontMet), 1.0f),
                     LogicalSize(aWM));
 
   const WritingMode wm = GetWritingMode();
   LogicalSize autoSize(wm);
   autoSize.BSize(wm) = autoSize.ISize(wm) = fontMet->Font().size; // 1em
 
   if (ResolvedOrientationIsVertical() == wm.IsVertical()) {
     autoSize.ISize(wm) *= 5; // 5em
@@ -248,17 +248,17 @@ nsMeterFrame::ComputeAutoSize(nsRenderin
   return autoSize.ConvertTo(aWM, wm);
 }
 
 nscoord
 nsMeterFrame::GetMinISize(nsRenderingContext *aRenderingContext)
 {
   RefPtr<nsFontMetrics> fontMet;
   NS_ENSURE_SUCCESS(
-      nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet)), 0);
+      nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet), 1.0f), 0);
 
   nscoord minISize = fontMet->Font().size; // 1em
 
   if (ResolvedOrientationIsVertical() == GetWritingMode().IsVertical()) {
     // The orientation is inline
     minISize *= 5; // 5em
   }
 
--- a/layout/forms/nsProgressFrame.cpp
+++ b/layout/forms/nsProgressFrame.cpp
@@ -254,17 +254,17 @@ nsProgressFrame::ComputeAutoSize(nsRende
   return autoSize.ConvertTo(aWM, wm);
 }
 
 nscoord
 nsProgressFrame::GetMinISize(nsRenderingContext *aRenderingContext)
 {
   RefPtr<nsFontMetrics> fontMet;
   NS_ENSURE_SUCCESS(
-      nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet)), 0);
+      nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet), 1.0f), 0);
 
   nscoord minISize = fontMet->Font().size; // 1em
 
   if (ResolvedOrientationIsVertical() == GetWritingMode().IsVertical()) {
     // The orientation is inline
     minISize *= 10; // 10em
   }
 
--- a/layout/generic/TextOverflow.cpp
+++ b/layout/generic/TextOverflow.cpp
@@ -45,18 +45,17 @@ public:
 private:
   nsIFrame* mFrame;
 };
 
 static gfxTextRun*
 GetEllipsisTextRun(nsIFrame* aFrame)
 {
   RefPtr<nsFontMetrics> fm;
-  nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm),
-    nsLayoutUtils::FontSizeInflationFor(aFrame));
+  nsLayoutUtils::GetInflatedFontMetricsForFrame(aFrame, getter_AddRefs(fm));
   LazyReferenceRenderingDrawTargetGetterFromFrame lazyRefDrawTargetGetter(aFrame);
   return fm->GetThebesFontGroup()->GetEllipsisTextRun(
     aFrame->PresContext()->AppUnitsPerDevPixel(),
     nsLayoutUtils::GetTextRunOrientFlagsForStyle(aFrame->StyleContext()),
     lazyRefDrawTargetGetter);
 }
 
 static nsIFrame*
@@ -252,18 +251,17 @@ nsDisplayTextOverflowMarker::PaintTextTo
       NS_ASSERTION(!textRun->IsRightToLeft(),
                    "Ellipsis textruns should always be LTR!");
       gfxPoint gfxPt(pt.x, pt.y);
       textRun->Draw(gfxTextRun::Range(textRun), gfxPt,
                     gfxTextRun::DrawParams(aCtx->ThebesContext()));
     }
   } else {
     RefPtr<nsFontMetrics> fm;
-    nsLayoutUtils::GetFontMetricsForFrame(mFrame, getter_AddRefs(fm),
-      nsLayoutUtils::FontSizeInflationFor(mFrame));
+    nsLayoutUtils::GetInflatedFontMetricsForFrame(mFrame, getter_AddRefs(fm));
     nsLayoutUtils::DrawString(mFrame, *fm, aCtx, mStyle->mString.get(),
                               mStyle->mString.Length(), pt);
   }
 }
 
 TextOverflow::TextOverflow(nsDisplayListBuilder* aBuilder,
                            nsIFrame* aBlockFrame)
   : mContentArea(aBlockFrame->GetWritingMode(),
@@ -806,18 +804,17 @@ TextOverflow::Marker::SetupString(nsIFra
       mISize = textRun->GetAdvanceWidth();
     } else {
       mISize = 0;
     }
   } else {
     nsRenderingContext rc(
       aFrame->PresContext()->PresShell()->CreateReferenceRenderingContext());
     RefPtr<nsFontMetrics> fm;
-    nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm),
-      nsLayoutUtils::FontSizeInflationFor(aFrame));
+    nsLayoutUtils::GetInflatedFontMetricsForFrame(aFrame, getter_AddRefs(fm));
     mISize = nsLayoutUtils::AppUnitWidthOfStringBidi(mStyle->mString, aFrame,
                                                      *fm, rc);
   }
   mIntrinsicISize = mISize;
   mInitialized = true;
 }
 
 } // namespace css
--- a/layout/generic/nsBRFrame.cpp
+++ b/layout/generic/nsBRFrame.cpp
@@ -117,18 +117,17 @@ BRFrame::Reflow(nsPresContext* aPresCont
       // quirks-mode fix that doesn't apply the block's min
       // line-height makes this necessary to make BR cause a line
       // of the full line-height
 
       // We also do this in strict mode because BR should act like a
       // normal inline frame.  That line-height is used is important
       // here for cases where the line-height is less than 1.
       RefPtr<nsFontMetrics> fm;
-      nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
-        nsLayoutUtils::FontSizeInflationFor(this));
+      nsLayoutUtils::GetInflatedFontMetricsForFrame(this, getter_AddRefs(fm));
       if (fm) {
         nscoord logicalHeight = aReflowState.CalcLineHeight();
         finalSize.BSize(wm) = logicalHeight;
         aMetrics.SetBlockStartAscent(nsLayoutUtils::GetCenteredFontBaseline(
                                        fm, logicalHeight, wm.IsLineInverted()));
       }
       else {
         aMetrics.SetBlockStartAscent(aMetrics.BSize(wm) = 0);
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -2621,18 +2621,17 @@ nsBlockFrame::ReflowDirtyLines(nsBlockRe
         if (nsLayoutUtils::GetFirstLineBaseline(wm, bullet, &ascent)) {
           metrics.SetBlockStartAscent(ascent);
         } else {
           metrics.SetBlockStartAscent(metrics.BSize(wm));
         }
       }
 
       RefPtr<nsFontMetrics> fm;
-      nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
-        nsLayoutUtils::FontSizeInflationFor(this));
+      nsLayoutUtils::GetInflatedFontMetricsForFrame(this, getter_AddRefs(fm));
 
       nscoord minAscent =
         nsLayoutUtils::GetCenteredFontBaseline(fm, aState.mMinLineHeight,
                                                wm.IsLineInverted());
       nscoord minDescent = aState.mMinLineHeight - minAscent;
 
       aState.mBCoord += std::max(minAscent, metrics.BlockStartAscent()) +
                         std::max(minDescent, metrics.BSize(wm) -
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -3900,18 +3900,17 @@ ScrollFrameHelper::ScrollSnap(const nsPo
     ScrollTo(snapDestination, aMode);
   }
 }
 
 nsSize
 ScrollFrameHelper::GetLineScrollAmount() const
 {
   RefPtr<nsFontMetrics> fm;
-  nsLayoutUtils::GetFontMetricsForFrame(mOuter, getter_AddRefs(fm),
-    nsLayoutUtils::FontSizeInflationFor(mOuter));
+  nsLayoutUtils::GetInflatedFontMetricsForFrame(mOuter, getter_AddRefs(fm));
   NS_ASSERTION(fm, "FontMetrics is null, assuming fontHeight == 1 appunit");
   static nscoord sMinLineScrollAmountInPixels = -1;
   if (sMinLineScrollAmountInPixels < 0) {
     Preferences::AddIntVarCache(&sMinLineScrollAmountInPixels,
                                 "mousewheel.min_line_scroll_amount", 1);
   }
   int32_t appUnitsPerDevPixel = mOuter->PresContext()->AppUnitsPerDevPixel();
   nscoord minScrollAmountInAppUnits =
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -1126,18 +1126,17 @@ nsImageFrame::DisplayAltText(nsPresConte
                              nsRenderingContext& aRenderingContext,
                              const nsString&      aAltText,
                              const nsRect&        aRect)
 {
   // Set font and color
   aRenderingContext.ThebesContext()->
     SetColor(Color::FromABGR(StyleColor()->mColor));
   RefPtr<nsFontMetrics> fm;
-  nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
-    nsLayoutUtils::FontSizeInflationFor(this));
+  nsLayoutUtils::GetInflatedFontMetricsForFrame(this, getter_AddRefs(fm));
 
   // Format the text to display within the formatting rect
 
   nscoord maxAscent = fm->MaxAscent();
   nscoord maxDescent = fm->MaxDescent();
   nscoord lineHeight = fm->MaxHeight(); // line-relative, so an x-coordinate
                                         // length if writing mode is vertical
 
--- a/layout/mathml/nsMathMLContainerFrame.cpp
+++ b/layout/mathml/nsMathMLContainerFrame.cpp
@@ -45,19 +45,17 @@ nsMathMLContainerFrame::ReflowError(Draw
 {
   // clear all other flags and record that there is an error with this frame
   mEmbellishData.flags = 0;
   mPresentationData.flags = NS_MATHML_ERROR;
 
   ///////////////
   // Set font
   RefPtr<nsFontMetrics> fm;
-  nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
-                                        nsLayoutUtils::
-                                        FontSizeInflationFor(this));
+  nsLayoutUtils::GetInflatedFontMetricsForFrame(this, getter_AddRefs(fm));
 
   // bounding metrics
   nsAutoString errorMsg; errorMsg.AssignLiteral("invalid-markup");
   mBoundingMetrics =
     nsLayoutUtils::AppUnitBoundsOfString(errorMsg.get(), errorMsg.Length(),
                                          *fm, aDrawTarget);
 
   // reflow metrics
@@ -90,17 +88,17 @@ public:
   NS_DISPLAY_DECL_NAME("MathMLError", TYPE_MATHML_ERROR)
 };
 
 void nsDisplayMathMLError::Paint(nsDisplayListBuilder* aBuilder,
                                  nsRenderingContext* aCtx)
 {
   // Set color and font ...
   RefPtr<nsFontMetrics> fm;
-  nsLayoutUtils::GetFontMetricsForFrame(mFrame, getter_AddRefs(fm));
+  nsLayoutUtils::GetFontMetricsForFrame(mFrame, getter_AddRefs(fm), 1.0f);
 
   nsPoint pt = ToReferenceFrame();
   int32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
   DrawTarget* drawTarget = aCtx->GetDrawTarget();
   Rect rect = NSRectToSnappedRect(nsRect(pt, mFrame->GetSize()),
                                   appUnitsPerDevPixel,
                                   *drawTarget);
   ColorPattern red(ToDeviceColor(Color(1.f, 0.f, 0.f, 1.f)));
--- a/layout/mathml/nsMathMLTokenFrame.cpp
+++ b/layout/mathml/nsMathMLTokenFrame.cpp
@@ -169,19 +169,17 @@ nsMathMLTokenFrame::Place(DrawTarget*   
     nsHTMLReflowMetrics childSize(aDesiredSize.GetWritingMode());
     GetReflowAndBoundingMetricsFor(childFrame, childSize,
                                    childSize.mBoundingMetrics, nullptr);
     // compute and cache the bounding metrics
     mBoundingMetrics += childSize.mBoundingMetrics;
   }
 
   RefPtr<nsFontMetrics> fm;
-  nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
-                                        nsLayoutUtils::
-                                        FontSizeInflationFor(this));
+  nsLayoutUtils::GetInflatedFontMetricsForFrame(this, getter_AddRefs(fm));
   nscoord ascent = fm->MaxAscent();
   nscoord descent = fm->MaxDescent();
 
   aDesiredSize.mBoundingMetrics = mBoundingMetrics;
   aDesiredSize.Width() = mBoundingMetrics.width;
   aDesiredSize.SetBlockStartAscent(std::max(mBoundingMetrics.ascent, ascent));
   aDesiredSize.Height() = aDesiredSize.BlockStartAscent() +
                         std::max(mBoundingMetrics.descent, descent);
--- a/layout/mathml/nsMathMLmtableFrame.cpp
+++ b/layout/mathml/nsMathMLmtableFrame.cpp
@@ -878,19 +878,17 @@ nsMathMLmtableOuterFrame::Reflow(nsPresC
       }
       // in other situations, fallback to center
       aDesiredSize.SetBlockStartAscent(dy + blockSize / 2);
       break;
     case eAlign_axis:
     default: {
       // XXX should instead use style data from the row of reference here ?
       RefPtr<nsFontMetrics> fm;
-      nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
-                                            nsLayoutUtils::
-                                            FontSizeInflationFor(this));
+      nsLayoutUtils::GetInflatedFontMetricsForFrame(this, getter_AddRefs(fm));
       nscoord axisHeight;
       GetAxisHeight(aReflowState.rendContext->GetDrawTarget(), fm, axisHeight);
       if (rowFrame) {
         // anchor the table on the axis of the row of reference
         // XXX fallback to baseline because it is a hard problem
         // XXX need to fetch the axis of the row; would need rowalign=axis to work better
         nscoord rowAscent = ((nsTableRowFrame*)rowFrame)->GetMaxCellAscent();
         if (rowAscent) { // the row has at least one cell with 'vertical-align: baseline'
--- a/layout/xul/nsListBoxBodyFrame.cpp
+++ b/layout/xul/nsListBoxBodyFrame.cpp
@@ -193,17 +193,17 @@ nsListBoxBodyFrame::Init(nsIContent*    
   if (scrollFrame) {
     nsIFrame* verticalScrollbar = scrollFrame->GetScrollbarBox(true);
     nsScrollbarFrame* scrollbarFrame = do_QueryFrame(verticalScrollbar);
     if (scrollbarFrame) {
       scrollbarFrame->SetScrollbarMediatorContent(GetContent());
     }
   }
   RefPtr<nsFontMetrics> fm;
-  nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
+  nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm), 1.0f);
   mRowHeight = fm->MaxHeight();
 }
 
 void
 nsListBoxBodyFrame::DestroyFrom(nsIFrame* aDestructRoot)
 {
   // make sure we cancel any posted callbacks.
   if (mReflowCallbackPosted)
--- a/layout/xul/nsTextBoxFrame.cpp
+++ b/layout/xul/nsTextBoxFrame.cpp
@@ -454,17 +454,17 @@ nsTextBoxFrame::DrawText(nsRenderingCont
           decorMask &= ~NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH;
           decorations |= NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH;
         }
       }
     } while (0 != decorMask &&
              (f = nsLayoutUtils::GetParentOrPlaceholderFor(f)));
 
     RefPtr<nsFontMetrics> fontMet;
-    nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet));
+    nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet), 1.0f);
     fontMet->SetVertical(wm.IsVertical());
     fontMet->SetTextOrientation(StyleVisibility()->mTextOrientation);
 
     nscoord offset;
     nscoord size;
     nscoord ascent = fontMet->MaxAscent();
 
     nsPoint baselinePt;
@@ -629,17 +629,17 @@ nsTextBoxFrame::CalculateTitleForWidth(n
     DrawTarget* drawTarget = aRenderingContext.GetDrawTarget();
 
     if (mTitle.IsEmpty()) {
         mCroppedTitle.Truncate();
         return 0;
     }
 
     RefPtr<nsFontMetrics> fm;
-    nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
+    nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm), 1.0f);
 
     // see if the text will completely fit in the width given
     nscoord titleWidth =
       nsLayoutUtils::AppUnitWidthOfStringBidi(mTitle, this, *fm,
                                               aRenderingContext);
     if (titleWidth <= aWidth) {
         mCroppedTitle = mTitle;
         if (HasRTLChars(mTitle) ||
@@ -965,17 +965,17 @@ nsTextBoxFrame::DoLayout(nsBoxLayoutStat
     CalcDrawRect(*aBoxLayoutState.GetRenderingContext());
 
     const nsStyleText* textStyle = StyleText();
     
     nsRect scrollBounds(nsPoint(0, 0), GetSize());
     nsRect textRect = mTextDrawRect;
     
     RefPtr<nsFontMetrics> fontMet;
-    nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet));
+    nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet), 1.0f);
     nsBoundingMetrics metrics = 
       fontMet->GetInkBoundsForVisualOverflow(mCroppedTitle.get(),
                                              mCroppedTitle.Length(),
                                              aBoxLayoutState.GetRenderingContext()->GetDrawTarget());
 
     WritingMode wm = GetWritingMode();
     LogicalRect tr(wm, textRect, GetSize());
 
@@ -1026,17 +1026,17 @@ nsTextBoxFrame::MarkIntrinsicISizesDirty
 }
 
 void
 nsTextBoxFrame::GetTextSize(nsRenderingContext& aRenderingContext,
                             const nsString& aString,
                             nsSize& aSize, nscoord& aAscent)
 {
     RefPtr<nsFontMetrics> fontMet;
-    nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet));
+    nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet), 1.0f);
     aSize.height = fontMet->MaxHeight();
     aSize.width =
       nsLayoutUtils::AppUnitWidthOfStringBidi(aString, this, *fontMet,
                                               aRenderingContext);
     aAscent = fontMet->MaxAscent();
 }
 
 void