Make unknown pres attrs panic

This commit is contained in:
Manish Goregaokar 2017-05-10 16:23:59 -07:00
parent 195e37954f
commit d1c3021f43

View file

@ -1441,18 +1441,14 @@ pub extern "C" fn Servo_MediaList_DeleteMedium(list: RawServoMediaListBorrowed,
} }
macro_rules! get_longhand_from_id { macro_rules! get_longhand_from_id {
($id:expr, $retval:expr) => { ($id:expr) => {
match PropertyId::from_nscsspropertyid($id) { match PropertyId::from_nscsspropertyid($id) {
Ok(PropertyId::Longhand(long)) => long, Ok(PropertyId::Longhand(long)) => long,
_ => { _ => {
error!("stylo: unknown presentation property with id {:?}", $id); panic!("stylo: unknown presentation property with id {:?}", $id);
return $retval
} }
} }
}; };
($id:expr) => {
get_longhand_from_id!($id, ())
}
} }
macro_rules! match_wrap_declared { macro_rules! match_wrap_declared {
@ -1462,8 +1458,7 @@ macro_rules! match_wrap_declared {
LonghandId::$property => PropertyDeclaration::$property($inner), LonghandId::$property => PropertyDeclaration::$property($inner),
)* )*
_ => { _ => {
error!("stylo: Don't know how to handle presentation property {:?}", $longhand); panic!("stylo: Don't know how to handle presentation property {:?}", $longhand);
return
} }
} }
) )
@ -1475,7 +1470,7 @@ pub extern "C" fn Servo_DeclarationBlock_PropertyIsSet(declarations:
property: nsCSSPropertyID) property: nsCSSPropertyID)
-> bool { -> bool {
use style::properties::PropertyDeclarationId; use style::properties::PropertyDeclarationId;
let long = get_longhand_from_id!(property, false); let long = get_longhand_from_id!(property);
read_locked_arc(declarations, |decls: &PropertyDeclarationBlock| { read_locked_arc(declarations, |decls: &PropertyDeclarationBlock| {
decls.get(PropertyDeclarationId::Longhand(long)).is_some() decls.get(PropertyDeclarationId::Longhand(long)).is_some()
}) })