diff options
7 files changed, 87 insertions, 136 deletions
diff --git a/components/script/dom/htmlhrelement.rs b/components/script/dom/htmlhrelement.rs index 93fdebbc954..bea12efbfea 100644 --- a/components/script/dom/htmlhrelement.rs +++ b/components/script/dom/htmlhrelement.rs @@ -37,6 +37,12 @@ impl HTMLHRElement { } impl HTMLHRElementMethods for HTMLHRElement { + // https://html.spec.whatwg.org/multipage/#dom-hr-align + make_getter!(Align, "align"); + + // https://html.spec.whatwg.org/multipage/#dom-hr-align + make_atomic_setter!(SetAlign, "align"); + // https://html.spec.whatwg.org/multipage/#dom-hr-color make_getter!(Color, "color"); @@ -86,6 +92,7 @@ impl VirtualMethods for HTMLHRElement { fn parse_plain_attribute(&self, name: &Atom, value: DOMString) -> AttrValue { match name { + &atom!("align") => AttrValue::from_dimension(value), &atom!("color") => AttrValue::from_legacy_color(value), &atom!("width") => AttrValue::from_dimension(value), _ => self.super_type().unwrap().parse_plain_attribute(name, value), diff --git a/components/script/dom/webidls/HTMLHRElement.webidl b/components/script/dom/webidls/HTMLHRElement.webidl index f203527b2bf..e3ba6113748 100644 --- a/components/script/dom/webidls/HTMLHRElement.webidl +++ b/components/script/dom/webidls/HTMLHRElement.webidl @@ -10,7 +10,7 @@ interface HTMLHRElement : HTMLElement { // https://html.spec.whatwg.org/multipage/#HTMLHRElement-partial partial interface HTMLHRElement { - // attribute DOMString align; + attribute DOMString align; attribute DOMString color; // attribute boolean noShade; // attribute DOMString size; diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index 2c18cb3f8ee..f034e7c57a7 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -36766,6 +36766,18 @@ "url": "/html/rendering/non-replaced-elements/the-fieldset-element-0/min-width-not-important.html" } ], + "html/rendering/non-replaced-elements/the-hr-element-0/align.html": [ + { + "path": "html/rendering/non-replaced-elements/the-hr-element-0/align.html", + "references": [ + [ + "/html/rendering/non-replaced-elements/the-hr-element-0/align-ref.html", + "==" + ] + ], + "url": "/html/rendering/non-replaced-elements/the-hr-element-0/align.html" + } + ], "html/rendering/non-replaced-elements/the-hr-element-0/color.html": [ { "path": "html/rendering/non-replaced-elements/the-hr-element-0/color.html", @@ -40161,6 +40173,18 @@ } }, "reftest_nodes": { + "html/rendering/non-replaced-elements/the-hr-element-0/align.html": [ + { + "path": "html/rendering/non-replaced-elements/the-hr-element-0/align.html", + "references": [ + [ + "/html/rendering/non-replaced-elements/the-hr-element-0/align-ref.html", + "==" + ] + ], + "url": "/html/rendering/non-replaced-elements/the-hr-element-0/align.html" + } + ], "html/semantics/links/linktypes/alternate-css-ref.html": [ { "path": "html/semantics/links/linktypes/alternate-css-ref.html", diff --git a/tests/wpt/metadata/html/dom/interfaces.html.ini b/tests/wpt/metadata/html/dom/interfaces.html.ini index 00884d95c00..ba5f8cadb8f 100644 --- a/tests/wpt/metadata/html/dom/interfaces.html.ini +++ b/tests/wpt/metadata/html/dom/interfaces.html.ini @@ -2148,18 +2148,12 @@ [HTMLParagraphElement interface: document.createElement("p") must inherit property "align" with the proper type (0)] expected: FAIL - [HTMLHRElement interface: attribute align] - expected: FAIL - [HTMLHRElement interface: attribute noShade] expected: FAIL [HTMLHRElement interface: attribute size] expected: FAIL - [HTMLHRElement interface: document.createElement("hr") must inherit property "align" with the proper type (0)] - expected: FAIL - [HTMLHRElement interface: document.createElement("hr") must inherit property "noShade" with the proper type (2)] expected: FAIL diff --git a/tests/wpt/metadata/html/dom/reflection-grouping.html.ini b/tests/wpt/metadata/html/dom/reflection-grouping.html.ini index 20cacc5dc08..7ecf978bf18 100644 --- a/tests/wpt/metadata/html/dom/reflection-grouping.html.ini +++ b/tests/wpt/metadata/html/dom/reflection-grouping.html.ini @@ -1317,135 +1317,6 @@ [hr.tabIndex: IDL set to -2147483648 followed by getAttribute()] expected: FAIL - [hr.align: typeof IDL attribute] - expected: FAIL - - [hr.align: IDL get with DOM attribute unset] - expected: FAIL - - [hr.align: setAttribute() to "" followed by IDL get] - expected: FAIL - - [hr.align: setAttribute() to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo " followed by IDL get] - expected: FAIL - - [hr.align: setAttribute() to undefined followed by IDL get] - expected: FAIL - - [hr.align: setAttribute() to 7 followed by IDL get] - expected: FAIL - - [hr.align: setAttribute() to 1.5 followed by IDL get] - expected: FAIL - - [hr.align: setAttribute() to true followed by IDL get] - expected: FAIL - - [hr.align: setAttribute() to false followed by IDL get] - expected: FAIL - - [hr.align: setAttribute() to object "[object Object\]" followed by IDL get] - expected: FAIL - - [hr.align: setAttribute() to NaN followed by IDL get] - expected: FAIL - - [hr.align: setAttribute() to Infinity followed by IDL get] - expected: FAIL - - [hr.align: setAttribute() to -Infinity followed by IDL get] - expected: FAIL - - [hr.align: setAttribute() to "\\0" followed by IDL get] - expected: FAIL - - [hr.align: setAttribute() to null followed by IDL get] - expected: FAIL - - [hr.align: setAttribute() to object "test-toString" followed by IDL get] - expected: FAIL - - [hr.align: setAttribute() to object "test-valueOf" followed by IDL get] - expected: FAIL - - [hr.align: IDL set to "" followed by getAttribute()] - expected: FAIL - - [hr.align: IDL set to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo " followed by getAttribute()] - expected: FAIL - - [hr.align: IDL set to undefined followed by getAttribute()] - expected: FAIL - - [hr.align: IDL set to undefined followed by IDL get] - expected: FAIL - - [hr.align: IDL set to 7 followed by getAttribute()] - expected: FAIL - - [hr.align: IDL set to 7 followed by IDL get] - expected: FAIL - - [hr.align: IDL set to 1.5 followed by getAttribute()] - expected: FAIL - - [hr.align: IDL set to 1.5 followed by IDL get] - expected: FAIL - - [hr.align: IDL set to true followed by getAttribute()] - expected: FAIL - - [hr.align: IDL set to true followed by IDL get] - expected: FAIL - - [hr.align: IDL set to false followed by getAttribute()] - expected: FAIL - - [hr.align: IDL set to false followed by IDL get] - expected: FAIL - - [hr.align: IDL set to object "[object Object\]" followed by getAttribute()] - expected: FAIL - - [hr.align: IDL set to object "[object Object\]" followed by IDL get] - expected: FAIL - - [hr.align: IDL set to NaN followed by getAttribute()] - expected: FAIL - - [hr.align: IDL set to NaN followed by IDL get] - expected: FAIL - - [hr.align: IDL set to Infinity followed by getAttribute()] - expected: FAIL - - [hr.align: IDL set to Infinity followed by IDL get] - expected: FAIL - - [hr.align: IDL set to -Infinity followed by getAttribute()] - expected: FAIL - - [hr.align: IDL set to -Infinity followed by IDL get] - expected: FAIL - - [hr.align: IDL set to "\\0" followed by getAttribute()] - expected: FAIL - - [hr.align: IDL set to null followed by getAttribute()] - expected: FAIL - - [hr.align: IDL set to null followed by IDL get] - expected: FAIL - - [hr.align: IDL set to object "test-toString" followed by getAttribute()] - expected: FAIL - - [hr.align: IDL set to object "test-toString" followed by IDL get] - expected: FAIL - - [hr.align: IDL set to object "test-valueOf" followed by IDL get] - expected: FAIL - [hr.noShade: typeof IDL attribute] expected: FAIL diff --git a/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/the-hr-element-0/align-ref.html b/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/the-hr-element-0/align-ref.html new file mode 100644 index 00000000000..9e4283e208e --- /dev/null +++ b/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/the-hr-element-0/align-ref.html @@ -0,0 +1,31 @@ + +<!doctype html> +<meta charset=utf-8> +<style> +.hr { + color: gray; + border-style: inset; + border-width: 1px; + margin: 0.5em auto; + width: 100px; +} + +.left { + margin-left: 0; +} + +.right { + margin-right: 0; +} +</style> +<div class='hr'></div> +<div class='hr left'></div> +<div class='hr'></div> +<div class='hr right'></div> +<div class='hr'></div> + +<div class='hr'></div> +<div class='hr left'></div> +<div class='hr'></div> +<div class='hr right'></div> +<div class='hr'></div> diff --git a/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/the-hr-element-0/align.html b/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/the-hr-element-0/align.html new file mode 100644 index 00000000000..1657f2458d0 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/rendering/non-replaced-elements/the-hr-element-0/align.html @@ -0,0 +1,24 @@ +<!doctype html> +<meta charset="utf-8"> +<link rel="match" href="align-ref.html"> +<style> +hr { + width: 100px; +} +</style> + +<hr align=> +<hr align=left> +<hr align=center> +<hr align=right> +<hr align=foobar> + +<script> +// Test the IDL attribute +const values = ['', 'left', 'center', 'right', 'foobar']; +values.forEach(value => { + const hr = document.createElement('hr'); + hr.align = value; + document.body.appendChild(hr); +}); +</script> |