diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 337e6999fa7..2b78c7e9181 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -72,7 +72,7 @@ use crate::values::computed::Length; use crate::values::specified::length::FontBaseSize; use crate::CaseSensitivityExt; use app_units::Au; -use atomic_refcell::{AtomicRefCell, AtomicRefMut}; +use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut}; use selectors::attr::{AttrSelectorOperation, AttrSelectorOperator}; use selectors::attr::{CaseSensitivity, NamespaceConstraint}; use selectors::matching::VisitedHandlingMode; @@ -557,8 +557,9 @@ impl<'le> fmt::Debug for GeckoElement<'le> { } impl<'le> GeckoElement<'le> { + /// Gets the raw `ElementData` refcell for the element. #[inline(always)] - fn get_data(&self) -> Option<&AtomicRefCell> { + pub fn get_data(&self) -> Option<&AtomicRefCell> { unsafe { self.0.mServoData.get().as_ref() } } @@ -1391,21 +1392,6 @@ impl<'le> TElement for GeckoElement<'le> { panic!("Atomic child count not implemented in Gecko"); } - /// Whether there is an ElementData container. - fn has_data(&self) -> bool { - self.get_data().is_some() - } - - /// Immutably borrows the ElementData. - fn borrow_data(&self) -> Option> { - self.get_data().map(|x| x.borrow()) - } - - /// Mutably borrows the ElementData. - fn mutate_data(&self) -> Option> { - self.get_data().map(|x| x.borrow_mut()) - } - unsafe fn ensure_data(&self) -> AtomicRefMut { if !self.has_data() { debug!("Creating ElementData for {:?}", self); @@ -1642,6 +1628,22 @@ impl<'le> TElement for GeckoElement<'le> { .any(|property| !transitions_to_keep.contains(*property)) } + /// Whether there is an ElementData container. + #[inline] + fn has_data(&self) -> bool { + self.get_data().is_some() + } + + /// Immutably borrows the ElementData. + fn borrow_data(&self) -> Option> { + self.get_data().map(|x| x.borrow()) + } + + /// Mutably borrows the ElementData. + fn mutate_data(&self) -> Option> { + self.get_data().map(|x| x.borrow_mut()) + } + #[inline] fn lang_attr(&self) -> Option { let ptr = unsafe { bindings::Gecko_LangValue(self.0) }; diff --git a/components/style/values/computed/font.rs b/components/style/values/computed/font.rs index cd1dc2888e8..a0c4ad695db 100644 --- a/components/style/values/computed/font.rs +++ b/components/style/values/computed/font.rs @@ -703,7 +703,7 @@ pub type FontVariationSettings = FontSettings>; /// (see http://www.microsoft.com/typography/otspec/languagetags.htm). #[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToResolvedValue)] #[repr(C)] -pub struct FontLanguageOverride(u32); +pub struct FontLanguageOverride(pub u32); impl FontLanguageOverride { #[inline] @@ -762,6 +762,15 @@ impl ToCss for FontLanguageOverride { } } +// FIXME(emilio): Make Gecko use the cbindgen'd fontLanguageOverride, then +// remove this. +#[cfg(feature = "gecko")] +impl From for FontLanguageOverride { + fn from(v: u32) -> Self { + unsafe { Self::from_u32(v) } + } +} + #[cfg(feature = "gecko")] impl From for u32 { fn from(v: FontLanguageOverride) -> u32 {