Skip to content

Commit

Permalink
style: Add ToShmem impl for URLValueSource.
Browse files Browse the repository at this point in the history
  • Loading branch information
heycam authored and emilio committed Apr 12, 2019
1 parent b8506e4 commit 41f6e67
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions components/style/gecko/url.rs
Expand Up @@ -19,8 +19,10 @@ use nsstring::nsCString;
use servo_arc::Arc;
use std::collections::HashMap;
use std::fmt::{self, Write};
use std::mem::ManuallyDrop;
use std::sync::RwLock;
use style_traits::{CssWriter, ParseError, ToCss};
use to_shmem::{SharedMemoryBuilder, ToShmem};

/// A CSS url() value for gecko.
#[css(function = "url")]
Expand Down Expand Up @@ -138,6 +140,15 @@ pub enum URLValueSource {
CORSMode(CORSMode),
}

impl ToShmem for URLValueSource {
fn to_shmem(&self, _builder: &mut SharedMemoryBuilder) -> ManuallyDrop<Self> {
ManuallyDrop::new(match self {
URLValueSource::URLValue(r) => URLValueSource::CORSMode(r.mCORSMode),
URLValueSource::CORSMode(c) => URLValueSource::CORSMode(*c),
})
}
}

/// A specified non-image `url()` value.
#[derive(Clone, Debug, SpecifiedValueInfo, ToCss)]
pub struct SpecifiedUrl {
Expand Down

0 comments on commit 41f6e67

Please sign in to comment.