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
--- 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;
};