Skip to content

Commit

Permalink
Generate bindings for HTMLQuoteElement.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tetsuharu OHZEKI committed Aug 23, 2013
1 parent a074267 commit 2878f44
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/components/script/dom/bindings/codegen/Bindings.conf
Expand Up @@ -565,6 +565,7 @@ addHTMLElement('HTMLLinkElement')
addHTMLElement('HTMLMetaElement')
addHTMLElement('HTMLOListElement')
addHTMLElement('HTMLParagraphElement')
addHTMLElement('HTMLQuoteElement')
addHTMLElement('HTMLScriptElement')
addHTMLElement('HTMLSourceElement')
addHTMLElement('HTMLSpanElement')
Expand Down
1 change: 1 addition & 0 deletions src/components/script/dom/bindings/codegen/CodegenRust.py
Expand Up @@ -4634,6 +4634,7 @@ def makeEnumTypedef(e):
'dom::htmllinkelement::HTMLLinkElement', #XXXrecrack
'dom::htmlmetaelement::HTMLMetaElement',
'dom::htmlolistelement::HTMLOListElement',
'dom::htmlquoteelement::HTMLQuoteElement',
'dom::htmlscriptelement::HTMLScriptElement',
'dom::htmlsourceelement::HTMLSourceElement',
'dom::htmlstyleelement::HTMLStyleElement',
Expand Down
19 changes: 19 additions & 0 deletions src/components/script/dom/bindings/codegen/HTMLQuoteElement.webidl
@@ -0,0 +1,19 @@
/* -*- 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-blockquote-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-blockquote-element
interface HTMLQuoteElement : HTMLElement {
[SetterThrows, Pure]
attribute DOMString cite;
};

4 changes: 3 additions & 1 deletion src/components/script/dom/bindings/node.rs
Expand Up @@ -15,7 +15,7 @@ use dom::element::{HTMLElementTypeId,
HTMLHtmlElementTypeId, HTMLIframeElementTypeId, HTMLImageElementTypeId,
HTMLLinkElementTypeId,
HTMLMetaElementTypeId, HTMLOListElementTypeId,
HTMLParagraphElementTypeId, HTMLScriptElementTypeId,
HTMLParagraphElementTypeId, HTMLQuoteElementTypeId, HTMLScriptElementTypeId,
HTMLSpanElementTypeId, HTMLSourceElementTypeId,
HTMLStyleElementTypeId, HTMLTextAreaElementTypeId,
HTMLTableCaptionElementTypeId, HTMLTableElementTypeId,
Expand All @@ -38,6 +38,7 @@ use dom::htmlimageelement::HTMLImageElement;
use dom::htmllinkelement::HTMLLinkElement;
use dom::htmlmetaelement::HTMLMetaElement;
use dom::htmlolistelement::HTMLOListElement;
use dom::htmlquoteelement::HTMLQuoteElement;
use dom::htmlscriptelement::HTMLScriptElement;
use dom::htmlsourceelement::HTMLSourceElement;
use dom::htmlstyleelement::HTMLStyleElement;
Expand Down Expand Up @@ -133,6 +134,7 @@ pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> *JSObject
ElementNodeTypeId(HTMLMetaElementTypeId) => generate_element!(HTMLMetaElement),
ElementNodeTypeId(HTMLOListElementTypeId) => generate_element!(HTMLOListElement),
ElementNodeTypeId(HTMLParagraphElementTypeId) => generate_element!(HTMLParagraphElement),
ElementNodeTypeId(HTMLQuoteElementTypeId) => generate_element!(HTMLQuoteElement),
ElementNodeTypeId(HTMLScriptElementTypeId) => generate_element!(HTMLScriptElement),
ElementNodeTypeId(HTMLSourceElementTypeId) => generate_element!(HTMLSourceElement),
ElementNodeTypeId(HTMLSpanElementTypeId) => generate_element!(HTMLSpanElement),
Expand Down
5 changes: 5 additions & 0 deletions src/components/script/dom/element.rs
Expand Up @@ -14,6 +14,7 @@ use dom::bindings::codegen::{HTMLAnchorElementBinding, HTMLAppletElementBinding,
HTMLImageElementBinding, HTMLMetaElementBinding,
HTMLLinkElementBinding,
HTMLOListElementBinding, HTMLParagraphElementBinding,
HTMLQuoteElementBinding,
HTMLScriptElementBinding, HTMLSourceElementBinding, HTMLSpanElementBinding,
HTMLStyleElementBinding, HTMLTableCaptionElementBinding,
HTMLTableElementBinding, HTMLTableRowElementBinding,
Expand All @@ -40,6 +41,7 @@ use dom::htmlimageelement::HTMLImageElement;
use dom::htmllinkelement::HTMLLinkElement;
use dom::htmlmetaelement::HTMLMetaElement;
use dom::htmlolistelement::HTMLOListElement;
use dom::htmlquoteelement::HTMLQuoteElement;
use dom::htmlscriptelement::HTMLScriptElement;
use dom::htmlsourceelement::HTMLSourceElement;
use dom::htmlstyleelement::HTMLStyleElement;
Expand Down Expand Up @@ -114,6 +116,7 @@ pub enum ElementTypeId {
HTMLOListElementTypeId,
HTMLOptionElementTypeId,
HTMLParagraphElementTypeId,
HTMLQuoteElementTypeId,
HTMLScriptElementTypeId,
HTMLSelectElementTypeId,
HTMLSmallElementTypeId,
Expand Down Expand Up @@ -241,6 +244,8 @@ generate_cacheable_wrapper!(HTMLOListElement, HTMLOListElementBinding::Wrap)
generate_binding_object!(HTMLOListElement)
generate_cacheable_wrapper!(HTMLParagraphElement, HTMLParagraphElementBinding::Wrap)
generate_binding_object!(HTMLParagraphElement)
generate_cacheable_wrapper!(HTMLQuoteElement, HTMLQuoteElementBinding::Wrap)
generate_binding_object!(HTMLQuoteElement)
generate_cacheable_wrapper!(HTMLScriptElement, HTMLScriptElementBinding::Wrap)
generate_binding_object!(HTMLScriptElement)
generate_cacheable_wrapper!(HTMLSourceElement, HTMLSourceElementBinding::Wrap)
Expand Down
19 changes: 19 additions & 0 deletions src/components/script/dom/htmlquoteelement.rs
@@ -0,0 +1,19 @@
/* 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 HTMLQuoteElement {
parent: HTMLElement,
}

impl HTMLQuoteElement {
pub fn Cite(&self) -> DOMString {
null_string
}

pub fn SetCite(&self, _cite: &DOMString, _rv: &mut ErrorResult) {
}
}
4 changes: 3 additions & 1 deletion src/components/script/html/hubbub_html_parser.rs
Expand Up @@ -12,7 +12,7 @@ use dom::element::{HTMLElementTypeId,
HTMLImageElementTypeId, HTMLIframeElementTypeId, HTMLInputElementTypeId,
HTMLLinkElementTypeId, HTMLListItemElementTypeId,
HTMLMetaElementTypeId, HTMLOListElementTypeId, HTMLOptionElementTypeId,
HTMLParagraphElementTypeId, HTMLScriptElementTypeId,
HTMLParagraphElementTypeId, HTMLQuoteElementTypeId, HTMLScriptElementTypeId,
HTMLSelectElementTypeId, HTMLSmallElementTypeId, HTMLSourceElementTypeId,
HTMLSpanElementTypeId, HTMLStyleElementTypeId, HTMLTableSectionElementTypeId,
HTMLTableCellElementTypeId, HTMLTableElementTypeId,
Expand Down Expand Up @@ -42,6 +42,7 @@ use dom::htmlimageelement::HTMLImageElement;
use dom::htmllinkelement::HTMLLinkElement;
use dom::htmlmetaelement::HTMLMetaElement;
use dom::htmlolistelement::HTMLOListElement;
use dom::htmlquoteelement::HTMLQuoteElement;
use dom::htmlscriptelement::HTMLScriptElement;
use dom::htmlsourceelement::HTMLSourceElement;
use dom::htmlstyleelement::HTMLStyleElement;
Expand Down Expand Up @@ -255,6 +256,7 @@ fn build_element_from_tag(cx: *JSContext, tag: &str) -> AbstractNode<ScriptView>
handle_element!(cx, tag, "ol", HTMLOListElementTypeId, HTMLOListElement, []);
handle_element!(cx, tag, "option", HTMLOptionElementTypeId, HTMLOptionElement, []);
handle_element!(cx, tag, "p", HTMLParagraphElementTypeId, HTMLParagraphElement, []);
handle_element!(cx, tag, "q", HTMLQuoteElementTypeId, HTMLQuoteElement, []);
handle_element!(cx, tag, "script", HTMLScriptElementTypeId, HTMLScriptElement, []);
handle_element!(cx, tag, "select", HTMLSelectElementTypeId, HTMLSelectElement, []);
handle_element!(cx, tag, "small", HTMLSmallElementTypeId, HTMLSmallElement, []);
Expand Down
2 changes: 2 additions & 0 deletions src/components/script/script.rc
Expand Up @@ -64,6 +64,7 @@ pub mod dom {
pub mod HTMLMetaElementBinding;
pub mod HTMLOListElementBinding;
pub mod HTMLParagraphElementBinding;
pub mod HTMLQuoteElementBinding;
pub mod HTMLScriptElementBinding;
pub mod HTMLSourceElementBinding;
pub mod HTMLSpanElementBinding;
Expand Down Expand Up @@ -114,6 +115,7 @@ pub mod dom {
pub mod htmllinkelement;
pub mod htmlmetaelement;
pub mod htmlolistelement;
pub mod htmlquoteelement;
pub mod htmlscriptelement;
pub mod htmlsourceelement;
pub mod htmlstyleelement;
Expand Down
1 change: 1 addition & 0 deletions src/test/html/test_bindings.html
Expand Up @@ -19,6 +19,7 @@
<hr />
<canvas/>
<p>pppppppppp</p>
<q>qqqqqqqqqqqqqqqqqqqqqqqqqqq</q>
<applet></applet>
<iframe></iframe>
<ol type="1"></ol>
Expand Down
7 changes: 7 additions & 0 deletions src/test/html/test_bindings.js
Expand Up @@ -189,6 +189,13 @@ window.alert(tags.length);
window.alert(tags[0].tagName);
window.alert(tags[0] instanceof HTMLTextAreaElement);

window.alert("HTMLQuoteElement:");
let tags = document.getElementsByTagName("q");
window.alert(tags);
window.alert(tags.length);
window.alert(tags[0].tagName);
window.alert(tags[0] instanceof HTMLQuoteElement);

//TODO: Doesn't work until we throw proper exceptions instead of returning 0 on
// unwrap failure.
/*try {
Expand Down

0 comments on commit 2878f44

Please sign in to comment.