Make make_enumerated_getter prettier again.

Fixes https://github.com/servo/servo/issues/4723.
This commit is contained in:
Corey Farwell 2016-10-12 23:00:07 -04:00
parent 4034bd68c2
commit 2944c8d964
6 changed files with 18 additions and 18 deletions

View file

@ -83,7 +83,7 @@ impl HTMLButtonElementMethods for HTMLButtonElement {
} }
// https://html.spec.whatwg.org/multipage/#dom-button-type // https://html.spec.whatwg.org/multipage/#dom-button-type
make_enumerated_getter!(Type, "type", "submit", ("reset") | ("button") | ("menu")); make_enumerated_getter!(Type, "type", "submit", "reset" | "button" | "menu");
// https://html.spec.whatwg.org/multipage/#dom-button-type // https://html.spec.whatwg.org/multipage/#dom-button-type
make_setter!(SetType, "type"); make_setter!(SetType, "type");
@ -98,13 +98,13 @@ impl HTMLButtonElementMethods for HTMLButtonElement {
make_enumerated_getter!(FormEnctype, make_enumerated_getter!(FormEnctype,
"formenctype", "formenctype",
"application/x-www-form-urlencoded", "application/x-www-form-urlencoded",
("text/plain") | ("multipart/form-data")); "text/plain" | "multipart/form-data");
// https://html.spec.whatwg.org/multipage/#dom-fs-formenctype // https://html.spec.whatwg.org/multipage/#dom-fs-formenctype
make_setter!(SetFormEnctype, "formenctype"); make_setter!(SetFormEnctype, "formenctype");
// https://html.spec.whatwg.org/multipage/#dom-fs-formmethod // https://html.spec.whatwg.org/multipage/#dom-fs-formmethod
make_enumerated_getter!(FormMethod, "formmethod", "get", ("post") | ("dialog")); make_enumerated_getter!(FormMethod, "formmethod", "get", "post" | "dialog");
// https://html.spec.whatwg.org/multipage/#dom-fs-formmethod // https://html.spec.whatwg.org/multipage/#dom-fs-formmethod
make_setter!(SetFormMethod, "formmethod"); make_setter!(SetFormMethod, "formmethod");

View file

@ -104,7 +104,7 @@ impl HTMLFormElementMethods for HTMLFormElement {
make_setter!(SetAction, "action"); make_setter!(SetAction, "action");
// https://html.spec.whatwg.org/multipage/#dom-form-autocomplete // https://html.spec.whatwg.org/multipage/#dom-form-autocomplete
make_enumerated_getter!(Autocomplete, "autocomplete", "on", ("off")); make_enumerated_getter!(Autocomplete, "autocomplete", "on", "off");
// https://html.spec.whatwg.org/multipage/#dom-form-autocomplete // https://html.spec.whatwg.org/multipage/#dom-form-autocomplete
make_setter!(SetAutocomplete, "autocomplete"); make_setter!(SetAutocomplete, "autocomplete");
@ -113,7 +113,7 @@ impl HTMLFormElementMethods for HTMLFormElement {
make_enumerated_getter!(Enctype, make_enumerated_getter!(Enctype,
"enctype", "enctype",
"application/x-www-form-urlencoded", "application/x-www-form-urlencoded",
("text/plain") | ("multipart/form-data")); "text/plain" | "multipart/form-data");
// https://html.spec.whatwg.org/multipage/#dom-fs-enctype // https://html.spec.whatwg.org/multipage/#dom-fs-enctype
make_setter!(SetEnctype, "enctype"); make_setter!(SetEnctype, "enctype");
@ -129,7 +129,7 @@ impl HTMLFormElementMethods for HTMLFormElement {
} }
// https://html.spec.whatwg.org/multipage/#dom-fs-method // https://html.spec.whatwg.org/multipage/#dom-fs-method
make_enumerated_getter!(Method, "method", "get", ("post") | ("dialog")); make_enumerated_getter!(Method, "method", "get", "post" | "dialog");
// https://html.spec.whatwg.org/multipage/#dom-fs-method // https://html.spec.whatwg.org/multipage/#dom-fs-method
make_setter!(SetMethod, "method"); make_setter!(SetMethod, "method");

View file

@ -297,7 +297,7 @@ impl HTMLImageElementMethods for HTMLImageElement {
make_setter!(SetSrc, "src"); make_setter!(SetSrc, "src");
// https://html.spec.whatwg.org/multipage/#dom-img-crossOrigin // https://html.spec.whatwg.org/multipage/#dom-img-crossOrigin
make_enumerated_getter!(CrossOrigin, "crossorigin", "anonymous", ("use-credentials")); make_enumerated_getter!(CrossOrigin, "crossorigin", "anonymous", "use-credentials");
// https://html.spec.whatwg.org/multipage/#dom-img-crossOrigin // https://html.spec.whatwg.org/multipage/#dom-img-crossOrigin
make_setter!(SetCrossOrigin, "crossorigin"); make_setter!(SetCrossOrigin, "crossorigin");

View file

@ -354,13 +354,13 @@ impl HTMLInputElementMethods for HTMLInputElement {
make_enumerated_getter!(Type, make_enumerated_getter!(Type,
"type", "type",
"text", "text",
("hidden") | ("search") | ("tel") | "hidden" | "search" | "tel" |
("url") | ("email") | ("password") | "url" | "email" | "password" |
("datetime") | ("date") | ("month") | "datetime" | "date" | "month" |
("week") | ("time") | ("datetime-local") | "week" | "time" | "datetime-local" |
("number") | ("range") | ("color") | "number" | "range" | "color" |
("checkbox") | ("radio") | ("file") | "checkbox" | "radio" | "file" |
("submit") | ("image") | ("reset") | ("button")); "submit" | "image" | "reset" | "button");
// https://html.spec.whatwg.org/multipage/#dom-input-type // https://html.spec.whatwg.org/multipage/#dom-input-type
make_atomic_setter!(SetType, "type"); make_atomic_setter!(SetType, "type");
@ -453,13 +453,13 @@ impl HTMLInputElementMethods for HTMLInputElement {
make_enumerated_getter!(FormEnctype, make_enumerated_getter!(FormEnctype,
"formenctype", "formenctype",
"application/x-www-form-urlencoded", "application/x-www-form-urlencoded",
("text/plain") | ("multipart/form-data")); "text/plain" | "multipart/form-data");
// https://html.spec.whatwg.org/multipage/#dom-input-formenctype // https://html.spec.whatwg.org/multipage/#dom-input-formenctype
make_setter!(SetFormEnctype, "formenctype"); make_setter!(SetFormEnctype, "formenctype");
// https://html.spec.whatwg.org/multipage/#dom-input-formmethod // https://html.spec.whatwg.org/multipage/#dom-input-formmethod
make_enumerated_getter!(FormMethod, "formmethod", "get", ("post") | ("dialog")); make_enumerated_getter!(FormMethod, "formmethod", "get", "post" | "dialog");
// https://html.spec.whatwg.org/multipage/#dom-input-formmethod // https://html.spec.whatwg.org/multipage/#dom-input-formmethod
make_setter!(SetFormMethod, "formmethod"); make_setter!(SetFormMethod, "formmethod");

View file

@ -664,7 +664,7 @@ impl HTMLMediaElementMethods for HTMLMediaElement {
// https://html.spec.whatwg.org/multipage/#attr-media-preload // https://html.spec.whatwg.org/multipage/#attr-media-preload
// Missing value default is user-agent defined. // Missing value default is user-agent defined.
make_enumerated_getter!(Preload, "preload", "", ("none") | ("metadata") | ("auto")); make_enumerated_getter!(Preload, "preload", "", "none" | "metadata" | "auto");
// https://html.spec.whatwg.org/multipage/#attr-media-preload // https://html.spec.whatwg.org/multipage/#attr-media-preload
make_setter!(SetPreload, "preload"); make_setter!(SetPreload, "preload");

View file

@ -145,7 +145,7 @@ macro_rules! make_string_or_document_url_getter(
#[macro_export] #[macro_export]
macro_rules! make_enumerated_getter( macro_rules! make_enumerated_getter(
( $attr:ident, $htmlname:tt, $default:expr, $(($choices: pat))|+) => ( ( $attr:ident, $htmlname:tt, $default:expr, $($choices: pat)|+) => (
fn $attr(&self) -> DOMString { fn $attr(&self) -> DOMString {
use dom::bindings::inheritance::Castable; use dom::bindings::inheritance::Castable;
use dom::element::Element; use dom::element::Element;