Bug 1477533 - Convert NS_STYLE_COLUMN_FILL_* to an enum class.
I put Balance as the first item in StyleColumnFill because it is the default
value.
MozReview-Commit-ID: A4DVMLL6XBa
--- a/layout/generic/nsColumnSetFrame.cpp
+++ b/layout/generic/nsColumnSetFrame.cpp
@@ -328,17 +328,17 @@ nsColumnSetFrame::ChooseColumnStrategy(c
} else if (aReflowInput.ComputedMaxBSize() != NS_INTRINSICSIZE) {
colBSize = std::min(colBSize, aReflowInput.ComputedMaxBSize());
}
nscoord colGap = GetColumnGap(this, aReflowInput.ComputedISize());
int32_t numColumns = colStyle->mColumnCount;
// If column-fill is set to 'balance', then we want to balance the columns.
- const bool isBalancing = colStyle->mColumnFill == NS_STYLE_COLUMN_FILL_BALANCE
+ const bool isBalancing = colStyle->mColumnFill == StyleColumnFill::Balance
&& !aForceAuto;
if (isBalancing) {
const uint32_t MAX_NESTED_COLUMN_BALANCING = 2;
uint32_t cnt = 0;
for (const ReflowInput* rs = aReflowInput.mParentReflowInput;
rs && cnt < MAX_NESTED_COLUMN_BALANCING; rs = rs->mParentReflowInput) {
if (rs->mFlags.mIsColumnBalancing) {
++cnt;
@@ -658,17 +658,17 @@ nsColumnSetFrame::ReflowChildren(ReflowO
bool skipIncremental = !aReflowInput.ShouldReflowAllKids()
&& !NS_SUBTREE_DIRTY(child)
&& child->GetNextSibling()
&& !(aUnboundedLastColumn && columnCount == aConfig.mBalanceColCount - 1)
&& !NS_SUBTREE_DIRTY(child->GetNextSibling());
// If column-fill is auto (not the default), then we might need to
// move content between columns for any change in column block-size.
if (skipIncremental && changingBSize &&
- StyleColumn()->mColumnFill == NS_STYLE_COLUMN_FILL_AUTO) {
+ StyleColumn()->mColumnFill == StyleColumnFill::Auto) {
skipIncremental = false;
}
// If we need to pull up content from the prev-in-flow then this is not just
// a height shrink. The prev in flow will have set the dirty bit.
// Check the overflow rect YMost instead of just the child's content height. The child
// may have overflowing content that cares about the available height boundary.
// (It may also have overflowing content that doesn't care about the available height
// boundary, but if so, too bad, this optimization is defeated.)
--- a/layout/style/ServoBindings.toml
+++ b/layout/style/ServoBindings.toml
@@ -148,16 +148,17 @@ rusty-enums = [
"mozilla::HalfCorner",
"mozilla::StyleDisplay",
"mozilla::StyleFloatEdge",
"mozilla::StyleShapeRadius",
"mozilla::StyleWindowDragging",
"mozilla::StyleOrient",
"mozilla::StyleBoxSizing",
"mozilla::StyleClear",
+ "mozilla::StyleColumnFill",
"mozilla::StyleComplexColor_Tag",
"mozilla::StyleFloat",
"mozilla::StyleImageOrientation",
"mozilla::StyleUserModify",
"mozilla::StyleUserInput",
"mozilla::StyleBoxDirection",
"mozilla::StyleTextJustify",
"mozilla::StyleHyphens",
--- a/layout/style/nsStyleConsts.h
+++ b/layout/style/nsStyleConsts.h
@@ -82,16 +82,21 @@ enum class StyleClear : uint8_t {
// so it needs to use a bit value that none of the other values can have.
//
// FIXME(emilio): Doesn't look like we do that anymore, so probably can be
// made a single value instead, and Max removed.
Line = 8,
Max = 13 // Max = (Both | Line)
};
+enum class StyleColumnFill : uint8_t {
+ Balance,
+ Auto,
+};
+
// Counters and generated content.
enum class StyleContentType : uint8_t {
String = 1,
Image = 10,
Attr = 20,
Counter = 30,
Counters = 31,
OpenQuote = 40,
@@ -974,19 +979,16 @@ enum class StyleWhiteSpace : uint8_t {
// See nsStyleBreaks
#define NS_STYLE_PAGE_BREAK_AUTO 0
#define NS_STYLE_PAGE_BREAK_ALWAYS 1
#define NS_STYLE_PAGE_BREAK_AVOID 2
#define NS_STYLE_PAGE_BREAK_LEFT 3
#define NS_STYLE_PAGE_BREAK_RIGHT 4
-#define NS_STYLE_COLUMN_FILL_AUTO 0
-#define NS_STYLE_COLUMN_FILL_BALANCE 1
-
#define NS_STYLE_COLUMN_SPAN_NONE 0
#define NS_STYLE_COLUMN_SPAN_ALL 1
// See nsStyleUIReset
#define NS_STYLE_IME_MODE_AUTO 0
#define NS_STYLE_IME_MODE_NORMAL 1
#define NS_STYLE_IME_MODE_ACTIVE 2
#define NS_STYLE_IME_MODE_DISABLED 3
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -754,17 +754,16 @@ 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(NS_STYLE_BORDER_STYLE_NONE)
- , mColumnFill(NS_STYLE_COLUMN_FILL_BALANCE)
, mColumnSpan(NS_STYLE_COLUMN_SPAN_NONE)
, mColumnRuleWidth((StaticPresData::Get()
->GetBorderWidthTable())[NS_STYLE_BORDER_WIDTH_MEDIUM])
, mTwipsPerPixel(aContext->AppUnitsPerDevPixel())
{
MOZ_COUNT_CTOR(nsStyleColumn);
}
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -2813,17 +2813,17 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsSt
// This represents the value of column-count: auto.
static const uint32_t kColumnCountAuto = 0;
uint32_t mColumnCount = kColumnCountAuto;
nsStyleCoord mColumnWidth; // coord, auto
mozilla::StyleComplexColor mColumnRuleColor;
uint8_t mColumnRuleStyle; // NS_STYLE_BORDER_STYLE_*
- uint8_t mColumnFill; // NS_STYLE_COLUMN_FILL_*
+ mozilla::StyleColumnFill mColumnFill = mozilla::StyleColumnFill::Balance;
uint8_t mColumnSpan; // NS_STYLE_COLUMN_SPAN_*
void SetColumnRuleWidth(nscoord aWidth) {
mColumnRuleWidth = NS_ROUND_BORDER_TO_PIXELS(aWidth, mTwipsPerPixel);
}
nscoord GetComputedColumnRuleWidth() const {
return (IsVisibleBorderStyle(mColumnRuleStyle) ? mColumnRuleWidth : 0);
--- a/servo/components/style/properties/longhands/column.mako.rs
+++ b/servo/components/style/properties/longhands/column.mako.rs
@@ -28,16 +28,17 @@
spec="https://drafts.csswg.org/css-multicol/#propdef-column-count",
servo_restyle_damage="rebuild_and_reflow",
)}
${helpers.single_keyword("column-fill", "balance auto", extra_prefixes="moz",
products="gecko", animation_value_type="discrete",
+ gecko_enum_prefix="StyleColumnFill",
spec="https://drafts.csswg.org/css-multicol/#propdef-column-fill")}
${helpers.predefined_type("column-rule-width",
"BorderSideWidth",
"::values::computed::NonNegativeLength::new(3.)",
initial_specified_value="specified::BorderSideWidth::Medium",
computed_type="::values::computed::NonNegativeLength",
products="gecko",