commit d977c6ae7005dea9e46e6d127469273b16d01fe2
parent 63fc8cb376519cd708411f78f542fb1b84d91100
Author: Jan Varga <jan.varga@gmail.com>
Date: Sat, 15 Nov 2025 23:17:30 +0000
Bug 1998916 - Add DeclarationBlock::GetPropertyValueById that takes CSSPropertyId; r=emilio,firefox-style-system-reviewers
Adds a new DeclarationBlock::GetPropertyValueById to support retrieving values
for both non custom and custom properties.
This complements the previous rename of the non custom version. No behavior
changes intended.
Differential Revision: https://phabricator.services.mozilla.com/D271764
Diffstat:
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/layout/style/DeclarationBlock.h b/layout/style/DeclarationBlock.h
@@ -20,6 +20,8 @@
namespace mozilla {
class AttributeStyles;
+struct CSSPropertyId;
+
namespace css {
class Declaration;
class Rule;
@@ -185,6 +187,11 @@ class DeclarationBlock final {
&aValue);
}
+ void GetPropertyValueById(const CSSPropertyId& aPropId,
+ nsACString& aValue) const {
+ Servo_DeclarationBlock_GetPropertyValueById(mRaw, &aPropId, &aValue);
+ }
+
bool GetPropertyIsImportant(const nsACString& aProperty) const {
return Servo_DeclarationBlock_GetPropertyIsImportant(mRaw, &aProperty);
}
diff --git a/servo/ports/geckolib/glue.rs b/servo/ports/geckolib/glue.rs
@@ -5369,6 +5369,19 @@ pub unsafe extern "C" fn Servo_DeclarationBlock_GetPropertyValueByNonCustomId(
}
#[no_mangle]
+pub unsafe extern "C" fn Servo_DeclarationBlock_GetPropertyValueById(
+ declarations: &LockedDeclarationBlock,
+ property_id: &structs::CSSPropertyId,
+ value: &mut nsACString,
+) {
+ get_property_value(
+ declarations,
+ get_property_id_from_csspropertyid!(property_id, ()),
+ value,
+ )
+}
+
+#[no_mangle]
pub unsafe extern "C" fn Servo_DeclarationBlock_GetPropertyIsImportant(
declarations: &LockedDeclarationBlock,
property: &nsACString,