/* Binding for browser using duktape and libdom
 *
 * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
 *
 * This file is part of NetSurf, http://www.netsurf-browser.org/
 *
 * Released under the terms of the MIT License,
 *         http://www.opensource.org/licenses/mit-license
 */

binding duk_libdom {
	webidl "dom.idl";
	webidl "dom-parsing.idl";
	webidl "html.idl";
	webidl "cssom.idl";
	webidl "uievents.idl";
	webidl "urlutils.idl";
	webidl "console.idl";

	preface	%{
/* DukTape JavaScript bindings for NetSurf browser
 *
 * Copyright 2015 Vincent Sanders <vince@netsurf-browser.org>
 * This file is part of NetSurf, http://www.netsurf-browser.org/
 * Released under the terms of the MIT License,
 *        http://www.opensource.org/licenses/mit-license
 */

#include <dom/dom.h>

#include "utils/log.h"
#include "utils/nsurl.h"

#include "javascript/duktape/duktape.h"

struct browser_window;
struct html_content;
struct dom_node;
struct dom_element;
struct dom_document;
struct dom_html_element;
struct dom_node_character_data;
struct dom_node_text;
struct dom_node_list;
struct dom_node_comment;
struct dom_html_collection;
struct dom_html_br_element;

%};

	prologue %{
#include "javascript/duktape/dukky.h"
%};

};

#include "EventTarget.bnd"
#include "Console.bnd"
#include "Window.bnd"
#include "Document.bnd"
#include "Node.bnd"
#include "NodeList.bnd"
#include "NamedNodeMap.bnd"
#include "Element.bnd"
#include "HTMLCollection.bnd"
#include "Location.bnd"
#include "Navigator.bnd"
#include "DOMImplementation.bnd"

/* events */

#include "Event.bnd"
#include "KeyboardEvent.bnd"

init MutationEvent(struct dom_mutation_event *evt::evt);
init UIEvent(struct dom_ui_event *evt::evt);
init TextEvent(struct dom_text_event *evt::evt);
init MutationNameEvent(struct dom_mutation_name_event *evt::evt);
init MouseWheelEvent(struct dom_mouse_wheel_event *evt::evt);
init MouseMultiWheelEvent(struct dom_mouse_multi_wheel_event *evt::evt);
init MouseEvent(struct dom_mouse_event *evt::evt);
init DocumentEvent(struct dom_document_event *evt::evt);
init CustomEvent(struct dom_custom_event *evt::evt);
init CompositionEvent(struct dom_ui_event *evt::evt);
init WheelEvent(struct dom_mouse_event *evt::evt);
init FocusEvent(struct dom_ui_event *evt::evt);
init StorageEvent(struct dom_event *evt::evt);
init CloseEvent(struct dom_event *evt::evt);
init MessageEvent(struct dom_event *evt::evt);
init ErrorEvent(struct dom_event *evt::evt);
init BeforeUnloadEvent(struct dom_event *evt::evt);
init PageTransitionEvent(struct dom_event *evt::evt);
init HashChangeEvent(struct dom_event *evt::evt);
init PopStateEvent(struct dom_event *evt::evt);
init DragEvent(struct dom_mouse_event *evt::evt);
init RelatedEvent(struct dom_event *evt::evt);
init AutocompleteErrorEvent(struct dom_event *evt::evt);
init TrackEvent(struct dom_event *evt::evt);


/* html elements */
#include "HTMLElement.bnd"

/* specialisations of html_element */
#include "HTMLAnchorElement.bnd"
#include "HTMLAppletElement.bnd"
#include "HTMLAreaElement.bnd"
#include "HTMLBaseElement.bnd"
#include "HTMLBodyElement.bnd"
#include "HTMLButtonElement.bnd"
#include "HTMLBRElement.bnd"
#include "HTMLCanvasElement.bnd"
#include "HTMLDivElement.bnd"
#include "HTMLFontElement.bnd"
#include "HTMLFormElement.bnd"
#include "HTMLFrameElement.bnd"
#include "HTMLFrameSetElement.bnd"
#include "HTMLHeadingElement.bnd"
#include "HTMLHRElement.bnd"
#include "HTMLHTMLElement.bnd"
#include "HTMLIFrameElement.bnd"
#include "HTMLImageElement.bnd"
#include "HTMLInputElement.bnd"
#include "HTMLLabelElement.bnd"
#include "HTMLLegendElement.bnd"
#include "HTMLLIElement.bnd"
#include "HTMLLinkElement.bnd"
#include "HTMLMapElement.bnd"
#include "HTMLMarqueeElement.bnd"
#include "HTMLMenuElement.bnd"
#include "HTMLMetaElement.bnd"
#include "HTMLObjectElement.bnd"
#include "HTMLOptionElement.bnd"
#include "HTMLOListElement.bnd"
#include "HTMLParagraphElement.bnd"
#include "HTMLParamElement.bnd"
#include "HTMLPreElement.bnd"
#include "HTMLQuoteElement.bnd"
#include "HTMLScriptElement.bnd"
#include "HTMLSelectElement.bnd"
#include "HTMLStyleElement.bnd"
#include "HTMLTableCaptionElement.bnd"
#include "HTMLTableCellElement.bnd"
#include "HTMLTableColElement.bnd"
#include "HTMLTableElement.bnd"
#include "HTMLTableRowElement.bnd"
#include "HTMLTableSectionElement.bnd"
#include "HTMLTextAreaElement.bnd"
#include "HTMLTitleElement.bnd"

init HTMLUnknownElement(struct dom_html_element *html_unknown_element::html_element);
init HTMLDirectoryElement(struct dom_html_element *html_directory_element::html_element);
init HTMLTemplateElement(struct dom_html_element *html_template_element::html_element);
init HTMLDialogElement(struct dom_html_element *html_dialog_element::html_element);
init HTMLMenuItemElement(struct dom_html_element *html_menu_item_element::html_element);
init HTMLDetailsElement(struct dom_html_element *html_details_element::html_element);
init HTMLFieldSetElement(struct dom_html_element *html_field_set_element::html_element);
init HTMLMeterElement(struct dom_html_element *html_meter_element::html_element);
init HTMLProgressElement(struct dom_html_element *html_progress_element::html_element);
init HTMLOutputElement(struct dom_html_element *html_output_element::html_element);
init HTMLKeygenElement(struct dom_html_element *html_keygen_element::html_element);
init HTMLOptGroupElement(struct dom_html_element *html_opt_group_element::html_element);
init HTMLDataListElement(struct dom_html_element *html_data_list_element::html_element);
init HTMLMediaElement(struct dom_html_element *html_media_element::html_element);
init HTMLTrackElement(struct dom_html_element *html_track_element::html_element);
init HTMLEmbedElement(struct dom_html_element *html_embed_element::html_element);
init HTMLSourceElement(struct dom_html_element *html_source_element::html_element);
init HTMLPictureElement(struct dom_html_element *html_picture_element::html_element);
init HTMLModElement(struct dom_html_element *html_mod_element::html_element);
init HTMLSpanElement(struct dom_html_element *html_span_element::html_element);
init HTMLTimeElement(struct dom_html_element *html_time_element::html_element);
init HTMLDataElement(struct dom_html_element *html_data_element::html_element);
init HTMLDListElement(struct dom_html_element *html_d_list_element::html_element);
init HTMLUListElement(struct dom_html_element *html_u_list_element::html_element);
init HTMLHeadElement(struct dom_html_element *html_head_element::html_element);

/* specialisations of HTMLTableCellElement */
init HTMLTableHeaderCellElement(struct dom_html_element *html_table_header_cell_element::html_table_cell_element);
init HTMLTableDataCellElement(struct dom_html_element *html_table_data_cell_element::html_table_cell_element);

/* specialisations of html_media_element */
init HTMLAudioElement(struct dom_html_element *html_audio_element::html_media_element);
init HTMLVideoElement(struct dom_html_element *html_video_element::html_media_element);

init Text(struct dom_node_text *text::character_data);
init Comment(struct dom_node_comment *comment::character_data);
init ProcessingInstruction(struct dom_node_text *text::character_data);

init XMLDocument(struct dom_document *document);

init CharacterData(struct dom_node_character_data *character_data::node);
init DocumentFragment(struct dom_document *document::node);
init DocumentType(struct dom_document *document::node);

init PropertyNodeList(struct dom_nodelist *nodes);
init RadioNodeList(struct dom_nodelist *nodes);

init HTMLAllCollection(struct dom_html_collection *coll);
init HTMLFormControlsCollection(struct dom_html_collection *coll);
init HTMLOptionsCollection(struct dom_html_collection *coll);
init HTMLPropertiesCollection(struct dom_html_collection *coll);

/* Stuff to do with canvasses */

#include "CanvasRenderingContext2D.bnd"
#include "ImageData.bnd"

