Save and expose on nsFontInflationData the width of the nearest common ancestor of the inflated descendants. (Bug 747720, patch 1) r=roc approval-mozilla-aurora=blassey
authorL. David Baron <dbaron@dbaron.org>
Sun, 20 May 2012 22:18:27 -0700
changeset 95855 562f7505891e90eb8cd5eaba9d99aa28acc5d92b
parent 95854 1e14ba6856a4ad6c307ecff702c25c9cf4f110fe
child 95856 a85cb76bb4fd7ec01b9f2239547df87274be6040
push idunknown
push userunknown
push dateunknown
reviewersroc
bugs747720
milestone14.0a2
Save and expose on nsFontInflationData the width of the nearest common ancestor of the inflated descendants. (Bug 747720, patch 1) r=roc approval-mozilla-aurora=blassey This width will be used in patch 3.
layout/generic/nsFontInflationData.cpp
layout/generic/nsFontInflationData.h
--- a/layout/generic/nsFontInflationData.cpp
+++ b/layout/generic/nsFontInflationData.cpp
@@ -230,16 +230,17 @@ nsFontInflationData::UpdateWidth(const n
   nscoord newTextThreshold = (newNCAWidth * lineThreshold) / 100;
 
   if (mTextThreshold <= mTextAmount && mTextAmount < newTextThreshold) {
     // Because we truncate our scan when we hit sufficient text, we now
     // need to rescan.
     mTextDirty = true;
   }
 
+  mNCAWidth = newNCAWidth;
   mTextThreshold = newTextThreshold;
   mInflationEnabled = mTextAmount >= mTextThreshold;
 }
 
 /* static */ nsIFrame*
 nsFontInflationData::FindEdgeInflatableFrameIn(nsIFrame* aFrame,
                                                SearchDirection aDirection)
 {
--- a/layout/generic/nsFontInflationData.h
+++ b/layout/generic/nsFontInflationData.h
@@ -59,16 +59,20 @@ public:
 
   bool InflationEnabled() {
     if (mTextDirty) {
       ScanText();
     }
     return mInflationEnabled;
   }
 
+  nscoord EffectiveWidth() const {
+    return mNCAWidth;
+  }
+
 private:
 
   nsFontInflationData(nsIFrame* aBFCFrame);
 
   nsFontInflationData(const nsFontInflationData&) MOZ_DELETE;
   void operator=(const nsFontInflationData&) MOZ_DELETE;
 
   void UpdateWidth(const nsHTMLReflowState &aReflowState);
@@ -89,14 +93,15 @@ private:
   {
     while (!(aFrame->GetStateBits() & NS_FRAME_FONT_INFLATION_FLOW_ROOT)) {
       aFrame = aFrame->GetParent();
     }
     return aFrame;
   }
 
   nsIFrame *mBFCFrame;
+  nscoord mNCAWidth;
   nscoord mTextAmount, mTextThreshold;
   bool mInflationEnabled; // for this BFC
   bool mTextDirty;
 };
 
 #endif /* !defined(nsFontInflationData_h_) */