mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
style: Reorder some conditions when handling class/part attributes.
Empty class attributes are uncommon. Differential Revision: https://phabricator.services.mozilla.com/D100592
This commit is contained in:
parent
0dc6c32759
commit
610ebe2e25
1 changed files with 17 additions and 18 deletions
|
@ -34,27 +34,26 @@ unsafe fn ptr<T>(attr: &structs::nsAttrValue) -> *const T {
|
||||||
unsafe fn get_class_or_part_from_attr(attr: &structs::nsAttrValue) -> Class {
|
unsafe fn get_class_or_part_from_attr(attr: &structs::nsAttrValue) -> Class {
|
||||||
debug_assert!(bindings::Gecko_AssertClassAttrValueIsSane(attr));
|
debug_assert!(bindings::Gecko_AssertClassAttrValueIsSane(attr));
|
||||||
let base_type = base_type(attr);
|
let base_type = base_type(attr);
|
||||||
if base_type == structs::nsAttrValue_ValueBaseType_eStringBase {
|
|
||||||
return Class::None;
|
|
||||||
}
|
|
||||||
if base_type == structs::nsAttrValue_ValueBaseType_eAtomBase {
|
if base_type == structs::nsAttrValue_ValueBaseType_eAtomBase {
|
||||||
return Class::One(ptr::<nsAtom>(attr));
|
return Class::One(ptr::<nsAtom>(attr));
|
||||||
}
|
}
|
||||||
debug_assert_eq!(base_type, structs::nsAttrValue_ValueBaseType_eOtherBase);
|
if base_type == structs::nsAttrValue_ValueBaseType_eOtherBase {
|
||||||
|
let container = ptr::<structs::MiscContainer>(attr);
|
||||||
let container = ptr::<structs::MiscContainer>(attr);
|
debug_assert_eq!(
|
||||||
debug_assert_eq!(
|
(*container).mType,
|
||||||
(*container).mType,
|
structs::nsAttrValue_ValueType_eAtomArray
|
||||||
structs::nsAttrValue_ValueType_eAtomArray
|
);
|
||||||
);
|
let array = (*container)
|
||||||
let array = (*container)
|
.__bindgen_anon_1
|
||||||
.__bindgen_anon_1
|
.mValue
|
||||||
.mValue
|
.as_ref()
|
||||||
.as_ref()
|
.__bindgen_anon_1
|
||||||
.__bindgen_anon_1
|
.mAtomArray
|
||||||
.mAtomArray
|
.as_ref();
|
||||||
.as_ref();
|
return Class::More(&***array)
|
||||||
Class::More(&***array)
|
}
|
||||||
|
debug_assert_eq!(base_type, structs::nsAttrValue_ValueBaseType_eStringBase);
|
||||||
|
Class::None
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue