@@ -177,7 +177,7 @@ namespace client_cssom
177177 }
178178
179179 // 3D Transforms
180- inline const bool hasTransform () const { return has_transform_ ; }
180+ inline const bool hasTransform () const { return bitfields_. HasTransform () ; }
181181 inline const values::computed::Transform &transform () const { return transform_; }
182182 inline const size_t applyTransformTo (glm::mat4 &matrix) const { return transform_.applyTo (matrix); }
183183
@@ -229,7 +229,7 @@ namespace client_cssom
229229 values::CSSFloat flex_shrink_ = 1 .0f ;
230230
231231 // Grid
232- // TODO
232+ // TODO(yorkie): add grid properties when needed.
233233
234234 // Visibility and UI
235235 std::optional<Visibility> visibility_ = Visibility::kVisible ;
@@ -251,7 +251,33 @@ namespace client_cssom
251251 values::computed::Color background_color_ = values::computed::Color::Transparent();
252252
253253 // 3D Transforms
254- bool has_transform_ = false ;
255254 values::computed::Transform transform_;
255+
256+ private: // Bitfields for computed style properties.
257+ #define ADD_BOOLEAN_BITFIELD (PRIVATE_NAME, PUBLIC_NAME ) \
258+ public: \
259+ bool PUBLIC_NAME () const { return PRIVATE_NAME; } \
260+ void Set##PUBLIC_NAME(bool new_value) { PRIVATE_NAME = new_value; } \
261+ \
262+ private: \
263+ unsigned PRIVATE_NAME : 1
264+
265+ class ComputedStyleBitfields
266+ {
267+ public:
268+ explicit ComputedStyleBitfields ()
269+ : has_transform_(false )
270+ {
271+ }
272+
273+ ADD_BOOLEAN_BITFIELD (has_display_, HasDisplay);
274+ ADD_BOOLEAN_BITFIELD (has_box_sizing_, HasBoxSizing);
275+ ADD_BOOLEAN_BITFIELD (has_overflow_x_, HasOverflowX);
276+ ADD_BOOLEAN_BITFIELD (has_overflow_y_, HasOverflowY);
277+ ADD_BOOLEAN_BITFIELD (has_transform_, HasTransform);
278+ };
279+ #undef ADD_BOOLEAN_BITFIELD
280+
281+ ComputedStyleBitfields bitfields_;
256282 };
257283}
0 commit comments