Generate bindings for HTMLTableElement.

This commit is contained in:
saneyuki_s 2013-08-08 21:18:20 +09:00 committed by Josh Matthews
parent c5125ca5e2
commit 655bdcc511
10 changed files with 175 additions and 4 deletions

View file

@ -560,6 +560,7 @@ addHTMLElement('HTMLParagraphElement')
addHTMLElement('HTMLScriptElement')
addHTMLElement('HTMLSpanElement')
addHTMLElement('HTMLStyleElement')
addHTMLElement('HTMLTableElement')
# If you add one of these, you need to make sure nsDOMQS.h has the relevant
# macros added for it

View file

@ -4628,6 +4628,7 @@ class CGBindingRoot(CGThing):
'dom::htmlolistelement::HTMLOListElement',
'dom::htmlscriptelement::HTMLScriptElement',
'dom::htmlstyleelement::HTMLStyleElement',
'dom::htmltableelement::HTMLTableElement',
'dom::bindings::utils::*',
'dom::bindings::conversions::*',
'dom::blob::*', #XXXjdm

View file

@ -0,0 +1,62 @@
/* -*- 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 HTMLTableElement : HTMLElement {
/*
attribute HTMLTableCaptionElement? caption;
HTMLElement createCaption();
*/
void deleteCaption();
/*
[SetterThrows]
attribute HTMLTableSectionElement? tHead;
HTMLElement createTHead();
*/
void deleteTHead();
/*
[SetterThrows]
attribute HTMLTableSectionElement? tFoot;
HTMLElement createTFoot();
*/
void deleteTFoot();
/*
readonly attribute HTMLCollection tBodies;
HTMLElement createTBody();
readonly attribute HTMLCollection rows;
[Throws]
HTMLElement insertRow(optional long index = -1);
*/
[Throws]
void deleteRow(long index);
attribute boolean sortable;
void stopSorting();
};
partial interface HTMLTableElement {
[SetterThrows]
attribute DOMString align;
[SetterThrows]
attribute DOMString border;
[SetterThrows]
attribute DOMString frame;
[SetterThrows]
attribute DOMString rules;
[SetterThrows]
attribute DOMString summary;
[SetterThrows]
attribute DOMString width;
[TreatNullAs=EmptyString, SetterThrows] attribute DOMString bgColor;
[TreatNullAs=EmptyString, SetterThrows] attribute DOMString cellPadding;
[TreatNullAs=EmptyString, SetterThrows] attribute DOMString cellSpacing;
};

View file

@ -10,7 +10,7 @@ use dom::element::{HTMLHeadElementTypeId, HTMLHtmlElementTypeId, HTMLAnchorEleme
use dom::element::{HTMLDivElementTypeId, HTMLImageElementTypeId, HTMLSpanElementTypeId};
use dom::element::{HTMLBodyElementTypeId, HTMLHRElementTypeId, HTMLIframeElementTypeId};
use dom::element::{HTMLParagraphElementTypeId, HTMLScriptElementTypeId, HTMLMetaElementTypeId};
use dom::element::{HTMLOListElementTypeId, HTMLStyleElementTypeId};
use dom::element::{HTMLOListElementTypeId, HTMLStyleElementTypeId, HTMLTableElementTypeId};
use dom::element::{HTMLHeadElement, HTMLHtmlElement, HTMLDivElement, HTMLSpanElement};
use dom::element::{HTMLParagraphElement};
use dom::htmlanchorelement::HTMLAnchorElement;
@ -22,6 +22,7 @@ use dom::htmlmetaelement::HTMLMetaElement;
use dom::htmlolistelement::HTMLOListElement;
use dom::htmlscriptelement::HTMLScriptElement;
use dom::htmlstyleelement::HTMLStyleElement;
use dom::htmltableelement::HTMLTableElement;
use dom::node::{AbstractNode, Node, ElementNodeTypeId, TextNodeTypeId, CommentNodeTypeId};
use dom::node::{DoctypeNodeTypeId, ScriptView, Text};
@ -101,6 +102,7 @@ pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> *JSObject
ElementNodeTypeId(HTMLScriptElementTypeId) => generate_element!(HTMLScriptElement),
ElementNodeTypeId(HTMLSpanElementTypeId) => generate_element!(HTMLSpanElement),
ElementNodeTypeId(HTMLStyleElementTypeId) => generate_element!(HTMLStyleElement),
ElementNodeTypeId(HTMLTableElementTypeId) => generate_element!(HTMLTableElement),
ElementNodeTypeId(_) => element::create(cx, node).ptr,
CommentNodeTypeId |
DoctypeNodeTypeId => text::create(cx, node).ptr,

View file

@ -617,7 +617,7 @@ pub extern fn ThrowingConstructor(_cx: *JSContext, _argc: uint, _vp: *JSVal) ->
}
pub fn initialize_global(global: *JSObject) {
let protoArray = @mut ([0 as *JSObject, ..44]);
let protoArray = @mut ([0 as *JSObject, ..45]);
assert!(protoArray.len() == PrototypeList::id::_ID_Count as uint);
unsafe {
//XXXjdm we should be storing the box pointer instead of the inner

View file

@ -11,6 +11,7 @@ use dom::bindings::codegen::{HTMLParagraphElementBinding, HTMLScriptElementBindi
use dom::bindings::codegen::{HTMLDivElementBinding, HTMLSpanElementBinding};
use dom::bindings::codegen::{HTMLImageElementBinding, HTMLOListElementBinding};
use dom::bindings::codegen::{HTMLMetaElementBinding, HTMLStyleElementBinding};
use dom::bindings::codegen::{HTMLTableElementBinding};
use dom::bindings::utils::{null_string, str};
use dom::bindings::utils::{BindingObject, CacheableWrapper, DOMString, ErrorResult, WrapperCache};
use dom::clientrect::ClientRect;
@ -26,6 +27,7 @@ use dom::htmlmetaelement::HTMLMetaElement;
use dom::htmlolistelement::HTMLOListElement;
use dom::htmlscriptelement::HTMLScriptElement;
use dom::htmlstyleelement::HTMLStyleElement;
use dom::htmltableelement::HTMLTableElement;
use dom::node::{ElementNodeTypeId, Node, ScriptView, AbstractNode};
use layout_interface::{ContentBoxQuery, ContentBoxResponse, ContentBoxesQuery};
use layout_interface::{ContentBoxesResponse};
@ -123,7 +125,6 @@ pub struct HTMLSmallElement { parent: HTMLElement }
pub struct HTMLSpanElement { parent: HTMLElement }
pub struct HTMLTableBodyElement { parent: HTMLElement }
pub struct HTMLTableCellElement { parent: HTMLElement }
pub struct HTMLTableElement { parent: HTMLElement }
pub struct HTMLTableRowElement { parent: HTMLElement }
pub struct HTMLTitleElement { parent: HTMLElement }
pub struct HTMLUListElement { parent: HTMLElement }
@ -209,6 +210,8 @@ generate_cacheable_wrapper!(HTMLSpanElement, HTMLSpanElementBinding::Wrap)
generate_binding_object!(HTMLSpanElement)
generate_cacheable_wrapper!(HTMLStyleElement, HTMLStyleElementBinding::Wrap)
generate_binding_object!(HTMLStyleElement)
generate_cacheable_wrapper!(HTMLTableElement, HTMLTableElementBinding::Wrap)
generate_binding_object!(HTMLTableElement)
//
// Fancier elements

View file

@ -0,0 +1,98 @@
/* 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 HTMLTableElement {
parent: HTMLElement,
}
impl HTMLTableElement {
pub fn DeleteCaption(&self) {
}
pub fn DeleteTHead(&self) {
}
pub fn DeleteTFoot(&self) {
}
pub fn DeleteRow(&mut self, _index: i32, _rv: &mut ErrorResult) {
}
pub fn Sortable(&self) -> bool {
false
}
pub fn SetSortable(&self, _sortable: bool) {
}
pub fn StopSorting(&self) {
}
pub fn Align(&self) -> DOMString {
null_string
}
pub fn SetAlign(&self, _align: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Border(&self) -> DOMString {
null_string
}
pub fn SetBorder(&self, _border: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Frame(&self) -> DOMString {
null_string
}
pub fn SetFrame(&self, _frame: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Rules(&self) -> DOMString {
null_string
}
pub fn SetRules(&self, _rules: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Summary(&self) -> DOMString {
null_string
}
pub fn SetSummary(&self, _summary: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Width(&self) -> DOMString {
null_string
}
pub fn SetWidth(&self, _width: &DOMString, _rv: &mut ErrorResult) {
}
pub fn BgColor(&self) -> DOMString {
null_string
}
pub fn SetBgColor(&self, _bg_color: &DOMString, _rv: &mut ErrorResult) {
}
pub fn CellPadding(&self) -> DOMString {
null_string
}
pub fn SetCellPadding(&self, _cell_padding: &DOMString, _rv: &mut ErrorResult) {
}
pub fn CellSpacing(&self) -> DOMString {
null_string
}
pub fn SetCellSpacing(&self, _cell_spacing: &DOMString, _rv: &mut ErrorResult) {
}
}

View file

@ -22,7 +22,7 @@ use dom::element::{HTMLAsideElement, HTMLBRElement,
HTMLOptionElement, HTMLParagraphElement, HTMLListItemElement,
HTMLSectionElement, HTMLSelectElement, HTMLSmallElement,
HTMLSpanElement, HTMLTableBodyElement,
HTMLTableCellElement, HTMLTableElement, HTMLTableRowElement,
HTMLTableCellElement, HTMLTableRowElement,
HTMLTitleElement, HTMLUListElement};
use dom::element::{HTMLHeadingElementTypeId, Heading1, Heading2, Heading3, Heading4, Heading5,
Heading6};
@ -35,6 +35,7 @@ use dom::htmlmetaelement::HTMLMetaElement;
use dom::htmlolistelement::HTMLOListElement;
use dom::htmlscriptelement::HTMLScriptElement;
use dom::htmlstyleelement::HTMLStyleElement;
use dom::htmltableelement::HTMLTableElement;
use dom::element::{Element, Attr};
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Comment, Doctype, ElementNodeTypeId, Node, ScriptView};

View file

@ -59,6 +59,7 @@ pub mod dom {
pub mod HTMLScriptElementBinding;
pub mod HTMLSpanElementBinding;
pub mod HTMLStyleElementBinding;
pub mod HTMLTableElementBinding;
pub mod MouseEventBinding;
pub mod NodeBinding;
pub mod PrototypeList;
@ -91,6 +92,7 @@ pub mod dom {
pub mod htmlolistelement;
pub mod htmlscriptelement;
pub mod htmlstyleelement;
pub mod htmltableelement;
pub mod mouseevent;
pub mod node;
pub mod uievent;

View file

@ -20,5 +20,6 @@
<applet></applet>
<iframe></iframe>
<ol type="1"></ol>
<table></table>
</body>
</html>