From d85a60e36626fe5e68bc193f90c29cabefc5385f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Thu, 11 Aug 2016 22:00:22 -0700 Subject: [PATCH] stylo: Use the improved version of Gecko_GetStyleContext() --- components/style/gecko_selector_impl.rs | 2 +- components/style/properties/gecko.mako.rs | 2 +- ports/geckolib/wrapper.rs | 11 +++-------- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/components/style/gecko_selector_impl.rs b/components/style/gecko_selector_impl.rs index 7002483e95b..d78349af2aa 100644 --- a/components/style/gecko_selector_impl.rs +++ b/components/style/gecko_selector_impl.rs @@ -34,7 +34,7 @@ pub struct PseudoElement(Atom, bool); impl PseudoElement { #[inline] - fn as_atom(&self) -> &Atom { + pub fn as_atom(&self) -> &Atom { &self.0 } diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 95cc6de7cb3..d8697e7611a 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -455,7 +455,7 @@ impl Clone for ${style_struct.gecko_struct_name} { impl Debug for ${style_struct.gecko_struct_name} { // FIXME(bholley): Generate this. fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "GECKO STYLE STRUCT") + write!(f, "Gecko style struct: ${style_struct.gecko_struct_name}") } } %else: diff --git a/ports/geckolib/wrapper.rs b/ports/geckolib/wrapper.rs index 62fc84a36fe..5d35acf6ef7 100644 --- a/ports/geckolib/wrapper.rs +++ b/ports/geckolib/wrapper.rs @@ -319,15 +319,10 @@ impl<'ln> TNode for GeckoNode<'ln> { return None; } - if pseudo.is_some() { - // FIXME(emilio): This makes us reconstruct frame for pseudos every - // restyle, add a FFI call to get the style context associated with - // a PE. - return None; - } - unsafe { - let context_ptr = Gecko_GetStyleContext(self.node); + let atom_ptr = pseudo.map(|p| p.as_atom().as_ptr()) + .unwrap_or(ptr::null_mut()); + let context_ptr = Gecko_GetStyleContext(self.node, atom_ptr); context_ptr.as_ref() } }