From 3eed093e33c759c8cf04491377756d88a563942a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Fri, 11 Aug 2023 02:17:32 +0200 Subject: [PATCH] style: Tweak contain bitflag definition order to avoid static constructors This has no behavior change otherwise. The STRICT definition depended on SIZE, which was defined later. That's fine in Rust, but in C++ it causes the initialization to be dynamic because it doesn't have the definition of SIZE yet (ugh). This is the fix for the regression, though the following patch turns on constexpr support in cbindgen, which would've caught this at build-time, and guarantees that we don't have extra static constructors. Differential Revision: https://phabricator.services.mozilla.com/D144316 --- components/style/values/specified/box.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/style/values/specified/box.rs b/components/style/values/specified/box.rs index 9e20e3a4f59..efdb65ff973 100644 --- a/components/style/values/specified/box.rs +++ b/components/style/values/specified/box.rs @@ -1346,12 +1346,12 @@ bitflags! { const LAYOUT = 1 << 2; /// `paint` variant, turns on paint containment const PAINT = 1 << 3; - /// `strict` variant, turns on all types of containment - const STRICT = 1 << 4 | Contain::LAYOUT.bits | Contain::PAINT.bits | Contain::SIZE.bits; + /// 'size' variant, turns on size containment + const SIZE = 1 << 4 | Contain::INLINE_SIZE.bits | Contain::BLOCK_SIZE.bits; /// `content` variant, turns on layout and paint containment const CONTENT = 1 << 5 | Contain::LAYOUT.bits | Contain::PAINT.bits; - /// 'size' variant, turns on size containment - const SIZE = 1 << 6 | Contain::INLINE_SIZE.bits | Contain::BLOCK_SIZE.bits; + /// `strict` variant, turns on all types of containment + const STRICT = 1 << 6 | Contain::LAYOUT.bits | Contain::PAINT.bits | Contain::SIZE.bits; } }