style: Use union to wrap different shape-like types. r=xidorn

1. We will add more shape-like types in the future, so it's better to
   use union to reduce the memory usage.
2. Those shape-like types are mutual exclusive, so we could use union to
   wrap them.

Differential Revision: https://phabricator.services.mozilla.com/D2746
This commit is contained in:
Boris Chiou 2018-08-07 07:56:01 +00:00 committed by Emilio Cobos Álvarez
parent ad83faa745
commit c87668fcd5
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
2 changed files with 5 additions and 5 deletions

View file

@ -4960,7 +4960,7 @@ fn static_assert() {
ShapeSource::ImageOrUrl(image) => {
unsafe {
bindings::Gecko_NewShapeImage(${ident});
let style_image = &mut *${ident}.mShapeImage.mPtr;
let style_image = &mut *${ident}.__bindgen_anon_1.mShapeImage.as_mut().mPtr;
style_image.set(image);
}
}
@ -4980,7 +4980,7 @@ fn static_assert() {
// Create StyleBasicShape in StyleShapeSource. mReferenceBox and mType
// will be set manually later.
Gecko_NewBasicShape(${ident}, basic_shape_type);
&mut *${ident}.mBasicShape.mPtr
&mut *${ident}.__bindgen_anon_1.mBasicShape.as_mut().mPtr
}
}
match servo_shape {