Generate bindings for HTMLAreaElement

This commit is contained in:
Junyoung Cho 2013-08-09 11:36:30 +09:00 committed by Josh Matthews
parent f12406ac24
commit e7b8038665
11 changed files with 138 additions and 2 deletions

View file

@ -547,6 +547,7 @@ def addHTMLElement(element):
addHTMLElement('HTMLAnchorElement') addHTMLElement('HTMLAnchorElement')
addHTMLElement('HTMLAppletElement') addHTMLElement('HTMLAppletElement')
addHTMLElement('HTMLAreaElement')
addHTMLElement('HTMLBodyElement') addHTMLElement('HTMLBodyElement')
addHTMLElement('HTMLBRElement') addHTMLElement('HTMLBRElement')
addHTMLElement('HTMLCanvasElement') addHTMLElement('HTMLCanvasElement')

View file

@ -4619,6 +4619,7 @@ class CGBindingRoot(CGThing):
'dom::element::{HTMLDivElement, HTMLSpanElement, HTMLParagraphElement}', #XXXjdm 'dom::element::{HTMLDivElement, HTMLSpanElement, HTMLParagraphElement}', #XXXjdm
'dom::htmlanchorelement::HTMLAnchorElement', #XXXjdm 'dom::htmlanchorelement::HTMLAnchorElement', #XXXjdm
'dom::htmlappletelement::HTMLAppletElement', 'dom::htmlappletelement::HTMLAppletElement',
'dom::htmlareaelement::HTMLAreaElement',
'dom::htmlbodyelement::HTMLBodyElement', 'dom::htmlbodyelement::HTMLBodyElement',
'dom::htmlbrelement::HTMLBRElement', #XXXrecrack 'dom::htmlbrelement::HTMLBRElement', #XXXrecrack
'dom::htmlcanvaselement::HTMLCanvasElement', 'dom::htmlcanvaselement::HTMLCanvasElement',

View file

@ -41,4 +41,3 @@ interface HTMLAppletElement : HTMLElement {
//HTMLAppletElement implements MozImageLoadingContent; //HTMLAppletElement implements MozImageLoadingContent;
//HTMLAppletElement implements MozFrameLoaderOwner; //HTMLAppletElement implements MozFrameLoaderOwner;
//HTMLAppletElement implements MozObjectLoadingContent; //HTMLAppletElement implements MozObjectLoadingContent;

View file

@ -0,0 +1,52 @@
/* -*- 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-area-element
* http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
*
* © 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-area-element
interface HTMLAreaElement : HTMLElement {
[SetterThrows]
attribute DOMString alt;
[SetterThrows]
attribute DOMString coords;
[SetterThrows]
attribute DOMString shape;
// No support for stringifier attributes yet
//[SetterThrows]
//stringifier attribute DOMString href;
// stringifier;
[SetterThrows]
attribute DOMString href;
[SetterThrows]
attribute DOMString target;
[SetterThrows]
attribute DOMString download;
[SetterThrows]
attribute DOMString ping;
// not implemented.
// [SetterThrows]
// attribute DOMString rel;
//readonly attribute DOMTokenList relList;
//
// [SetterThrows]
// attribute DOMString hreflang;
// [SetterThrows]
// attribute DOMString type;
};
//HTMLAreaElement implements URLUtils;
// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
partial interface HTMLAreaElement {
[SetterThrows]
attribute boolean noHref;
};

View file

@ -8,6 +8,7 @@ use dom::bindings::utils;
use dom::bindings::utils::{CacheableWrapper, WrapperCache, DerivedWrapper}; use dom::bindings::utils::{CacheableWrapper, WrapperCache, DerivedWrapper};
use dom::element::{HTMLElementTypeId, use dom::element::{HTMLElementTypeId,
HTMLAnchorElementTypeId, HTMLAppletElementTypeId, HTMLAnchorElementTypeId, HTMLAppletElementTypeId,
HTMLAreaElementTypeId,
HTMLBodyElementTypeId, HTMLBRElementTypeId, HTMLBodyElementTypeId, HTMLBRElementTypeId,
HTMLCanvasElementTypeId, HTMLCanvasElementTypeId,
HTMLDivElementTypeId, HTMLHeadElementTypeId, HTMLHRElementTypeId, HTMLDivElementTypeId, HTMLHeadElementTypeId, HTMLHRElementTypeId,
@ -23,6 +24,7 @@ use dom::element::{HTMLHeadElement,HTMLHtmlElement, HTMLDivElement, HTMLParagrap
use dom::htmlelement::HTMLElement; use dom::htmlelement::HTMLElement;
use dom::htmlanchorelement::HTMLAnchorElement; use dom::htmlanchorelement::HTMLAnchorElement;
use dom::htmlappletelement::HTMLAppletElement; use dom::htmlappletelement::HTMLAppletElement;
use dom::htmlareaelement::HTMLAreaElement;
use dom::htmlbodyelement::HTMLBodyElement; use dom::htmlbodyelement::HTMLBodyElement;
use dom::htmlhrelement::HTMLHRElement; use dom::htmlhrelement::HTMLHRElement;
use dom::htmlbrelement::HTMLBRElement; use dom::htmlbrelement::HTMLBRElement;
@ -110,6 +112,7 @@ pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> *JSObject
ElementNodeTypeId(HTMLElementTypeId) => generate_element!(HTMLElement), ElementNodeTypeId(HTMLElementTypeId) => generate_element!(HTMLElement),
ElementNodeTypeId(HTMLAnchorElementTypeId) => generate_element!(HTMLAnchorElement), ElementNodeTypeId(HTMLAnchorElementTypeId) => generate_element!(HTMLAnchorElement),
ElementNodeTypeId(HTMLAppletElementTypeId) => generate_element!(HTMLAppletElement), ElementNodeTypeId(HTMLAppletElementTypeId) => generate_element!(HTMLAppletElement),
ElementNodeTypeId(HTMLAreaElementTypeId) => generate_element!(HTMLAreaElement),
ElementNodeTypeId(HTMLBodyElementTypeId) => generate_element!(HTMLBodyElement), ElementNodeTypeId(HTMLBodyElementTypeId) => generate_element!(HTMLBodyElement),
ElementNodeTypeId(HTMLBRElementTypeId) => generate_element!(HTMLBRElement), ElementNodeTypeId(HTMLBRElementTypeId) => generate_element!(HTMLBRElement),
ElementNodeTypeId(HTMLCanvasElementTypeId) => generate_element!(HTMLCanvasElement), ElementNodeTypeId(HTMLCanvasElementTypeId) => generate_element!(HTMLCanvasElement),

View file

@ -5,6 +5,7 @@
//! Element nodes. //! Element nodes.
use dom::bindings::codegen::{HTMLAnchorElementBinding, HTMLAppletElementBinding, use dom::bindings::codegen::{HTMLAnchorElementBinding, HTMLAppletElementBinding,
HTMLAreaElementBinding,
HTMLBodyElementBinding, HTMLBRElementBinding, HTMLBodyElementBinding, HTMLBRElementBinding,
HTMLCanvasElementBinding, HTMLDListElementBinding, HTMLDivElementBinding, HTMLCanvasElementBinding, HTMLDListElementBinding, HTMLDivElementBinding,
HTMLHeadElementBinding, HTMLHRElementBinding, HTMLHeadElementBinding, HTMLHRElementBinding,
@ -22,6 +23,7 @@ use dom::clientrect::ClientRect;
use dom::clientrectlist::ClientRectList; use dom::clientrectlist::ClientRectList;
use dom::htmlanchorelement::HTMLAnchorElement; use dom::htmlanchorelement::HTMLAnchorElement;
use dom::htmlappletelement::HTMLAppletElement; use dom::htmlappletelement::HTMLAppletElement;
use dom::htmlareaelement::HTMLAreaElement;
use dom::htmlbodyelement::HTMLBodyElement; use dom::htmlbodyelement::HTMLBodyElement;
use dom::htmlbrelement::HTMLBRElement; use dom::htmlbrelement::HTMLBRElement;
use dom::htmlcanvaselement::HTMLCanvasElement; use dom::htmlcanvaselement::HTMLCanvasElement;
@ -84,6 +86,7 @@ pub enum ElementTypeId {
HTMLElementTypeId, HTMLElementTypeId,
HTMLAnchorElementTypeId, HTMLAnchorElementTypeId,
HTMLAppletElementTypeId, HTMLAppletElementTypeId,
HTMLAreaElementTypeId,
HTMLBRElementTypeId, HTMLBRElementTypeId,
HTMLBodyElementTypeId, HTMLBodyElementTypeId,
HTMLCanvasElementTypeId, HTMLCanvasElementTypeId,
@ -200,6 +203,8 @@ generate_cacheable_wrapper!(HTMLAnchorElement, HTMLAnchorElementBinding::Wrap)
generate_binding_object!(HTMLAnchorElement) generate_binding_object!(HTMLAnchorElement)
generate_cacheable_wrapper!(HTMLAppletElement, HTMLAppletElementBinding::Wrap) generate_cacheable_wrapper!(HTMLAppletElement, HTMLAppletElementBinding::Wrap)
generate_binding_object!(HTMLAppletElement) generate_binding_object!(HTMLAppletElement)
generate_cacheable_wrapper!(HTMLAreaElement, HTMLAreaElementBinding::Wrap)
generate_binding_object!(HTMLAreaElement)
generate_cacheable_wrapper!(HTMLBodyElement, HTMLBodyElementBinding::Wrap) generate_cacheable_wrapper!(HTMLBodyElement, HTMLBodyElementBinding::Wrap)
generate_binding_object!(HTMLBodyElement) generate_binding_object!(HTMLBodyElement)
generate_cacheable_wrapper!(HTMLCanvasElement, HTMLCanvasElementBinding::Wrap) generate_cacheable_wrapper!(HTMLCanvasElement, HTMLCanvasElementBinding::Wrap)

View file

@ -0,0 +1,68 @@
/* 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};
use dom::htmlelement::HTMLElement;
pub struct HTMLAreaElement {
parent: HTMLElement
}
impl HTMLAreaElement {
pub fn Alt(&self) -> DOMString {
null_string
}
pub fn SetAlt(&self, _alt: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Coords(&self) -> DOMString {
null_string
}
pub fn SetCoords(&self, _coords: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Shape(&self) -> DOMString {
null_string
}
pub fn SetShape(&self, _shape: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Href(&self) -> DOMString {
null_string
}
pub fn SetHref(&self, _href: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Target(&self) -> DOMString {
null_string
}
pub fn SetTarget(&self, _target: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Download(&self) -> DOMString {
null_string
}
pub fn SetDownload(&self, _download: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Ping(&self) -> DOMString {
null_string
}
pub fn SetPing(&self, _ping: &DOMString, _rv: &mut ErrorResult) {
}
pub fn NoHref(&self) -> bool {
false
}
pub fn SetNoHref(&mut self, _no_href: bool, _rv: &mut ErrorResult) {
}
}

View file

@ -3,7 +3,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::element::{HTMLElementTypeId, use dom::element::{HTMLElementTypeId,
HTMLAnchorElementTypeId, HTMLAppletElementTypeId, HTMLBRElementTypeId, HTMLAnchorElementTypeId, HTMLAppletElementTypeId,
HTMLAreaElementTypeId, HTMLBRElementTypeId,
HTMLBodyElementTypeId, HTMLCanvasElementTypeId, HTMLDivElementTypeId, HTMLBodyElementTypeId, HTMLCanvasElementTypeId, HTMLDivElementTypeId,
HTMLDListElementTypeId, HTMLDListElementTypeId,
HTMLFontElementTypeId, HTMLFormElementTypeId, HTMLHRElementTypeId, HTMLFontElementTypeId, HTMLFormElementTypeId, HTMLHRElementTypeId,
@ -29,6 +30,7 @@ use dom::element::{HTMLHeadingElementTypeId, Heading1, Heading2, Heading3, Headi
use dom::htmlbrelement::HTMLBRElement; use dom::htmlbrelement::HTMLBRElement;
use dom::htmlanchorelement::HTMLAnchorElement; use dom::htmlanchorelement::HTMLAnchorElement;
use dom::htmlappletelement::HTMLAppletElement; use dom::htmlappletelement::HTMLAppletElement;
use dom::htmlareaelement::HTMLAreaElement;
use dom::htmlbodyelement::HTMLBodyElement; use dom::htmlbodyelement::HTMLBodyElement;
use dom::htmlcanvaselement::HTMLCanvasElement; use dom::htmlcanvaselement::HTMLCanvasElement;
use dom::htmldlistelement::HTMLDListElement; use dom::htmldlistelement::HTMLDListElement;
@ -230,6 +232,7 @@ fn build_element_from_tag(cx: *JSContext, tag: &str) -> AbstractNode<ScriptView>
// TODO (Issue #85): use atoms // TODO (Issue #85): use atoms
handle_element!(cx, tag, "a", HTMLAnchorElementTypeId, HTMLAnchorElement, []); handle_element!(cx, tag, "a", HTMLAnchorElementTypeId, HTMLAnchorElement, []);
handle_element!(cx, tag, "applet", HTMLAppletElementTypeId, HTMLAppletElement, []); handle_element!(cx, tag, "applet", HTMLAppletElementTypeId, HTMLAppletElement, []);
handle_element!(cx, tag, "area", HTMLAreaElementTypeId, HTMLAreaElement, []);
handle_element!(cx, tag, "br", HTMLBRElementTypeId, HTMLBRElement, []); handle_element!(cx, tag, "br", HTMLBRElementTypeId, HTMLBRElement, []);
handle_element!(cx, tag, "body", HTMLBodyElementTypeId, HTMLBodyElement, []); handle_element!(cx, tag, "body", HTMLBodyElementTypeId, HTMLBodyElement, []);
handle_element!(cx, tag, "canvas", HTMLCanvasElementTypeId, HTMLCanvasElement, []); handle_element!(cx, tag, "canvas", HTMLCanvasElementTypeId, HTMLCanvasElement, []);

View file

@ -44,6 +44,7 @@ pub mod dom {
pub mod FormDataBinding; pub mod FormDataBinding;
pub mod HTMLAnchorElementBinding; pub mod HTMLAnchorElementBinding;
pub mod HTMLAppletElementBinding; pub mod HTMLAppletElementBinding;
pub mod HTMLAreaElementBinding;
pub mod HTMLBodyElementBinding; pub mod HTMLBodyElementBinding;
pub mod HTMLBRElementBinding; pub mod HTMLBRElementBinding;
pub mod HTMLCanvasElementBinding; pub mod HTMLCanvasElementBinding;
@ -94,6 +95,7 @@ pub mod dom {
pub mod formdata; pub mod formdata;
pub mod htmlanchorelement; pub mod htmlanchorelement;
pub mod htmlappletelement; pub mod htmlappletelement;
pub mod htmlareaelement;
pub mod htmlbodyelement; pub mod htmlbodyelement;
pub mod htmlbrelement; pub mod htmlbrelement;
pub mod htmlcanvaselement; pub mod htmlcanvaselement;

View file

@ -37,5 +37,6 @@
<source src="horse.ogg" type="audio/ogg"> <source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg"> <source src="horse.mp3" type="audio/mpeg">
</audio> </audio>
<area></area>
</body> </body>
</html> </html>

View file

@ -133,6 +133,7 @@ window.alert(document.links[0]);
window.alert(document.getElementsByTagName('iframe')[0]); window.alert(document.getElementsByTagName('iframe')[0]);
window.alert(document.getElementsByTagName("body")[0]); window.alert(document.getElementsByTagName("body")[0]);
window.alert(document.getElementsByTagName("area")[0]);
window.alert("OList:"); window.alert("OList:");
let tags = document.getElementsByTagName("ol"); let tags = document.getElementsByTagName("ol");