Bug 1504644 - Fix servo build.

This commit is contained in:
Emilio Cobos Álvarez 2018-11-05 12:39:54 +01:00
Родитель 0fce47dc20
Коммит 8babb8a035
4 изменённых файлов: 17 добавлений и 3 удалений

Просмотреть файл

@ -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
/// to the `media_queries` module, or something.
#[derive(Debug, MallocSizeOf)]
pub struct CssEnvironment;
struct EnvironmentVariable {

Просмотреть файл

@ -18,7 +18,7 @@ use num_traits::Zero;
use properties::{CSSWideKeyword, PropertyDeclaration};
use properties::longhands;
use properties::longhands::visibility::computed_value::T as Visibility;
use properties::{LonghandId, ShorthandId};
use properties::LonghandId;
use servo_arc::Arc;
use smallvec::SmallVec;
use std::{cmp, ptr};
@ -50,6 +50,7 @@ use void::{self, Void};
#[allow(non_upper_case_globals)]
impl From<nsCSSPropertyID> for TransitionProperty {
fn from(property: nsCSSPropertyID) -> TransitionProperty {
use properties::ShorthandId;
match property {
% for prop in data.longhands:
${prop.nscsspropertyid()} => {

Просмотреть файл

@ -6,6 +6,7 @@
use app_units::Au;
use cssparser::RGBA;
use custom_properties::CssEnvironment;
use euclid::{Size2D, TypedScale, TypedSize2D};
use media_queries::MediaType;
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.
#[ignore_malloc_size_of = "Pure stack type"]
used_viewport_units: AtomicBool,
/// The CssEnvironment object responsible of getting CSS environment
/// variables.
environment: CssEnvironment,
}
impl Device {
@ -66,9 +70,16 @@ impl Device {
root_font_size: AtomicIsize::new(FontSize::medium().size().0 as isize),
used_root_font_size: 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.
pub fn default_computed_values(&self) -> &ComputedValues {
// FIXME(bz): This isn't really right, but it's no more wrong

Просмотреть файл

@ -4,7 +4,7 @@
use cssparser::{Parser, ParserInput};
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 test::{self, Bencher};
@ -18,7 +18,8 @@ fn cascade(
(Name::from(name), SpecifiedValue::parse(&mut parser).unwrap())
}).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 {
builder.cascade(name, &CustomDeclarationValue::Value(val.clone()));