mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Generate bindings for HTMLAreaElement
This commit is contained in:
parent
f12406ac24
commit
e7b8038665
11 changed files with 138 additions and 2 deletions
|
@ -547,6 +547,7 @@ def addHTMLElement(element):
|
|||
|
||||
addHTMLElement('HTMLAnchorElement')
|
||||
addHTMLElement('HTMLAppletElement')
|
||||
addHTMLElement('HTMLAreaElement')
|
||||
addHTMLElement('HTMLBodyElement')
|
||||
addHTMLElement('HTMLBRElement')
|
||||
addHTMLElement('HTMLCanvasElement')
|
||||
|
|
|
@ -4619,6 +4619,7 @@ class CGBindingRoot(CGThing):
|
|||
'dom::element::{HTMLDivElement, HTMLSpanElement, HTMLParagraphElement}', #XXXjdm
|
||||
'dom::htmlanchorelement::HTMLAnchorElement', #XXXjdm
|
||||
'dom::htmlappletelement::HTMLAppletElement',
|
||||
'dom::htmlareaelement::HTMLAreaElement',
|
||||
'dom::htmlbodyelement::HTMLBodyElement',
|
||||
'dom::htmlbrelement::HTMLBRElement', #XXXrecrack
|
||||
'dom::htmlcanvaselement::HTMLCanvasElement',
|
||||
|
|
|
@ -41,4 +41,3 @@ interface HTMLAppletElement : HTMLElement {
|
|||
//HTMLAppletElement implements MozImageLoadingContent;
|
||||
//HTMLAppletElement implements MozFrameLoaderOwner;
|
||||
//HTMLAppletElement implements MozObjectLoadingContent;
|
||||
|
||||
|
|
|
@ -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;
|
||||
};
|
|
@ -8,6 +8,7 @@ use dom::bindings::utils;
|
|||
use dom::bindings::utils::{CacheableWrapper, WrapperCache, DerivedWrapper};
|
||||
use dom::element::{HTMLElementTypeId,
|
||||
HTMLAnchorElementTypeId, HTMLAppletElementTypeId,
|
||||
HTMLAreaElementTypeId,
|
||||
HTMLBodyElementTypeId, HTMLBRElementTypeId,
|
||||
HTMLCanvasElementTypeId,
|
||||
HTMLDivElementTypeId, HTMLHeadElementTypeId, HTMLHRElementTypeId,
|
||||
|
@ -23,6 +24,7 @@ use dom::element::{HTMLHeadElement,HTMLHtmlElement, HTMLDivElement, HTMLParagrap
|
|||
use dom::htmlelement::HTMLElement;
|
||||
use dom::htmlanchorelement::HTMLAnchorElement;
|
||||
use dom::htmlappletelement::HTMLAppletElement;
|
||||
use dom::htmlareaelement::HTMLAreaElement;
|
||||
use dom::htmlbodyelement::HTMLBodyElement;
|
||||
use dom::htmlhrelement::HTMLHRElement;
|
||||
use dom::htmlbrelement::HTMLBRElement;
|
||||
|
@ -110,6 +112,7 @@ pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> *JSObject
|
|||
ElementNodeTypeId(HTMLElementTypeId) => generate_element!(HTMLElement),
|
||||
ElementNodeTypeId(HTMLAnchorElementTypeId) => generate_element!(HTMLAnchorElement),
|
||||
ElementNodeTypeId(HTMLAppletElementTypeId) => generate_element!(HTMLAppletElement),
|
||||
ElementNodeTypeId(HTMLAreaElementTypeId) => generate_element!(HTMLAreaElement),
|
||||
ElementNodeTypeId(HTMLBodyElementTypeId) => generate_element!(HTMLBodyElement),
|
||||
ElementNodeTypeId(HTMLBRElementTypeId) => generate_element!(HTMLBRElement),
|
||||
ElementNodeTypeId(HTMLCanvasElementTypeId) => generate_element!(HTMLCanvasElement),
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
//! Element nodes.
|
||||
|
||||
use dom::bindings::codegen::{HTMLAnchorElementBinding, HTMLAppletElementBinding,
|
||||
HTMLAreaElementBinding,
|
||||
HTMLBodyElementBinding, HTMLBRElementBinding,
|
||||
HTMLCanvasElementBinding, HTMLDListElementBinding, HTMLDivElementBinding,
|
||||
HTMLHeadElementBinding, HTMLHRElementBinding,
|
||||
|
@ -22,6 +23,7 @@ use dom::clientrect::ClientRect;
|
|||
use dom::clientrectlist::ClientRectList;
|
||||
use dom::htmlanchorelement::HTMLAnchorElement;
|
||||
use dom::htmlappletelement::HTMLAppletElement;
|
||||
use dom::htmlareaelement::HTMLAreaElement;
|
||||
use dom::htmlbodyelement::HTMLBodyElement;
|
||||
use dom::htmlbrelement::HTMLBRElement;
|
||||
use dom::htmlcanvaselement::HTMLCanvasElement;
|
||||
|
@ -84,6 +86,7 @@ pub enum ElementTypeId {
|
|||
HTMLElementTypeId,
|
||||
HTMLAnchorElementTypeId,
|
||||
HTMLAppletElementTypeId,
|
||||
HTMLAreaElementTypeId,
|
||||
HTMLBRElementTypeId,
|
||||
HTMLBodyElementTypeId,
|
||||
HTMLCanvasElementTypeId,
|
||||
|
@ -200,6 +203,8 @@ generate_cacheable_wrapper!(HTMLAnchorElement, HTMLAnchorElementBinding::Wrap)
|
|||
generate_binding_object!(HTMLAnchorElement)
|
||||
generate_cacheable_wrapper!(HTMLAppletElement, HTMLAppletElementBinding::Wrap)
|
||||
generate_binding_object!(HTMLAppletElement)
|
||||
generate_cacheable_wrapper!(HTMLAreaElement, HTMLAreaElementBinding::Wrap)
|
||||
generate_binding_object!(HTMLAreaElement)
|
||||
generate_cacheable_wrapper!(HTMLBodyElement, HTMLBodyElementBinding::Wrap)
|
||||
generate_binding_object!(HTMLBodyElement)
|
||||
generate_cacheable_wrapper!(HTMLCanvasElement, HTMLCanvasElementBinding::Wrap)
|
||||
|
|
68
src/components/script/dom/htmlareaelement.rs
Normal file
68
src/components/script/dom/htmlareaelement.rs
Normal 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) {
|
||||
}
|
||||
}
|
|
@ -3,7 +3,8 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::element::{HTMLElementTypeId,
|
||||
HTMLAnchorElementTypeId, HTMLAppletElementTypeId, HTMLBRElementTypeId,
|
||||
HTMLAnchorElementTypeId, HTMLAppletElementTypeId,
|
||||
HTMLAreaElementTypeId, HTMLBRElementTypeId,
|
||||
HTMLBodyElementTypeId, HTMLCanvasElementTypeId, HTMLDivElementTypeId,
|
||||
HTMLDListElementTypeId,
|
||||
HTMLFontElementTypeId, HTMLFormElementTypeId, HTMLHRElementTypeId,
|
||||
|
@ -29,6 +30,7 @@ use dom::element::{HTMLHeadingElementTypeId, Heading1, Heading2, Heading3, Headi
|
|||
use dom::htmlbrelement::HTMLBRElement;
|
||||
use dom::htmlanchorelement::HTMLAnchorElement;
|
||||
use dom::htmlappletelement::HTMLAppletElement;
|
||||
use dom::htmlareaelement::HTMLAreaElement;
|
||||
use dom::htmlbodyelement::HTMLBodyElement;
|
||||
use dom::htmlcanvaselement::HTMLCanvasElement;
|
||||
use dom::htmldlistelement::HTMLDListElement;
|
||||
|
@ -230,6 +232,7 @@ fn build_element_from_tag(cx: *JSContext, tag: &str) -> AbstractNode<ScriptView>
|
|||
// TODO (Issue #85): use atoms
|
||||
handle_element!(cx, tag, "a", HTMLAnchorElementTypeId, HTMLAnchorElement, []);
|
||||
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, "body", HTMLBodyElementTypeId, HTMLBodyElement, []);
|
||||
handle_element!(cx, tag, "canvas", HTMLCanvasElementTypeId, HTMLCanvasElement, []);
|
||||
|
|
|
@ -44,6 +44,7 @@ pub mod dom {
|
|||
pub mod FormDataBinding;
|
||||
pub mod HTMLAnchorElementBinding;
|
||||
pub mod HTMLAppletElementBinding;
|
||||
pub mod HTMLAreaElementBinding;
|
||||
pub mod HTMLBodyElementBinding;
|
||||
pub mod HTMLBRElementBinding;
|
||||
pub mod HTMLCanvasElementBinding;
|
||||
|
@ -94,6 +95,7 @@ pub mod dom {
|
|||
pub mod formdata;
|
||||
pub mod htmlanchorelement;
|
||||
pub mod htmlappletelement;
|
||||
pub mod htmlareaelement;
|
||||
pub mod htmlbodyelement;
|
||||
pub mod htmlbrelement;
|
||||
pub mod htmlcanvaselement;
|
||||
|
|
|
@ -37,5 +37,6 @@
|
|||
<source src="horse.ogg" type="audio/ogg">
|
||||
<source src="horse.mp3" type="audio/mpeg">
|
||||
</audio>
|
||||
<area></area>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -133,6 +133,7 @@ window.alert(document.links[0]);
|
|||
window.alert(document.getElementsByTagName('iframe')[0]);
|
||||
|
||||
window.alert(document.getElementsByTagName("body")[0]);
|
||||
window.alert(document.getElementsByTagName("area")[0]);
|
||||
|
||||
window.alert("OList:");
|
||||
let tags = document.getElementsByTagName("ol");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue