From d87b710fdd83955e60edff791da35496a1cdc897 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Wed, 30 Nov 2016 17:34:54 -0800 Subject: [PATCH] stylo: Store servo computed values for animation properties MozReview-Commit-ID: IoQLN5tdIBw --- components/style/build_gecko.rs | 27 ++++-- components/style/gecko_bindings/bindings.rs | 41 ++++++++-- .../style/gecko_bindings/structs_debug.rs | 44 ++++++++++ .../style/gecko_bindings/structs_release.rs | 44 ++++++++++ .../style/gecko_bindings/sugar/refptr.rs | 10 +++ .../helpers/animated_properties.mako.rs | 49 ++++++++++- ports/geckolib/glue.rs | 82 +++++++++++++++++-- 7 files changed, 275 insertions(+), 22 deletions(-) diff --git a/components/style/build_gecko.rs b/components/style/build_gecko.rs index b696f0f123a..0420b498a73 100644 --- a/components/style/build_gecko.rs +++ b/components/style/build_gecko.rs @@ -108,7 +108,7 @@ mod bindings { trait BuilderExt { fn get_initial_builder(build_type: BuildType) -> Builder; fn include>(self, file: T) -> Builder; - fn zero_size_type(self, ty: &str) -> Builder; + fn zero_size_type(self, ty: &str, structs_list: &[&str]) -> Builder; fn borrowed_type(self, ty: &str) -> Builder; fn mutable_borrowed_type(self, ty: &str) -> Builder; } @@ -172,10 +172,14 @@ mod bindings { // Not 100% sure of how safe this is, but it's what we're using // in the XPCOM ffi too // https://github.com/nikomatsakis/rust-memory-model/issues/2 - fn zero_size_type(self, ty: &str) -> Builder { - self.hide_type(ty) - .raw_line(format!("enum {}Void {{ }}", ty)) - .raw_line(format!("pub struct {0}({0}Void);", ty)) + fn zero_size_type(self, ty: &str, structs_list: &[&str]) -> Builder { + if !structs_list.contains(&ty) { + self.hide_type(ty) + .raw_line(format!("enum {}Void {{ }}", ty)) + .raw_line(format!("pub struct {0}({0}Void);", ty)) + } else { + self + } } fn borrowed_type(self, ty: &str) -> Builder { self.hide_type(format!("{}Borrowed", ty)) @@ -222,6 +226,7 @@ mod bindings { ..CodegenConfig::nothing() }) .header(add_include("nsStyleStruct.h")) + .header(add_include("mozilla/StyleAnimationValue.h")) .include(add_include("gfxFontConstants.h")) .include(add_include("nsThemeConstants.h")) .include(add_include("mozilla/dom/AnimationEffectReadOnlyBinding.h")) @@ -255,6 +260,7 @@ mod bindings { "mozilla::CSSPseudoClassType", "mozilla::css::SheetParsingMode", "mozilla::HalfCorner", + "mozilla::PropertyStyleAnimationValuePair", "mozilla::TraversalRootBehavior", "mozilla::DisplayItemClip", // Needed because bindgen generates // specialization tests for this even @@ -398,7 +404,10 @@ mod bindings { "gfxSize", // <- union { struct { T width; T height; }; T components[2] }; "gfxSize_Super", // Ditto. "mozilla::ErrorResult", // Causes JSWhyMagic to be included & handled incorrectly. + "mozilla::StyleAnimationValue", + "StyleAnimationValue", // pulls in a whole bunch of stuff we don't need in the bindings ]; + struct MappedGenericType { generic: bool, gecko: &'static str, @@ -468,6 +477,8 @@ mod bindings { "RawGeckoDocument", "RawGeckoElement", "RawGeckoNode", + "RawGeckoAnimationValueList", + "RawServoAnimationValue", "RawGeckoPresContext", "ThreadSafeURIHolder", "ThreadSafePrincipalHolder", @@ -547,6 +558,7 @@ mod bindings { "RawServoDeclarationBlock", "RawServoStyleRule", "RawServoImportRule", + "RawServoAnimationValue", ]; struct ServoOwnedType { name: &'static str, @@ -566,6 +578,7 @@ mod bindings { ]; let servo_borrow_types = [ "nsCSSValue", + "RawGeckoAnimationValueList", ]; for &ty in structs_types.iter() { builder = builder.hide_type(ty) @@ -588,7 +601,7 @@ mod bindings { .hide_type(format!("{}Strong", ty)) .raw_line(format!("pub type {0}Strong = ::gecko_bindings::sugar::ownership::Strong<{0}>;", ty)) .borrowed_type(ty) - .zero_size_type(ty); + .zero_size_type(ty, &structs_types); } for &ServoOwnedType { name, opaque } in servo_owned_types.iter() { builder = builder @@ -599,7 +612,7 @@ mod bindings { name)) .mutable_borrowed_type(name); if opaque { - builder = builder.zero_size_type(name); + builder = builder.zero_size_type(name, &structs_types); } } for &ty in servo_immutable_borrow_types.iter() { diff --git a/components/style/gecko_bindings/bindings.rs b/components/style/gecko_bindings/bindings.rs index ee1f7de87ae..b5c454db594 100644 --- a/components/style/gecko_bindings/bindings.rs +++ b/components/style/gecko_bindings/bindings.rs @@ -6,6 +6,8 @@ type nsAString_internal = nsAString; use gecko_bindings::structs::RawGeckoDocument; use gecko_bindings::structs::RawGeckoElement; use gecko_bindings::structs::RawGeckoNode; +use gecko_bindings::structs::RawGeckoAnimationValueList; +use gecko_bindings::structs::RawServoAnimationValue; use gecko_bindings::structs::RawGeckoPresContext; use gecko_bindings::structs::ThreadSafeURIHolder; use gecko_bindings::structs::ThreadSafePrincipalHolder; @@ -177,6 +179,9 @@ pub type RawServoImportRuleBorrowed<'a> = &'a RawServoImportRule; pub type RawServoImportRuleBorrowedOrNull<'a> = Option<&'a RawServoImportRule>; enum RawServoImportRuleVoid { } pub struct RawServoImportRule(RawServoImportRuleVoid); +pub type RawServoAnimationValueStrong = ::gecko_bindings::sugar::ownership::Strong; +pub type RawServoAnimationValueBorrowed<'a> = &'a RawServoAnimationValue; +pub type RawServoAnimationValueBorrowedOrNull<'a> = Option<&'a RawServoAnimationValue>; pub type RawServoStyleSetOwned = ::gecko_bindings::sugar::ownership::Owned; pub type RawServoStyleSetOwnedOrNull = ::gecko_bindings::sugar::ownership::OwnedOrNull; pub type RawServoStyleSetBorrowed<'a> = &'a RawServoStyleSet; @@ -213,7 +218,19 @@ pub type nsCSSValueBorrowed<'a> = &'a nsCSSValue; pub type nsCSSValueBorrowedOrNull<'a> = Option<&'a nsCSSValue>; pub type nsCSSValueBorrowedMut<'a> = &'a mut nsCSSValue; pub type nsCSSValueBorrowedMutOrNull<'a> = Option<&'a mut nsCSSValue>; +pub type RawGeckoAnimationValueListBorrowed<'a> = &'a RawGeckoAnimationValueList; +pub type RawGeckoAnimationValueListBorrowedOrNull<'a> = Option<&'a RawGeckoAnimationValueList>; +pub type RawGeckoAnimationValueListBorrowedMut<'a> = &'a mut RawGeckoAnimationValueList; +pub type RawGeckoAnimationValueListBorrowedMutOrNull<'a> = Option<&'a mut RawGeckoAnimationValueList>; +extern "C" { + pub fn Gecko_EnsureTArrayCapacity(aArray: *mut ::std::os::raw::c_void, + aCapacity: usize, aElementSize: usize); +} +extern "C" { + pub fn Gecko_ClearPODTArray(aArray: *mut ::std::os::raw::c_void, + aElementSize: usize, aElementAlign: usize); +} extern "C" { pub fn Servo_CssRules_AddRef(ptr: ServoCssRulesBorrowed); } @@ -252,17 +269,15 @@ extern "C" { extern "C" { pub fn Servo_ImportRule_Release(ptr: RawServoImportRuleBorrowed); } +extern "C" { + pub fn Servo_AnimationValue_AddRef(ptr: RawServoAnimationValueBorrowed); +} +extern "C" { + pub fn Servo_AnimationValue_Release(ptr: RawServoAnimationValueBorrowed); +} extern "C" { pub fn Servo_StyleSet_Drop(ptr: RawServoStyleSetOwned); } -extern "C" { - pub fn Gecko_EnsureTArrayCapacity(aArray: *mut ::std::os::raw::c_void, - aCapacity: usize, aElementSize: usize); -} -extern "C" { - pub fn Gecko_ClearPODTArray(aArray: *mut ::std::os::raw::c_void, - aElementSize: usize, aElementAlign: usize); -} extern "C" { pub fn Gecko_AddRefPrincipalArbitraryThread(aPtr: *mut ThreadSafePrincipalHolder); @@ -1194,6 +1209,16 @@ extern "C" { ServoComputedValuesBorrowed) -> ServoComputedValuesStrong; } +extern "C" { + pub fn Servo_AnimationValues_Populate(arg1: + RawGeckoAnimationValueListBorrowedMut, + arg2: + RawServoDeclarationBlockBorrowed, + arg3: ServoComputedValuesBorrowed, + arg4: + ServoComputedValuesBorrowedOrNull, + arg5: RawGeckoPresContextBorrowed); +} extern "C" { pub fn Servo_ParseStyleAttribute(data: *const nsACString_internal) -> RawServoDeclarationBlockStrong; diff --git a/components/style/gecko_bindings/structs_debug.rs b/components/style/gecko_bindings/structs_debug.rs index 1fee5044fb4..daf706f3353 100644 --- a/components/style/gecko_bindings/structs_debug.rs +++ b/components/style/gecko_bindings/structs_debug.rs @@ -3047,6 +3047,20 @@ pub mod root { impl Clone for StyleComplexColor { fn clone(&self) -> Self { *self } } + #[repr(C)] + #[derive(Debug)] + pub struct PropertyStyleAnimationValuePair { + pub mProperty: root::nsCSSPropertyID, + pub mValue: [u64; 2usize], + pub mServoValue: root::RefPtr, + } + #[test] + fn bindgen_test_layout_PropertyStyleAnimationValuePair() { + assert_eq!(::std::mem::size_of::() + , 32usize); + assert_eq!(::std::mem::align_of::() + , 8usize); + } #[test] fn __bindgen_test_layout_template_1() { assert_eq!(::std::mem::size_of::>() @@ -11596,6 +11610,24 @@ pub mod root { assert_eq!(::std::mem::size_of::() , 32usize); assert_eq!(::std::mem::align_of::() , 8usize); } + #[test] + fn __bindgen_test_layout_template_8_TEMPORARY() { + assert_eq!(::std::mem::size_of::>>() + , 8usize); + assert_eq!(::std::mem::align_of::>>() + , 8usize); + } + #[test] + fn __bindgen_test_layout_template_9_TEMPORARY() { + assert_eq!(::std::mem::size_of::>>() + , 8usize); + assert_eq!(::std::mem::align_of::>>() + , 8usize); + } #[repr(C)] #[derive(Debug)] pub struct nsCSSValue { @@ -11669,6 +11701,14 @@ pub mod root { } #[repr(C)] #[derive(Debug, Copy)] + pub struct RawServoAnimationValue { + pub _address: u8, + } + impl Clone for RawServoAnimationValue { + fn clone(&self) -> Self { *self } + } + #[repr(C)] + #[derive(Debug, Copy)] pub struct RawServoStyleSet { pub _address: u8, } @@ -11679,6 +11719,8 @@ pub mod root { pub type RawGeckoElement = root::mozilla::dom::Element; pub type RawGeckoDocument = root::nsIDocument; pub type RawGeckoPresContext = [u64; 162usize]; + pub type RawGeckoAnimationValueList = + root::nsTArray; pub type RawGeckoNodeBorrowed = *const root::RawGeckoNode; pub type RawGeckoNodeBorrowedOrNull = *const root::RawGeckoNode; pub type RawGeckoElementBorrowed = *const root::RawGeckoElement; @@ -11686,6 +11728,8 @@ pub mod root { pub type RawGeckoDocumentBorrowed = *const root::RawGeckoDocument; pub type RawGeckoDocumentBorrowedOrNull = *const root::RawGeckoDocument; pub type RawGeckoPresContextBorrowed = *const [u64; 162usize]; + pub type RawGeckoAnimationValueListBorrowedMut = + *mut root::RawGeckoAnimationValueList; #[repr(u32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum nsCSSTokenSerializationType { diff --git a/components/style/gecko_bindings/structs_release.rs b/components/style/gecko_bindings/structs_release.rs index 928a4b6deeb..95030a8f8dd 100644 --- a/components/style/gecko_bindings/structs_release.rs +++ b/components/style/gecko_bindings/structs_release.rs @@ -3029,6 +3029,20 @@ pub mod root { impl Clone for StyleComplexColor { fn clone(&self) -> Self { *self } } + #[repr(C)] + #[derive(Debug)] + pub struct PropertyStyleAnimationValuePair { + pub mProperty: root::nsCSSPropertyID, + pub mValue: [u64; 2usize], + pub mServoValue: root::RefPtr, + } + #[test] + fn bindgen_test_layout_PropertyStyleAnimationValuePair() { + assert_eq!(::std::mem::size_of::() + , 32usize); + assert_eq!(::std::mem::align_of::() + , 8usize); + } #[test] fn __bindgen_test_layout_template_1() { assert_eq!(::std::mem::size_of::>() @@ -11523,6 +11537,24 @@ pub mod root { assert_eq!(::std::mem::size_of::() , 24usize); assert_eq!(::std::mem::align_of::() , 8usize); } + #[test] + fn __bindgen_test_layout_template_8_TEMPORARY() { + assert_eq!(::std::mem::size_of::>>() + , 8usize); + assert_eq!(::std::mem::align_of::>>() + , 8usize); + } + #[test] + fn __bindgen_test_layout_template_9_TEMPORARY() { + assert_eq!(::std::mem::size_of::>>() + , 8usize); + assert_eq!(::std::mem::align_of::>>() + , 8usize); + } #[repr(C)] #[derive(Debug)] pub struct nsCSSValue { @@ -11596,6 +11628,14 @@ pub mod root { } #[repr(C)] #[derive(Debug, Copy)] + pub struct RawServoAnimationValue { + pub _address: u8, + } + impl Clone for RawServoAnimationValue { + fn clone(&self) -> Self { *self } + } + #[repr(C)] + #[derive(Debug, Copy)] pub struct RawServoStyleSet { pub _address: u8, } @@ -11606,6 +11646,8 @@ pub mod root { pub type RawGeckoElement = root::mozilla::dom::Element; pub type RawGeckoDocument = root::nsIDocument; pub type RawGeckoPresContext = [u64; 158usize]; + pub type RawGeckoAnimationValueList = + root::nsTArray; pub type RawGeckoNodeBorrowed = *const root::RawGeckoNode; pub type RawGeckoNodeBorrowedOrNull = *const root::RawGeckoNode; pub type RawGeckoElementBorrowed = *const root::RawGeckoElement; @@ -11613,6 +11655,8 @@ pub mod root { pub type RawGeckoDocumentBorrowed = *const root::RawGeckoDocument; pub type RawGeckoDocumentBorrowedOrNull = *const root::RawGeckoDocument; pub type RawGeckoPresContextBorrowed = *const [u64; 158usize]; + pub type RawGeckoAnimationValueListBorrowedMut = + *mut root::RawGeckoAnimationValueList; #[repr(u32)] #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum nsCSSTokenSerializationType { diff --git a/components/style/gecko_bindings/sugar/refptr.rs b/components/style/gecko_bindings/sugar/refptr.rs index 91c83259925..1689522e892 100644 --- a/components/style/gecko_bindings/sugar/refptr.rs +++ b/components/style/gecko_bindings/sugar/refptr.rs @@ -5,10 +5,12 @@ //! A rust helper to ease the use of Gecko's refcounted types. use gecko_bindings::structs; +use gecko_bindings::sugar::ownership::HasArcFFI; use heapsize::HeapSizeOf; use std::{mem, ptr}; use std::marker::PhantomData; use std::ops::{Deref, DerefMut}; +use std::sync::Arc; /// Trait for all objects that have Addref() and Release /// methods and can be placed inside RefPtr @@ -196,6 +198,14 @@ impl structs::RefPtr { } } +impl structs::RefPtr { + /// Sets the contents to an Arc + /// will leak existing contents + pub fn set_arc_leaky(&mut self, other: Arc) where U: HasArcFFI { + *self = unsafe { mem::transmute(other) }; // Arc::into_raw is unstable :( + } +} + impl Drop for RefPtr { fn drop(&mut self) { unsafe { self.release() } diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 2414948ebd0..addaf94c7b0 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -5,7 +5,7 @@ use app_units::Au; use cssparser::{Color as CSSParserColor, Parser, RGBA}; use euclid::{Point2D, Size2D}; -use properties::PropertyDeclaration; +use properties::{DeclaredValue, PropertyDeclaration}; use properties::longhands; use properties::longhands::background_position_x::computed_value::T as BackgroundPositionX; use properties::longhands::background_position_y::computed_value::T as BackgroundPositionY; @@ -26,7 +26,7 @@ use super::ComputedValues; use values::Either; use values::computed::{Angle, LengthOrPercentageOrAuto, LengthOrPercentageOrNone}; use values::computed::{BorderRadiusSize, LengthOrNone}; -use values::computed::{CalcLengthOrPercentage, LengthOrPercentage}; +use values::computed::{CalcLengthOrPercentage, Context, LengthOrPercentage}; use values::computed::position::{HorizontalPosition, Position, VerticalPosition}; use values::computed::ToComputedValue; @@ -191,6 +191,17 @@ impl AnimatedProperty { } } + +% if product == "gecko": + use gecko_bindings::structs::RawServoAnimationValue; + use gecko_bindings::sugar::ownership::{HasArcFFI, HasFFI}; + + unsafe impl HasFFI for AnimationValue { + type FFIType = RawServoAnimationValue; + } + unsafe impl HasArcFFI for AnimationValue {} +% endif + /// An enum to represent a single computed value belonging to an animated /// property in order to be interpolated with another one. When interpolating, /// both values need to belong to the same property. @@ -230,6 +241,40 @@ impl AnimationValue { % endfor } } + + /// Construct an AnimationValue from a property declaration + pub fn from_declaration(decl: &PropertyDeclaration, context: &Context, initial: &ComputedValues) -> Option { + match *decl { + % for prop in data.longhands: + % if prop.animatable: + PropertyDeclaration::${prop.camel_case}(ref val) => { + let computed = match *val { + // https://bugzilla.mozilla.org/show_bug.cgi?id=1326131 + DeclaredValue::WithVariables{..} => unimplemented!(), + DeclaredValue::Value(ref val) => val.to_computed_value(context), + % if not prop.style_struct.inherited: + DeclaredValue::Unset | + % endif + DeclaredValue::Initial => { + let initial_struct = initial.get_${prop.style_struct.name_lower}(); + initial_struct.clone_${prop.ident}() + }, + % if prop.style_struct.inherited: + DeclaredValue::Unset | + % endif + DeclaredValue::Inherit => { + let inherit_struct = context.inherited_style + .get_${prop.style_struct.name_lower}(); + inherit_struct.clone_${prop.ident}() + }, + }; + Some(AnimationValue::${prop.camel_case}(computed)) + } + % endif + % endfor + _ => None // non animatable properties will get included because of shorthands. ignore. + } + } } impl Interpolate for AnimationValue { diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index fb2faa5ae67..aaf5ef5087d 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -13,7 +13,7 @@ use selectors::Element; use servo_url::ServoUrl; use std::borrow::Cow; use std::fmt::Write; -use std::mem::transmute; +use std::mem; use std::ptr; use std::sync::{Arc, Mutex}; use style::arc_ptr_eq; @@ -35,8 +35,10 @@ use style::gecko_bindings::bindings::{RawServoStyleSheetBorrowed, ServoComputedV use style::gecko_bindings::bindings::{RawServoStyleSheetStrong, ServoComputedValuesStrong}; use style::gecko_bindings::bindings::{ServoCssRulesBorrowed, ServoCssRulesStrong}; use style::gecko_bindings::bindings::{nsACString, nsAString}; +use style::gecko_bindings::bindings::RawGeckoAnimationValueListBorrowedMut; use style::gecko_bindings::bindings::RawGeckoElementBorrowed; use style::gecko_bindings::bindings::RawGeckoPresContextBorrowed; +use style::gecko_bindings::bindings::RawServoAnimationValueBorrowed; use style::gecko_bindings::bindings::RawServoImportRuleBorrowed; use style::gecko_bindings::bindings::ServoComputedValuesBorrowedOrNull; use style::gecko_bindings::bindings::nsTArrayBorrowed_uintptr_t; @@ -55,6 +57,7 @@ use style::parser::{ParserContext, ParserContextExtraData}; use style::properties::{CascadeFlags, ComputedValues, Importance, PropertyDeclaration}; use style::properties::{PropertyDeclarationParseResult, PropertyDeclarationBlock, PropertyId}; use style::properties::{apply_declarations, parse_one_declaration}; +use style::properties::animated_properties::AnimationValue; use style::restyle_hints::RestyleHint; use style::selector_parser::PseudoElementCascadeType; use style::sequential; @@ -155,6 +158,76 @@ pub extern "C" fn Servo_TraverseSubtree(root: RawGeckoElementBorrowed, behavior == structs::TraversalRootBehavior::UnstyledChildrenOnly); } +/// Takes a ServoAnimationValues and populates it with the animation values corresponding +/// to a given property declaration block +#[no_mangle] +pub extern "C" fn Servo_AnimationValues_Populate(anim: RawGeckoAnimationValueListBorrowedMut, + declarations: RawServoDeclarationBlockBorrowed, + style: ServoComputedValuesBorrowed, + parent_style: ServoComputedValuesBorrowedOrNull, + pres_context: RawGeckoPresContextBorrowed) +{ + use style::properties::declaration_block::Importance; + use style::values::computed::Context; + + let parent_style = parent_style.as_ref().map(|r| &**ComputedValues::as_arc(&r)); + // FIXME this might not be efficient since Populate + // is called multiple times. We should precalculate the Context + // and share it across Populate calls + let style = ComputedValues::as_arc(&style); + let declarations = RwLock::::as_arc(&declarations); + let guard = declarations.read(); + + let init = ComputedValues::default_values(pres_context); + + let context = Context { + is_root_element: false, + // FIXME (bug 1303229): Use the actual viewport size here + viewport_size: Size2D::new(Au(0), Au(0)), + inherited_style: parent_style.unwrap_or(&init), + style: (**style).clone(), + font_metrics_provider: None, + }; + + let mut iter = guard.declarations + .iter() + .filter_map(|&(ref decl, imp)| { + if imp == Importance::Normal { + AnimationValue::from_declaration(decl, &context, &init) + } else { + None + } + }); + + let mut geckoiter = anim.iter_mut(); + { + // we reborrow to scope the consumed mutable borrow + // we need to be able to ensure geckoiter is empty later on + // and thus can't directly use `geckoiter` + let local_geckoiter = &mut geckoiter; + for (gecko, servo) in local_geckoiter.zip(&mut iter) { + gecko.mServoValue.set_arc_leaky(Arc::new(servo)); + } + } + + // we should have gone through both iterators + if iter.next().is_some() || geckoiter.next().is_some() { + error!("stylo: Mismatched sizes of Gecko and Servo \ + array during animation value construction"); + } +} + + +#[no_mangle] +pub extern "C" fn Servo_AnimationValue_AddRef(anim: RawServoAnimationValueBorrowed) -> () { + unsafe { AnimationValue::addref(anim) }; +} + +#[no_mangle] +pub extern "C" fn Servo_AnimationValue_Release(anim: RawServoAnimationValueBorrowed) -> () { + unsafe { AnimationValue::release(anim) }; +} + #[no_mangle] pub extern "C" fn Servo_RestyleWithAddedDeclaration(raw_data: RawServoStyleSetBorrowed, declarations: RawServoDeclarationBlockBorrowed, @@ -226,7 +299,7 @@ pub extern "C" fn Servo_StyleSheet_Empty(mode: SheetParsingMode) -> RawServoStyl "", url, origin, Default::default(), None, Box::new(StdoutErrorReporter), extra_data)); unsafe { - transmute(sheet) + mem::transmute(sheet) } } @@ -271,7 +344,7 @@ pub extern "C" fn Servo_StyleSheet_FromUTF8Bytes(loader: *mut Loader, input, url, origin, Default::default(), loader, Box::new(StdoutErrorReporter), extra_data)); unsafe { - transmute(sheet) + mem::transmute(sheet) } } @@ -618,7 +691,6 @@ pub extern "C" fn Servo_StyleSet_Drop(data: RawServoStyleSetOwned) -> () { let _ = data.into_box::(); } - #[no_mangle] pub extern "C" fn Servo_ParseProperty(property: *const nsACString, value: *const nsACString, base_url: *const nsACString, base: *mut ThreadSafeURIHolder, @@ -909,7 +981,7 @@ pub extern "C" fn Servo_ImportRule_GetSheet(import_rule: RawServoImportRuleBorrowed) -> RawServoStyleSheetStrong { let import_rule = RwLock::::as_arc(&import_rule); - unsafe { transmute(import_rule.read().stylesheet.clone()) } + unsafe { mem::transmute(import_rule.read().stylesheet.clone()) } } #[no_mangle]