mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
style: Fix servo build.
This commit is contained in:
parent
64e70e28fc
commit
ac6f921588
4 changed files with 17 additions and 3 deletions
|
@ -25,6 +25,7 @@ use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||||
///
|
///
|
||||||
/// TODO(emilio): If this becomes a bit more complex we should probably move it
|
/// TODO(emilio): If this becomes a bit more complex we should probably move it
|
||||||
/// to the `media_queries` module, or something.
|
/// to the `media_queries` module, or something.
|
||||||
|
#[derive(Debug, MallocSizeOf)]
|
||||||
pub struct CssEnvironment;
|
pub struct CssEnvironment;
|
||||||
|
|
||||||
struct EnvironmentVariable {
|
struct EnvironmentVariable {
|
||||||
|
|
|
@ -18,7 +18,7 @@ use num_traits::Zero;
|
||||||
use properties::{CSSWideKeyword, PropertyDeclaration};
|
use properties::{CSSWideKeyword, PropertyDeclaration};
|
||||||
use properties::longhands;
|
use properties::longhands;
|
||||||
use properties::longhands::visibility::computed_value::T as Visibility;
|
use properties::longhands::visibility::computed_value::T as Visibility;
|
||||||
use properties::{LonghandId, ShorthandId};
|
use properties::LonghandId;
|
||||||
use servo_arc::Arc;
|
use servo_arc::Arc;
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
use std::{cmp, ptr};
|
use std::{cmp, ptr};
|
||||||
|
@ -50,6 +50,7 @@ use void::{self, Void};
|
||||||
#[allow(non_upper_case_globals)]
|
#[allow(non_upper_case_globals)]
|
||||||
impl From<nsCSSPropertyID> for TransitionProperty {
|
impl From<nsCSSPropertyID> for TransitionProperty {
|
||||||
fn from(property: nsCSSPropertyID) -> TransitionProperty {
|
fn from(property: nsCSSPropertyID) -> TransitionProperty {
|
||||||
|
use properties::ShorthandId;
|
||||||
match property {
|
match property {
|
||||||
% for prop in data.longhands:
|
% for prop in data.longhands:
|
||||||
${prop.nscsspropertyid()} => {
|
${prop.nscsspropertyid()} => {
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
use app_units::Au;
|
use app_units::Au;
|
||||||
use cssparser::RGBA;
|
use cssparser::RGBA;
|
||||||
|
use custom_properties::CssEnvironment;
|
||||||
use euclid::{Size2D, TypedScale, TypedSize2D};
|
use euclid::{Size2D, TypedScale, TypedSize2D};
|
||||||
use media_queries::MediaType;
|
use media_queries::MediaType;
|
||||||
use media_queries::media_feature::{AllowsRanges, ParsingRequirements};
|
use media_queries::media_feature::{AllowsRanges, ParsingRequirements};
|
||||||
|
@ -49,6 +50,9 @@ pub struct Device {
|
||||||
/// Whether any styles computed in the document relied on the viewport size.
|
/// Whether any styles computed in the document relied on the viewport size.
|
||||||
#[ignore_malloc_size_of = "Pure stack type"]
|
#[ignore_malloc_size_of = "Pure stack type"]
|
||||||
used_viewport_units: AtomicBool,
|
used_viewport_units: AtomicBool,
|
||||||
|
/// The CssEnvironment object responsible of getting CSS environment
|
||||||
|
/// variables.
|
||||||
|
environment: CssEnvironment,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Device {
|
impl Device {
|
||||||
|
@ -66,9 +70,16 @@ impl Device {
|
||||||
root_font_size: AtomicIsize::new(FontSize::medium().size().0 as isize),
|
root_font_size: AtomicIsize::new(FontSize::medium().size().0 as isize),
|
||||||
used_root_font_size: AtomicBool::new(false),
|
used_root_font_size: AtomicBool::new(false),
|
||||||
used_viewport_units: AtomicBool::new(false),
|
used_viewport_units: AtomicBool::new(false),
|
||||||
|
environment: CssEnvironment,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the relevant environment to resolve `env()` functions.
|
||||||
|
#[inline]
|
||||||
|
pub fn environment(&self) -> &CssEnvironment {
|
||||||
|
&self.environment
|
||||||
|
}
|
||||||
|
|
||||||
/// Return the default computed values for this device.
|
/// Return the default computed values for this device.
|
||||||
pub fn default_computed_values(&self) -> &ComputedValues {
|
pub fn default_computed_values(&self) -> &ComputedValues {
|
||||||
// FIXME(bz): This isn't really right, but it's no more wrong
|
// FIXME(bz): This isn't really right, but it's no more wrong
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
use cssparser::{Parser, ParserInput};
|
use cssparser::{Parser, ParserInput};
|
||||||
use servo_arc::Arc;
|
use servo_arc::Arc;
|
||||||
use style::custom_properties::{Name, SpecifiedValue, CustomPropertiesMap, CustomPropertiesBuilder};
|
use style::custom_properties::{Name, SpecifiedValue, CustomPropertiesMap, CustomPropertiesBuilder, CssEnvironment};
|
||||||
use style::properties::CustomDeclarationValue;
|
use style::properties::CustomDeclarationValue;
|
||||||
use test::{self, Bencher};
|
use test::{self, Bencher};
|
||||||
|
|
||||||
|
@ -18,7 +18,8 @@ fn cascade(
|
||||||
(Name::from(name), SpecifiedValue::parse(&mut parser).unwrap())
|
(Name::from(name), SpecifiedValue::parse(&mut parser).unwrap())
|
||||||
}).collect::<Vec<_>>();
|
}).collect::<Vec<_>>();
|
||||||
|
|
||||||
let mut builder = CustomPropertiesBuilder::new(inherited);
|
let env = CssEnvironment;
|
||||||
|
let mut builder = CustomPropertiesBuilder::new(inherited, &env);
|
||||||
|
|
||||||
for &(ref name, ref val) in &values {
|
for &(ref name, ref val) in &values {
|
||||||
builder.cascade(name, &CustomDeclarationValue::Value(val.clone()));
|
builder.cascade(name, &CustomDeclarationValue::Value(val.clone()));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue