mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #20351 - jwatt:master, r=emilio
Add Servo_Property_IsShorthand to geckolib/glue.rs <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20351) <!-- Reviewable:end -->
This commit is contained in:
commit
42305e3c36
2 changed files with 23 additions and 0 deletions
|
@ -1645,6 +1645,12 @@ impl PropertyId {
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns true if the property is a shorthand or shorthand alias.
|
||||
#[inline]
|
||||
pub fn is_shorthand(&self) -> bool {
|
||||
self.as_shorthand().is_ok()
|
||||
}
|
||||
|
||||
/// Given this property id, get it either as a shorthand or as a
|
||||
/// `PropertyDeclarationId`.
|
||||
pub fn as_shorthand(&self) -> Result<ShorthandId, PropertyDeclarationId> {
|
||||
|
|
|
@ -933,6 +933,23 @@ pub extern "C" fn Servo_ComputedValues_ExtractAnimationValue(
|
|||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn Servo_Property_IsShorthand(
|
||||
prop_name: *const nsACString,
|
||||
found: *mut bool
|
||||
) -> bool {
|
||||
let prop_id = PropertyId::parse(prop_name.as_ref().unwrap().as_str_unchecked());
|
||||
let prop_id = match prop_id {
|
||||
Ok(ref p) if p.enabled_for_all_content() => p,
|
||||
_ => {
|
||||
*found = false;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
*found = true;
|
||||
prop_id.is_shorthand()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_Property_IsAnimatable(property: nsCSSPropertyID) -> bool {
|
||||
use style::properties::animated_properties;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue