Use automatic generation for all HTMLElement event handler attributes

This commit is contained in:
Vincent Sanders 2015-11-05 23:58:16 +00:00
parent 5e4011bee7
commit 0397a6637d
2 changed files with 131 additions and 167 deletions

View File

@ -83,8 +83,8 @@ method CanvasRenderingContext2D::drawImage();\n
method CanvasRenderingContext2D::ellipse();\n
method CanvasRenderingContext2D::fill();\n
method CanvasRenderingContext2D::fillRect();\n
getter CanvasRenderingContext2D::fillStyle(string);\n
setter CanvasRenderingContext2D::fillStyle(string);\n
getter CanvasRenderingContext2D::fillStyle(multiple);\n
setter CanvasRenderingContext2D::fillStyle(multiple);\n
method CanvasRenderingContext2D::fillText();\n
getter CanvasRenderingContext2D::font(string);\n
setter CanvasRenderingContext2D::font(string);\n
@ -138,8 +138,8 @@ getter CanvasRenderingContext2D::shadowOffsetY(double);\n
setter CanvasRenderingContext2D::shadowOffsetY(double);\n
method CanvasRenderingContext2D::stroke();\n
method CanvasRenderingContext2D::strokeRect();\n
getter CanvasRenderingContext2D::strokeStyle(string);\n
setter CanvasRenderingContext2D::strokeStyle(string);\n
getter CanvasRenderingContext2D::strokeStyle(multiple);\n
setter CanvasRenderingContext2D::strokeStyle(multiple);\n
method CanvasRenderingContext2D::strokeText();\n
getter CanvasRenderingContext2D::textAlign(string);\n
setter CanvasRenderingContext2D::textAlign(string);\n
@ -752,130 +752,8 @@ method HTMLElement::forceSpellCheck();\n
getter HTMLElement::hidden(boolean);\n
setter HTMLElement::hidden(boolean);\n
getter HTMLElement::isContentEditable(boolean);\n
getter HTMLElement::onabort(user);\n
setter HTMLElement::onabort(user);\n
getter HTMLElement::onautocompleteerror(user);\n
setter HTMLElement::onautocompleteerror(user);\n
getter HTMLElement::onautocomplete(user);\n
setter HTMLElement::onautocomplete(user);\n
getter HTMLElement::onblur(user);\n
setter HTMLElement::onblur(user);\n
getter HTMLElement::oncancel(user);\n
setter HTMLElement::oncancel(user);\n
getter HTMLElement::oncanplaythrough(user);\n
setter HTMLElement::oncanplaythrough(user);\n
getter HTMLElement::oncanplay(user);\n
setter HTMLElement::oncanplay(user);\n
getter HTMLElement::onchange(user);\n
setter HTMLElement::onchange(user);\n
getter HTMLElement::onclose(user);\n
setter HTMLElement::onclose(user);\n
getter HTMLElement::oncontextmenu(user);\n
setter HTMLElement::oncontextmenu(user);\n
getter HTMLElement::oncuechange(user);\n
setter HTMLElement::oncuechange(user);\n
getter HTMLElement::ondblclick(user);\n
setter HTMLElement::ondblclick(user);\n
getter HTMLElement::ondragend(user);\n
setter HTMLElement::ondragend(user);\n
getter HTMLElement::ondragenter(user);\n
setter HTMLElement::ondragenter(user);\n
getter HTMLElement::ondragexit(user);\n
setter HTMLElement::ondragexit(user);\n
getter HTMLElement::ondragleave(user);\n
setter HTMLElement::ondragleave(user);\n
getter HTMLElement::ondragover(user);\n
setter HTMLElement::ondragover(user);\n
getter HTMLElement::ondragstart(user);\n
setter HTMLElement::ondragstart(user);\n
getter HTMLElement::ondrag(user);\n
setter HTMLElement::ondrag(user);\n
getter HTMLElement::ondrop(user);\n
setter HTMLElement::ondrop(user);\n
getter HTMLElement::ondurationchange(user);\n
setter HTMLElement::ondurationchange(user);\n
getter HTMLElement::onemptied(user);\n
setter HTMLElement::onemptied(user);\n
getter HTMLElement::onended(user);\n
setter HTMLElement::onended(user);\n
getter HTMLElement::onerror(user);\n
setter HTMLElement::onerror(user);\n
getter HTMLElement::onfocus(user);\n
setter HTMLElement::onfocus(user);\n
getter HTMLElement::oninput(user);\n
setter HTMLElement::oninput(user);\n
getter HTMLElement::oninvalid(user);\n
setter HTMLElement::oninvalid(user);\n
getter HTMLElement::onkeydown(user);\n
setter HTMLElement::onkeydown(user);\n
getter HTMLElement::onkeypress(user);\n
setter HTMLElement::onkeypress(user);\n
getter HTMLElement::onkeyup(user);\n
setter HTMLElement::onkeyup(user);\n
getter HTMLElement::onloadeddata(user);\n
setter HTMLElement::onloadeddata(user);\n
getter HTMLElement::onloadedmetadata(user);\n
setter HTMLElement::onloadedmetadata(user);\n
getter HTMLElement::onloadstart(user);\n
setter HTMLElement::onloadstart(user);\n
getter HTMLElement::onload(user);\n
setter HTMLElement::onload(user);\n
getter HTMLElement::onmousedown(user);\n
setter HTMLElement::onmousedown(user);\n
getter HTMLElement::onmouseenter(user);\n
setter HTMLElement::onmouseenter(user);\n
getter HTMLElement::onmouseleave(user);\n
setter HTMLElement::onmouseleave(user);\n
getter HTMLElement::onmousemove(user);\n
setter HTMLElement::onmousemove(user);\n
getter HTMLElement::onmouseout(user);\n
setter HTMLElement::onmouseout(user);\n
getter HTMLElement::onmouseover(user);\n
setter HTMLElement::onmouseover(user);\n
getter HTMLElement::onmouseup(user);\n
setter HTMLElement::onmouseup(user);\n
getter HTMLElement::onpause(user);\n
setter HTMLElement::onpause(user);\n
getter HTMLElement::onplaying(user);\n
setter HTMLElement::onplaying(user);\n
getter HTMLElement::onplay(user);\n
setter HTMLElement::onplay(user);\n
getter HTMLElement::onprogress(user);\n
setter HTMLElement::onprogress(user);\n
getter HTMLElement::onratechange(user);\n
setter HTMLElement::onratechange(user);\n
getter HTMLElement::onreset(user);\n
setter HTMLElement::onreset(user);\n
getter HTMLElement::onresize(user);\n
setter HTMLElement::onresize(user);\n
getter HTMLElement::onscroll(user);\n
setter HTMLElement::onscroll(user);\n
getter HTMLElement::onseeked(user);\n
setter HTMLElement::onseeked(user);\n
getter HTMLElement::onseeking(user);\n
setter HTMLElement::onseeking(user);\n
getter HTMLElement::onselect(user);\n
setter HTMLElement::onselect(user);\n
getter HTMLElement::onshow(user);\n
setter HTMLElement::onshow(user);\n
getter HTMLElement::onsort(user);\n
setter HTMLElement::onsort(user);\n
getter HTMLElement::onstalled(user);\n
setter HTMLElement::onstalled(user);\n
getter HTMLElement::onsubmit(user);\n
setter HTMLElement::onsubmit(user);\n
getter HTMLElement::onsuspend(user);\n
setter HTMLElement::onsuspend(user);\n
getter HTMLElement::ontimeupdate(user);\n
setter HTMLElement::ontimeupdate(user);\n
getter HTMLElement::ontoggle(user);\n
setter HTMLElement::ontoggle(user);\n
getter HTMLElement::onvolumechange(user);\n
setter HTMLElement::onvolumechange(user);\n
getter HTMLElement::onwaiting(user);\n
setter HTMLElement::onwaiting(user);\n
getter HTMLElement::onwheel(user);\n
setter HTMLElement::onwheel(user);\n
getter HTMLElement::spellcheck(boolean);\n
setter HTMLElement::spellcheck(boolean);\n
getter HTMLElement::style(user);\n
@ -1488,7 +1366,7 @@ method MessageEvent::initMessageEvent();\n
getter MessageEvent::lastEventId(string);\n
getter MessageEvent::origin(string);\n
getter MessageEvent::ports(user);\n
getter MessageEvent::source(user);\n
getter MessageEvent::source(multiple);\n
method MessagePort::close();\n
getter MessagePort::onmessage(user);\n
setter MessagePort::onmessage(user);\n
@ -1647,7 +1525,7 @@ getter StyleSheet::href(string);\n
method StyleSheetList::item();\n
getter StyleSheetList::length(unsigned long);\n
getter StyleSheet::media(user);\n
getter StyleSheet::ownerNode(user);\n
getter StyleSheet::ownerNode(multiple);\n
getter StyleSheet::parentStyleSheet(user);\n
getter StyleSheet::title(string);\n
getter StyleSheet::type(string);\n
@ -1706,7 +1584,7 @@ method TimeRanges::end();\n
getter TimeRanges::length(unsigned long);\n
method TimeRanges::start();\n
getter Touch::region(string);\n
getter TrackEvent::track(user);\n
getter TrackEvent::track(multiple);\n
getter TreeWalker::currentNode(user);\n
setter TreeWalker::currentNode(user);\n
getter TreeWalker::filter(user);\n

View File

@ -25,43 +25,129 @@ setter HTMLElement::lang();
getter HTMLElement::title();
setter HTMLElement::title();
setter HTMLElement::onclick()
%{
/* handlerfn */
duk_push_this(ctx);
/* handlerfn this */
duk_get_prop_string(ctx, -1, HANDLER_MAGIC);
/* handlerfn this handlers */
duk_push_lstring(ctx, "click", 5);
/* handlerfn this handlers click */
duk_dup(ctx, -4);
/* handlerfn this handlers click handlerfn */
duk_put_prop(ctx, -3);
/* handlerfn this handlers */
dukky_register_event_listener_for(ctx,
(dom_element *)((node_private_t *)priv)->node,
corestring_dom_click);
return 0;
%}
getter HTMLElement::onchange();
setter HTMLElement::onchange();
getter HTMLElement::onclick()
%{
dom_event_target *et = (dom_event_target *)(((node_private_t *)priv)->node);
dom_string *name;
dom_exception exc;
setter HTMLElement::onclick();
getter HTMLElement::onclick();
exc = dom_string_create((const uint8_t *)"click", 5, &name);
if (exc != DOM_NO_ERR) return 0;
duk_push_this(ctx);
/* ... node */
if (dukky_get_current_value_of_event_handler(ctx, name, et) == false) {
dom_string_unref(name);
return 0;
}
dom_string_unref(name);
/* ... handler node */
duk_pop(ctx);
/* ... handler */
return 1;
%}
getter HTMLElement::onabort();
setter HTMLElement::onabort();
getter HTMLElement::onautocompleteerror();
setter HTMLElement::onautocompleteerror();
getter HTMLElement::onautocomplete();
setter HTMLElement::onautocomplete();
getter HTMLElement::onblur();
setter HTMLElement::onblur();
getter HTMLElement::oncancel();
setter HTMLElement::oncancel();
getter HTMLElement::oncanplaythrough();
setter HTMLElement::oncanplaythrough();
getter HTMLElement::oncanplay();
setter HTMLElement::oncanplay();
getter HTMLElement::onclose();
setter HTMLElement::onclose();
getter HTMLElement::oncontextmenu();
setter HTMLElement::oncontextmenu();
getter HTMLElement::oncuechange();
setter HTMLElement::oncuechange();
getter HTMLElement::ondblclick();
setter HTMLElement::ondblclick();
getter HTMLElement::ondragend();
setter HTMLElement::ondragend();
getter HTMLElement::ondragenter();
setter HTMLElement::ondragenter();
getter HTMLElement::ondragexit();
setter HTMLElement::ondragexit();
getter HTMLElement::ondragleave();
setter HTMLElement::ondragleave();
getter HTMLElement::ondragover();
setter HTMLElement::ondragover();
getter HTMLElement::ondragstart();
setter HTMLElement::ondragstart();
getter HTMLElement::ondrag();
setter HTMLElement::ondrag();
getter HTMLElement::ondrop();
setter HTMLElement::ondrop();
getter HTMLElement::ondurationchange();
setter HTMLElement::ondurationchange();
getter HTMLElement::onemptied();
setter HTMLElement::onemptied();
getter HTMLElement::onended();
setter HTMLElement::onended();
getter HTMLElement::onfocus();
setter HTMLElement::onfocus();
getter HTMLElement::oninput();
setter HTMLElement::oninput();
getter HTMLElement::oninvalid();
setter HTMLElement::oninvalid();
getter HTMLElement::onkeydown();
setter HTMLElement::onkeydown();
getter HTMLElement::onkeypress();
setter HTMLElement::onkeypress();
getter HTMLElement::onkeyup();
setter HTMLElement::onkeyup();
getter HTMLElement::onloadeddata();
setter HTMLElement::onloadeddata();
getter HTMLElement::onloadedmetadata();
setter HTMLElement::onloadedmetadata();
getter HTMLElement::onloadstart();
setter HTMLElement::onloadstart();
getter HTMLElement::onload();
setter HTMLElement::onload();
getter HTMLElement::onmousedown();
setter HTMLElement::onmousedown();
getter HTMLElement::onmouseenter();
setter HTMLElement::onmouseenter();
getter HTMLElement::onmouseleave();
setter HTMLElement::onmouseleave();
getter HTMLElement::onmousemove();
setter HTMLElement::onmousemove();
getter HTMLElement::onmouseout();
setter HTMLElement::onmouseout();
getter HTMLElement::onmouseover();
setter HTMLElement::onmouseover();
getter HTMLElement::onmouseup();
setter HTMLElement::onmouseup();
getter HTMLElement::onpause();
setter HTMLElement::onpause();
getter HTMLElement::onplaying();
setter HTMLElement::onplaying();
getter HTMLElement::onplay();
setter HTMLElement::onplay();
getter HTMLElement::onprogress();
setter HTMLElement::onprogress();
getter HTMLElement::onratechange();
setter HTMLElement::onratechange();
getter HTMLElement::onreset();
setter HTMLElement::onreset();
getter HTMLElement::onresize();
setter HTMLElement::onresize();
getter HTMLElement::onscroll();
setter HTMLElement::onscroll();
getter HTMLElement::onseeked();
setter HTMLElement::onseeked();
getter HTMLElement::onseeking();
setter HTMLElement::onseeking();
getter HTMLElement::onselect();
setter HTMLElement::onselect();
getter HTMLElement::onshow();
setter HTMLElement::onshow();
getter HTMLElement::onsort();
setter HTMLElement::onsort();
getter HTMLElement::onstalled();
setter HTMLElement::onstalled();
getter HTMLElement::onsubmit();
setter HTMLElement::onsubmit();
getter HTMLElement::onsuspend();
setter HTMLElement::onsuspend();
getter HTMLElement::ontimeupdate();
setter HTMLElement::ontimeupdate();
getter HTMLElement::ontoggle();
setter HTMLElement::ontoggle();
getter HTMLElement::onvolumechange();
setter HTMLElement::onvolumechange();
getter HTMLElement::onwaiting();
setter HTMLElement::onwaiting();
getter HTMLElement::onwheel();
setter HTMLElement::onwheel();