Generate bindings for HTMLTableColElement.

This commit is contained in:
Tetsuharu OHZEKI 2013-08-13 15:54:44 +09:00
parent ce647eb80f
commit c2391fe5ff
10 changed files with 117 additions and 5 deletions

View file

@ -573,6 +573,7 @@ addHTMLElement('HTMLStyleElement')
addHTMLElement('HTMLTableCaptionElement')
addHTMLElement('HTMLTableElement')
addHTMLElement('HTMLTableCellElement')
addHTMLElement('HTMLTableColElement')
addHTMLElement('HTMLTableRowElement')
addHTMLElement('HTMLTableSectionElement')
addHTMLElement('HTMLTextAreaElement')

View file

@ -4641,6 +4641,7 @@ class CGBindingRoot(CGThing):
'dom::htmltablecaptionelement::HTMLTableCaptionElement',
'dom::htmltableelement::HTMLTableElement',
'dom::htmltablecellelement::HTMLTableCellElement',
'dom::htmltablecolelement::HTMLTableColElement',
'dom::htmltablerowelement::HTMLTableRowElement',
'dom::htmltablesectionelement::HTMLTableSectionElement',
'dom::htmltextareaelement::HTMLTextAreaElement',

View file

@ -0,0 +1,30 @@
/* -*- 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/
*
* © 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.
*/
interface HTMLTableColElement : HTMLElement {
[SetterThrows]
attribute unsigned long span;
};
partial interface HTMLTableColElement {
[SetterThrows]
attribute DOMString align;
[SetterThrows]
attribute DOMString ch;
[SetterThrows]
attribute DOMString chOff;
[SetterThrows]
attribute DOMString vAlign;
[SetterThrows]
attribute DOMString width;
};

View file

@ -19,6 +19,7 @@ use dom::element::{HTMLElementTypeId,
HTMLSpanElementTypeId, HTMLSourceElementTypeId,
HTMLStyleElementTypeId, HTMLTextAreaElementTypeId,
HTMLTableElementTypeId, HTMLTableCaptionElementTypeId, HTMLTableCellElementTypeId,
HTMLTableColElementTypeId,
HTMLTableRowElementTypeId, HTMLTableSectionElementTypeId, HTMLTimeElementTypeId,
HTMLTitleElementTypeId, HTMLUListElementTypeId, HTMLDListElementTypeId};
use dom::element::{HTMLHeadElement,HTMLHtmlElement, HTMLDivElement, HTMLParagraphElement, HTMLSpanElement};
@ -45,6 +46,7 @@ use dom::htmlstyleelement::HTMLStyleElement;
use dom::htmltableelement::HTMLTableElement;
use dom::htmltablecaptionelement::HTMLTableCaptionElement;
use dom::htmltablecellelement::HTMLTableCellElement;
use dom::htmltablecolelement::HTMLTableColElement;
use dom::htmltablerowelement::HTMLTableRowElement;
use dom::htmltablesectionelement::HTMLTableSectionElement;
use dom::htmltextareaelement::HTMLTextAreaElement;
@ -143,6 +145,7 @@ pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> *JSObject
ElementNodeTypeId(HTMLTableElementTypeId) => generate_element!(HTMLTableElement),
ElementNodeTypeId(HTMLTableCellElementTypeId) => generate_element!(HTMLTableCellElement),
ElementNodeTypeId(HTMLTableCaptionElementTypeId) => generate_element!(HTMLTableCaptionElement),
ElementNodeTypeId(HTMLTableColElementTypeId) => generate_element!(HTMLTableColElement),
ElementNodeTypeId(HTMLTableRowElementTypeId) => generate_element!(HTMLTableRowElement),
ElementNodeTypeId(HTMLTableSectionElementTypeId) => generate_element!(HTMLTableSectionElement),
ElementNodeTypeId(HTMLTextAreaElementTypeId) => generate_element!(HTMLTextAreaElement),

View file

@ -18,7 +18,7 @@ use dom::bindings::codegen::{HTMLAnchorElementBinding, HTMLAppletElementBinding,
HTMLScriptElementBinding, HTMLSourceElementBinding, HTMLSpanElementBinding,
HTMLStyleElementBinding, HTMLTableElementBinding,
HTMLTableCaptionElementBinding, HTMLTableCellElementBinding,
HTMLTableRowElementBinding,
HTMLTableColElementBinding, HTMLTableRowElementBinding,
HTMLTableSectionElementBinding, HTMLTextAreaElementBinding,
HTMLTimeElementBinding, HTMLTitleElementBinding, HTMLUListElementBinding};
use dom::bindings::utils::{null_string, str};
@ -49,6 +49,7 @@ use dom::htmlstyleelement::HTMLStyleElement;
use dom::htmltableelement::HTMLTableElement;
use dom::htmltablecaptionelement::HTMLTableCaptionElement;
use dom::htmltablecellelement::HTMLTableCellElement;
use dom::htmltablecolelement::HTMLTableColElement;
use dom::htmltablerowelement::HTMLTableRowElement;
use dom::htmltablesectionelement::HTMLTableSectionElement;
use dom::htmltextareaelement::HTMLTextAreaElement;
@ -125,9 +126,10 @@ pub enum ElementTypeId {
HTMLSourceElementTypeId,
HTMLSpanElementTypeId,
HTMLStyleElementTypeId,
HTMLTableElementTypeId,
HTMLTableCaptionElementTypeId,
HTMLTableCellElementTypeId,
HTMLTableElementTypeId,
HTMLTableColElementTypeId,
HTMLTableRowElementTypeId,
HTMLTableSectionElementTypeId,
HTMLTextAreaElementTypeId,
@ -261,6 +263,8 @@ generate_cacheable_wrapper!(HTMLTableCaptionElement, HTMLTableCaptionElementBind
generate_binding_object!(HTMLTableCaptionElement)
generate_cacheable_wrapper!(HTMLTableCellElement, HTMLTableCellElementBinding::Wrap)
generate_binding_object!(HTMLTableCellElement)
generate_cacheable_wrapper!(HTMLTableColElement, HTMLTableColElementBinding::Wrap)
generate_binding_object!(HTMLTableColElement)
generate_cacheable_wrapper!(HTMLTableRowElement, HTMLTableRowElementBinding::Wrap)
generate_binding_object!(HTMLTableRowElement)
generate_cacheable_wrapper!(HTMLTableSectionElement, HTMLTableSectionElementBinding::Wrap)

View file

@ -0,0 +1,54 @@
/* 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 HTMLTableColElement {
parent: HTMLElement,
}
impl HTMLTableColElement {
pub fn Span(&self) -> u32 {
0
}
pub fn SetSpan(&mut self, _span: u32, _rv: &mut ErrorResult) {
}
pub fn Align(&self) -> DOMString {
null_string
}
pub fn SetAlign(&mut self, _align: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Ch(&self) -> DOMString {
null_string
}
pub fn SetCh(&mut self, _ch: &DOMString, _rv: &mut ErrorResult) {
}
pub fn ChOff(&self) -> DOMString {
null_string
}
pub fn SetChOff(&mut self, _ch_off: &DOMString, _rv: &mut ErrorResult) {
}
pub fn VAlign(&self) -> DOMString {
null_string
}
pub fn SetVAlign(&mut self, _v_align: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Width(&self) -> DOMString {
null_string
}
pub fn SetWidth(&mut self, _width: &DOMString, _rv: &mut ErrorResult) {
}
}

View file

@ -16,7 +16,8 @@ use dom::element::{HTMLElementTypeId,
HTMLSelectElementTypeId, HTMLSmallElementTypeId, HTMLSourceElementTypeId,
HTMLSpanElementTypeId, HTMLStyleElementTypeId, HTMLTableSectionElementTypeId,
HTMLTableCellElementTypeId, HTMLTableElementTypeId,
HTMLTableCaptionElementTypeId, HTMLTableRowElementTypeId, HTMLTextAreaElementTypeId,
HTMLTableCaptionElementTypeId, HTMLTableColElementTypeId,
HTMLTableRowElementTypeId, HTMLTextAreaElementTypeId,
HTMLTimeElementTypeId, HTMLTitleElementTypeId, HTMLUListElementTypeId,
UnknownElementTypeId};
use dom::element::{HTMLDivElement, HTMLFontElement, HTMLFormElement,
@ -49,6 +50,7 @@ use dom::htmlstyleelement::HTMLStyleElement;
use dom::htmltableelement::HTMLTableElement;
use dom::htmltablecaptionelement::HTMLTableCaptionElement;
use dom::htmltablecellelement::HTMLTableCellElement;
use dom::htmltablecolelement::HTMLTableColElement;
use dom::htmltablerowelement::HTMLTableRowElement;
use dom::htmltablesectionelement::HTMLTableSectionElement;
use dom::htmltextareaelement::HTMLTextAreaElement;
@ -264,9 +266,11 @@ fn build_element_from_tag(cx: *JSContext, tag: &str) -> AbstractNode<ScriptView>
handle_element!(cx, tag, "source", HTMLSourceElementTypeId, HTMLSourceElement, []);
handle_element!(cx, tag, "span", HTMLSpanElementTypeId, HTMLSpanElement, []);
handle_element!(cx, tag, "style", HTMLStyleElementTypeId, HTMLStyleElement, []);
handle_element!(cx, tag, "table", HTMLTableElementTypeId, HTMLTableElement, []);
handle_element!(cx, tag, "caption", HTMLTableCaptionElementTypeId, HTMLTableCaptionElement, []);
handle_element!(cx, tag, "td", HTMLTableCellElementTypeId, HTMLTableCellElement, []);
handle_element!(cx, tag, "table", HTMLTableElementTypeId, HTMLTableElement, []);
handle_element!(cx, tag, "col", HTMLTableColElementTypeId, HTMLTableColElement, []);
handle_element!(cx, tag, "colgroup",HTMLTableColElementTypeId, HTMLTableColElement, []);
handle_element!(cx, tag, "tbody", HTMLTableSectionElementTypeId, HTMLTableSectionElement, []);
handle_element!(cx, tag, "textarea",HTMLTextAreaElementTypeId, HTMLTextAreaElement, []);
handle_element!(cx, tag, "time", HTMLTimeElementTypeId, HTMLTimeElement, []);

View file

@ -70,8 +70,9 @@ pub mod dom {
pub mod HTMLSpanElementBinding;
pub mod HTMLStyleElementBinding;
pub mod HTMLTableElementBinding;
pub mod HTMLTableCellElementBinding;
pub mod HTMLTableCaptionElementBinding;
pub mod HTMLTableCellElementBinding;
pub mod HTMLTableColElementBinding;
pub mod HTMLTableRowElementBinding;
pub mod HTMLTableSectionElementBinding;
pub mod HTMLTextAreaElementBinding;
@ -123,6 +124,7 @@ pub mod dom {
pub mod htmltableelement;
pub mod htmltablecaptionelement;
pub mod htmltablecellelement;
pub mod htmltablecolelement;
pub mod htmltablerowelement;
pub mod htmltablesectionelement;
pub mod htmltextareaelement;

View file

@ -25,6 +25,9 @@
<ol type="1"></ol>
<table>
<caption>sample table</caption>
<colgroup>
<col/>
</colgroup>
<tbody>
<tr><td>head</td></tr>
<tr><td>data</td></tr>

View file

@ -210,6 +210,16 @@ window.alert(tags.length);
window.alert(tags[0].tagName);
window.alert(tags[0] instanceof HTMLTableCellElement);
window.alert("HTMLTableColElement");
let tagList = ["col", "colgroup"];
for (let i = 0, l = tagList.length; i < l; ++i) {
let tags = document.getElementsByTagName(tagList[i]);
window.alert(tags);
window.alert(tags.length);
window.alert(tags[0].tagName);
window.alert(tags[0] instanceof HTMLTableColElement);
}
//TODO: Doesn't work until we throw proper exceptions instead of returning 0 on
// unwrap failure.
/*try {