Skip to content

Commit

Permalink
Generate bindings for HTMLProgressElement.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tetsuharu OHZEKI committed Aug 24, 2013
1 parent 9b28443 commit 4fc2f74
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/components/script/dom/bindings/codegen/Bindings.conf
Expand Up @@ -567,6 +567,7 @@ addHTMLElement('HTMLLinkElement')
addHTMLElement('HTMLMetaElement')
addHTMLElement('HTMLOListElement')
addHTMLElement('HTMLParagraphElement')
addHTMLElement('HTMLProgressElement')
addHTMLElement('HTMLQuoteElement')
addHTMLElement('HTMLScriptElement')
addHTMLElement('HTMLSourceElement')
Expand Down
1 change: 1 addition & 0 deletions src/components/script/dom/bindings/codegen/CodegenRust.py
Expand Up @@ -4636,6 +4636,7 @@ def makeEnumTypedef(e):
'dom::htmllinkelement::HTMLLinkElement', #XXXrecrack
'dom::htmlmetaelement::HTMLMetaElement',
'dom::htmlolistelement::HTMLOListElement',
'dom::htmlprogresselement::HTMLProgressElement',
'dom::htmlquoteelement::HTMLQuoteElement',
'dom::htmlscriptelement::HTMLScriptElement',
'dom::htmlsourceelement::HTMLSourceElement',
Expand Down
@@ -0,0 +1,27 @@
/* -*- 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-progress-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.
*/

// original import from:
// http://hg.mozilla.org/mozilla-central/filelog/8c240c67f76c/dom/webidl/HTMLProgressElement.webidl

interface HTMLProgressElement : HTMLElement {
[SetterThrows]
attribute double value;
[SetterThrows]
attribute double max;
readonly attribute double position;

/*
readonly attribute NodeList labels;
*/
};
5 changes: 4 additions & 1 deletion src/components/script/dom/bindings/node.rs
Expand Up @@ -15,7 +15,8 @@ use dom::element::{HTMLElementTypeId,
HTMLHtmlElementTypeId, HTMLIframeElementTypeId, HTMLImageElementTypeId,
HTMLInputElementTypeId, HTMLLIElementTypeId, HTMLLinkElementTypeId,
HTMLMetaElementTypeId, HTMLOListElementTypeId,
HTMLParagraphElementTypeId, HTMLQuoteElementTypeId, HTMLScriptElementTypeId,
HTMLParagraphElementTypeId, HTMLProgressElementTypeId,
HTMLQuoteElementTypeId, HTMLScriptElementTypeId,
HTMLSpanElementTypeId, HTMLSourceElementTypeId,
HTMLStyleElementTypeId, HTMLTextAreaElementTypeId,
HTMLTableElementTypeId, HTMLTableCaptionElementTypeId, HTMLTableCellElementTypeId,
Expand All @@ -41,6 +42,7 @@ use dom::htmllielement::HTMLLIElement;
use dom::htmllinkelement::HTMLLinkElement;
use dom::htmlmetaelement::HTMLMetaElement;
use dom::htmlolistelement::HTMLOListElement;
use dom::htmlprogresselement::HTMLProgressElement;
use dom::htmlquoteelement::HTMLQuoteElement;
use dom::htmlscriptelement::HTMLScriptElement;
use dom::htmlsourceelement::HTMLSourceElement;
Expand Down Expand Up @@ -141,6 +143,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(HTMLProgressElementTypeId) => generate_element!(HTMLProgressElement),
ElementNodeTypeId(HTMLQuoteElementTypeId) => generate_element!(HTMLQuoteElement),
ElementNodeTypeId(HTMLScriptElementTypeId) => generate_element!(HTMLScriptElement),
ElementNodeTypeId(HTMLSourceElementTypeId) => generate_element!(HTMLSourceElement),
Expand Down
6 changes: 5 additions & 1 deletion src/components/script/dom/element.rs
Expand Up @@ -15,7 +15,7 @@ use dom::bindings::codegen::{HTMLAnchorElementBinding, HTMLAppletElementBinding,
HTMLLIElementBinding,
HTMLLinkElementBinding, HTMLMetaElementBinding,
HTMLOListElementBinding, HTMLParagraphElementBinding,
HTMLQuoteElementBinding,
HTMLProgressElementBinding, HTMLQuoteElementBinding,
HTMLScriptElementBinding, HTMLSourceElementBinding, HTMLSpanElementBinding,
HTMLStyleElementBinding, HTMLTableElementBinding,
HTMLTableCaptionElementBinding, HTMLTableCellElementBinding,
Expand Down Expand Up @@ -45,6 +45,7 @@ use dom::htmllielement::HTMLLIElement;
use dom::htmllinkelement::HTMLLinkElement;
use dom::htmlmetaelement::HTMLMetaElement;
use dom::htmlolistelement::HTMLOListElement;
use dom::htmlprogresselement::HTMLProgressElement;
use dom::htmlquoteelement::HTMLQuoteElement;
use dom::htmlscriptelement::HTMLScriptElement;
use dom::htmlsourceelement::HTMLSourceElement;
Expand Down Expand Up @@ -122,6 +123,7 @@ pub enum ElementTypeId {
HTMLOListElementTypeId,
HTMLOptionElementTypeId,
HTMLParagraphElementTypeId,
HTMLProgressElementTypeId,
HTMLQuoteElementTypeId,
HTMLScriptElementTypeId,
HTMLSelectElementTypeId,
Expand Down Expand Up @@ -252,6 +254,8 @@ generate_cacheable_wrapper!(HTMLOListElement, HTMLOListElementBinding::Wrap)
generate_binding_object!(HTMLOListElement)
generate_cacheable_wrapper!(HTMLParagraphElement, HTMLParagraphElementBinding::Wrap)
generate_binding_object!(HTMLParagraphElement)
generate_cacheable_wrapper!(HTMLProgressElement, HTMLProgressElementBinding::Wrap)
generate_binding_object!(HTMLProgressElement)
generate_cacheable_wrapper!(HTMLQuoteElement, HTMLQuoteElementBinding::Wrap)
generate_binding_object!(HTMLQuoteElement)
generate_cacheable_wrapper!(HTMLScriptElement, HTMLScriptElementBinding::Wrap)
Expand Down
34 changes: 34 additions & 0 deletions src/components/script/dom/htmlprogresselement.rs
@@ -0,0 +1,34 @@
/* 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::{ErrorResult};
use dom::htmlelement::HTMLElement;

pub struct HTMLProgressElement {
parent: HTMLElement,
}

impl HTMLProgressElement {
pub fn Value(&self) -> f64 {
0f64
}

pub fn SetValue(&mut self, _value: f64, _rv: &mut ErrorResult) {
}

pub fn Max(&self) -> f64 {
0f64
}

pub fn SetMax(&mut self, _max: f64, _rv: &mut ErrorResult) {
}

pub fn Position(&self) -> f64 {
0f64
}

pub fn GetPositiom(&self, _rv: &mut ErrorResult) -> f64 {
0f64
}
}
5 changes: 4 additions & 1 deletion src/components/script/html/hubbub_html_parser.rs
Expand Up @@ -12,7 +12,8 @@ use dom::element::{HTMLElementTypeId,
HTMLImageElementTypeId, HTMLIframeElementTypeId, HTMLInputElementTypeId,
HTMLLinkElementTypeId, HTMLLIElementTypeId,
HTMLMetaElementTypeId, HTMLOListElementTypeId, HTMLOptionElementTypeId,
HTMLParagraphElementTypeId, HTMLQuoteElementTypeId, HTMLScriptElementTypeId,
HTMLParagraphElementTypeId, HTMLProgressElementTypeId,
HTMLQuoteElementTypeId, HTMLScriptElementTypeId,
HTMLSelectElementTypeId, HTMLSmallElementTypeId, HTMLSourceElementTypeId,
HTMLSpanElementTypeId, HTMLStyleElementTypeId, HTMLTableSectionElementTypeId,
HTMLTableCellElementTypeId, HTMLTableElementTypeId,
Expand Down Expand Up @@ -44,6 +45,7 @@ use dom::htmllielement::HTMLLIElement;
use dom::htmllinkelement::HTMLLinkElement;
use dom::htmlmetaelement::HTMLMetaElement;
use dom::htmlolistelement::HTMLOListElement;
use dom::htmlprogresselement::HTMLProgressElement;
use dom::htmlquoteelement::HTMLQuoteElement;
use dom::htmlscriptelement::HTMLScriptElement;
use dom::htmlsourceelement::HTMLSourceElement;
Expand Down Expand Up @@ -260,6 +262,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, "progress",HTMLProgressElementTypeId, HTMLProgressElement, []);
handle_element!(cx, tag, "q", HTMLQuoteElementTypeId, HTMLQuoteElement, []);
handle_element!(cx, tag, "script", HTMLScriptElementTypeId, HTMLScriptElement, []);
handle_element!(cx, tag, "select", HTMLSelectElementTypeId, HTMLSelectElement, []);
Expand Down
2 changes: 2 additions & 0 deletions src/components/script/script.rc
Expand Up @@ -66,6 +66,7 @@ pub mod dom {
pub mod HTMLMetaElementBinding;
pub mod HTMLOListElementBinding;
pub mod HTMLParagraphElementBinding;
pub mod HTMLProgressElementBinding;
pub mod HTMLQuoteElementBinding;
pub mod HTMLScriptElementBinding;
pub mod HTMLSourceElementBinding;
Expand Down Expand Up @@ -121,6 +122,7 @@ pub mod dom {
pub mod htmllinkelement;
pub mod htmlmetaelement;
pub mod htmlolistelement;
pub mod htmlprogresselement;
pub mod htmlquoteelement;
pub mod htmlscriptelement;
pub mod htmlsourceelement;
Expand Down
1 change: 1 addition & 0 deletions src/test/html/test_bindings.html
Expand Up @@ -20,6 +20,7 @@
<canvas/>
<p>pppppppppp</p>
<q>qqqqqqqqqqqqqqqqqqqqqqqqqqq</q>
<progress max="100" value="80">80%</progress>
<applet></applet>
<input type="text" value="input"/>
<iframe></iframe>
Expand Down
7 changes: 7 additions & 0 deletions src/test/html/test_bindings.js
Expand Up @@ -234,6 +234,13 @@ window.alert(tags.length);
window.alert(tags[0].tagName);
window.alert(tags[0] instanceof HTMLLLIElement);

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

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

5 comments on commit 4fc2f74

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from jdm
at tetsuharuohzeki@4fc2f74

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging saneyuki/servo/webidl = 4fc2f74 into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saneyuki/servo/webidl = 4fc2f74 merged ok, testing candidate = 5647ca6

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 5647ca6

Please sign in to comment.