mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Auto merge of #10535 - frewsxcv:hr-align, r=mbrubeck
Implement 'align' IDL attribute on '<hr>'. <!-- 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/10535) <!-- Reviewable:end -->
This commit is contained in:
commit
f9608022ca
7 changed files with 87 additions and 136 deletions
|
@ -37,6 +37,12 @@ impl HTMLHRElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HTMLHRElementMethods for 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
|
// https://html.spec.whatwg.org/multipage/#dom-hr-color
|
||||||
make_getter!(Color, "color");
|
make_getter!(Color, "color");
|
||||||
|
|
||||||
|
@ -86,6 +92,7 @@ impl VirtualMethods for HTMLHRElement {
|
||||||
|
|
||||||
fn parse_plain_attribute(&self, name: &Atom, value: DOMString) -> AttrValue {
|
fn parse_plain_attribute(&self, name: &Atom, value: DOMString) -> AttrValue {
|
||||||
match name {
|
match name {
|
||||||
|
&atom!("align") => AttrValue::from_dimension(value),
|
||||||
&atom!("color") => AttrValue::from_legacy_color(value),
|
&atom!("color") => AttrValue::from_legacy_color(value),
|
||||||
&atom!("width") => AttrValue::from_dimension(value),
|
&atom!("width") => AttrValue::from_dimension(value),
|
||||||
_ => self.super_type().unwrap().parse_plain_attribute(name, value),
|
_ => self.super_type().unwrap().parse_plain_attribute(name, value),
|
||||||
|
|
|
@ -10,7 +10,7 @@ interface HTMLHRElement : HTMLElement {
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#HTMLHRElement-partial
|
// https://html.spec.whatwg.org/multipage/#HTMLHRElement-partial
|
||||||
partial interface HTMLHRElement {
|
partial interface HTMLHRElement {
|
||||||
// attribute DOMString align;
|
attribute DOMString align;
|
||||||
attribute DOMString color;
|
attribute DOMString color;
|
||||||
// attribute boolean noShade;
|
// attribute boolean noShade;
|
||||||
// attribute DOMString size;
|
// attribute DOMString size;
|
||||||
|
|
|
@ -36766,6 +36766,18 @@
|
||||||
"url": "/html/rendering/non-replaced-elements/the-fieldset-element-0/min-width-not-important.html"
|
"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": [
|
"html/rendering/non-replaced-elements/the-hr-element-0/color.html": [
|
||||||
{
|
{
|
||||||
"path": "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": {
|
"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": [
|
"html/semantics/links/linktypes/alternate-css-ref.html": [
|
||||||
{
|
{
|
||||||
"path": "html/semantics/links/linktypes/alternate-css-ref.html",
|
"path": "html/semantics/links/linktypes/alternate-css-ref.html",
|
||||||
|
|
|
@ -2148,18 +2148,12 @@
|
||||||
[HTMLParagraphElement interface: document.createElement("p") must inherit property "align" with the proper type (0)]
|
[HTMLParagraphElement interface: document.createElement("p") must inherit property "align" with the proper type (0)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[HTMLHRElement interface: attribute align]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[HTMLHRElement interface: attribute noShade]
|
[HTMLHRElement interface: attribute noShade]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[HTMLHRElement interface: attribute size]
|
[HTMLHRElement interface: attribute size]
|
||||||
expected: FAIL
|
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)]
|
[HTMLHRElement interface: document.createElement("hr") must inherit property "noShade" with the proper type (2)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -1317,135 +1317,6 @@
|
||||||
[hr.tabIndex: IDL set to -2147483648 followed by getAttribute()]
|
[hr.tabIndex: IDL set to -2147483648 followed by getAttribute()]
|
||||||
expected: FAIL
|
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]
|
[hr.noShade: typeof IDL attribute]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -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>
|
|
@ -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>
|
Loading…
Add table
Add a link
Reference in a new issue