Enforce linking to spec for method implementations via macros

This commit is contained in:
Corey Farwell 2015-08-31 19:19:08 -04:00
parent 7474b29510
commit 3a1d140ab5
23 changed files with 137 additions and 11 deletions

View file

@ -334,5 +334,6 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
rval
}
// https://drafts.csswg.org/cssom/#cssstyledeclaration
css_properties_accessors!(css_properties);
}

View file

@ -357,6 +357,7 @@ impl DedicatedWorkerGlobalScopeMethods for DedicatedWorkerGlobalScope {
Ok(())
}
// https://html.spec.whatwg.org/multipage/#handler-dedicatedworkerglobalscope-onmessage
event_handler!(message, GetOnmessage, SetOnmessage);
}

View file

@ -1842,7 +1842,10 @@ impl DocumentMethods for Document {
// This method intentionally does nothing
}
// https://html.spec.whatwg.org/multipage/#globaleventhandlers
global_event_handlers!();
// https://html.spec.whatwg.org/multipage/#handler-onreadystatechange
event_handler!(readystatechange, GetOnreadystatechange, SetOnreadystatechange);
}

View file

@ -253,11 +253,22 @@ impl FileReader {
}
impl FileReaderMethods for FileReader {
// https://w3c.github.io/FileAPI/#dfn-onloadstart
event_handler!(loadstart, GetOnloadstart, SetOnloadstart);
// https://w3c.github.io/FileAPI/#dfn-onprogress
event_handler!(progress, GetOnprogress, SetOnprogress);
// https://w3c.github.io/FileAPI/#dfn-onload
event_handler!(load, GetOnload, SetOnload);
// https://w3c.github.io/FileAPI/#dfn-onabort
event_handler!(abort, GetOnabort, SetOnabort);
// https://w3c.github.io/FileAPI/#dfn-onerror
event_handler!(error, GetOnerror, SetOnerror);
// https://w3c.github.io/FileAPI/#dfn-onloadend
event_handler!(loadend, GetOnloadend, SetOnloadend);
//TODO https://w3c.github.io/FileAPI/#dfn-readAsArrayBuffer

View file

@ -54,6 +54,8 @@ impl HTMLAppletElement {
impl HTMLAppletElementMethods for HTMLAppletElement {
// https://html.spec.whatwg.org/#the-applet-element:dom-applet-name
make_getter!(Name);
// https://html.spec.whatwg.org/#the-applet-element:dom-applet-name
make_atomic_setter!(SetName, "name");
}

View file

@ -71,6 +71,8 @@ impl HTMLBodyElement {
impl HTMLBodyElementMethods for HTMLBodyElement {
// https://html.spec.whatwg.org/multipage#dom-body-bgcolor
make_getter!(BgColor, "bgcolor");
// https://html.spec.whatwg.org/multipage#dom-body-bgcolor
make_setter!(SetBgColor, "bgcolor");
// https://html.spec.whatwg.org/multipage/#the-body-element

View file

@ -98,22 +98,29 @@ impl HTMLButtonElementMethods for HTMLButtonElement {
// https://html.spec.whatwg.org/multipage/#dom-button-type
make_setter!(SetType, "type");
// https://html.spec.whatwg.org/multipage/#htmlbuttonelement
// https://html.spec.whatwg.org/multipage/#dom-fs-formaction
make_url_or_base_getter!(FormAction);
// https://html.spec.whatwg.org/multipage/#dom-fs-formaction
make_setter!(SetFormAction, "formaction");
// https://html.spec.whatwg.org/multipage/#dom-fs-formenctype
make_enumerated_getter!(
FormEnctype, "application/x-www-form-urlencoded", ("text/plain") | ("multipart/form-data"));
// https://html.spec.whatwg.org/multipage/#dom-fs-formenctype
make_setter!(SetFormEnctype, "formenctype");
// https://html.spec.whatwg.org/multipage/#dom-fs-formmethod
make_enumerated_getter!(FormMethod, "get", ("post") | ("dialog"));
// https://html.spec.whatwg.org/multipage/#dom-fs-formmethod
make_setter!(SetFormMethod, "formmethod");
// https://html.spec.whatwg.org/multipage/#dom-fs-formtarget
make_getter!(FormTarget);
// https://html.spec.whatwg.org/multipage/#dom-fs-formtarget
make_setter!(SetFormTarget, "formtarget");
// https://html.spec.whatwg.org/multipage/#dom-fe-name

View file

@ -130,16 +130,22 @@ impl HTMLElementMethods for HTMLElement {
})
}
// https://html.spec.whatwg.org/multipage/#attr-title
make_getter!(Title);
// https://html.spec.whatwg.org/multipage/#attr-title
make_setter!(SetTitle, "title");
// https://html.spec.whatwg.org/multipage/#attr-lang
make_getter!(Lang);
// https://html.spec.whatwg.org/multipage/#attr-lang
make_setter!(SetLang, "lang");
// https://html.spec.whatwg.org/multipage/#dom-hidden
make_bool_getter!(Hidden);
// https://html.spec.whatwg.org/multipage/#dom-hidden
make_bool_setter!(SetHidden, "hidden");
// https://html.spec.whatwg.org/multipage/#globaleventhandlers
global_event_handlers!(NoOnload);
// https://html.spec.whatwg.org/multipage/#dom-dataset

View file

@ -50,7 +50,10 @@ impl HTMLFontElement {
}
impl HTMLFontElementMethods for HTMLFontElement {
// https://html.spec.whatwg.org/multipage/#dom-font-color
make_getter!(Color, "color");
// https://html.spec.whatwg.org/multipage/#dom-font-color
make_setter!(SetColor, "color");
}

View file

@ -122,6 +122,8 @@ impl HTMLFormElementMethods for HTMLFormElement {
// https://html.spec.whatwg.org/multipage/#dom-form-name
make_getter!(Name);
// https://html.spec.whatwg.org/multipage/#dom-form-name
make_atomic_setter!(SetName, "name");
// https://html.spec.whatwg.org/multipage/#dom-fs-novalidate

View file

@ -339,12 +339,14 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement {
Err(NotSupported)
}
// https://html.spec.whatwg.org/multipage/#dom-dim-width
make_getter!(Width);
// https://html.spec.whatwg.org/multipage/#dom-dim-width
make_setter!(SetWidth, "width");
// https://html.spec.whatwg.org/multipage/#dom-dim-height
make_getter!(Height);
// https://html.spec.whatwg.org/multipage/#dom-dim-height
make_setter!(SetHeight, "height");
}

View file

@ -197,18 +197,22 @@ impl LayoutHTMLImageElementHelpers for LayoutJS<HTMLImageElement> {
}
impl HTMLImageElementMethods for HTMLImageElement {
// https://html.spec.whatwg.org/multipage/#dom-img-alt
make_getter!(Alt);
// https://html.spec.whatwg.org/multipage/#dom-img-alt
make_setter!(SetAlt, "alt");
// https://html.spec.whatwg.org/multipage/#dom-img-src
make_url_getter!(Src);
// https://html.spec.whatwg.org/multipage/#dom-img-src
make_setter!(SetSrc, "src");
// https://html.spec.whatwg.org/multipage/#dom-img-usemap
make_getter!(UseMap);
// https://html.spec.whatwg.org/multipage/#dom-img-usemap
make_setter!(SetUseMap, "usemap");
// https://html.spec.whatwg.org/multipage/#dom-img-ismap
make_bool_getter!(IsMap);
// https://html.spec.whatwg.org/multipage/#dom-img-ismap
@ -269,28 +273,40 @@ impl HTMLImageElementMethods for HTMLImageElement {
image.is_some()
}
// https://html.spec.whatwg.org/#dom-img-name
// https://html.spec.whatwg.org/multipage/#dom-img-name
make_getter!(Name);
// https://html.spec.whatwg.org/multipage/#dom-img-name
make_atomic_setter!(SetName, "name");
// https://html.spec.whatwg.org/multipage/#dom-img-align
make_getter!(Align);
// https://html.spec.whatwg.org/multipage/#dom-img-align
make_setter!(SetAlign, "align");
// https://html.spec.whatwg.org/multipage/#dom-img-hspace
make_uint_getter!(Hspace);
// https://html.spec.whatwg.org/multipage/#dom-img-hspace
make_uint_setter!(SetHspace, "hspace");
// https://html.spec.whatwg.org/multipage/#dom-img-vspace
make_uint_getter!(Vspace);
// https://html.spec.whatwg.org/multipage/#dom-img-vspace
make_uint_setter!(SetVspace, "vspace");
// https://html.spec.whatwg.org/multipage/#dom-img-longdesc
make_getter!(LongDesc);
// https://html.spec.whatwg.org/multipage/#dom-img-longdesc
make_setter!(SetLongDesc, "longdesc");
// https://html.spec.whatwg.org/multipage/#dom-img-border
make_getter!(Border);
// https://html.spec.whatwg.org/multipage/#dom-img-border
make_setter!(SetBorder, "border");
}

View file

@ -247,6 +247,8 @@ impl HTMLInputElementMethods for HTMLInputElement {
// https://html.spec.whatwg.org/multipage/#dom-input-size
make_uint_getter!(Size, "size", DEFAULT_INPUT_SIZE);
// https://html.spec.whatwg.org/multipage/#dom-input-size
make_limited_uint_setter!(SetSize, "size", DEFAULT_INPUT_SIZE);
// https://html.spec.whatwg.org/multipage/#dom-input-type

View file

@ -209,19 +209,34 @@ impl HTMLLinkElement {
}
impl HTMLLinkElementMethods for HTMLLinkElement {
// https://html.spec.whatwg.org/multipage/#dom-link-href
make_url_getter!(Href);
// https://html.spec.whatwg.org/multipage/#dom-link-href
make_setter!(SetHref, "href");
// https://html.spec.whatwg.org/multipage/#dom-link-rel
make_getter!(Rel);
// https://html.spec.whatwg.org/multipage/#dom-link-rel
make_setter!(SetRel, "rel");
// https://html.spec.whatwg.org/multipage/#dom-link-media
make_getter!(Media);
// https://html.spec.whatwg.org/multipage/#dom-link-media
make_setter!(SetMedia, "media");
// https://html.spec.whatwg.org/multipage/#dom-link-hreflang
make_getter!(Hreflang);
// https://html.spec.whatwg.org/multipage/#dom-link-hreflang
make_setter!(SetHreflang, "hreflang");
// https://html.spec.whatwg.org/multipage/#dom-link-type
make_getter!(Type);
// https://html.spec.whatwg.org/multipage/#dom-link-type
make_setter!(SetType, "type");
// https://html.spec.whatwg.org/multipage/#dom-link-rellist

View file

@ -571,8 +571,9 @@ impl VirtualMethods for HTMLScriptElement {
}
impl HTMLScriptElementMethods for HTMLScriptElement {
// https://html.spec.whatwg.org/multipage/#dom-script-src
make_url_getter!(Src);
// https://html.spec.whatwg.org/multipage/#dom-script-src
make_setter!(SetSrc, "src");
// https://www.whatwg.org/html/#dom-script-text

View file

@ -77,6 +77,8 @@ impl HTMLTableCellElement {
impl HTMLTableCellElementMethods for HTMLTableCellElement {
// https://html.spec.whatwg.org/multipage/#dom-tdth-colspan
make_uint_getter!(ColSpan, "colspan", DEFAULT_COLSPAN);
// https://html.spec.whatwg.org/multipage/#dom-tdth-colspan
make_uint_setter!(SetColSpan, "colspan");
}

View file

@ -121,6 +121,8 @@ impl HTMLTextAreaElementMethods for HTMLTextAreaElement {
// https://html.spec.whatwg.org/multipage/#dom-textarea-cols
make_uint_getter!(Cols, "cols", DEFAULT_COLS);
// https://html.spec.whatwg.org/multipage/#dom-textarea-cols
make_limited_uint_setter!(SetCols, "cols", DEFAULT_COLS);
// https://www.whatwg.org/html/#dom-fe-disabled
@ -155,6 +157,8 @@ impl HTMLTextAreaElementMethods for HTMLTextAreaElement {
// https://html.spec.whatwg.org/multipage/#dom-textarea-rows
make_uint_getter!(Rows, "rows", DEFAULT_ROWS);
// https://html.spec.whatwg.org/multipage/#dom-textarea-rows
make_limited_uint_setter!(SetRows, "rows", DEFAULT_ROWS);
// https://html.spec.whatwg.org/multipage/#dom-textarea-wrap

View file

@ -228,9 +228,16 @@ impl WebSocket {
}
impl WebSocketMethods for WebSocket {
// https://html.spec.whatwg.org/multipage/#handler-websocket-onopen
event_handler!(open, GetOnopen, SetOnopen);
// https://html.spec.whatwg.org/multipage/#handler-websocket-onclose
event_handler!(close, GetOnclose, SetOnclose);
// https://html.spec.whatwg.org/multipage/#handler-websocket-onerror
event_handler!(error, GetOnerror, SetOnerror);
// https://html.spec.whatwg.org/multipage/#handler-websocket-onmessage
event_handler!(message, GetOnmessage, SetOnmessage);
// https://html.spec.whatwg.org/multipage/#dom-websocket-url

View file

@ -503,8 +503,13 @@ impl WindowMethods for Window {
})
}
// https://html.spec.whatwg.org/multipage/#globaleventhandlers
global_event_handlers!();
// https://html.spec.whatwg.org/multipage/#handler-window-onunload
event_handler!(unload, GetOnunload, SetOnunload);
// https://html.spec.whatwg.org/multipage/#handler-onerror
error_event_handler!(error, GetOnerror, SetOnerror);
// https://developer.mozilla.org/en-US/docs/Web/API/Window/screen

View file

@ -162,7 +162,10 @@ impl WorkerMethods for Worker {
Ok(())
}
// https://html.spec.whatwg.org/multipage/#handler-dedicatedworkerglobalscope-onmessage
event_handler!(message, GetOnmessage, SetOnmessage);
// https://html.spec.whatwg.org/multipage/#handler-workerglobalscope-onerror
event_handler!(error, GetOnerror, SetOnerror);
}

View file

@ -293,6 +293,7 @@ impl XMLHttpRequest {
}
impl XMLHttpRequestMethods for XMLHttpRequest {
// https://xhr.spec.whatwg.org/#handler-xhr-onreadystatechange
event_handler!(readystatechange, GetOnreadystatechange, SetOnreadystatechange);
// https://xhr.spec.whatwg.org/#dom-xmlhttprequest-readystate

View file

@ -38,11 +38,24 @@ impl XMLHttpRequestEventTargetDerived for EventTarget {
}
impl XMLHttpRequestEventTargetMethods for XMLHttpRequestEventTarget {
// https://xhr.spec.whatwg.org/#handler-xhr-onloadstart
event_handler!(loadstart, GetOnloadstart, SetOnloadstart);
// https://xhr.spec.whatwg.org/#handler-xhr-onprogress
event_handler!(progress, GetOnprogress, SetOnprogress);
// https://xhr.spec.whatwg.org/#handler-xhr-onabort
event_handler!(abort, GetOnabort, SetOnabort);
// https://xhr.spec.whatwg.org/#handler-xhr-onerror
event_handler!(error, GetOnerror, SetOnerror);
// https://xhr.spec.whatwg.org/#handler-xhr-onload
event_handler!(load, GetOnload, SetOnload);
// https://xhr.spec.whatwg.org/#handler-xhr-ontimeout
event_handler!(timeout, GetOntimeout, SetOntimeout);
// https://xhr.spec.whatwg.org/#handler-xhr-onloadend
event_handler!(loadend, GetOnloadend, SetOnloadend);
}