diff options
author | Xidorn Quan <me@upsuper.org> | 2018-04-09 19:10:44 +1000 |
---|---|---|
committer | Xidorn Quan <me@upsuper.org> | 2018-04-09 19:10:44 +1000 |
commit | 22cf429c35b1aea9096775a34cdb04bfbaf57b41 (patch) | |
tree | e52b2b8a8fc8823a527cac7141abdcd947394aee /ports | |
parent | e460b4ab8a9abfe70d0cac9cf03160510f791b7c (diff) | |
download | servo-22cf429c35b1aea9096775a34cdb04bfbaf57b41.tar.gz servo-22cf429c35b1aea9096775a34cdb04bfbaf57b41.zip |
Use Servo code to check whether a property is inherited.
Diffstat (limited to 'ports')
-rw-r--r-- | ports/geckolib/glue.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 41905bfe55e..26cf67dc3a8 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -953,6 +953,25 @@ pub unsafe extern "C" fn Servo_Property_IsShorthand( } #[no_mangle] +pub unsafe extern "C" fn Servo_Property_IsInherited( + prop_name: *const nsACString, +) -> bool { + let prop_name = prop_name.as_ref().unwrap().as_str_unchecked(); + let prop_id = match PropertyId::parse(prop_name) { + Ok(id) => id, + Err(_) => return false, + }; + let longhand_id = match prop_id { + PropertyId::Custom(_) => return true, + PropertyId::Longhand(id) | + PropertyId::LonghandAlias(id, _) => id, + PropertyId::Shorthand(id) | + PropertyId::ShorthandAlias(id, _) => id.longhands().next().unwrap(), + }; + longhand_id.inherited() +} + +#[no_mangle] pub extern "C" fn Servo_Property_IsAnimatable(property: nsCSSPropertyID) -> bool { use style::properties::animated_properties; animated_properties::nscsspropertyid_is_animatable(property) |