commit 2f696ddedabb972cda43a843e08713028ed07b3e
parent 3ed37cc4a6bf02974288add6e6635e87c69cc80a
Author: agoloman <agoloman@mozilla.com>
Date: Wed, 12 Nov 2025 22:20:49 +0200
Revert "Bug 1998365 - Switch NonCustomCSSPropertyId to uint16_t; r=emilio,firefox-style-system-reviewers" for casuing build bustages @nsCSSProps.h.
This reverts commit 467aeff5c9a6fe0e3f9bcab7ac42fac1c8f71eb6.
Diffstat:
5 files changed, 9 insertions(+), 17 deletions(-)
diff --git a/dom/html/nsGenericHTMLElement.h b/dom/html/nsGenericHTMLElement.h
@@ -28,7 +28,7 @@ class nsILayoutHistoryState;
class nsIURI;
struct nsSize;
-enum NonCustomCSSPropertyId : uint16_t;
+enum NonCustomCSSPropertyId : int32_t;
namespace mozilla {
class EditorBase;
diff --git a/ipc/glue/IPCMessageUtilsSpecializations.h b/ipc/glue/IPCMessageUtilsSpecializations.h
@@ -375,7 +375,7 @@ struct ParamTraits<float> {
template <>
struct ParamTraits<NonCustomCSSPropertyId>
: public ContiguousEnumSerializer<
- NonCustomCSSPropertyId, eCSSProperty_FIRST, eCSSProperty_INVALID> {};
+ NonCustomCSSPropertyId, eCSSProperty_UNKNOWN, eCSSProperty_COUNT> {};
template <>
struct ParamTraits<nsID> {
diff --git a/layout/style/GenerateCSSPropertyID.py b/layout/style/GenerateCSSPropertyID.py
@@ -33,7 +33,6 @@ def generate(output, template, dataFile):
template.substitute(
{
"property_ids": "\n".join(" {},".format(p) for p in property_ids),
- "longhand_first": property_ids[0],
"longhand_count": property_ids[longhand_count],
"shorthand_count": property_ids[longhand_count + shorthand_count],
}
diff --git a/layout/style/NonCustomCSSPropertyId.h.in b/layout/style/NonCustomCSSPropertyId.h.in
@@ -18,7 +18,9 @@
To change the list of properties, see ServoCSSPropList.h
*/
-enum NonCustomCSSPropertyId : uint16_t {
+enum NonCustomCSSPropertyId : int32_t {
+ eCSSProperty_UNKNOWN = -1,
+
$property_ids
// Some of the values below could probably overlap with each other
@@ -26,20 +28,11 @@ $property_ids
// Extra value to represent custom properties (--*).
eCSSPropertyExtra_variable,
-
- eCSSProperty_UNKNOWN,
-
- // Only needed for IPC serialization helper, should never be used in code.
- eCSSProperty_INVALID,
};
// MOZ_DBG support is defined in nsCSSProps.h since it depends on
// nsCSSProps::GetStringValue
-static_assert(static_cast<uint64_t>($longhand_first) == 0);
-
-const NonCustomCSSPropertyId
- eCSSProperty_FIRST = NonCustomCSSPropertyId(0);
const NonCustomCSSPropertyId
eCSSProperty_COUNT_no_shorthands = $longhand_count;
const NonCustomCSSPropertyId
diff --git a/servo/components/style/properties/mod.rs b/servo/components/style/properties/mod.rs
@@ -223,19 +223,19 @@ impl NonCustomPropertyId {
#[inline]
pub fn to_noncustomcsspropertyid(self) -> NonCustomCSSPropertyId {
// unsafe: guaranteed by static_assert_noncustomcsspropertyid.
- unsafe { mem::transmute(self.0) }
+ unsafe { mem::transmute(self.0 as i32) }
}
/// Convert an `NonCustomCSSPropertyId` into a `NonCustomPropertyId`.
#[cfg(feature = "gecko")]
#[inline]
pub fn from_noncustomcsspropertyid(prop: NonCustomCSSPropertyId) -> Option<Self> {
- let prop = prop as u16;
- if prop >= property_counts::NON_CUSTOM as u16 {
+ let prop = prop as i32;
+ if prop < 0 || prop >= property_counts::NON_CUSTOM as i32 {
return None;
}
// guaranteed by static_assert_noncustomcsspropertyid above.
- Some(NonCustomPropertyId(prop))
+ Some(NonCustomPropertyId(prop as u16))
}
/// Resolves the alias of a given property if needed.