From 29c52cc61b263e513b6fcb66eb6a8febb39c6d4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 8 May 2017 22:07:12 +0200 Subject: [PATCH] stylo: Fix nsCOMPtr release bindings. --- components/style/gecko/wrapper.rs | 2 +- components/style/gecko_bindings/sugar/ns_com_ptr.rs | 10 ++++++---- components/style/properties/gecko.mako.rs | 6 ++++-- components/style/properties/longhand/font.mako.rs | 4 ++-- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index a8ed92192af..66ac6797b97 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -1060,7 +1060,7 @@ impl<'le> ::selectors::Element for GeckoElement<'le> { fn get_local_name(&self) -> &WeakAtom { unsafe { - WeakAtom::new(self.as_node().node_info().mInner.mName.raw()) + WeakAtom::new(self.as_node().node_info().mInner.mName.raw::()) } } diff --git a/components/style/gecko_bindings/sugar/ns_com_ptr.rs b/components/style/gecko_bindings/sugar/ns_com_ptr.rs index 4cbd81e5876..488dc862608 100644 --- a/components/style/gecko_bindings/sugar/ns_com_ptr.rs +++ b/components/style/gecko_bindings/sugar/ns_com_ptr.rs @@ -6,18 +6,20 @@ use gecko_bindings::structs::nsCOMPtr; +#[cfg(feature = "gecko_debug")] impl nsCOMPtr { /// Get this pointer as a raw pointer. - #[cfg(feature = "gecko_debug")] #[inline] - pub fn raw(&self) -> *mut T { + pub fn raw(&self) -> *mut T { self.mRawPtr } +} +#[cfg(not(feature = "gecko_debug"))] +impl nsCOMPtr { /// Get this pointer as a raw pointer. - #[cfg(not(feature = "gecko_debug"))] #[inline] - pub fn raw(&self) -> *mut T { + pub fn raw(&self) -> *mut T { self._base.mRawPtr as *mut _ } } diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index f6fb7b95709..4995e9abfce 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -2273,10 +2273,11 @@ fn static_assert() { use gecko_bindings::structs::nsCSSPropertyID::eCSSPropertyExtra_no_properties; use gecko_bindings::structs::nsCSSPropertyID::eCSSPropertyExtra_variable; use gecko_bindings::structs::nsCSSPropertyID::eCSSProperty_UNKNOWN; + use gecko_bindings::structs::nsIAtom; let property = self.gecko.mTransitions[index].mProperty; if property == eCSSProperty_UNKNOWN || property == eCSSPropertyExtra_variable { - let atom = self.gecko.mTransitions[index].mUnknownProperty.raw(); + let atom = self.gecko.mTransitions[index].mUnknownProperty.raw::(); debug_assert!(!atom.is_null()); TransitionProperty::Unsupported(atom.into()) } else if property == eCSSPropertyExtra_no_properties { @@ -2295,6 +2296,7 @@ fn static_assert() { pub fn copy_transition_property_from(&mut self, other: &Self) { use gecko_bindings::structs::nsCSSPropertyID::eCSSPropertyExtra_variable; use gecko_bindings::structs::nsCSSPropertyID::eCSSProperty_UNKNOWN; + use gecko_bindings::structs::nsIAtom; unsafe { self.gecko.mTransitions.ensure_len(other.gecko.mTransitions.len()) }; let count = other.gecko.mTransitionPropertyCount; @@ -2304,7 +2306,7 @@ fn static_assert() { transition.mProperty = other.gecko.mTransitions[index].mProperty; if transition.mProperty == eCSSProperty_UNKNOWN || transition.mProperty == eCSSPropertyExtra_variable { - let atom = other.gecko.mTransitions[index].mUnknownProperty.raw(); + let atom = other.gecko.mTransitions[index].mUnknownProperty.raw::(); debug_assert!(!atom.is_null()); unsafe { Gecko_StyleTransition_SetUnsupportedProperty(transition, atom) }; } diff --git a/components/style/properties/longhand/font.mako.rs b/components/style/properties/longhand/font.mako.rs index 159f5de5884..603e100a4e2 100644 --- a/components/style/properties/longhand/font.mako.rs +++ b/components/style/properties/longhand/font.mako.rs @@ -695,7 +695,7 @@ ${helpers.single_keyword_system("font-variant-caps", #[inline] fn to_computed_value(&self, cx: &Context) -> computed_value::T { use gecko_bindings::bindings::Gecko_GetBaseSize; - use gecko_bindings::structs; + use gecko_bindings::structs::{self, nsIAtom}; use values::specified::length::au_to_int_px; // Data from nsRuleNode.cpp in Gecko // Mapping from base size and HTML size to pixels @@ -721,7 +721,7 @@ ${helpers.single_keyword_system("font-variant-caps", // XXXManishearth handle quirks mode let ref gecko_font = cx.style().get_font().gecko(); - let base_size = unsafe { Atom::with(gecko_font.mLanguage.raw(), &mut |atom| { + let base_size = unsafe { Atom::with(gecko_font.mLanguage.raw::(), &mut |atom| { cx.font_metrics_provider.get_size(atom, gecko_font.mGenericID).0 }) };