Skip to content

Add logic for registering custom properties from script#325

Merged
Loirooriol merged 1 commit intoservo:mainfrom
Loirooriol:register_custom_property
Mar 8, 2026
Merged

Add logic for registering custom properties from script#325
Loirooriol merged 1 commit intoservo:mainfrom
Loirooriol:register_custom_property

Conversation

@Loirooriol
Copy link
Copy Markdown
Collaborator

@Loirooriol Loirooriol commented Mar 7, 2026

This way it can be shared among Gecko and Servo.

Stylo PR: servo/servo#43085
Upstream: https://bugzilla.mozilla.org/show_bug.cgi?id=2021743

Copy link
Copy Markdown
Member

@mrobinson mrobinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, though:

  1. Let's wait for the upstream version to land.
  2. Please modernize the Rust a bit via the following suggestions, if they work.

Comment thread style/stylist.rs Outdated
Comment thread style/stylist.rs Outdated
Comment thread style/stylist.rs
Comment on lines +2086 to +2096
if let Err(error) =
PropertyRegistration::validate_initial_value(&syntax, initial_value.as_deref())
{
return match error {
PropertyRegistrationError::InitialValueNotComputationallyIndependent => {
InitialValueNotComputationallyIndependent
},
PropertyRegistrationError::InvalidInitialValue => InvalidInitialValue,
PropertyRegistrationError::NoInitialValue => NoInitialValue,
};
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could use map_err here with ?.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went with the Gecko version which returns RegisterCustomPropertyResult, so I can't use ?. The Servo version uses Result<(), RegisterPropertyError> but overall it didn't seem worth it.

This way it can be shared among Gecko and Servo.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
@Loirooriol Loirooriol force-pushed the register_custom_property branch from 49fd91b to 6198d77 Compare March 8, 2026 21:50
@Loirooriol
Copy link
Copy Markdown
Collaborator Author

The upstream version landed. I will export the review changes during the next sync.

@Loirooriol Loirooriol added this pull request to the merge queue Mar 8, 2026
Merged via the queue into servo:main with commit 1d21770 Mar 8, 2026
5 checks passed
@Loirooriol Loirooriol deleted the register_custom_property branch March 8, 2026 21:56
github-merge-queue Bot pushed a commit to servo/servo that referenced this pull request Mar 8, 2026
…om script (#43085)

Stylo PR: servo/stylo#325

Testing: Not needed, no behavior change

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants