aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith Yeung <kungfukeith11@gmail.com>2016-04-05 13:12:10 -0400
committerKeith Yeung <kungfukeith11@gmail.com>2016-04-07 17:16:45 -0400
commitb8971867f8b1c0b742c7eab07d76054d5aa573c7 (patch)
treed32384a36c78f469ea5a33d288bbc1729a46c2f0
parenta8ed5c3fc66ab9ea57b6b78311485040dae27328 (diff)
downloadservo-b8971867f8b1c0b742c7eab07d76054d5aa573c7.tar.gz
servo-b8971867f8b1c0b742c7eab07d76054d5aa573c7.zip
Properly inherit text decorations
-rw-r--r--components/style/properties.mako.rs36
-rw-r--r--tests/wpt/metadata-css/css21_dev/html4/text-decoration-applies-to-006.htm.ini3
-rw-r--r--tests/wpt/metadata-css/css21_dev/html4/text-decoration-applies-to-008.htm.ini3
-rw-r--r--tests/wpt/metadata-css/css21_dev/html4/text-decoration-applies-to-009.htm.ini3
-rw-r--r--tests/wpt/metadata-css/css21_dev/html4/text-decoration-applies-to-010.htm.ini3
-rw-r--r--tests/wpt/metadata-css/css21_dev/html4/text-decoration-applies-to-011.htm.ini3
-rw-r--r--tests/wpt/metadata/html/rendering/non-replaced-elements/phrasing-content-0/font-element-text-decoration-color/001-a.html.ini3
-rw-r--r--tests/wpt/metadata/html/rendering/non-replaced-elements/phrasing-content-0/font-element-text-decoration-color/001-q.html.ini3
-rw-r--r--tests/wpt/metadata/html/rendering/non-replaced-elements/phrasing-content-0/font-element-text-decoration-color/001-s.html.ini3
-rw-r--r--tests/wpt/metadata/html/rendering/non-replaced-elements/phrasing-content-0/font-element-text-decoration-color/001-x.xhtml.ini3
-rw-r--r--tests/wpt/mozilla/meta/MANIFEST.json24
-rw-r--r--tests/wpt/mozilla/meta/css/text_decoration_propagation_a.html.ini4
-rw-r--r--tests/wpt/mozilla/tests/css/non-inline-block-resets-underline-property-ref.html11
-rw-r--r--tests/wpt/mozilla/tests/css/non-inline-block-resets-underline-property.html12
14 files changed, 62 insertions, 52 deletions
diff --git a/components/style/properties.mako.rs b/components/style/properties.mako.rs
index 0b9dcd11217..8b2ab91ea18 100644
--- a/components/style/properties.mako.rs
+++ b/components/style/properties.mako.rs
@@ -2309,30 +2309,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 {
- underline: None,
- overline: None,
- line_through: None,
- }
- }
+ 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
}
diff --git a/tests/wpt/metadata-css/css21_dev/html4/text-decoration-applies-to-006.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/text-decoration-applies-to-006.htm.ini
deleted file mode 100644
index b888ea98254..00000000000
--- a/tests/wpt/metadata-css/css21_dev/html4/text-decoration-applies-to-006.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[text-decoration-applies-to-006.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata-css/css21_dev/html4/text-decoration-applies-to-008.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/text-decoration-applies-to-008.htm.ini
deleted file mode 100644
index beaaae03b5c..00000000000
--- a/tests/wpt/metadata-css/css21_dev/html4/text-decoration-applies-to-008.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[text-decoration-applies-to-008.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata-css/css21_dev/html4/text-decoration-applies-to-009.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/text-decoration-applies-to-009.htm.ini
deleted file mode 100644
index 308007c79e5..00000000000
--- a/tests/wpt/metadata-css/css21_dev/html4/text-decoration-applies-to-009.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[text-decoration-applies-to-009.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata-css/css21_dev/html4/text-decoration-applies-to-010.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/text-decoration-applies-to-010.htm.ini
deleted file mode 100644
index 8167d1824c8..00000000000
--- a/tests/wpt/metadata-css/css21_dev/html4/text-decoration-applies-to-010.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[text-decoration-applies-to-010.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata-css/css21_dev/html4/text-decoration-applies-to-011.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/text-decoration-applies-to-011.htm.ini
deleted file mode 100644
index 3081b9a7b93..00000000000
--- a/tests/wpt/metadata-css/css21_dev/html4/text-decoration-applies-to-011.htm.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[text-decoration-applies-to-011.htm]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata/html/rendering/non-replaced-elements/phrasing-content-0/font-element-text-decoration-color/001-a.html.ini b/tests/wpt/metadata/html/rendering/non-replaced-elements/phrasing-content-0/font-element-text-decoration-color/001-a.html.ini
deleted file mode 100644
index 4ab40584c66..00000000000
--- a/tests/wpt/metadata/html/rendering/non-replaced-elements/phrasing-content-0/font-element-text-decoration-color/001-a.html.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[001-a.html]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata/html/rendering/non-replaced-elements/phrasing-content-0/font-element-text-decoration-color/001-q.html.ini b/tests/wpt/metadata/html/rendering/non-replaced-elements/phrasing-content-0/font-element-text-decoration-color/001-q.html.ini
deleted file mode 100644
index 649e95c47ba..00000000000
--- a/tests/wpt/metadata/html/rendering/non-replaced-elements/phrasing-content-0/font-element-text-decoration-color/001-q.html.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[001-q.html]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata/html/rendering/non-replaced-elements/phrasing-content-0/font-element-text-decoration-color/001-s.html.ini b/tests/wpt/metadata/html/rendering/non-replaced-elements/phrasing-content-0/font-element-text-decoration-color/001-s.html.ini
deleted file mode 100644
index f6fe434b3aa..00000000000
--- a/tests/wpt/metadata/html/rendering/non-replaced-elements/phrasing-content-0/font-element-text-decoration-color/001-s.html.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[001-s.html]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/metadata/html/rendering/non-replaced-elements/phrasing-content-0/font-element-text-decoration-color/001-x.xhtml.ini b/tests/wpt/metadata/html/rendering/non-replaced-elements/phrasing-content-0/font-element-text-decoration-color/001-x.xhtml.ini
deleted file mode 100644
index 55ede6bf25d..00000000000
--- a/tests/wpt/metadata/html/rendering/non-replaced-elements/phrasing-content-0/font-element-text-decoration-color/001-x.xhtml.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[001-x.xhtml]
- type: reftest
- expected: FAIL
diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json
index 41a4d229f32..83fa892e1ce 100644
--- a/tests/wpt/mozilla/meta/MANIFEST.json
+++ b/tests/wpt/mozilla/meta/MANIFEST.json
@@ -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",
@@ -9757,6 +9769,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",
diff --git a/tests/wpt/mozilla/meta/css/text_decoration_propagation_a.html.ini b/tests/wpt/mozilla/meta/css/text_decoration_propagation_a.html.ini
deleted file mode 100644
index 12d7ad7b519..00000000000
--- a/tests/wpt/mozilla/meta/css/text_decoration_propagation_a.html.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[text_decoration_propagation_a.html]
- type: reftest
- expected: FAIL
- bug: https://github.com/servo/servo/issues/8783
diff --git a/tests/wpt/mozilla/tests/css/non-inline-block-resets-underline-property-ref.html b/tests/wpt/mozilla/tests/css/non-inline-block-resets-underline-property-ref.html
new file mode 100644
index 00000000000..deb5cddf31a
--- /dev/null
+++ b/tests/wpt/mozilla/tests/css/non-inline-block-resets-underline-property-ref.html
@@ -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>
diff --git a/tests/wpt/mozilla/tests/css/non-inline-block-resets-underline-property.html b/tests/wpt/mozilla/tests/css/non-inline-block-resets-underline-property.html
new file mode 100644
index 00000000000..6b7f0c947fe
--- /dev/null
+++ b/tests/wpt/mozilla/tests/css/non-inline-block-resets-underline-property.html
@@ -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>