mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Use Servo code to check whether a property is inherited.
This commit is contained in:
parent
e460b4ab8a
commit
22cf429c35
2 changed files with 21 additions and 1 deletions
|
@ -826,7 +826,8 @@ impl LonghandId {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn inherited(&self) -> bool {
|
/// Returns whether the longhand property is inherited by default.
|
||||||
|
pub fn inherited(&self) -> bool {
|
||||||
${static_longhand_id_set("INHERITED", lambda p: p.style_struct.inherited)}
|
${static_longhand_id_set("INHERITED", lambda p: p.style_struct.inherited)}
|
||||||
INHERITED.contains(*self)
|
INHERITED.contains(*self)
|
||||||
}
|
}
|
||||||
|
|
|
@ -952,6 +952,25 @@ pub unsafe extern "C" fn Servo_Property_IsShorthand(
|
||||||
prop_id.is_shorthand()
|
prop_id.is_shorthand()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[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]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_Property_IsAnimatable(property: nsCSSPropertyID) -> bool {
|
pub extern "C" fn Servo_Property_IsAnimatable(property: nsCSSPropertyID) -> bool {
|
||||||
use style::properties::animated_properties;
|
use style::properties::animated_properties;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue