Bug 1342330 Part 3 - Convert FlagBits::mBreakType to StyleClear. r=xidorn
authorTing-Yu Lin <tlin@mozilla.com>
Fri, 24 Feb 2017 15:27:23 +0800
changeset 373761 94dabc6479b22c85b59722f94cebf7371f0de4d0
parent 373760 55a43be33799ab0e92c4968a40b835b2d207fab4
child 373762 be46bf0c2fd6c7526a304d96efa2ecfb16ee5676
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn
bugs1342330
milestone54.0a1
Bug 1342330 Part 3 - Convert FlagBits::mBreakType to StyleClear. r=xidorn We can avoid static_cast if using StyleClear type directly. MozReview-Commit-ID: 3lh2VJCAfuW
layout/generic/nsLineBox.h
--- a/layout/generic/nsLineBox.h
+++ b/layout/generic/nsLineBox.h
@@ -399,28 +399,28 @@ public:
   }
   void SetBreakTypeBefore(StyleClear aBreakType) {
     MOZ_ASSERT(IsBlock(), "Only blocks have break-before");
     MOZ_ASSERT(aBreakType == StyleClear::None ||
                aBreakType == StyleClear::Left ||
                aBreakType == StyleClear::Right ||
                aBreakType == StyleClear::Both,
                "Only float break types are allowed before a line");
-    mFlags.mBreakType = static_cast<int>(aBreakType);
+    mFlags.mBreakType = aBreakType;
   }
   StyleClear GetBreakTypeBefore() const {
     return IsBlock() ? BreakType() : StyleClear::None;
   }
 
   bool HasBreakAfter() const {
     return !IsBlock() && StyleClear::None != BreakType();
   }
   void SetBreakTypeAfter(StyleClear aBreakType) {
     MOZ_ASSERT(!IsBlock(), "Only inlines have break-after");
-    mFlags.mBreakType = static_cast<int>(aBreakType);
+    mFlags.mBreakType = aBreakType;
   }
   bool HasFloatBreakAfter() const {
     return !IsBlock() &&
            (StyleClear::Left == BreakType() ||
             StyleClear::Right == BreakType() ||
             StyleClear::Both == BreakType());
   }
   StyleClear GetBreakTypeAfter() const {
@@ -671,17 +671,17 @@ public:
     bool mEmptyCacheState: 1;
     // mHasBullet indicates that this is an inline line whose block's
     // bullet is adjacent to this line and non-empty.
     bool mHasBullet : 1;
     // Indicates that this line *may* have a placeholder for a float
     // that was pushed to a later column or page.
     bool mHadFloatPushed : 1;
     bool mHasHashedFrames: 1;
-    uint32_t mBreakType : 4;
+    StyleClear mBreakType;
   };
 
   struct ExtraData {
     explicit ExtraData(const nsRect& aBounds) : mOverflowAreas(aBounds, aBounds) {
     }
     nsOverflowAreas mOverflowAreas;
   };
 
@@ -705,17 +705,17 @@ protected:
   static_assert(sizeof(FlagBits) <= sizeof(uint32_t),
                 "size of FlagBits should not be larger than size of uint32_t");
   union {
     uint32_t mAllFlags;
     FlagBits mFlags;
   };
 
   StyleClear BreakType() const {
-    return static_cast<StyleClear>(mFlags.mBreakType);
+    return mFlags.mBreakType;
   };
 
   union {
     ExtraData* mData;
     ExtraBlockData* mBlockData;
     ExtraInlineData* mInlineData;
   };