Skip to content

Commit bbfc3a0

Browse files
AtkinsSJtcl3
authored andcommitted
LibWeb/CSS: Use a bitfield for Containment flags
Shrinks the struct down from 5 bytes to 1.
1 parent 3916e33 commit bbfc3a0

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Libraries/LibWeb/CSS/ComputedValues.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,11 @@ struct ObjectPosition {
7272

7373
// https://drafts.csswg.org/css-contain-2/#containment-types
7474
struct Containment {
75-
// FIXME: It'd be nice if this was a single-byte bitfield instead of some bools.
76-
bool size_containment = false;
77-
bool inline_size_containment = false;
78-
bool layout_containment = false;
79-
bool style_containment = false;
80-
bool paint_containment = false;
75+
bool size_containment : 1 { false };
76+
bool inline_size_containment : 1 { false };
77+
bool layout_containment : 1 { false };
78+
bool style_containment : 1 { false };
79+
bool paint_containment : 1 { false };
8180

8281
bool is_empty() const { return !(size_containment || inline_size_containment || layout_containment || style_containment || paint_containment); }
8382
};

0 commit comments

Comments
 (0)