mirror of
https://github.com/servo/servo.git
synced 2025-08-18 11:55:39 +01:00
style: Add simple ToShmem implementations.
Differential Revision: https://phabricator.services.mozilla.com/D17190
This commit is contained in:
parent
f6ef35c5d3
commit
7fa7c103d6
7 changed files with 85 additions and 3 deletions
|
@ -100,7 +100,6 @@ extern crate style_traits;
|
|||
extern crate thin_slice;
|
||||
extern crate time;
|
||||
extern crate to_shmem;
|
||||
#[macro_use]
|
||||
extern crate to_shmem_derive;
|
||||
extern crate uluru;
|
||||
extern crate unicode_bidi;
|
||||
|
|
|
@ -67,6 +67,7 @@ pub mod system_colors {
|
|||
use crate::gecko_bindings::structs::root::mozilla::LookAndFeel_ColorID;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use to_shmem::impl_trivial_to_shmem;
|
||||
use crate::values::computed::{Context, ToComputedValue};
|
||||
|
||||
pub type SystemColor = LookAndFeel_ColorID;
|
||||
|
@ -75,6 +76,8 @@ pub mod system_colors {
|
|||
// is a bindgen type. So we implement it on the typedef instead.
|
||||
malloc_size_of_is_0!(SystemColor);
|
||||
|
||||
impl_trivial_to_shmem!(SystemColor);
|
||||
|
||||
impl ToCss for SystemColor {
|
||||
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
|
||||
where
|
||||
|
|
|
@ -36,6 +36,7 @@ use selectors::parser::SelectorParseErrorKind;
|
|||
#[cfg(feature = "servo")] use servo_config::prefs;
|
||||
use style_traits::{CssWriter, KeywordsCollectFn, ParseError, ParsingMode};
|
||||
use style_traits::{SpecifiedValueInfo, StyleParseErrorKind, ToCss};
|
||||
use to_shmem::impl_trivial_to_shmem;
|
||||
use crate::stylesheets::{CssRuleType, Origin, UrlExtraData};
|
||||
use crate::values::generics::text::LineHeight;
|
||||
use crate::values::computed;
|
||||
|
@ -741,11 +742,13 @@ static ${name}: LonghandIdSet = LonghandIdSet {
|
|||
</%def>
|
||||
|
||||
/// A set of longhand properties
|
||||
#[derive(Clone, Debug, Default, MallocSizeOf, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, Default, MallocSizeOf, PartialEq)]
|
||||
pub struct LonghandIdSet {
|
||||
storage: [u32; (${len(data.longhands)} - 1 + 32) / 32]
|
||||
}
|
||||
|
||||
impl_trivial_to_shmem!(LonghandIdSet);
|
||||
|
||||
/// An iterator over a set of longhand ids.
|
||||
pub struct LonghandIdSetIterator<'a> {
|
||||
longhands: &'a LonghandIdSet,
|
||||
|
|
|
@ -15,7 +15,9 @@ use crate::stylesheets::{CssRule, Origin, StylesheetInDocument};
|
|||
use crate::values::CssUrl;
|
||||
use cssparser::SourceLocation;
|
||||
use std::fmt::{self, Write};
|
||||
use std::mem::ManuallyDrop;
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use to_shmem::{SharedMemoryBuilder, ToShmem};
|
||||
|
||||
/// With asynchronous stylesheet parsing, we can't synchronously create a
|
||||
/// GeckoStyleSheet. So we use this placeholder instead.
|
||||
|
@ -180,6 +182,12 @@ pub struct ImportRule {
|
|||
pub source_location: SourceLocation,
|
||||
}
|
||||
|
||||
impl ToShmem for ImportRule {
|
||||
fn to_shmem(&self, _builder: &mut SharedMemoryBuilder) -> ManuallyDrop<Self> {
|
||||
panic!("ToShmem failed for ImportRule: cannot handle imported style sheets")
|
||||
}
|
||||
}
|
||||
|
||||
impl DeepCloneWithLock for ImportRule {
|
||||
fn deep_clone_with_lock(
|
||||
&self,
|
||||
|
|
|
@ -17,6 +17,7 @@ use selectors::parser::SelectorParseErrorKind;
|
|||
use std::fmt::{self, Debug, Write};
|
||||
use std::hash;
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use to_shmem::impl_trivial_to_shmem;
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use crate::gecko::url::CssUrl;
|
||||
|
@ -108,6 +109,8 @@ impl ComputeSquaredDistance for Impossible {
|
|||
}
|
||||
}
|
||||
|
||||
impl_trivial_to_shmem!(Impossible);
|
||||
|
||||
impl Parse for Impossible {
|
||||
fn parse<'i, 't>(
|
||||
_context: &ParserContext,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue