Bug 1342330 Part 3 - Convert FlagBits::mBreakType to StyleClear. r?xidorn draft
authorTing-Yu Lin <tlin@mozilla.com>
Fri, 24 Feb 2017 15:27:23 +0800
changeset 489070 098f3137507640a179b943ad90657f0c3452d8dc
parent 489005 833ea2cab3bb420b5632a3f52444a9234819933b
child 546927 835fb4de526b3672399e5a61ef61d947292bf0da
push id46744
push userbmo:tlin@mozilla.com
push dateFri, 24 Feb 2017 09:49:53 +0000
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;
   };