Bug 1548673 Part 3 - Rename nsBlockFrame's mPrefWidth to mCachedPrefISize. r=jfkthame
authorTing-Yu Lin <tlin@mozilla.com>
Fri, 03 May 2019 17:34:55 +0000
changeset 531352 5ad9fb7a2713a3c63e3375773ef3a26e093d69c1
parent 531351 2a7dcc0cc43d85811a6a06904094143dc499dc8d
child 531353 00441f7cdd1c724fab51360d0aa43023b47928dd
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs1548673
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1548673 Part 3 - Rename nsBlockFrame's mPrefWidth to mCachedPrefISize. r=jfkthame Like Part 2, I choose mCachedPrefISize because grid and flex container are using it. Differential Revision: https://phabricator.services.mozilla.com/D29748
layout/forms/nsFileControlFrame.cpp
layout/generic/nsBlockFrame.cpp
layout/generic/nsBlockFrame.h
--- a/layout/forms/nsFileControlFrame.cpp
+++ b/layout/forms/nsFileControlFrame.cpp
@@ -171,17 +171,17 @@ void nsFileControlFrame::Reflow(nsPresCo
           buttonFrame->GetLogicalUsedMargin(wm).IStartEnd(wm);
       if (CropTextToWidth(*aReflowInput.mRenderingContext, labelFrame,
                           availableISizeForLabel - labelBP, filename)) {
         nsBlockFrame::DidReflow(aPresContext, &aReflowInput);
         aStatus.Reset();
         labelFrame->AddStateBits(NS_FRAME_IS_DIRTY |
                                  NS_BLOCK_NEEDS_BIDI_RESOLUTION);
         mCachedMinISize = NS_INTRINSIC_ISIZE_UNKNOWN;
-        mPrefWidth = NS_INTRINSIC_ISIZE_UNKNOWN;
+        mCachedPrefISize = NS_INTRINSIC_ISIZE_UNKNOWN;
         done = true;
         continue;
       }
     }
     break;
   }
 }
 
@@ -523,17 +523,17 @@ nscoord nsFileControlFrame::GetMinISize(
   return result;
 }
 
 nscoord nsFileControlFrame::GetPrefISize(gfxContext* aRenderingContext) {
   nscoord result;
   DISPLAY_MIN_INLINE_SIZE(this, result);
 
   // Make sure we measure with the uncropped filename.
-  if (mPrefWidth == NS_INTRINSIC_ISIZE_UNKNOWN) {
+  if (mCachedPrefISize == NS_INTRINSIC_ISIZE_UNKNOWN) {
     nsAutoString filename;
     HTMLInputElement::FromNode(mContent)->GetDisplayFileName(filename);
     UpdateDisplayedValue(filename, false);
   }
 
   result = nsBlockFrame::GetPrefISize(aRenderingContext);
   return result;
 }
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -678,17 +678,17 @@ static bool RemoveFirstLine(nsLineList& 
 
 //////////////////////////////////////////////////////////////////////
 // Reflow methods
 
 /* virtual */
 void nsBlockFrame::MarkIntrinsicISizesDirty() {
   nsBlockFrame* dirtyBlock = static_cast<nsBlockFrame*>(FirstContinuation());
   dirtyBlock->mCachedMinISize = NS_INTRINSIC_ISIZE_UNKNOWN;
-  dirtyBlock->mPrefWidth = NS_INTRINSIC_ISIZE_UNKNOWN;
+  dirtyBlock->mCachedPrefISize = NS_INTRINSIC_ISIZE_UNKNOWN;
   if (!(GetStateBits() & NS_BLOCK_NEEDS_BIDI_RESOLUTION)) {
     for (nsIFrame* frame = dirtyBlock; frame;
          frame = frame->GetNextContinuation()) {
       frame->AddStateBits(NS_BLOCK_NEEDS_BIDI_RESOLUTION);
     }
   }
 
   nsContainerFrame::MarkIntrinsicISizesDirty();
@@ -698,17 +698,17 @@ void nsBlockFrame::CheckIntrinsicCacheAg
   nsPresContext* presContext = PresContext();
   if (!nsLayoutUtils::FontSizeInflationEnabled(presContext)) {
     return;
   }
   bool inflationEnabled = !presContext->mInflationDisabledForShrinkWrap;
   if (inflationEnabled !=
       !!(GetStateBits() & NS_BLOCK_FRAME_INTRINSICS_INFLATED)) {
     mCachedMinISize = NS_INTRINSIC_ISIZE_UNKNOWN;
-    mPrefWidth = NS_INTRINSIC_ISIZE_UNKNOWN;
+    mCachedPrefISize = NS_INTRINSIC_ISIZE_UNKNOWN;
     if (inflationEnabled) {
       AddStateBits(NS_BLOCK_FRAME_INTRINSICS_INFLATED);
     } else {
       RemoveStateBits(NS_BLOCK_FRAME_INTRINSICS_INFLATED);
     }
   }
 }
 
@@ -792,25 +792,27 @@ nscoord nsBlockFrame::GetMinISize(gfxCon
   return mCachedMinISize;
 }
 
 /* virtual */
 nscoord nsBlockFrame::GetPrefISize(gfxContext* aRenderingContext) {
   nsIFrame* firstInFlow = FirstContinuation();
   if (firstInFlow != this) return firstInFlow->GetPrefISize(aRenderingContext);
 
-  DISPLAY_PREF_INLINE_SIZE(this, mPrefWidth);
+  DISPLAY_PREF_INLINE_SIZE(this, mCachedPrefISize);
 
   CheckIntrinsicCacheAgainstShrinkWrapState();
 
-  if (mPrefWidth != NS_INTRINSIC_ISIZE_UNKNOWN) return mPrefWidth;
+  if (mCachedPrefISize != NS_INTRINSIC_ISIZE_UNKNOWN) {
+    return mCachedPrefISize;
+  }
 
   if (StyleDisplay()->IsContainSize()) {
-    mPrefWidth = 0;
-    return mPrefWidth;
+    mCachedPrefISize = 0;
+    return mCachedPrefISize;
   }
 
 #ifdef DEBUG
   if (gNoisyIntrinsic) {
     IndentBy(stdout, gNoiseIndent);
     ListTag(stdout);
     printf(": GetPrefISize\n");
   }
@@ -872,18 +874,18 @@ nscoord nsBlockFrame::GetPrefISize(gfxCo
         printf("pref: [prevLines=%d currentLine=%d]\n", data.mPrevLines,
                data.mCurrentLine);
       }
 #endif
     }
   }
   data.ForceBreak();
 
-  mPrefWidth = data.mPrevLines;
-  return mPrefWidth;
+  mCachedPrefISize = data.mPrevLines;
+  return mCachedPrefISize;
 }
 
 nsRect nsBlockFrame::ComputeTightBounds(DrawTarget* aDrawTarget) const {
   // be conservative
   if (Style()->HasTextDecorationLines()) {
     return GetVisualOverflowRect();
   }
   return ComputeSimpleTightBounds(aDrawTarget);
--- a/layout/generic/nsBlockFrame.h
+++ b/layout/generic/nsBlockFrame.h
@@ -405,18 +405,17 @@ class nsBlockFrame : public nsContainerF
 
   // Update our first-letter styles during stylo post-traversal.  This needs to
   // be done at a slightly different time than our other pseudo-elements.
   void UpdateFirstLetterStyle(mozilla::ServoRestyleState& aRestyleState);
 
  protected:
   explicit nsBlockFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
                         ClassID aID = kClassID)
-      : nsContainerFrame(aStyle, aPresContext, aID),
-        mPrefWidth(NS_INTRINSIC_ISIZE_UNKNOWN) {
+      : nsContainerFrame(aStyle, aPresContext, aID) {
 #ifdef DEBUG
     InitDebugFlags();
 #endif
   }
 
   virtual ~nsBlockFrame();
 
 #ifdef DEBUG
@@ -898,20 +897,18 @@ class nsBlockFrame : public nsContainerF
   nsFrameList* RemovePushedFloats();
 
 #ifdef DEBUG
   void VerifyLines(bool aFinalCheckOK);
   void VerifyOverflowSituation();
   int32_t GetDepth() const;
 #endif
 
-  // FIXME The two variables should go through a renaming refactoring to reflect
-  // the fact that they mean an inline size, not a width.
   nscoord mCachedMinISize = NS_INTRINSIC_ISIZE_UNKNOWN;
-  nscoord mPrefWidth;
+  nscoord mCachedPrefISize = NS_INTRINSIC_ISIZE_UNKNOWN;
 
   nsLineList mLines;
 
   // List of all floats in this block
   // XXXmats blocks rarely have floats, make it a frame property
   nsFrameList mFloats;
 
   friend class mozilla::BlockReflowInput;