style: Use alias for StylePathCommand.

So we could drop transmute in svg_path related functions.

Differential Revision: https://phabricator.services.mozilla.com/D10140
This commit is contained in:
Boris Chiou 2018-10-31 06:20:32 +00:00 committed by Emilio Cobos Álvarez
parent c7027e2676
commit b81bbb85b4
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
2 changed files with 2 additions and 13 deletions

View file

@ -701,18 +701,11 @@ pub mod basic_shape {
/// Generate a SVGPathData from StyleShapeSource if possible.
fn to_svg_path(&self) -> Option<SVGPathData> {
use gecko_bindings::structs::StylePathCommand;
use values::specified::svg_path::PathCommand;
match self.mType {
StyleShapeSourceType::Path => {
let gecko_path = unsafe { &*self.__bindgen_anon_1.mSVGPath.as_ref().mPtr };
let result: Vec<PathCommand> = gecko_path
.mPath
.iter()
.map(|gecko: &StylePathCommand| {
// unsafe: cbindgen ensures the representation is the same.
unsafe { ::std::mem::transmute(*gecko) }
}).collect();
let result: Vec<PathCommand> = gecko_path.mPath.iter().cloned().collect();
Some(SVGPathData::new(result.into_boxed_slice()))
},
_ => None,