Generate bindings for HTMLMapElement.

This commit is contained in:
Josh Matthews 2013-08-26 17:25:10 -04:00
parent 39772f0bf4
commit 48ce912757
8 changed files with 77 additions and 8 deletions

View file

@ -577,6 +577,7 @@ addHTMLElement('HTMLImageElement')
addHTMLElement('HTMLInputElement')
addHTMLElement('HTMLLIElement')
addHTMLElement('HTMLLinkElement')
addHTMLElement('HTMLMapElement')
addHTMLElement('HTMLMetaElement')
addHTMLElement('HTMLOListElement')
addHTMLElement('HTMLParagraphElement')

View file

@ -4643,6 +4643,7 @@ class CGBindingRoot(CGThing):
'dom::htmlinputelement::HTMLInputElement',
'dom::htmllielement::HTMLLIElement',
'dom::htmllinkelement::HTMLLinkElement', #XXXrecrack
'dom::htmlmapelement::HTMLMapElement',
'dom::htmlmetaelement::HTMLMetaElement',
'dom::htmlolistelement::HTMLOListElement',
'dom::htmlprogresselement::HTMLProgressElement',

View file

@ -0,0 +1,21 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* http://www.whatwg.org/specs/web-apps/current-work/#the-map-element
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
* Opera Software ASA. You are granted a license to use, reproduce
* and create derivative works of this document.
*/
// http://www.whatwg.org/specs/web-apps/current-work/#the-map-element
interface HTMLMapElement : HTMLElement {
[SetterThrows, Pure]
attribute DOMString name;
[Constant]
readonly attribute HTMLCollection areas;
// Not supported yet.
//readonly attribute HTMLCollection images;
};

View file

@ -16,9 +16,9 @@ use dom::element::{HTMLElementTypeId,
HTMLFrameSetElementTypeId, HTMLHeadElementTypeId, HTMLHeadingElementTypeId,
HTMLHRElementTypeId, HTMLHtmlElementTypeId, HTMLIframeElementTypeId,
HTMLImageElementTypeId, HTMLInputElementTypeId, HTMLLIElementTypeId,
HTMLLinkElementTypeId, HTMLMetaElementTypeId, HTMLOListElementTypeId,
HTMLParagraphElementTypeId, HTMLProgressElementTypeId,
HTMLQuoteElementTypeId, HTMLScriptElementTypeId,
HTMLLinkElementTypeId, HTMLMapElementTypeId, HTMLMetaElementTypeId,
HTMLOListElementTypeId, HTMLParagraphElementTypeId,
HTMLProgressElementTypeId, HTMLQuoteElementTypeId, HTMLScriptElementTypeId,
HTMLSpanElementTypeId, HTMLSourceElementTypeId,
HTMLStyleElementTypeId, HTMLTextAreaElementTypeId,
HTMLTableElementTypeId, HTMLTableCaptionElementTypeId, HTMLTableCellElementTypeId,
@ -51,6 +51,7 @@ use dom::htmlimageelement::HTMLImageElement;
use dom::htmlinputelement::HTMLInputElement;
use dom::htmllielement::HTMLLIElement;
use dom::htmllinkelement::HTMLLinkElement;
use dom::htmlmapelement::HTMLMapElement;
use dom::htmlmetaelement::HTMLMetaElement;
use dom::htmlolistelement::HTMLOListElement;
use dom::htmlprogresselement::HTMLProgressElement;
@ -160,6 +161,7 @@ pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> *JSObject
ElementNodeTypeId(HTMLInputElementTypeId) => generate_element!(HTMLInputElement),
ElementNodeTypeId(HTMLLIElementTypeId) => generate_element!(HTMLLIElement),
ElementNodeTypeId(HTMLLinkElementTypeId) => generate_element!(HTMLLinkElement),
ElementNodeTypeId(HTMLMapElementTypeId) => generate_element!(HTMLMapElement),
ElementNodeTypeId(HTMLMetaElementTypeId) => generate_element!(HTMLMetaElement),
ElementNodeTypeId(HTMLOListElementTypeId) => generate_element!(HTMLOListElement),
ElementNodeTypeId(HTMLParagraphElementTypeId) => generate_element!(HTMLParagraphElement),

View file

@ -17,7 +17,8 @@ use dom::bindings::codegen::{HTMLAnchorElementBinding, HTMLAppletElementBinding,
HTMLHRElementBinding, HTMLHtmlElementBinding,
HTMLIFrameElementBinding, HTMLImageElementBinding,
HTMLInputElementBinding, HTMLLIElementBinding,
HTMLLinkElementBinding, HTMLMetaElementBinding,
HTMLLinkElementBinding, HTMLMapElementBinding,
HTMLMetaElementBinding,
HTMLOListElementBinding, HTMLParagraphElementBinding,
HTMLProgressElementBinding, HTMLQuoteElementBinding,
HTMLScriptElementBinding, HTMLSourceElementBinding, HTMLSpanElementBinding,
@ -56,6 +57,7 @@ use dom::htmlimageelement::HTMLImageElement;
use dom::htmlinputelement::HTMLInputElement;
use dom::htmllielement::HTMLLIElement;
use dom::htmllinkelement::HTMLLinkElement;
use dom::htmlmapelement::HTMLMapElement;
use dom::htmlmetaelement::HTMLMetaElement;
use dom::htmlolistelement::HTMLOListElement;
use dom::htmlprogresselement::HTMLProgressElement;
@ -139,6 +141,7 @@ pub enum ElementTypeId {
HTMLInputElementTypeId,
HTMLLinkElementTypeId,
HTMLLIElementTypeId,
HTMLMapElementTypeId,
HTMLMetaElementTypeId,
HTMLOListElementTypeId,
HTMLOptionElementTypeId,
@ -285,6 +288,8 @@ generate_cacheable_wrapper!(HTMLLIElement, HTMLLIElementBinding::Wrap)
generate_binding_object!(HTMLLIElement)
generate_cacheable_wrapper!(HTMLLinkElement, HTMLLinkElementBinding::Wrap)
generate_binding_object!(HTMLLinkElement)
generate_cacheable_wrapper!(HTMLMapElement, HTMLMapElementBinding::Wrap)
generate_binding_object!(HTMLMapElement)
generate_cacheable_wrapper!(HTMLMetaElement, HTMLMetaElementBinding::Wrap)
generate_binding_object!(HTMLMetaElement)
generate_cacheable_wrapper!(HTMLOListElement, HTMLOListElementBinding::Wrap)

View file

@ -0,0 +1,35 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::utils::{DOMString, null_string, ErrorResult, CacheableWrapper};
use dom::htmlcollection::HTMLCollection;
use dom::htmlelement::HTMLElement;
use js::jsapi::{JSObject, JSContext};
pub struct HTMLMapElement {
parent: HTMLElement
}
impl HTMLMapElement {
pub fn Name(&self) -> DOMString {
null_string
}
pub fn SetName(&mut self, _name: &DOMString, _rv: &mut ErrorResult) {
}
fn get_scope_and_cx(&self) -> (*JSObject, *JSContext) {
let doc = self.parent.parent.parent.owner_doc.unwrap();
let win = doc.with_base(|doc| doc.window.unwrap());
let cx = unsafe {(*win.page).js_info.get_ref().js_compartment.cx.ptr};
let cache = win.get_wrappercache();
let scope = cache.get_wrapper();
(scope, cx)
}
pub fn Areas(&self) -> @mut HTMLCollection {
let (scope, cx) = self.get_scope_and_cx();
HTMLCollection::new(~[], cx, scope)
}
}

View file

@ -10,10 +10,10 @@ use dom::element::{HTMLElementTypeId,
HTMLDirectoryElementTypeId, HTMLDListElementTypeId, HTMLEmbedElementTypeId,
HTMLFieldSetElementTypeId, HTMLFontElementTypeId, HTMLFormElementTypeId,
HTMLFrameElementTypeId, HTMLFrameSetElementTypeId, HTMLHRElementTypeId,
HTMLHeadElementTypeId,
HTMLHtmlElementTypeId, HTMLImageElementTypeId, HTMLIframeElementTypeId,
HTMLInputElementTypeId, HTMLLinkElementTypeId, HTMLLIElementTypeId,
HTMLMetaElementTypeId, HTMLOListElementTypeId, HTMLOptionElementTypeId,
HTMLHeadElementTypeId, HTMLHtmlElementTypeId, HTMLImageElementTypeId,
HTMLIframeElementTypeId, HTMLInputElementTypeId, HTMLLinkElementTypeId,
HTMLLIElementTypeId, HTMLMapElementTypeId, HTMLMetaElementTypeId,
HTMLOListElementTypeId, HTMLOptionElementTypeId,
HTMLParagraphElementTypeId, HTMLProgressElementTypeId,
HTMLQuoteElementTypeId, HTMLScriptElementTypeId,
HTMLSelectElementTypeId, HTMLSmallElementTypeId, HTMLSourceElementTypeId,
@ -54,6 +54,7 @@ use dom::htmlimageelement::HTMLImageElement;
use dom::htmlinputelement::HTMLInputElement;
use dom::htmllielement::HTMLLIElement;
use dom::htmllinkelement::HTMLLinkElement;
use dom::htmlmapelement::HTMLMapElement;
use dom::htmlmetaelement::HTMLMetaElement;
use dom::htmlolistelement::HTMLOListElement;
use dom::htmlprogresselement::HTMLProgressElement;
@ -276,6 +277,7 @@ fn build_element_from_tag(cx: *JSContext, tag: &str) -> AbstractNode<ScriptView>
handle_element!(cx, tag, "input", HTMLInputElementTypeId, HTMLInputElement, []);
handle_element!(cx, tag, "link", HTMLLinkElementTypeId, HTMLLinkElement, []);
handle_element!(cx, tag, "li", HTMLLIElementTypeId, HTMLLIElement, []);
handle_element!(cx, tag, "map", HTMLMapElementTypeId, HTMLMapElement, []);
handle_element!(cx, tag, "meta", HTMLMetaElementTypeId, HTMLMetaElement, []);
handle_element!(cx, tag, "ol", HTMLOListElementTypeId, HTMLOListElement, []);
handle_element!(cx, tag, "option", HTMLOptionElementTypeId, HTMLOptionElement, []);

View file

@ -72,6 +72,7 @@ pub mod dom {
pub mod HTMLInputElementBinding;
pub mod HTMLLIElementBinding;
pub mod HTMLLinkElementBinding;
pub mod HTMLMapElementBinding;
pub mod HTMLMetaElementBinding;
pub mod HTMLOListElementBinding;
pub mod HTMLParagraphElementBinding;
@ -139,6 +140,7 @@ pub mod dom {
pub mod htmlinputelement;
pub mod htmllielement;
pub mod htmllinkelement;
pub mod htmlmapelement;
pub mod htmlmetaelement;
pub mod htmlolistelement;
pub mod htmlprogresselement;