Skip to content

Commit 1f5d8f5

Browse files
committed
Bug 1979806 - Allow clang-format for TrackSize::StateBits. r=layout-reviewers,emilio
I feel it is better for `TrackSize::StateBits` be formatted automatically by `clang-format`. This patch removes the last `clang-format off` directive in the grid container. Previously, we removed one for `GridItemInfo::StateBits` in Bug 1878846: https://hg.mozilla.org/mozilla-central/rev/7829576fd77e In addition, convert the enum values to `1 << N` style to improve readability. Differential Revision: https://phabricator.services.mozilla.com/D258998
1 parent ba9fd3a commit 1f5d8f5

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

layout/generic/nsGridContainerFrame.cpp

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -435,38 +435,36 @@ enum class GridLineSide {
435435

436436
struct nsGridContainerFrame::TrackSize {
437437
enum StateBits : uint16_t {
438-
// clang-format off
439-
eAutoMinSizing = 0x1,
440-
eMinContentMinSizing = 0x2,
441-
eMaxContentMinSizing = 0x4,
438+
eAutoMinSizing = 1 << 0,
439+
eMinContentMinSizing = 1 << 1,
440+
eMaxContentMinSizing = 1 << 2,
442441
eMinOrMaxContentMinSizing = eMinContentMinSizing | eMaxContentMinSizing,
443442
eIntrinsicMinSizing = eMinOrMaxContentMinSizing | eAutoMinSizing,
444-
eModified = 0x8,
445-
eAutoMaxSizing = 0x10,
446-
eMinContentMaxSizing = 0x20,
447-
eMaxContentMaxSizing = 0x40,
443+
eModified = 1 << 3,
444+
eAutoMaxSizing = 1 << 4,
445+
eMinContentMaxSizing = 1 << 5,
446+
eMaxContentMaxSizing = 1 << 6,
448447
eAutoOrMaxContentMaxSizing = eAutoMaxSizing | eMaxContentMaxSizing,
449448
eIntrinsicMaxSizing = eAutoOrMaxContentMaxSizing | eMinContentMaxSizing,
450-
eFlexMaxSizing = 0x80,
451-
eFrozen = 0x100,
452-
eSkipGrowUnlimited1 = 0x200,
453-
eSkipGrowUnlimited2 = 0x400,
449+
eFlexMaxSizing = 1 << 7,
450+
eFrozen = 1 << 8,
451+
eSkipGrowUnlimited1 = 1 << 9,
452+
eSkipGrowUnlimited2 = 1 << 10,
454453
eSkipGrowUnlimited = eSkipGrowUnlimited1 | eSkipGrowUnlimited2,
455-
eBreakBefore = 0x800,
456-
eApplyFitContentClamping = 0x1000,
457-
eInfinitelyGrowable = 0x2000,
454+
eBreakBefore = 1 << 11,
455+
eApplyFitContentClamping = 1 << 12,
456+
eInfinitelyGrowable = 1 << 13,
458457

459458
// These are only used in the masonry axis. They share the same value
460459
// as *MinSizing above, but that's OK because we don't use those in
461460
// the masonry axis.
462461
//
463462
// This track corresponds to an item margin-box size that is stretching.
464-
eItemStretchSize = 0x1,
463+
eItemStretchSize = 1 << 0,
465464
// This bit says that we should clamp that size to mLimit.
466-
eClampToLimit = 0x2,
465+
eClampToLimit = 1 << 1,
467466
// This bit says that the corresponding item has `auto` margin(s).
468-
eItemHasAutoMargin = 0x4,
469-
// clang-format on
467+
eItemHasAutoMargin = 1 << 2,
470468
};
471469

472470
StateBits Initialize(nscoord aPercentageBasis, const StyleTrackSize&);

0 commit comments

Comments
 (0)