Generate bindings for HTMLBaseElement

This commit is contained in:
Junyoung Cho 2013-08-09 18:19:16 +09:00 committed by Josh Matthews
parent e7b8038665
commit 13bb1a49b8
10 changed files with 64 additions and 4 deletions

View file

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

View file

@ -4620,6 +4620,7 @@ class CGBindingRoot(CGThing):
'dom::htmlanchorelement::HTMLAnchorElement', #XXXjdm
'dom::htmlappletelement::HTMLAppletElement',
'dom::htmlareaelement::HTMLAreaElement',
'dom::htmlbaseelement::HTMLBaseElement',
'dom::htmlbodyelement::HTMLBodyElement',
'dom::htmlbrelement::HTMLBRElement', #XXXrecrack
'dom::htmlcanvaselement::HTMLCanvasElement',

View file

@ -0,0 +1,20 @@
/* -*- 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-base-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-base-element
interface HTMLBaseElement : HTMLElement {
[SetterThrows, Pure]
attribute DOMString href;
[SetterThrows, Pure]
attribute DOMString target;
}

View file

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

View file

@ -5,7 +5,7 @@
//! Element nodes.
use dom::bindings::codegen::{HTMLAnchorElementBinding, HTMLAppletElementBinding,
HTMLAreaElementBinding,
HTMLAreaElementBinding, HTMLBaseElementBinding,
HTMLBodyElementBinding, HTMLBRElementBinding,
HTMLCanvasElementBinding, HTMLDListElementBinding, HTMLDivElementBinding,
HTMLHeadElementBinding, HTMLHRElementBinding,
@ -24,6 +24,7 @@ use dom::clientrectlist::ClientRectList;
use dom::htmlanchorelement::HTMLAnchorElement;
use dom::htmlappletelement::HTMLAppletElement;
use dom::htmlareaelement::HTMLAreaElement;
use dom::htmlbaseelement::HTMLBaseElement;
use dom::htmlbodyelement::HTMLBodyElement;
use dom::htmlbrelement::HTMLBRElement;
use dom::htmlcanvaselement::HTMLCanvasElement;
@ -87,6 +88,7 @@ pub enum ElementTypeId {
HTMLAnchorElementTypeId,
HTMLAppletElementTypeId,
HTMLAreaElementTypeId,
HTMLBaseElementTypeId,
HTMLBRElementTypeId,
HTMLBodyElementTypeId,
HTMLCanvasElementTypeId,
@ -205,6 +207,8 @@ generate_cacheable_wrapper!(HTMLAppletElement, HTMLAppletElementBinding::Wrap)
generate_binding_object!(HTMLAppletElement)
generate_cacheable_wrapper!(HTMLAreaElement, HTMLAreaElementBinding::Wrap)
generate_binding_object!(HTMLAreaElement)
generate_cacheable_wrapper!(HTMLBaseElement, HTMLBaseElementBinding::Wrap)
generate_binding_object!(HTMLBaseElement)
generate_cacheable_wrapper!(HTMLBodyElement, HTMLBodyElementBinding::Wrap)
generate_binding_object!(HTMLBodyElement)
generate_cacheable_wrapper!(HTMLCanvasElement, HTMLCanvasElementBinding::Wrap)

View file

@ -0,0 +1,26 @@
/* 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 HTMLBaseElement {
parent: HTMLElement
}
impl HTMLBaseElement {
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) {
}
}

View file

@ -4,8 +4,8 @@
use dom::element::{HTMLElementTypeId,
HTMLAnchorElementTypeId, HTMLAppletElementTypeId,
HTMLAreaElementTypeId, HTMLBRElementTypeId,
HTMLBodyElementTypeId, HTMLCanvasElementTypeId, HTMLDivElementTypeId,
HTMLAreaElementTypeId, HTMLBaseElementTypeId, HTMLBodyElementTypeId,
HTMLBRElementTypeId, HTMLCanvasElementTypeId, HTMLDivElementTypeId,
HTMLDListElementTypeId,
HTMLFontElementTypeId, HTMLFormElementTypeId, HTMLHRElementTypeId,
HTMLHeadElementTypeId, HTMLHtmlElementTypeId,
@ -31,6 +31,7 @@ use dom::htmlbrelement::HTMLBRElement;
use dom::htmlanchorelement::HTMLAnchorElement;
use dom::htmlappletelement::HTMLAppletElement;
use dom::htmlareaelement::HTMLAreaElement;
use dom::htmlbaseelement::HTMLBaseElement;
use dom::htmlbodyelement::HTMLBodyElement;
use dom::htmlcanvaselement::HTMLCanvasElement;
use dom::htmldlistelement::HTMLDListElement;
@ -233,6 +234,7 @@ fn build_element_from_tag(cx: *JSContext, tag: &str) -> AbstractNode<ScriptView>
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, "base", HTMLBaseElementTypeId, HTMLBaseElement, []);
handle_element!(cx, tag, "br", HTMLBRElementTypeId, HTMLBRElement, []);
handle_element!(cx, tag, "body", HTMLBodyElementTypeId, HTMLBodyElement, []);
handle_element!(cx, tag, "canvas", HTMLCanvasElementTypeId, HTMLCanvasElement, []);

View file

@ -45,6 +45,7 @@ pub mod dom {
pub mod HTMLAnchorElementBinding;
pub mod HTMLAppletElementBinding;
pub mod HTMLAreaElementBinding;
pub mod HTMLBaseElementBinding;
pub mod HTMLBodyElementBinding;
pub mod HTMLBRElementBinding;
pub mod HTMLCanvasElementBinding;
@ -96,6 +97,7 @@ pub mod dom {
pub mod htmlanchorelement;
pub mod htmlappletelement;
pub mod htmlareaelement;
pub mod htmlbaseelement;
pub mod htmlbodyelement;
pub mod htmlbrelement;
pub mod htmlcanvaselement;

View file

@ -4,6 +4,7 @@
<head>
<title>test_binding
page </title>
<base href="./"></base>
<script src="test_bindings.js"></script>
</head>
<body>

View file

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