Substitute var() in longhand property declarations.

This commit is contained in:
Simon Sapin 2015-09-02 22:56:39 +02:00
parent b2ee828520
commit b4fdb5d803
6 changed files with 254 additions and 157 deletions

View file

@ -135,7 +135,7 @@ version = "0.0.1"
dependencies = [
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
"canvas_traits 0.0.1",
"cssparser 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"gleam 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
@ -152,7 +152,7 @@ name = "canvas_traits"
version = "0.0.1"
dependencies = [
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
"cssparser 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
@ -288,7 +288,7 @@ dependencies = [
[[package]]
name = "cssparser"
version = "0.3.5"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
@ -886,7 +886,7 @@ dependencies = [
"canvas 0.0.1",
"canvas_traits 0.0.1",
"clock_ticks 0.0.6 (git+https://github.com/tomaka/clock_ticks)",
"cssparser 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1369,7 +1369,7 @@ dependencies = [
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"canvas 0.0.1",
"canvas_traits 0.0.1",
"cssparser 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"devtools_traits 0.0.1",
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1435,7 +1435,7 @@ version = "0.1.0"
source = "git+https://github.com/servo/rust-selectors#572353b3209af040cd3e6261978b09c7f8122844"
dependencies = [
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quickersort 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1572,7 +1572,7 @@ name = "style"
version = "0.0.1"
dependencies = [
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1596,7 +1596,7 @@ dependencies = [
name = "style_tests"
version = "0.0.1"
dependencies = [
"cssparser 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.1.0 (git+https://github.com/servo/rust-selectors)",
"string_cache 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1714,7 +1714,7 @@ version = "0.0.1"
dependencies = [
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -20,7 +20,7 @@ git = "https://github.com/servo/rust-selectors"
features = ["unstable"]
[dependencies.cssparser]
version = "0.3"
version = "0.3.6"
features = [ "serde-serialization" ]
[dependencies.url]

View file

@ -24,18 +24,19 @@ pub struct BorrowedValue<'a> {
pub fn parse(input: &mut Parser) -> Result<Value, ()> {
let start = input.position();
let mut references = HashSet::new();
let mut references = Some(HashSet::new());
// FIXME: dont consume a top-level `!` as that would prevent parsing `!important`.
// Maybe using Parser::parse_until_before?
try!(parse_declaration_value(input, &mut references));
Ok(Value {
value: input.slice_from(start).to_owned(),
references: references,
references: references.unwrap(),
})
}
/// https://drafts.csswg.org/css-syntax-3/#typedef-declaration-value
fn parse_declaration_value(input: &mut Parser, references: &mut HashSet<Atom>) -> Result<(), ()> {
pub fn parse_declaration_value(input: &mut Parser, references: &mut Option<HashSet<Atom>>)
-> Result<(), ()> {
if input.is_exhausted() {
// Need at least one token
return Err(())
@ -76,7 +77,7 @@ fn parse_declaration_value(input: &mut Parser, references: &mut HashSet<Atom>) -
/// Like parse_declaration_value,
/// but accept `!` and `;` since they are only invalid at the top level
fn parse_declaration_value_block(input: &mut Parser, references: &mut HashSet<Atom>)
fn parse_declaration_value_block(input: &mut Parser, references: &mut Option<HashSet<Atom>>)
-> Result<(), ()> {
while let Ok(token) = input.next() {
match token {
@ -110,7 +111,7 @@ fn parse_declaration_value_block(input: &mut Parser, references: &mut HashSet<At
}
// If the var function is valid, return Ok((custom_property_name, fallback))
fn parse_var_function<'i, 't>(input: &mut Parser<'i, 't>, references: &mut HashSet<Atom>)
fn parse_var_function<'i, 't>(input: &mut Parser<'i, 't>, references: &mut Option<HashSet<Atom>>)
-> Result<(), ()> {
// https://drafts.csswg.org/css-variables/#typedef-custom-property-name
let name = try!(input.expect_ident());
@ -122,7 +123,9 @@ fn parse_var_function<'i, 't>(input: &mut Parser<'i, 't>, references: &mut HashS
if input.expect_comma().is_ok() {
try!(parse_declaration_value(input, references));
}
references.insert(Atom::from_slice(name));
if let Some(ref mut refs) = *references {
refs.insert(Atom::from_slice(name));
}
Ok(())
}
@ -153,7 +156,8 @@ pub fn cascade<'a>(custom_properties: &mut Option<HashMap<&'a Atom, BorrowedValu
value: &value.value,
references: Some(&value.references),
});
}
},
DeclaredValue::WithVariables { .. } => unreachable!(),
DeclaredValue::Initial => {
map.remove(&name);
}
@ -188,8 +192,8 @@ fn remove_cycles(map: &mut HashMap<&Atom, BorrowedValue>) {
stack: &mut Vec<&'a Atom>,
visited: &mut HashSet<&'a Atom>,
to_remove: &mut HashSet<Atom>) {
let was_not_already_present = visited.insert(name);
if !was_not_already_present {
let already_visited_before = !visited.insert(name);
if already_visited_before {
return
}
if let Some(value) = map.get(name) {
@ -216,6 +220,7 @@ fn remove_cycles(map: &mut HashMap<&Atom, BorrowedValue>) {
}
}
/// Replace `var()` functions for all custom properties.
fn substitute_all(custom_properties: HashMap<&Atom, BorrowedValue>,
inherited: &Option<Arc<HashMap<Atom, String>>>)
-> HashMap<Atom, String> {
@ -230,6 +235,9 @@ fn substitute_all(custom_properties: HashMap<&Atom, BorrowedValue>,
substituted_map
}
/// Replace `var()` functions for one custom property.
/// Also recursively record results for other custom properties referenced by `var()` functions.
/// Return `Err(())` for invalid at computed time.
fn substitute_one(name: &Atom,
value: &BorrowedValue,
custom_properties: &HashMap<&Atom, BorrowedValue>,
@ -252,10 +260,14 @@ fn substitute_one(name: &Atom,
let mut substituted = String::new();
let mut input = Parser::new(&value.value);
let mut start = input.position();
if substitute_block(
custom_properties, inherited, &mut input, &mut start, &mut substituted,
substituted_map, invalid,
).is_ok() {
if substitute_block(&mut input, &mut start, &mut substituted, &mut |name, substituted| {
if let Some(value) = custom_properties.get(name) {
substitute_one(name, value, custom_properties, inherited,
Some(substituted), substituted_map, invalid)
} else {
Err(())
}
}).is_ok() {
substituted.push_str(input.slice_from(start));
substituted
} else {
@ -279,27 +291,33 @@ fn substitute_one(name: &Atom,
Ok(())
}
fn substitute_block(custom_properties: &HashMap<&Atom, BorrowedValue>,
inherited: &Option<Arc<HashMap<Atom, String>>>,
input: &mut Parser,
/// Replace `var()` functions in an arbitrary bit of input.
///
/// The `substitute_one` callback is called for each `var()` function in `input`.
/// If the variable has its initial value,
/// the callback should return `Err(())` and leave `substituted` unchanged.
/// Otherwise, it should push the value of the variable (with its own `var()` functions replaced)
/// to `substituted` and return `Ok(())`.
///
/// Return `Err(())` if `input` is invalid at computed-value time.
fn substitute_block<F>(input: &mut Parser,
start: &mut SourcePosition,
substituted: &mut String,
substituted_map: &mut HashMap<Atom, String>,
invalid: &mut HashSet<Atom>)
-> Result<(), ()> {
while let Ok(token) = input.next() {
substitute_one: &mut F)
-> Result<(), ()>
where F: FnMut(&Atom, &mut String) -> Result<(), ()> {
loop {
let input_slice = input.slice_from(*start);
let token = if let Ok(token) = input.next() { token } else { break };
match token {
Token::Function(ref name) if name == "var" => {
substituted.push_str(input.slice_from(*start));
substituted.push_str(input_slice);
try!(input.parse_nested_block(|input| {
let name = input.expect_ident().unwrap();
debug_assert!(name.starts_with("--"));
debug_assert!(name.starts_with("--")); // Ensured by parse_var_function()
let name = Atom::from_slice(&name[2..]);
if let Some(value) = custom_properties.get(&name) {
try!(substitute_one(
&name, value, custom_properties, inherited,
Some(substituted), substituted_map, invalid));
if substitute_one(&name, substituted).is_ok() {
// Skip over the fallback, as `parse_nested_block` would return `Err`
// if we dont consume all of `input`.
// FIXME: Add a specialized method to cssparser to do this with less work.
@ -307,9 +325,7 @@ fn substitute_block(custom_properties: &HashMap<&Atom, BorrowedValue>,
} else {
try!(input.expect_comma());
let mut start = input.position();
try!(substitute_block(
custom_properties, inherited, input,
&mut start, substituted, substituted_map, invalid));
try!(substitute_block(input, &mut start, substituted, substitute_one));
substituted.push_str(input.slice_from(start));
}
Ok(())
@ -321,9 +337,9 @@ fn substitute_block(custom_properties: &HashMap<&Atom, BorrowedValue>,
Token::ParenthesisBlock |
Token::CurlyBracketBlock |
Token::SquareBracketBlock => {
try!(input.parse_nested_block(|input| substitute_block(
custom_properties, inherited, input,
start, substituted, substituted_map, invalid)));
try!(input.parse_nested_block(|input| {
substitute_block(input, start, substituted, substitute_one)
}));
}
_ => {}
@ -337,3 +353,29 @@ fn substitute_block(custom_properties: &HashMap<&Atom, BorrowedValue>,
// ```
Ok(())
}
/// Replace `var()` functions for a non-custom property.
/// Return `Err(())` for invalid at computed time.
pub fn substitute(input: &str, custom_properties: &Option<Arc<HashMap<Atom, String>>>)
-> Result<String, ()> {
let empty_map;
let custom_properties = if let &Some(ref arc) = custom_properties {
&**arc
} else {
empty_map = HashMap::new();
&empty_map
};
let mut substituted = String::new();
let mut input = Parser::new(input);
let mut start = input.position();
try!(substitute_block(&mut input, &mut start, &mut substituted, &mut |name, substituted| {
if let Some(value) = custom_properties.get(name) {
substituted.push_str(value);
Ok(())
} else {
Err(())
}
}));
substituted.push_str(input.slice_from(start));
Ok(substituted)
}

View file

@ -133,9 +133,11 @@ pub mod longhands {
use properties::longhands;
use properties::property_bit_field::PropertyBitField;
use properties::{ComputedValues, PropertyDeclaration};
use std::collections::HashMap;
use std::sync::Arc;
use values::computed::ToComputedValue;
use values::{computed, specified};
use string_cache::Atom;
${caller.body()}
#[allow(unused_variables)]
pub fn cascade_property(declaration: &PropertyDeclaration,
@ -155,10 +157,12 @@ pub mod longhands {
return
}
seen.set_${property.ident}();
let computed_value = match *declared_value {
let computed_value = substitute_variables(
declared_value, &style.custom_properties, |value| match *value {
DeclaredValue::Value(ref specified_value) => {
specified_value.to_computed_value(&context)
}
DeclaredValue::WithVariables { .. } => unreachable!(),
DeclaredValue::Initial => get_initial_value(),
DeclaredValue::Inherit => {
// This is a bit slow, but this is rare so it shouldn't
@ -170,7 +174,8 @@ pub mod longhands {
.${property.ident}
.clone()
}
};
}
);
Arc::make_mut(&mut style.${THIS_STYLE_STRUCT.ident}).${property.ident} =
computed_value;
@ -188,6 +193,29 @@ pub mod longhands {
% endif
}
% if derived_from is None:
pub fn substitute_variables<F, R>(value: &DeclaredValue<SpecifiedValue>,
custom_properties: &Option<Arc<HashMap<Atom, String>>>,
f: F)
-> R
where F: FnOnce(&DeclaredValue<SpecifiedValue>) -> R {
if let DeclaredValue::WithVariables { ref css, ref base_url } = *value {
f(&
::custom_properties::substitute(css, custom_properties)
.and_then(|css| {
// As of this writing, only the base URL is used for property values:
let context = ParserContext::new(
::stylesheets::Origin::Author, base_url);
parse_specified(&context, &mut Parser::new(&css))
})
.unwrap_or(
// Invalid at computed-value time.
DeclaredValue::${"Inherit" if THIS_STYLE_STRUCT.inherited else "Initial"}
)
)
} else {
f(value)
}
}
pub fn parse_declared(context: &ParserContext, input: &mut Parser)
-> Result<DeclaredValue<SpecifiedValue>, ()> {
match input.try(CSSWideKeyword::parse) {
@ -195,7 +223,21 @@ pub mod longhands {
Ok(CSSWideKeyword::InitialKeyword) => Ok(DeclaredValue::Initial),
Ok(CSSWideKeyword::UnsetKeyword) => Ok(DeclaredValue::${
"Inherit" if THIS_STYLE_STRUCT.inherited else "Initial"}),
Err(()) => parse_specified(context, input),
Err(()) => {
input.look_for_var_functions();
let start = input.position();
let specified = parse_specified(context, input);
let var = input.seen_var_functions();
if specified.is_err() && var {
input.reset(start);
try!(::custom_properties::parse_declaration_value(input, &mut None));
return Ok(DeclaredValue::WithVariables {
css: input.slice_from(start).to_owned(),
base_url: context.base_url.clone(),
})
}
specified
}
}
}
% endif
@ -1666,7 +1708,6 @@ pub mod longhands {
<%self:longhand name="font-family">
use self::computed_value::FontFamily;
use string_cache::Atom;
use values::computed::ComputedValueAsSpecified;
pub use self::computed_value::T as SpecifiedValue;
@ -5659,9 +5700,10 @@ impl CSSWideKeyword {
}
#[derive(Clone, PartialEq, Eq, Copy, Debug)]
#[derive(Clone, PartialEq, Eq, Debug)]
pub enum DeclaredValue<T> {
Value(T),
WithVariables { css: String, base_url: Url },
Initial,
Inherit,
// There is no Unset variant here.
@ -5673,6 +5715,7 @@ impl<T: ToCss> DeclaredValue<T> {
pub fn specified_value(&self) -> String {
match self {
&DeclaredValue::Value(ref inner) => inner.to_css_string(),
&DeclaredValue::WithVariables { ref css, .. } => css.clone(),
&DeclaredValue::Initial => "initial".to_owned(),
&DeclaredValue::Inherit => "inherit".to_owned(),
}
@ -6092,6 +6135,7 @@ fn cascade_with_cached_declarations(
shareable: bool,
parent_style: &ComputedValues,
cached_style: &ComputedValues,
custom_properties: Option<Arc<HashMap<Atom, String>>>,
context: &computed::Context)
-> ComputedValues {
% for style_struct in STYLE_STRUCTS:
@ -6101,10 +6145,7 @@ fn cascade_with_cached_declarations(
let mut style_${style_struct.ident} = cached_style.${style_struct.ident}.clone();
% endif
% endfor
let mut custom_properties = None;
let mut seen = PropertyBitField::new();
let mut seen_custom = HashSet::new();
// Declaration blocks are stored in increasing precedence order,
// we want them in decreasing order here.
for sub_list in applicable_declarations.iter().rev() {
@ -6122,7 +6163,9 @@ fn cascade_with_cached_declarations(
continue
}
seen.set_${property.ident}();
let computed_value = match *declared_value {
let computed_value =
longhands::${property.ident}::substitute_variables(
declared_value, &custom_properties, |value| match *value {
DeclaredValue::Value(ref specified_value)
=> specified_value.to_computed_value(context),
DeclaredValue::Initial
@ -6136,7 +6179,9 @@ fn cascade_with_cached_declarations(
.${property.ident}
.clone()
}
};
DeclaredValue::WithVariables { .. } => unreachable!()
}
);
Arc::make_mut(&mut style_${style_struct.ident})
.${property.ident} = computed_value;
% endif
@ -6164,11 +6209,7 @@ fn cascade_with_cached_declarations(
% endif
% endfor
% endfor
PropertyDeclaration::Custom(ref name, ref value) => {
::custom_properties::cascade(
&mut custom_properties, &parent_style.custom_properties,
&mut seen_custom, name, value)
}
PropertyDeclaration::Custom(..) => {}
}
}
}
@ -6183,8 +6224,7 @@ fn cascade_with_cached_declarations(
% for style_struct in STYLE_STRUCTS:
${style_struct.ident}: style_${style_struct.ident},
% endfor
custom_properties: ::custom_properties::finish_cascade(
custom_properties, &parent_style.custom_properties),
custom_properties: custom_properties,
shareable: shareable,
root_font_size: parent_style.root_font_size,
}
@ -6247,6 +6287,25 @@ pub fn cascade(viewport_size: Size2D<Au>,
Some(parent_style) => (false, parent_style),
None => (true, initial_values),
};
let mut custom_properties = None;
let mut seen_custom = HashSet::new();
for sub_list in applicable_declarations.iter().rev() {
// Declarations are already stored in reverse order.
for declaration in sub_list.declarations.iter() {
match *declaration {
PropertyDeclaration::Custom(ref name, ref value) => {
::custom_properties::cascade(
&mut custom_properties, &inherited_style.custom_properties,
&mut seen_custom, name, value)
}
_ => {}
}
}
}
let custom_properties = ::custom_properties::finish_cascade(
custom_properties, &inherited_style.custom_properties);
let mut context = {
let inherited_font_style = inherited_style.get_font();
computed::Context {
@ -6277,11 +6336,16 @@ pub fn cascade(viewport_size: Size2D<Au>,
// This assumes that the computed and specified values have the same Rust type.
macro_rules! get_specified(
($style_struct_getter: ident, $property: ident, $declared_value: expr) => {
match *$declared_value {
longhands::$property::substitute_variables(
$declared_value, &custom_properties, |value| match *value {
DeclaredValue::Value(specified_value) => specified_value,
DeclaredValue::Initial => longhands::$property::get_initial_value(),
DeclaredValue::Inherit => inherited_style.$style_struct_getter().$property.clone(),
DeclaredValue::Inherit => {
inherited_style.$style_struct_getter().$property.clone()
}
DeclaredValue::WithVariables { .. } => unreachable!()
}
)
};
);
@ -6292,7 +6356,8 @@ pub fn cascade(viewport_size: Size2D<Au>,
for declaration in sub_list.declarations.iter().rev() {
match *declaration {
PropertyDeclaration::FontSize(ref value) => {
context.font_size = match *value {
context.font_size = longhands::font_size::substitute_variables(
value, &custom_properties, |value| match *value {
DeclaredValue::Value(ref specified_value) => {
match specified_value.0 {
Length::FontRelative(value) => {
@ -6307,16 +6372,21 @@ pub fn cascade(viewport_size: Size2D<Au>,
}
DeclaredValue::Initial => longhands::font_size::get_initial_value(),
DeclaredValue::Inherit => context.inherited_font_size,
DeclaredValue::WithVariables { .. } => unreachable!(),
}
);
}
PropertyDeclaration::Color(ref value) => {
context.color = match *value {
context.color = longhands::color::substitute_variables(
value, &custom_properties, |value| match *value {
DeclaredValue::Value(ref specified_value) => {
specified_value.parsed
}
DeclaredValue::Initial => longhands::color::get_initial_value(),
DeclaredValue::Inherit => inherited_style.get_color().color.clone(),
};
DeclaredValue::WithVariables { .. } => unreachable!(),
}
);
}
PropertyDeclaration::Display(ref value) => {
context.display = get_specified!(get_box, display, value);
@ -6368,6 +6438,7 @@ pub fn cascade(viewport_size: Size2D<Au>,
shareable,
parent_style,
cached_style,
custom_properties,
&context), false)
}
(_, _) => {}
@ -6384,14 +6455,13 @@ pub fn cascade(viewport_size: Size2D<Au>,
% endif
.${style_struct.ident}.clone(),
% endfor
custom_properties: None,
shareable: false,
custom_properties: custom_properties,
shareable: shareable,
writing_mode: WritingMode::empty(),
root_font_size: context.root_font_size,
};
let mut cacheable = true;
let mut seen = PropertyBitField::new();
let mut custom_properties = None;
// Declaration blocks are stored in increasing precedence order, we want them in decreasing
// order here.
//
@ -6399,17 +6469,12 @@ pub fn cascade(viewport_size: Size2D<Au>,
// of compiled code! To improve i-cache behavior, we outline the individual functions and use
// virtual dispatch instead.
CASCADE_PROPERTY.with(|cascade_property| {
let mut seen_custom = HashSet::new();
for sub_list in applicable_declarations.iter().rev() {
// Declarations are already stored in reverse order.
for declaration in sub_list.declarations.iter() {
match *declaration {
PropertyDeclaration::Custom(ref name, ref value) => {
::custom_properties::cascade(
&mut custom_properties, &inherited_style.custom_properties,
&mut seen_custom, name, value)
if let PropertyDeclaration::Custom(..) = *declaration {
continue
}
_ => {
let discriminant = unsafe {
intrinsics::discriminant_value(declaration) as usize
};
@ -6421,8 +6486,6 @@ pub fn cascade(viewport_size: Size2D<Au>,
&mut cacheable);
}
}
}
}
});
// The initial value of border-*-width may be changed at computed value time.
@ -6457,16 +6520,8 @@ pub fn cascade(viewport_size: Size2D<Au>,
compute_font_hash(&mut *Arc::make_mut(&mut style.font))
}
(ComputedValues {
writing_mode: get_writing_mode(&*style.inheritedbox),
% for style_struct in STYLE_STRUCTS:
${style_struct.ident}: style.${style_struct.ident},
% endfor
custom_properties: ::custom_properties::finish_cascade(
custom_properties, &inherited_style.custom_properties),
shareable: shareable,
root_font_size: context.root_font_size,
}, cacheable)
style.writing_mode = get_writing_mode(&*style.inheritedbox);
(style, cacheable)
}
/// Alters the given style to accommodate replaced content. This is called in flow construction. It

16
ports/cef/Cargo.lock generated
View file

@ -127,7 +127,7 @@ version = "0.0.1"
dependencies = [
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
"canvas_traits 0.0.1",
"cssparser 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"gleam 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
@ -144,7 +144,7 @@ name = "canvas_traits"
version = "0.0.1"
dependencies = [
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
"cssparser 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
@ -280,7 +280,7 @@ dependencies = [
[[package]]
name = "cssparser"
version = "0.3.5"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
@ -871,7 +871,7 @@ dependencies = [
"canvas 0.0.1",
"canvas_traits 0.0.1",
"clock_ticks 0.0.6 (git+https://github.com/tomaka/clock_ticks)",
"cssparser 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1339,7 +1339,7 @@ dependencies = [
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"canvas 0.0.1",
"canvas_traits 0.0.1",
"cssparser 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"devtools_traits 0.0.1",
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1397,7 +1397,7 @@ version = "0.1.0"
source = "git+https://github.com/servo/rust-selectors#572353b3209af040cd3e6261978b09c7f8122844"
dependencies = [
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quickersort 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1567,7 +1567,7 @@ name = "style"
version = "0.0.1"
dependencies = [
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1695,7 +1695,7 @@ version = "0.0.1"
dependencies = [
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",

16
ports/gonk/Cargo.lock generated
View file

@ -108,7 +108,7 @@ version = "0.0.1"
dependencies = [
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
"canvas_traits 0.0.1",
"cssparser 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"gleam 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
@ -125,7 +125,7 @@ name = "canvas_traits"
version = "0.0.1"
dependencies = [
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
"cssparser 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"ipc-channel 0.1.0 (git+https://github.com/pcwalton/ipc-channel)",
@ -250,7 +250,7 @@ dependencies = [
[[package]]
name = "cssparser"
version = "0.3.5"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
@ -755,7 +755,7 @@ dependencies = [
"canvas 0.0.1",
"canvas_traits 0.0.1",
"clock_ticks 0.0.6 (git+https://github.com/tomaka/clock_ticks)",
"cssparser 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1205,7 +1205,7 @@ dependencies = [
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"canvas 0.0.1",
"canvas_traits 0.0.1",
"cssparser 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"devtools_traits 0.0.1",
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1263,7 +1263,7 @@ version = "0.1.0"
source = "git+https://github.com/servo/rust-selectors#572353b3209af040cd3e6261978b09c7f8122844"
dependencies = [
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quickersort 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1413,7 +1413,7 @@ name = "style"
version = "0.0.1"
dependencies = [
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1530,7 +1530,7 @@ version = "0.0.1"
dependencies = [
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",