geckolib: fix geckolib build by implementing display on Atoms.

This commit is contained in:
Emilio Cobos Álvarez 2016-06-27 23:20:52 +00:00
parent 2d566ef0ef
commit e015e87697
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
4 changed files with 15 additions and 3 deletions

View file

@ -6,12 +6,11 @@ use euclid::Size2D;
use euclid::size::TypedSize2D; use euclid::size::TypedSize2D;
use gecko_bindings::bindings::RawServoStyleSet; use gecko_bindings::bindings::RawServoStyleSet;
use num_cpus; use num_cpus;
use selector_impl::{Stylist, Stylesheet, SharedStyleContext}; use selector_impl::{GeckoSelectorImpl, Stylist, Stylesheet, SharedStyleContext};
use std::cmp; use std::cmp;
use std::collections::HashMap; use std::collections::HashMap;
use std::sync::mpsc::{channel, Receiver, Sender}; use std::sync::mpsc::{channel, Receiver, Sender};
use std::sync::{Arc, RwLock}; use std::sync::{Arc, RwLock};
use style::animation::Animation;
use style::dom::OpaqueNode; use style::dom::OpaqueNode;
use style::media_queries::{Device, MediaType}; use style::media_queries::{Device, MediaType};
use style::parallel::WorkQueueData; use style::parallel::WorkQueueData;
@ -19,6 +18,8 @@ use util::geometry::ViewportPx;
use util::thread_state; use util::thread_state;
use util::workqueue::WorkQueue; use util::workqueue::WorkQueue;
pub type Animation = ::style::animation::Animation<GeckoSelectorImpl>;
pub struct PerDocumentStyleData { pub struct PerDocumentStyleData {
/// Rule processor. /// Rule processor.
pub stylist: Arc<Stylist>, pub stylist: Arc<Stylist>,

View file

@ -39,7 +39,7 @@ use values::{StyleCoordHelpers, ToGeckoStyleCoord, convert_nscolor_to_rgba};
use values::{convert_rgba_to_nscolor, debug_assert_unit_is_safe_to_copy}; use values::{convert_rgba_to_nscolor, debug_assert_unit_is_safe_to_copy};
use values::round_border_to_device_pixels; use values::round_border_to_device_pixels;
#[derive(Clone)] #[derive(Clone, Debug)]
pub struct GeckoComputedValues { pub struct GeckoComputedValues {
% for style_struct in data.style_structs: % for style_struct in data.style_structs:
${style_struct.ident}: Arc<${style_struct.gecko_struct_name}>, ${style_struct.ident}: Arc<${style_struct.gecko_struct_name}>,

View file

@ -16,6 +16,7 @@ pub type PrivateStyleData = style::data::PrivateStyleData<GeckoSelectorImpl, Gec
#[cfg(feature = "servo_features")] #[cfg(feature = "servo_features")]
known_heap_size!(0, GeckoSelectorImpl, PseudoElement, NonTSPseudoClass); known_heap_size!(0, GeckoSelectorImpl, PseudoElement, NonTSPseudoClass);
#[derive(Debug, Clone)]
pub struct GeckoSelectorImpl; pub struct GeckoSelectorImpl;
#[derive(Clone, Debug, PartialEq, Eq, Hash)] #[derive(Clone, Debug, PartialEq, Eq, Hash)]

View file

@ -15,6 +15,7 @@ use gecko_bindings::structs::nsIAtom;
use heapsize::HeapSizeOf; use heapsize::HeapSizeOf;
use serde::{Deserialize, Deserializer, Serialize, Serializer}; use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::borrow::Cow; use std::borrow::Cow;
use std::char;
use std::fmt; use std::fmt;
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};
use std::marker::PhantomData; use std::marker::PhantomData;
@ -206,6 +207,15 @@ impl fmt::Debug for Atom {
} }
} }
impl fmt::Display for Atom {
fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
for c in char::decode_utf16(self.as_slice().iter().cloned()) {
try!(write!(w, "{}", c.unwrap_or(char::REPLACEMENT_CHARACTER)))
}
Ok(())
}
}
impl<'a> From<&'a str> for Atom { impl<'a> From<&'a str> for Atom {
#[inline] #[inline]
fn from(string: &str) -> Atom { fn from(string: &str) -> Atom {