style: Remove refcount for StyleBasicShape

This is due to Bug 1404243 Part 3.

MozReview-Commit-ID: DKymebmAYLX
This commit is contained in:
Ting-Yu Lin 2017-09-26 10:53:59 +08:00 committed by Ting-Yu Lin
parent 4d95e2cd46
commit 3547a59e28
2 changed files with 11 additions and 11 deletions

View file

@ -623,7 +623,7 @@ pub mod basic_shape {
}
},
StyleShapeSourceType::Shape => {
let other_shape = unsafe { &(**other.__bindgen_anon_1.mBasicShape.as_ref()) };
let other_shape = unsafe { &*other.mBasicShape.mPtr };
let shape = other_shape.into();
let reference_box = if other.mReferenceBox == StyleGeometryBox::NoBox {
None

View file

@ -4912,17 +4912,13 @@ fn static_assert() {
${ident}.mType = StyleShapeSourceType::Box;
}
ShapeSource::Shape(servo_shape, maybe_box) => {
${ident}.mReferenceBox = maybe_box.map(Into::into)
.unwrap_or(StyleGeometryBox::NoBox);
${ident}.mType = StyleShapeSourceType::Shape;
fn init_shape(${ident}: &mut StyleShapeSource, ty: StyleBasicShapeType) -> &mut StyleBasicShape {
fn init_shape(${ident}: &mut StyleShapeSource, basic_shape_type: StyleBasicShapeType)
-> &mut StyleBasicShape {
unsafe {
// We have to be very careful to avoid a copy here!
let ref mut union = ${ident}.__bindgen_anon_1;
let shape: &mut *mut StyleBasicShape = union.mBasicShape.as_mut();
*shape = Gecko_NewBasicShape(ty);
&mut **shape
// Create StyleBasicShape in StyleShapeSource. mReferenceBox and mType
// will be set manually later.
Gecko_NewBasicShape(${ident}, basic_shape_type);
&mut *${ident}.mBasicShape.mPtr
}
}
match servo_shape {
@ -4984,6 +4980,10 @@ fn static_assert() {
};
}
}
${ident}.mReferenceBox = maybe_box.map(Into::into)
.unwrap_or(StyleGeometryBox::NoBox);
${ident}.mType = StyleShapeSourceType::Shape;
}
}