mirror of
https://github.com/servo/servo.git
synced 2025-07-05 06:23:39 +01:00
style: Fix Servo build.
This commit is contained in:
parent
390d03da70
commit
aa03bf2e19
4 changed files with 27 additions and 14 deletions
|
@ -260,12 +260,8 @@ pub struct SpecifiedImageUrl(pub SpecifiedUrl);
|
||||||
|
|
||||||
impl SpecifiedImageUrl {
|
impl SpecifiedImageUrl {
|
||||||
/// Parse a URL from a string value that is a valid CSS token for a URL.
|
/// 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 {
|
pub fn parse_from_string(url: String, context: &ParserContext, cors_mode: CorsMode) -> Self {
|
||||||
SpecifiedImageUrl(SpecifiedUrl::parse_from_string(
|
SpecifiedImageUrl(SpecifiedUrl::parse_from_string(url, context, cors_mode))
|
||||||
url,
|
|
||||||
context,
|
|
||||||
CorsMode::None,
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Provides an alternate method for parsing that associates the URL
|
/// Provides an alternate method for parsing that associates the URL
|
||||||
|
|
|
@ -5,14 +5,12 @@
|
||||||
//! Common handling for the specified value CSS url() values.
|
//! Common handling for the specified value CSS url() values.
|
||||||
|
|
||||||
use crate::parser::{Parse, ParserContext};
|
use crate::parser::{Parse, ParserContext};
|
||||||
|
use crate::stylesheets::CorsMode;
|
||||||
|
use crate::values::computed::{Context, ToComputedValue};
|
||||||
use cssparser::Parser;
|
use cssparser::Parser;
|
||||||
|
use servo_arc::Arc;
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
use std::fmt::{self, Write};
|
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};
|
use style_traits::{CssWriter, ParseError, ToCss};
|
||||||
|
|
||||||
/// A CSS url() value for servo.
|
/// A CSS url() value for servo.
|
||||||
|
@ -44,7 +42,9 @@ pub struct CssUrl {
|
||||||
impl CssUrl {
|
impl CssUrl {
|
||||||
/// Try to parse a URL from a string value that is a valid CSS token for a
|
/// Try to parse a URL from a string value that is a valid CSS token for a
|
||||||
/// URL.
|
/// 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 serialization = Arc::new(url);
|
||||||
let resolved = context.url_data.join(&serialization).ok();
|
let resolved = context.url_data.join(&serialization).ok();
|
||||||
CssUrl {
|
CssUrl {
|
||||||
|
@ -121,7 +121,11 @@ impl Parse for CssUrl {
|
||||||
input: &mut Parser<'i, 't>,
|
input: &mut Parser<'i, 't>,
|
||||||
) -> Result<Self, ParseError<'i>> {
|
) -> Result<Self, ParseError<'i>> {
|
||||||
let url = input.expect_url()?;
|
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).
|
/// Create a new global shared lock (gecko).
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
pub fn new_leaked() -> Self {
|
pub fn new_leaked() -> Self {
|
||||||
|
|
|
@ -11,6 +11,7 @@ use crate::custom_properties::SpecifiedValue;
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
use crate::gecko_bindings::structs;
|
use crate::gecko_bindings::structs;
|
||||||
use crate::parser::{Parse, ParserContext};
|
use crate::parser::{Parse, ParserContext};
|
||||||
|
use crate::stylesheets::CorsMode;
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
use crate::values::computed::{Context, Position as ComputedPosition, ToComputedValue};
|
use crate::values::computed::{Context, Position as ComputedPosition, ToComputedValue};
|
||||||
use crate::values::generics::image::PaintWorklet;
|
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.try(|i| i.expect_function_matching("-moz-image-rect"))?;
|
||||||
input.parse_nested_block(|i| {
|
input.parse_nested_block(|i| {
|
||||||
let string = i.expect_url_or_string()?;
|
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()?;
|
i.expect_comma()?;
|
||||||
let top = NumberOrPercentage::parse_non_negative(context, i)?;
|
let top = NumberOrPercentage::parse_non_negative(context, i)?;
|
||||||
i.expect_comma()?;
|
i.expect_comma()?;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue