mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Fix deriving in cascade_with_cached_declarations
Even though we don't recompute non-inherited properties here, we still need to compute properties that are derived from them. Fixes #2498: because text-decoration is not inherited, -servo-text-decorations-in-effect was not derived correctly for cached declarations.
This commit is contained in:
parent
48922fc261
commit
3e53dbd2e5
4 changed files with 56 additions and 23 deletions
|
@ -1653,10 +1653,10 @@ fn cascade_with_cached_declarations(applicable_declarations: &[MatchedProperty],
|
|||
for declaration in sub_list.declarations.iter() {
|
||||
match *declaration {
|
||||
% for style_struct in STYLE_STRUCTS:
|
||||
% if style_struct.inherited:
|
||||
% for property in style_struct.longhands:
|
||||
% if property.derived_from is None:
|
||||
${property.camel_case}Declaration(ref declared_value) => {
|
||||
% for property in style_struct.longhands:
|
||||
% if property.derived_from is None:
|
||||
${property.camel_case}Declaration(ref declared_value) => {
|
||||
% if style_struct.inherited:
|
||||
if seen.get_${property.ident}() {
|
||||
continue
|
||||
}
|
||||
|
@ -1681,28 +1681,32 @@ fn cascade_with_cached_declarations(applicable_declarations: &[MatchedProperty],
|
|||
};
|
||||
style_${style_struct.ident}.make_unique_experimental()
|
||||
.${property.ident} = computed_value;
|
||||
% endif
|
||||
|
||||
% if property.name in DERIVED_LONGHANDS:
|
||||
% for derived in DERIVED_LONGHANDS[property.name]:
|
||||
style_${derived.style_struct.ident}
|
||||
.make_unique_experimental()
|
||||
.${derived.ident} =
|
||||
longhands::${derived.ident}
|
||||
::derive_from_${property.ident}(
|
||||
computed_value,
|
||||
context);
|
||||
% endfor
|
||||
% if property.name in DERIVED_LONGHANDS:
|
||||
% if not style_struct.inherited:
|
||||
// Use the cached value.
|
||||
let computed_value = style_${style_struct.ident}
|
||||
.${property.ident}.clone();
|
||||
% endif
|
||||
}
|
||||
% else:
|
||||
${property.camel_case}Declaration(_) => {
|
||||
// Do not allow stylesheets to set derived properties.
|
||||
}
|
||||
% endif
|
||||
% endfor
|
||||
% endif
|
||||
% for derived in DERIVED_LONGHANDS[property.name]:
|
||||
style_${derived.style_struct.ident}
|
||||
.make_unique_experimental()
|
||||
.${derived.ident} =
|
||||
longhands::${derived.ident}
|
||||
::derive_from_${property.ident}(
|
||||
computed_value,
|
||||
context);
|
||||
% endfor
|
||||
% endif
|
||||
}
|
||||
% else:
|
||||
${property.camel_case}Declaration(_) => {
|
||||
// Do not allow stylesheets to set derived properties.
|
||||
}
|
||||
% endif
|
||||
% endfor
|
||||
% endfor
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
== border_style_none_a.html border_style_none_b.html
|
||||
== borders_a.html borders_b.html
|
||||
== acid1_a.html acid1_b.html
|
||||
== text_decoration_cached.html text_decoration_cached_ref.html
|
||||
# text_decoration_propagation_a.html text_decoration_propagation_b.html
|
||||
# inline_text_align_a.html inline_text_align_b.html
|
||||
== font_size_em.html font_size_em_ref.html
|
||||
|
|
14
src/test/ref/text_decoration_cached.html
Normal file
14
src/test/ref/text_decoration_cached.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>text-decoration cache test</title>
|
||||
<style>
|
||||
span { text-decoration: underline; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<u>test</u>
|
||||
<u>test</u>
|
||||
<body>
|
||||
</html>
|
14
src/test/ref/text_decoration_cached_ref.html
Normal file
14
src/test/ref/text_decoration_cached_ref.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>text-decoration cache reference</title>
|
||||
<style>
|
||||
span { text-decoration: underline; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<u>test</u>
|
||||
<span>test</span>
|
||||
<body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue