Auto merge of #10438 - KiChjang:text-decoration-fix, r=mbrubeck

Properly inherit text decorations

Fixes #8684.
Fixes #8783.

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10438)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-04-08 03:39:41 +05:30
commit eda8784c34
14 changed files with 62 additions and 52 deletions

View file

@ -2314,30 +2314,24 @@ pub mod longhands {
}
fn derive<Cx: TContext>(context: &Cx) -> computed_value::T {
// Start with no declarations if this is a block; otherwise, start with the
// declarations in effect and add in the text decorations that this inline specifies.
// Start with no declarations if this is an atomic inline-level box; otherwise, start with the
// declarations in effect and add in the text decorations that this block specifies.
let mut result = match context.style().get_box().clone_display() {
super::display::computed_value::T::inline => {
context.inherited_style().get_inheritedtext().clone__servo_text_decorations_in_effect()
}
_ => {
SpecifiedValue {
super::display::computed_value::T::inline_block |
super::display::computed_value::T::inline_table => SpecifiedValue {
underline: None,
overline: None,
line_through: None,
}
}
},
_ => context.inherited_style().get_inheritedtext().clone__servo_text_decorations_in_effect()
};
if result.underline.is_none() {
result.underline = maybe(context.style().get_text().has_underline(), context)
}
if result.overline.is_none() {
result.overline = maybe(context.style().get_text().has_overline(), context)
}
if result.line_through.is_none() {
result.line_through = maybe(context.style().get_text().has_line_through(), context)
}
result.underline = maybe(context.style().get_text().has_underline()
|| result.underline.is_some(), context);
result.overline = maybe(context.style().get_text().has_overline()
|| result.overline.is_some(), context);
result.line_through = maybe(context.style().get_text().has_line_through()
|| result.line_through.is_some(), context);
result
}

View file

@ -1,3 +0,0 @@
[text-decoration-applies-to-006.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[text-decoration-applies-to-008.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[text-decoration-applies-to-009.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[text-decoration-applies-to-010.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[text-decoration-applies-to-011.htm]
type: reftest
expected: FAIL

View file

@ -3299,6 +3299,18 @@
"url": "/_mozilla/css/no_image_background_a.html"
}
],
"css/non-inline-block-resets-underline-property.html": [
{
"path": "css/non-inline-block-resets-underline-property.html",
"references": [
[
"/_mozilla/css/non-inline-block-resets-underline-property-ref.html",
"=="
]
],
"url": "/_mozilla/css/non-inline-block-resets-underline-property.html"
}
],
"css/noscript.html": [
{
"path": "css/noscript.html",
@ -9769,6 +9781,18 @@
"url": "/_mozilla/css/no_image_background_a.html"
}
],
"css/non-inline-block-resets-underline-property.html": [
{
"path": "css/non-inline-block-resets-underline-property.html",
"references": [
[
"/_mozilla/css/non-inline-block-resets-underline-property-ref.html",
"=="
]
],
"url": "/_mozilla/css/non-inline-block-resets-underline-property.html"
}
],
"css/noscript.html": [
{
"path": "css/noscript.html",

View file

@ -1,4 +0,0 @@
[text_decoration_propagation_a.html]
type: reftest
expected: FAIL
bug: https://github.com/servo/servo/issues/8783

View file

@ -0,0 +1,11 @@
<!doctype html>
<meta charset="utf-8">
<title></title>
<body>
<style>
.u { text-decoration: underline; }
</style>
<div class='u'>a</div>
<div class='u'>b</div>
<div class='u'>c</div>
</body>

View file

@ -0,0 +1,12 @@
<!doctype html>
<meta charset="utf-8">
<title></title>
<link rel="match" href="non-inline-block-resets-underline-property-ref.html">
<body>
<style>
.u { text-decoration: underline; }
</style>
<div class='u'>a</div>
<div class='u'><div>b</div></div>
<div class='u'><div style="display:inline">c</div></div>
</body>