diff options
author | Tetsuharu OHZEKI <saneyuki.s.snyk@gmail.com> | 2013-08-13 16:43:31 +0900 |
---|---|---|
committer | Tetsuharu OHZEKI <saneyuki.s.snyk@gmail.com> | 2013-08-24 00:25:06 +0900 |
commit | d86d38c584e4ce1d54e8350bc9879ae269bed97a (patch) | |
tree | a31ebdceece304011a9a3351de2377641e908261 /src | |
parent | 2878f444164c603ba2a379a88f0fba58fbefc896 (diff) | |
download | servo-d86d38c584e4ce1d54e8350bc9879ae269bed97a.tar.gz servo-d86d38c584e4ce1d54e8350bc9879ae269bed97a.zip |
Generate bindings for HTMLTableCellElement.
Diffstat (limited to 'src')
-rw-r--r-- | src/components/script/dom/bindings/codegen/Bindings.conf | 1 | ||||
-rw-r--r-- | src/components/script/dom/bindings/codegen/CodegenRust.py | 1 | ||||
-rw-r--r-- | src/components/script/dom/bindings/codegen/HTMLTableCellElement.webidl | 53 | ||||
-rw-r--r-- | src/components/script/dom/bindings/node.rs | 8 | ||||
-rw-r--r-- | src/components/script/dom/element.rs | 11 | ||||
-rw-r--r-- | src/components/script/dom/htmltablecellelement.rs | 117 | ||||
-rw-r--r-- | src/components/script/html/hubbub_html_parser.rs | 5 | ||||
-rw-r--r-- | src/components/script/script.rc | 6 | ||||
-rw-r--r-- | src/test/html/test_bindings.html | 3 | ||||
-rw-r--r-- | src/test/html/test_bindings.js | 14 |
10 files changed, 207 insertions, 12 deletions
diff --git a/src/components/script/dom/bindings/codegen/Bindings.conf b/src/components/script/dom/bindings/codegen/Bindings.conf index 4afbe1a1c9d..768cca25b18 100644 --- a/src/components/script/dom/bindings/codegen/Bindings.conf +++ b/src/components/script/dom/bindings/codegen/Bindings.conf @@ -572,6 +572,7 @@ addHTMLElement('HTMLSpanElement') addHTMLElement('HTMLStyleElement') addHTMLElement('HTMLTableCaptionElement') addHTMLElement('HTMLTableElement') +addHTMLElement('HTMLTableCellElement') addHTMLElement('HTMLTableRowElement') addHTMLElement('HTMLTableSectionElement') addHTMLElement('HTMLTextAreaElement') diff --git a/src/components/script/dom/bindings/codegen/CodegenRust.py b/src/components/script/dom/bindings/codegen/CodegenRust.py index bee3c638419..75401ae15a2 100644 --- a/src/components/script/dom/bindings/codegen/CodegenRust.py +++ b/src/components/script/dom/bindings/codegen/CodegenRust.py @@ -4640,6 +4640,7 @@ class CGBindingRoot(CGThing): 'dom::htmlstyleelement::HTMLStyleElement', 'dom::htmltablecaptionelement::HTMLTableCaptionElement', 'dom::htmltableelement::HTMLTableElement', + 'dom::htmltablecellelement::HTMLTableCellElement', 'dom::htmltablerowelement::HTMLTableRowElement', 'dom::htmltablesectionelement::HTMLTableSectionElement', 'dom::htmltextareaelement::HTMLTextAreaElement', diff --git a/src/components/script/dom/bindings/codegen/HTMLTableCellElement.webidl b/src/components/script/dom/bindings/codegen/HTMLTableCellElement.webidl new file mode 100644 index 00000000000..b1fed450fac --- /dev/null +++ b/src/components/script/dom/bindings/codegen/HTMLTableCellElement.webidl @@ -0,0 +1,53 @@ +/* -*- 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 HTMLTableCellElement : HTMLElement { + [SetterThrows] + attribute unsigned long colSpan; + [SetterThrows] + attribute unsigned long rowSpan; +/* + [PutForwards=value] readonly attribute DOMSettableTokenList headers; +*/ + [SetterThrows] + attribute DOMString headers; + readonly attribute long cellIndex; + + // Mozilla-specific extensions + [SetterThrows] + attribute DOMString abbr; + [SetterThrows] + attribute DOMString scope; +}; + +partial interface HTMLTableCellElement { + [SetterThrows] + attribute DOMString align; + [SetterThrows] + attribute DOMString axis; + [SetterThrows] + attribute DOMString height; + [SetterThrows] + attribute DOMString width; + + [SetterThrows] + attribute DOMString ch; + [SetterThrows] + attribute DOMString chOff; + [SetterThrows] + attribute boolean noWrap; + [SetterThrows] + attribute DOMString vAlign; + + [TreatNullAs=EmptyString, SetterThrows] attribute DOMString bgColor; +}; diff --git a/src/components/script/dom/bindings/node.rs b/src/components/script/dom/bindings/node.rs index e7dfb583ac0..e330e44d1cd 100644 --- a/src/components/script/dom/bindings/node.rs +++ b/src/components/script/dom/bindings/node.rs @@ -18,7 +18,7 @@ use dom::element::{HTMLElementTypeId, HTMLParagraphElementTypeId, HTMLQuoteElementTypeId, HTMLScriptElementTypeId, HTMLSpanElementTypeId, HTMLSourceElementTypeId, HTMLStyleElementTypeId, HTMLTextAreaElementTypeId, - HTMLTableCaptionElementTypeId, HTMLTableElementTypeId, + HTMLTableElementTypeId, HTMLTableCaptionElementTypeId, HTMLTableCellElementTypeId, HTMLTableRowElementTypeId, HTMLTableSectionElementTypeId, HTMLTimeElementTypeId, HTMLTitleElementTypeId, HTMLUListElementTypeId, HTMLDListElementTypeId}; use dom::element::{HTMLHeadElement,HTMLHtmlElement, HTMLDivElement, HTMLParagraphElement, HTMLSpanElement}; @@ -42,8 +42,9 @@ use dom::htmlquoteelement::HTMLQuoteElement; use dom::htmlscriptelement::HTMLScriptElement; use dom::htmlsourceelement::HTMLSourceElement; use dom::htmlstyleelement::HTMLStyleElement; -use dom::htmltablecaptionelement::HTMLTableCaptionElement; use dom::htmltableelement::HTMLTableElement; +use dom::htmltablecaptionelement::HTMLTableCaptionElement; +use dom::htmltablecellelement::HTMLTableCellElement; use dom::htmltablerowelement::HTMLTableRowElement; use dom::htmltablesectionelement::HTMLTableSectionElement; use dom::htmltextareaelement::HTMLTextAreaElement; @@ -139,8 +140,9 @@ pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> *JSObject ElementNodeTypeId(HTMLSourceElementTypeId) => generate_element!(HTMLSourceElement), ElementNodeTypeId(HTMLSpanElementTypeId) => generate_element!(HTMLSpanElement), ElementNodeTypeId(HTMLStyleElementTypeId) => generate_element!(HTMLStyleElement), - ElementNodeTypeId(HTMLTableCaptionElementTypeId) => generate_element!(HTMLTableCaptionElement), ElementNodeTypeId(HTMLTableElementTypeId) => generate_element!(HTMLTableElement), + ElementNodeTypeId(HTMLTableCellElementTypeId) => generate_element!(HTMLTableCellElement), + ElementNodeTypeId(HTMLTableCaptionElementTypeId) => generate_element!(HTMLTableCaptionElement), ElementNodeTypeId(HTMLTableRowElementTypeId) => generate_element!(HTMLTableRowElement), ElementNodeTypeId(HTMLTableSectionElementTypeId) => generate_element!(HTMLTableSectionElement), ElementNodeTypeId(HTMLTextAreaElementTypeId) => generate_element!(HTMLTextAreaElement), diff --git a/src/components/script/dom/element.rs b/src/components/script/dom/element.rs index 5aaa4188f6b..b6e2b8ed897 100644 --- a/src/components/script/dom/element.rs +++ b/src/components/script/dom/element.rs @@ -16,8 +16,9 @@ use dom::bindings::codegen::{HTMLAnchorElementBinding, HTMLAppletElementBinding, HTMLOListElementBinding, HTMLParagraphElementBinding, HTMLQuoteElementBinding, HTMLScriptElementBinding, HTMLSourceElementBinding, HTMLSpanElementBinding, - HTMLStyleElementBinding, HTMLTableCaptionElementBinding, - HTMLTableElementBinding, HTMLTableRowElementBinding, + HTMLStyleElementBinding, HTMLTableElementBinding, + HTMLTableCaptionElementBinding, HTMLTableCellElementBinding, + HTMLTableRowElementBinding, HTMLTableSectionElementBinding, HTMLTextAreaElementBinding, HTMLTimeElementBinding, HTMLTitleElementBinding, HTMLUListElementBinding}; use dom::bindings::utils::{null_string, str}; @@ -45,8 +46,9 @@ use dom::htmlquoteelement::HTMLQuoteElement; use dom::htmlscriptelement::HTMLScriptElement; use dom::htmlsourceelement::HTMLSourceElement; use dom::htmlstyleelement::HTMLStyleElement; -use dom::htmltablecaptionelement::HTMLTableCaptionElement; use dom::htmltableelement::HTMLTableElement; +use dom::htmltablecaptionelement::HTMLTableCaptionElement; +use dom::htmltablecellelement::HTMLTableCellElement; use dom::htmltablerowelement::HTMLTableRowElement; use dom::htmltablesectionelement::HTMLTableSectionElement; use dom::htmltextareaelement::HTMLTextAreaElement; @@ -151,7 +153,6 @@ pub struct HTMLParagraphElement { parent: HTMLElement } pub struct HTMLSelectElement { parent: HTMLElement } pub struct HTMLSmallElement { parent: HTMLElement } pub struct HTMLSpanElement { parent: HTMLElement } -pub struct HTMLTableCellElement { parent: HTMLElement } pub struct UnknownElement { parent: HTMLElement } impl HTMLHtmlElement { @@ -258,6 +259,8 @@ generate_cacheable_wrapper!(HTMLTableElement, HTMLTableElementBinding::Wrap) generate_binding_object!(HTMLTableCaptionElement) generate_cacheable_wrapper!(HTMLTableCaptionElement, HTMLTableCaptionElementBinding::Wrap) generate_binding_object!(HTMLTableElement) +generate_cacheable_wrapper!(HTMLTableCellElement, HTMLTableCellElementBinding::Wrap) +generate_binding_object!(HTMLTableCellElement) generate_cacheable_wrapper!(HTMLTableRowElement, HTMLTableRowElementBinding::Wrap) generate_binding_object!(HTMLTableRowElement) generate_cacheable_wrapper!(HTMLTableSectionElement, HTMLTableSectionElementBinding::Wrap) diff --git a/src/components/script/dom/htmltablecellelement.rs b/src/components/script/dom/htmltablecellelement.rs new file mode 100644 index 00000000000..5a57a9ccb6d --- /dev/null +++ b/src/components/script/dom/htmltablecellelement.rs @@ -0,0 +1,117 @@ +/* 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 HTMLTableCellElement { + parent: HTMLElement, +} + +impl HTMLTableCellElement { + pub fn ColSpan(&self) -> u32 { + 0 + } + + pub fn SetColSpan(&self, _col_span: u32, _rv: &mut ErrorResult) { + } + + pub fn RowSpan(&self) -> u32 { + 0 + } + + pub fn SetRowSpan(&self, _col_span: u32, _rv: &mut ErrorResult) { + } + + pub fn Headers(&self) -> DOMString { + null_string + } + + pub fn SetHeaders(&self, _headers: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn CellIndex(&self) -> i32 { + 0 + } + + pub fn GetCellIndex(&self, _cell_index: i32, _rv: &mut ErrorResult) { + } + + pub fn Abbr(&self) -> DOMString { + null_string + } + + pub fn SetAbbr(&self, _abbr: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn Scope(&self) -> DOMString { + null_string + } + + pub fn SetScope(&self, _abbr: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn Align(&self) -> DOMString { + null_string + } + + pub fn SetAlign(&self, _align: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn Axis(&self) -> DOMString { + null_string + } + + pub fn SetAxis(&self, _axis: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn Height(&self) -> DOMString { + null_string + } + + pub fn SetHeight(&self, _height: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn Width(&self) -> DOMString { + null_string + } + + pub fn SetWidth(&self, _width: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn Ch(&self) -> DOMString { + null_string + } + + pub fn SetCh(&self, _ch: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn ChOff(&self) -> DOMString { + null_string + } + + pub fn SetChOff(&self, _ch_off: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn NoWrap(&self) -> bool { + false + } + + pub fn SetNoWrap(&self, _no_wrap: bool, _rv: &mut ErrorResult) { + } + + pub fn VAlign(&self) -> DOMString { + null_string + } + + pub fn SetVAlign(&self, _valign: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn BgColor(&self) -> DOMString { + null_string + } + + pub fn SetBgColor(&self, _bg_color: &DOMString, _rv: &mut ErrorResult) { + } +} diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index 8cb4c1b1fbc..677026ff761 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -24,7 +24,7 @@ use dom::element::{HTMLDivElement, HTMLFontElement, HTMLFormElement, HTMLInputElement, HTMLOptionElement, HTMLParagraphElement, HTMLListItemElement, HTMLSelectElement, HTMLSmallElement, - HTMLSpanElement, HTMLTableCellElement}; + HTMLSpanElement}; use dom::element::{HTMLHeadingElementTypeId, Heading1, Heading2, Heading3, Heading4, Heading5, Heading6}; use dom::htmlbrelement::HTMLBRElement; @@ -46,8 +46,9 @@ use dom::htmlquoteelement::HTMLQuoteElement; use dom::htmlscriptelement::HTMLScriptElement; use dom::htmlsourceelement::HTMLSourceElement; use dom::htmlstyleelement::HTMLStyleElement; -use dom::htmltablecaptionelement::HTMLTableCaptionElement; use dom::htmltableelement::HTMLTableElement; +use dom::htmltablecaptionelement::HTMLTableCaptionElement; +use dom::htmltablecellelement::HTMLTableCellElement; use dom::htmltablerowelement::HTMLTableRowElement; use dom::htmltablesectionelement::HTMLTableSectionElement; use dom::htmltextareaelement::HTMLTextAreaElement; diff --git a/src/components/script/script.rc b/src/components/script/script.rc index 7cdc31d3128..968b7fa8a5b 100644 --- a/src/components/script/script.rc +++ b/src/components/script/script.rc @@ -69,8 +69,9 @@ pub mod dom { pub mod HTMLSourceElementBinding; pub mod HTMLSpanElementBinding; pub mod HTMLStyleElementBinding; - pub mod HTMLTableCaptionElementBinding; pub mod HTMLTableElementBinding; + pub mod HTMLTableCellElementBinding; + pub mod HTMLTableCaptionElementBinding; pub mod HTMLTableRowElementBinding; pub mod HTMLTableSectionElementBinding; pub mod HTMLTextAreaElementBinding; @@ -119,8 +120,9 @@ pub mod dom { pub mod htmlscriptelement; pub mod htmlsourceelement; pub mod htmlstyleelement; - pub mod htmltablecaptionelement; pub mod htmltableelement; + pub mod htmltablecaptionelement; + pub mod htmltablecellelement; pub mod htmltablerowelement; pub mod htmltablesectionelement; pub mod htmltextareaelement; diff --git a/src/test/html/test_bindings.html b/src/test/html/test_bindings.html index 33d91e2e778..1fe9a5e88d6 100644 --- a/src/test/html/test_bindings.html +++ b/src/test/html/test_bindings.html @@ -26,7 +26,8 @@ <table> <caption>sample table</caption> <tbody> - <tr></tr> + <tr><td>head</td></tr> + <tr><td>data</td></tr> </tbody> </table> <section>section</section> diff --git a/src/test/html/test_bindings.js b/src/test/html/test_bindings.js index 1217975e7b6..d19c263c598 100644 --- a/src/test/html/test_bindings.js +++ b/src/test/html/test_bindings.js @@ -196,6 +196,20 @@ window.alert(tags.length); window.alert(tags[0].tagName); window.alert(tags[0] instanceof HTMLQuoteElement); +window.alert("HTMLTableCellElement:"); +let tags = document.getElementsByTagName("th"); +window.alert(tags); +window.alert(tags.length); +window.alert(tags[0].tagName); +window.alert(tags[0] instanceof HTMLTableCellElement); + +window.alert("HTMLTableCellElement:"); +let tags = document.getElementsByTagName("td"); +window.alert(tags); +window.alert(tags.length); +window.alert(tags[0].tagName); +window.alert(tags[0] instanceof HTMLTableCellElement); + //TODO: Doesn't work until we throw proper exceptions instead of returning 0 on // unwrap failure. /*try { |