Bug 1334036 - Part 10: Use &[ComputedOperation] as the argument type of convert_transform.
Therefore, we don't need to clone the vector.
MozReview-Commit-ID: zZ3jW2cWhb
--- a/servo/components/style/properties/gecko.mako.rs
+++ b/servo/components/style/properties/gecko.mako.rs
@@ -2094,17 +2094,17 @@ fn static_assert() {
% for index, item in enumerate(items):
${css_value_setters[item] % (
"bindings::Gecko_CSSValue_GetArrayItem(gecko_value, %d)" % (index + 1),
item + str(index + 1)
)};
% endfor
}
</%def>
- pub fn convert_transform(input: Vec<longhands::transform::computed_value::ComputedOperation>,
+ pub fn convert_transform(input: &[longhands::transform::computed_value::ComputedOperation],
output: &mut structs::root::RefPtr<structs::root::nsCSSValueSharedList>) {
use gecko_bindings::structs::nsCSSKeyword::*;
use gecko_bindings::sugar::refptr::RefPtr;
use properties::longhands::transform::computed_value::ComputedMatrix;
use properties::longhands::transform::computed_value::ComputedMatrixWithPercents;
unsafe { output.clear() };
@@ -2114,17 +2114,17 @@ fn static_assert() {
let mut cur = list.mHead;
let mut iter = input.into_iter();
while !cur.is_null() {
let gecko_value = unsafe { &mut (*cur).mValue };
let servo = iter.next().expect("Gecko_NewCSSValueSharedList should create a shared \
value list of the same length as the transform vector");
unsafe {
- match servo {
+ match *servo {
${transform_function_arm("Matrix", "matrix3d", ["number"] * 16)}
${transform_function_arm("MatrixWithPercents", "matrix3d", ["number"] * 12 + ["lop"] * 2
+ ["length"] + ["number"])}
${transform_function_arm("Skew", "skew", ["angle"] * 2)}
${transform_function_arm("Translate", "translate3d", ["lop", "lop", "length"])}
${transform_function_arm("Scale", "scale3d", ["number"] * 3)}
${transform_function_arm("Rotate", "rotate3d", ["number"] * 3 + ["angle"])}
${transform_function_arm("Perspective", "perspective", ["length"])}
@@ -2140,17 +2140,17 @@ fn static_assert() {
let vec = if let Some(v) = other.0 {
v
} else {
unsafe {
self.gecko.mSpecifiedTransform.clear();
}
return;
};
- Self::convert_transform(vec, &mut self.gecko.mSpecifiedTransform);
+ Self::convert_transform(&vec, &mut self.gecko.mSpecifiedTransform);
}
pub fn copy_transform_from(&mut self, other: &Self) {
unsafe { self.gecko.mSpecifiedTransform.set(&other.gecko.mSpecifiedTransform); }
}
<%def name="computed_operation_arm(name, keyword, items)">
<%
--- a/servo/ports/geckolib/glue.rs
+++ b/servo/ports/geckolib/glue.rs
@@ -428,17 +428,17 @@ pub extern "C" fn Servo_AnimationValue_G
pub extern "C" fn Servo_AnimationValue_GetTransform(value: RawServoAnimationValueBorrowed,
list: *mut structs::RefPtr<nsCSSValueSharedList>)
{
let value = AnimationValue::as_arc(&value);
if let AnimationValue::Transform(ref servo_list) = **value {
let list = unsafe { &mut *list };
match servo_list.0 {
Some(ref servo_list) => {
- style_structs::Box::convert_transform(servo_list.clone(), list);
+ style_structs::Box::convert_transform(servo_list, list);
},
None => unsafe {
list.set_move(RefPtr::from_addrefed(Gecko_NewNoneTransform()));
}
}
} else {
panic!("The AnimationValue should be transform");
}