aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/gecko/snapshot_helpers.rs
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2021-01-02 04:50:01 +0000
committerEmilio Cobos Álvarez <emilio@crisal.io>2021-02-26 16:44:05 +0100
commit610ebe2e25086f0d980f5d6cc0ab79e63e0f1130 (patch)
tree74a8a1f3163c10ac12c988f6690634234d387ff1 /components/style/gecko/snapshot_helpers.rs
parent0dc6c32759c9e8284fb6b34ad16ba243d18c7ecb (diff)
downloadservo-610ebe2e25086f0d980f5d6cc0ab79e63e0f1130.tar.gz
servo-610ebe2e25086f0d980f5d6cc0ab79e63e0f1130.zip
style: Reorder some conditions when handling class/part attributes.
Empty class attributes are uncommon. Differential Revision: https://phabricator.services.mozilla.com/D100592
Diffstat (limited to 'components/style/gecko/snapshot_helpers.rs')
-rw-r--r--components/style/gecko/snapshot_helpers.rs35
1 files changed, 17 insertions, 18 deletions
diff --git a/components/style/gecko/snapshot_helpers.rs b/components/style/gecko/snapshot_helpers.rs
index ee8d7dfd704..f34fca40f1c 100644
--- a/components/style/gecko/snapshot_helpers.rs
+++ b/components/style/gecko/snapshot_helpers.rs
@@ -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 {
debug_assert!(bindings::Gecko_AssertClassAttrValueIsSane(attr));
let base_type = base_type(attr);
- if base_type == structs::nsAttrValue_ValueBaseType_eStringBase {
- return Class::None;
- }
if base_type == structs::nsAttrValue_ValueBaseType_eAtomBase {
return Class::One(ptr::<nsAtom>(attr));
}
- debug_assert_eq!(base_type, structs::nsAttrValue_ValueBaseType_eOtherBase);
-
- let container = ptr::<structs::MiscContainer>(attr);
- debug_assert_eq!(
- (*container).mType,
- structs::nsAttrValue_ValueType_eAtomArray
- );
- let array = (*container)
- .__bindgen_anon_1
- .mValue
- .as_ref()
- .__bindgen_anon_1
- .mAtomArray
- .as_ref();
- Class::More(&***array)
+ if base_type == structs::nsAttrValue_ValueBaseType_eOtherBase {
+ let container = ptr::<structs::MiscContainer>(attr);
+ debug_assert_eq!(
+ (*container).mType,
+ structs::nsAttrValue_ValueType_eAtomArray
+ );
+ let array = (*container)
+ .__bindgen_anon_1
+ .mValue
+ .as_ref()
+ .__bindgen_anon_1
+ .mAtomArray
+ .as_ref();
+ return Class::More(&***array)
+ }
+ debug_assert_eq!(base_type, structs::nsAttrValue_ValueBaseType_eStringBase);
+ Class::None
}
#[inline(always)]