Bug 842128 - Don't call nsLayoutUtils::GetFontMetricsForFrame in nsProgressFrame::ComputeAutoSize. r=dbaron.
authorJonathan Watt <jwatt@jwatt.org>
Tue, 19 Feb 2013 12:48:46 +0000
changeset 128751 cde67a09beaddce99883c78b0a95bea91ad2e63c
parent 128403 cc37417e2c284aed960f98ffa479de4ccdd5c7c3
child 128752 5d873401eb7bb18b95a32006af79a6e4338762ad
push id3582
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 20:50:56 +0000
treeherdermozilla-aurora@400370bbc9fa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs842128
milestone21.0a1
Bug 842128 - Don't call nsLayoutUtils::GetFontMetricsForFrame in nsProgressFrame::ComputeAutoSize. r=dbaron.
layout/forms/nsProgressFrame.cpp
--- a/layout/forms/nsProgressFrame.cpp
+++ b/layout/forms/nsProgressFrame.cpp
@@ -231,25 +231,20 @@ nsProgressFrame::AttributeChanged(int32_
 }
 
 nsSize
 nsProgressFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
                                  nsSize aCBSize, nscoord aAvailableWidth,
                                  nsSize aMargin, nsSize aBorder,
                                  nsSize aPadding, bool aShrinkWrap)
 {
-  float inflation = nsLayoutUtils::FontSizeInflationFor(this);
-  nsRefPtr<nsFontMetrics> fontMet;
-  NS_ENSURE_SUCCESS(nsLayoutUtils::GetFontMetricsForFrame(this,
-                                                          getter_AddRefs(fontMet),
-                                                          inflation),
-                    nsSize(0, 0));
-
   nsSize autoSize;
-  autoSize.height = autoSize.width = fontMet->Font().size; // 1em
+  autoSize.height = autoSize.width =
+    NSToCoordRound(StyleFont()->mFont.size *
+                   nsLayoutUtils::FontSizeInflationFor(this)); // 1em
 
   if (StyleDisplay()->mOrient == NS_STYLE_ORIENT_VERTICAL) {
     autoSize.height *= 10; // 10em
   } else {
     autoSize.width *= 10; // 10em
   }
 
   return autoSize;