Skip to content
Permalink
Browse files

style: Fix Servo build.

  • Loading branch information...
emilio committed Jun 3, 2019
1 parent 390d03d commit aa03bf2e19e42f5e28f679d010434d7f4b4d2db8
@@ -260,12 +260,8 @@ pub struct SpecifiedImageUrl(pub SpecifiedUrl);

impl SpecifiedImageUrl {
/// Parse a URL from a string value that is a valid CSS token for a URL.
pub fn parse_from_string(url: String, context: &ParserContext) -> Self {
SpecifiedImageUrl(SpecifiedUrl::parse_from_string(
url,
context,
CorsMode::None,
))
pub fn parse_from_string(url: String, context: &ParserContext, cors_mode: CorsMode) -> Self {
SpecifiedImageUrl(SpecifiedUrl::parse_from_string(url, context, cors_mode))
}

/// Provides an alternate method for parsing that associates the URL
@@ -5,14 +5,12 @@
//! Common handling for the specified value CSS url() values.

use crate::parser::{Parse, ParserContext};
use crate::stylesheets::CorsMode;
use crate::values::computed::{Context, ToComputedValue};
use cssparser::Parser;
use servo_arc::Arc;
use servo_url::ServoUrl;
use std::fmt::{self, Write};
// Note: We use std::sync::Arc rather than servo_arc::Arc here because the
// nonzero optimization is important in keeping the size of SpecifiedUrl below
// the threshold.
use crate::values::computed::{Context, ToComputedValue};
use servo_arc::Arc;
use style_traits::{CssWriter, ParseError, ToCss};

/// A CSS url() value for servo.
@@ -44,7 +42,9 @@ pub struct CssUrl {
impl CssUrl {
/// Try to parse a URL from a string value that is a valid CSS token for a
/// URL.
pub fn parse_from_string(url: String, context: &ParserContext) -> Self {
///
/// FIXME(emilio): Should honor CorsMode.
pub fn parse_from_string(url: String, context: &ParserContext, _: CorsMode) -> Self {
let serialization = Arc::new(url);
let resolved = context.url_data.join(&serialization).ok();
CssUrl {
@@ -121,7 +121,11 @@ impl Parse for CssUrl {
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
let url = input.expect_url()?;
Ok(Self::parse_from_string(url.as_ref().to_owned(), context))
Ok(Self::parse_from_string(
url.as_ref().to_owned(),
context,
CorsMode::None,
))
}
}

@@ -71,6 +71,14 @@ impl SharedRwLock {
}
}

/// Create a new global shared lock (servo).
#[cfg(feature = "servo")]
pub fn new_leaked() -> Self {
SharedRwLock {
arc: Arc::new_leaked(RwLock::new(())),
}
}

/// Create a new global shared lock (gecko).
#[cfg(feature = "gecko")]
pub fn new_leaked() -> Self {
@@ -11,6 +11,7 @@ use crate::custom_properties::SpecifiedValue;
#[cfg(feature = "gecko")]
use crate::gecko_bindings::structs;
use crate::parser::{Parse, ParserContext};
use crate::stylesheets::CorsMode;
#[cfg(feature = "gecko")]
use crate::values::computed::{Context, Position as ComputedPosition, ToComputedValue};
use crate::values::generics::image::PaintWorklet;
@@ -1032,7 +1033,11 @@ impl Parse for MozImageRect {
input.try(|i| i.expect_function_matching("-moz-image-rect"))?;
input.parse_nested_block(|i| {
let string = i.expect_url_or_string()?;
let url = SpecifiedImageUrl::parse_from_string(string.as_ref().to_owned(), context);
let url = SpecifiedImageUrl::parse_from_string(
string.as_ref().to_owned(),
context,
CorsMode::None,
);
i.expect_comma()?;
let top = NumberOrPercentage::parse_non_negative(context, i)?;
i.expect_comma()?;

0 comments on commit aa03bf2

Please sign in to comment.
You can’t perform that action at this time.