Bug 1509718 - Get rid of mBorderWidthTable. r=jwatt
authorEmilio Cobos Álvarez <emilio@crisal.io>
Tue, 27 Nov 2018 19:52:13 +0000
changeset 508150 7cd2172b993f1c7c876f415c11549bd319aebbf3
parent 508149 b4c0c0fecdba68979d41609d3978fe596078d0cd
child 508151 70030bab1073c89c41311368a224178257cb9068
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwatt
bugs1509718
milestone65.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 1509718 - Get rid of mBorderWidthTable. r=jwatt It has little to no use these days. Differential Revision: https://phabricator.services.mozilla.com/D12857
layout/base/StaticPresData.cpp
layout/base/StaticPresData.h
layout/base/nsPresContext.cpp
layout/base/nsPresContext.h
layout/mathml/nsMathMLmtableFrame.cpp
layout/style/nsStyleConsts.h
layout/style/nsStyleStruct.cpp
--- a/layout/base/StaticPresData.cpp
+++ b/layout/base/StaticPresData.cpp
@@ -33,20 +33,16 @@ StaticPresData::Get()
 {
   MOZ_ASSERT(sSingleton);
   return sSingleton;
 }
 
 StaticPresData::StaticPresData()
 {
   mLangService = nsLanguageAtomService::GetService();
-
-  mBorderWidthTable[NS_STYLE_BORDER_WIDTH_THIN] = nsPresContext::CSSPixelsToAppUnits(1);
-  mBorderWidthTable[NS_STYLE_BORDER_WIDTH_MEDIUM] = nsPresContext::CSSPixelsToAppUnits(3);
-  mBorderWidthTable[NS_STYLE_BORDER_WIDTH_THICK] = nsPresContext::CSSPixelsToAppUnits(5);
 }
 
 #define MAKE_FONT_PREF_KEY(_pref, _s0, _s1) \
  _pref.Assign(_s0); \
  _pref.Append(_s1);
 
 static const char* const kGenericFont[] = {
   ".variable.",
--- a/layout/base/StaticPresData.h
+++ b/layout/base/StaticPresData.h
@@ -88,22 +88,16 @@ public:
   static void Init();
   static void Shutdown();
 
   // Gets an instance of the singleton. Infallible between the calls to Init
   // and Shutdown.
   static StaticPresData* Get();
 
   /**
-   * This table maps border-width enums 'thin', 'medium', 'thick'
-   * to actual nscoord values.
-   */
-  const nscoord* GetBorderWidthTable() { return mBorderWidthTable; }
-
-  /**
    * Given a language, get the language group name, which can
    * be used as an argument to LangGroupFontPrefs::Initialize()
    *
    * aNeedsToCache is used for two things.  If null, it indicates that
    * the nsLanguageAtomService is safe to cache the result of the
    * language group lookup, either because we're on the main thread,
    * or because we're on a style worker thread but the font lock has
    * been acquired.  If non-null, it indicates that it's not safe to
@@ -183,15 +177,14 @@ public:
 
   void ResetCachedFontPrefs() { mStaticLangGroupFontPrefs.Reset(); }
 
 private:
   StaticPresData();
   ~StaticPresData() {}
 
   nsLanguageAtomService* mLangService;
-  nscoord mBorderWidthTable[3];
   LangGroupFontPrefs mStaticLangGroupFontPrefs;
 };
 
 } // namespace mozilla
 
 #endif // mozilla_StaticPresData_h
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -252,17 +252,16 @@ nsPresContext::nsPresContext(nsIDocument
     mQuirkSheetAdded(false),
     mNeedsPrefUpdate(false),
     mHadNonBlankPaint(false),
     mHadContentfulPaint(false)
 #ifdef DEBUG
     , mInitialized(false)
 #endif
 {
-  PodZero(&mBorderWidthTable);
 #ifdef DEBUG
   PodZero(&mLayoutPhaseCount);
 #endif
 
   if (!IsDynamic()) {
     mImageAnimationMode = imgIContainer::kDontAnimMode;
     mNeverAnimate = true;
   } else {
--- a/layout/base/nsPresContext.h
+++ b/layout/base/nsPresContext.h
@@ -1381,18 +1381,16 @@ protected:
   // typically be a very short (usually of length 1) linked list. There are 31
   // language groups, so in the worst case scenario we'll need to traverse 31
   // link items.
   LangGroupFontPrefs    mLangGroupFontPrefs;
 
   bool mFontGroupCacheDirty;
   nsTHashtable<nsRefPtrHashKey<nsAtom>> mLanguagesUsed;
 
-  nscoord               mBorderWidthTable[3];
-
   uint32_t              mInterruptChecksToSkip;
 
   // Counters for tests and tools that want to detect frame construction
   // or reflow.
   uint64_t              mElementsRestyled;
   uint64_t              mFramesConstructed;
   uint64_t              mFramesReflowed;
 
--- a/layout/mathml/nsMathMLmtableFrame.cpp
+++ b/layout/mathml/nsMathMLmtableFrame.cpp
@@ -180,18 +180,17 @@ FindCellProperty(const nsIFrame* aCellFr
 
 static void
 ApplyBorderToStyle(const nsMathMLmtdFrame* aFrame,
                    nsStyleBorder& aStyleBorder)
 {
   uint32_t rowIndex = aFrame->RowIndex();
   uint32_t columnIndex = aFrame->ColIndex();
 
-  nscoord borderWidth =
-    nsPresContext::GetBorderWidthForKeyword(NS_STYLE_BORDER_WIDTH_THIN);
+  nscoord borderWidth = nsPresContext::CSSPixelsToAppUnits(1);
 
   nsTArray<int8_t>* rowLinesList =
     FindCellProperty(aFrame, RowLinesProperty());
 
   nsTArray<int8_t>* columnLinesList =
     FindCellProperty(aFrame, ColumnLinesProperty());
 
   // We don't place a row line on top of the first row
--- a/layout/style/nsStyleConsts.h
+++ b/layout/style/nsStyleConsts.h
@@ -295,22 +295,16 @@ enum class StyleImageLayerRepeat : uint8
 #define NS_STYLE_MASK_MODE_ALPHA                0
 #define NS_STYLE_MASK_MODE_LUMINANCE            1
 #define NS_STYLE_MASK_MODE_MATCH_SOURCE         2
 
 // See nsStyleTable
 #define NS_STYLE_BORDER_COLLAPSE                0
 #define NS_STYLE_BORDER_SEPARATE                1
 
-// Possible enumerated specified values of border-*-width, used by nsCSSMargin
-#define NS_STYLE_BORDER_WIDTH_THIN              0
-#define NS_STYLE_BORDER_WIDTH_MEDIUM            1
-#define NS_STYLE_BORDER_WIDTH_THICK             2
-// XXX chopping block #define NS_STYLE_BORDER_WIDTH_LENGTH_VALUE      3
-
 enum class StyleBorderStyle : uint8_t {
   None,
   Groove,
   Ridge,
   Dotted,
   Dashed,
   Solid,
   Double,
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -43,16 +43,18 @@
 #include "ImageLoader.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 /* static */ const int32_t nsStyleGridLine::kMinLine;
 /* static */ const int32_t nsStyleGridLine::kMaxLine;
 
+static const nscoord kMediumBorderWidth = nsPresContext::CSSPixelsToAppUnits(3);
+
 // We set the size limit of style structs to 504 bytes so that when they
 // are allocated by Servo side with Arc, the total size doesn't exceed
 // 512 bytes, which minimizes allocator slop.
 static constexpr size_t kStyleStructSizeLimit = 504;
 #define STYLE_STRUCT(name_) \
   static_assert(sizeof(nsStyle##name_) <= kStyleStructSizeLimit, \
                 "nsStyle" #name_ " became larger than the size limit");
 #include "nsStyleStructList.h"
@@ -278,18 +280,17 @@ nsStyleBorder::nsStyleBorder(const nsPre
   , mComputedBorder(0, 0, 0, 0)
 {
   MOZ_COUNT_CTOR(nsStyleBorder);
 
   NS_FOR_CSS_HALF_CORNERS (corner) {
     mBorderRadius.Set(corner, nsStyleCoord(0, nsStyleCoord::CoordConstructor));
   }
 
-  nscoord medium =
-    (StaticPresData::Get()->GetBorderWidthTable())[NS_STYLE_BORDER_WIDTH_MEDIUM];
+  nscoord medium = kMediumBorderWidth;
   NS_FOR_CSS_SIDES(side) {
     mBorderImageSlice.Set(side, nsStyleCoord(1.0f, eStyleUnit_Percent));
     mBorderImageWidth.Set(side, nsStyleCoord(1.0f, eStyleUnit_Factor));
     mBorderImageOutset.Set(side, nsStyleCoord(0.0f, eStyleUnit_Factor));
 
     mBorder.Side(side) = medium;
     mBorderStyle[side] = StyleBorderStyle::None;
   }
@@ -440,18 +441,17 @@ nsStyleBorder::CalcDifference(const nsSt
       mBorderImageWidth   != aNewData.mBorderImageWidth) {
     return nsChangeHint_NeutralChange;
   }
 
   return nsChangeHint(0);
 }
 
 nsStyleOutline::nsStyleOutline(const nsPresContext* aContext)
-  : mOutlineWidth((StaticPresData::Get()
-                     ->GetBorderWidthTable())[NS_STYLE_BORDER_WIDTH_MEDIUM])
+  : mOutlineWidth(kMediumBorderWidth)
   , mOutlineOffset(0)
   , mOutlineColor(StyleComplexColor::CurrentColor())
   , mOutlineStyle(StyleBorderStyle::None)
   , mActualOutlineWidth(0)
   , mTwipsPerPixel(aContext->DevPixelsToAppUnits(1))
 {
   MOZ_COUNT_CTOR(nsStyleOutline);
   // spacing values not inherited
@@ -663,18 +663,17 @@ nsStyleXUL::CalcDifference(const nsStyle
 //
 /* static */ const uint32_t nsStyleColumn::kMaxColumnCount;
 /* static */ const uint32_t nsStyleColumn::kColumnCountAuto;
 
 nsStyleColumn::nsStyleColumn(const nsPresContext* aContext)
   : mColumnWidth(eStyleUnit_Auto)
   , mColumnRuleColor(StyleComplexColor::CurrentColor())
   , mColumnRuleStyle(StyleBorderStyle::None)
-  , mColumnRuleWidth((StaticPresData::Get()
-                        ->GetBorderWidthTable())[NS_STYLE_BORDER_WIDTH_MEDIUM])
+  , mColumnRuleWidth(kMediumBorderWidth)
   , mTwipsPerPixel(aContext->AppUnitsPerDevPixel())
 {
   MOZ_COUNT_CTOR(nsStyleColumn);
 }
 
 nsStyleColumn::~nsStyleColumn()
 {
   MOZ_COUNT_DTOR(nsStyleColumn);