auto merge of #709 : jdm/servo/webidl, r=jdm

This commit is contained in:
bors-servo 2013-08-09 09:18:40 -07:00
commit 96e928a653
13 changed files with 400 additions and 8 deletions

View file

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

View file

@ -4630,7 +4630,9 @@ class CGBindingRoot(CGThing):
'dom::htmlscriptelement::HTMLScriptElement',
'dom::htmlstyleelement::HTMLStyleElement',
'dom::htmltableelement::HTMLTableElement',
'dom::htmltablerowelement::HTMLTableRowElement',
'dom::htmltablesectionelement::HTMLTableSectionElement',
'dom::htmltextareaelement::HTMLTextAreaElement',
'dom::bindings::utils::*',
'dom::bindings::conversions::*',
'dom::blob::*', #XXXjdm

View file

@ -0,0 +1,37 @@
/* -*- 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 HTMLTableRowElement : HTMLElement {
readonly attribute long rowIndex;
readonly attribute long sectionRowIndex;
/*
readonly attribute HTMLCollection cells;
[Throws]
HTMLElement insertCell(optional long index = -1);
*/
[Throws]
void deleteCell(long index);
};
partial interface HTMLTableRowElement {
[SetterThrows]
attribute DOMString align;
[SetterThrows]
attribute DOMString ch;
[SetterThrows]
attribute DOMString chOff;
[SetterThrows]
attribute DOMString vAlign;
[TreatNullAs=EmptyString, SetterThrows] attribute DOMString bgColor;
};

View file

@ -0,0 +1,101 @@
/* -*- 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-textarea-element
* http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
* © 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 nsIEditor;
interface MozControllers;
*/
interface HTMLTextAreaElement : HTMLElement {
// attribute DOMString autocomplete;
[SetterThrows, Pure]
attribute boolean autofocus;
[SetterThrows, Pure]
attribute unsigned long cols;
// attribute DOMString dirName;
[SetterThrows, Pure]
attribute boolean disabled;
/*
[Pure]
readonly attribute HTMLFormElement? form;
*/
// attribute DOMString inputMode;
[SetterThrows, Pure]
attribute long maxLength;
[SetterThrows, Pure]
attribute DOMString name;
[SetterThrows, Pure]
attribute DOMString placeholder;
[SetterThrows, Pure]
attribute boolean readOnly;
[SetterThrows, Pure]
attribute boolean required;
[SetterThrows, Pure]
attribute unsigned long rows;
[SetterThrows, Pure]
attribute DOMString wrap;
[Constant]
readonly attribute DOMString type;
[SetterThrows, Pure]
attribute DOMString defaultValue;
[TreatNullAs=EmptyString] attribute DOMString value;
readonly attribute unsigned long textLength;
readonly attribute boolean willValidate;
/*
readonly attribute ValidityState validity;
*/
readonly attribute DOMString validationMessage;
boolean checkValidity();
void setCustomValidity(DOMString error);
/*
readonly attribute NodeList labels;
*/
void select();
[Throws]
attribute unsigned long selectionStart;
[Throws]
attribute unsigned long selectionEnd;
[Throws]
attribute DOMString selectionDirection;
void setRangeText(DOMString replacement);
/*
void setRangeText(DOMString replacement, unsigned long start, unsigned long end, optional SelectionMode selectionMode);
[Throws]
void setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction);
*/
};
/*
partial interface HTMLTextAreaElement {
// Mirrored chrome-only Mozilla extensions to nsIDOMHTMLTextAreaElement.
// Please make sure to update this list of nsIDOMHTMLTextAreaElement changes.
[Throws, ChromeOnly]
readonly attribute MozControllers controllers;
};
partial interface HTMLTextAreaElement {
// Mirrored chrome-only nsIDOMNSEditableElement methods. Please make sure
// to update this list if nsIDOMNSEditableElement changes.
[ChromeOnly]
readonly attribute nsIEditor? editor;
// This is similar to set .value on nsIDOMInput/TextAreaElements, but
// handling of the value change is closer to the normal user input, so
// 'change' event for example will be dispatched when focusing out the
// element.
[ChromeOnly]
void setUserInput(DOMString input);
};
*/

View file

@ -13,7 +13,8 @@ use dom::element::{HTMLBodyElementTypeId, HTMLHRElementTypeId, HTMLIframeElement
use dom::element::{HTMLBRElementTypeId};
use dom::element::{HTMLParagraphElementTypeId, HTMLScriptElementTypeId, HTMLMetaElementTypeId};
use dom::element::{HTMLOListElementTypeId, HTMLStyleElementTypeId, HTMLTableElementTypeId};
use dom::element::{HTMLTableSectionElementTypeId};
use dom::element::{HTMLTableRowElementTypeId, HTMLTableSectionElementTypeId};
use dom::element::{HTMLTextAreaElementTypeId};
use dom::element::{HTMLHeadElement, HTMLHtmlElement, HTMLDivElement, HTMLSpanElement};
use dom::element::{HTMLParagraphElement};
use dom::htmlelement::HTMLElement;
@ -28,7 +29,9 @@ use dom::htmlolistelement::HTMLOListElement;
use dom::htmlscriptelement::HTMLScriptElement;
use dom::htmlstyleelement::HTMLStyleElement;
use dom::htmltableelement::HTMLTableElement;
use dom::htmltablerowelement::HTMLTableRowElement;
use dom::htmltablesectionelement::HTMLTableSectionElement;
use dom::htmltextareaelement::HTMLTextAreaElement;
use dom::node::{AbstractNode, Node, ElementNodeTypeId, TextNodeTypeId, CommentNodeTypeId};
use dom::node::{DoctypeNodeTypeId, ScriptView, Text};
@ -111,7 +114,9 @@ pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> *JSObject
ElementNodeTypeId(HTMLSpanElementTypeId) => generate_element!(HTMLSpanElement),
ElementNodeTypeId(HTMLStyleElementTypeId) => generate_element!(HTMLStyleElement),
ElementNodeTypeId(HTMLTableElementTypeId) => generate_element!(HTMLTableElement),
ElementNodeTypeId(HTMLTableRowElementTypeId) => generate_element!(HTMLTableRowElement),
ElementNodeTypeId(HTMLTableSectionElementTypeId) => generate_element!(HTMLTableSectionElement),
ElementNodeTypeId(HTMLTextAreaElementTypeId) => generate_element!(HTMLTextAreaElement),
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, ..47]);
let protoArray = @mut ([0 as *JSObject, ..49]);
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,8 +11,8 @@ use dom::bindings::codegen::{HTMLHRElementBinding, HTMLIFrameElementBinding};
use dom::bindings::codegen::{HTMLParagraphElementBinding, HTMLScriptElementBinding};
use dom::bindings::codegen::{HTMLImageElementBinding, HTMLOListElementBinding};
use dom::bindings::codegen::{HTMLMetaElementBinding, HTMLStyleElementBinding};
use dom::bindings::codegen::{HTMLTableElementBinding};
use dom::bindings::codegen::{HTMLTableSectionElementBinding};
use dom::bindings::codegen::{HTMLTableElementBinding, HTMLTableRowElementBinding};
use dom::bindings::codegen::{HTMLTableSectionElementBinding, HTMLTextAreaElementBinding};
use dom::bindings::utils::{null_string, str};
use dom::bindings::utils::{BindingObject, CacheableWrapper, DOMString, ErrorResult, WrapperCache};
use dom::clientrect::ClientRect;
@ -30,7 +30,9 @@ use dom::htmlolistelement::HTMLOListElement;
use dom::htmlscriptelement::HTMLScriptElement;
use dom::htmlstyleelement::HTMLStyleElement;
use dom::htmltableelement::HTMLTableElement;
use dom::htmltablerowelement::HTMLTableRowElement;
use dom::htmltablesectionelement::HTMLTableSectionElement;
use dom::htmltextareaelement::HTMLTextAreaElement;
use dom::node::{ElementNodeTypeId, Node, ScriptView, AbstractNode};
use layout_interface::{ContentBoxQuery, ContentBoxResponse, ContentBoxesQuery};
use layout_interface::{ContentBoxesResponse};
@ -96,6 +98,7 @@ pub enum ElementTypeId {
HTMLTableCellElementTypeId,
HTMLTableElementTypeId,
HTMLTableRowElementTypeId,
HTMLTextAreaElementTypeId,
HTMLTitleElementTypeId,
HTMLUListElementTypeId,
UnknownElementTypeId,
@ -119,7 +122,6 @@ pub struct HTMLSelectElement { parent: HTMLElement }
pub struct HTMLSmallElement { parent: HTMLElement }
pub struct HTMLSpanElement { parent: HTMLElement }
pub struct HTMLTableCellElement { parent: HTMLElement }
pub struct HTMLTableRowElement { parent: HTMLElement }
pub struct HTMLTitleElement { parent: HTMLElement }
pub struct HTMLUListElement { parent: HTMLElement }
pub struct UnknownElement { parent: HTMLElement }
@ -208,8 +210,12 @@ generate_cacheable_wrapper!(HTMLStyleElement, HTMLStyleElementBinding::Wrap)
generate_binding_object!(HTMLStyleElement)
generate_cacheable_wrapper!(HTMLTableElement, HTMLTableElementBinding::Wrap)
generate_binding_object!(HTMLTableElement)
generate_cacheable_wrapper!(HTMLTableRowElement, HTMLTableRowElementBinding::Wrap)
generate_binding_object!(HTMLTableRowElement)
generate_cacheable_wrapper!(HTMLTableSectionElement, HTMLTableSectionElementBinding::Wrap)
generate_binding_object!(HTMLTableSectionElement)
generate_cacheable_wrapper!(HTMLTextAreaElement, HTMLTextAreaElementBinding::Wrap)
generate_binding_object!(HTMLTextAreaElement)
//
// Fancier elements

View file

@ -0,0 +1,66 @@
/* 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 HTMLTableRowElement {
parent: HTMLElement,
}
impl HTMLTableRowElement {
pub fn RowIndex(&self) -> i32 {
0
}
pub fn GetRowIndex(&self) -> i32 {
0
}
pub fn SectionRowIndex(&self) -> i32 {
0
}
pub fn GetSectionRowIndex(&self) -> i32 {
0
}
pub fn DeleteCell(&mut self, _index: i32, _rv: &mut ErrorResult) {
}
pub fn Align(&self) -> DOMString {
null_string
}
pub fn SetAlign(&self, _align: &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 VAlign(&self) -> DOMString {
null_string
}
pub fn SetVAlign(&self, _v_align: &DOMString, _rv: &mut ErrorResult) {
}
pub fn BgColor(&self) -> DOMString {
null_string
}
pub fn SetBgColor(&self, _bg_color: &DOMString, _rv: &mut ErrorResult) {
}
}

View file

@ -0,0 +1,155 @@
/* 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 HTMLTextAreaElement {
parent: HTMLElement,
}
impl HTMLTextAreaElement {
pub fn Autofocus(&self) -> bool {
false
}
pub fn SetAutofocus(&mut self, _autofocus: bool, _rv: &mut ErrorResult) {
}
pub fn Cols(&self) -> u32 {
0
}
pub fn SetCols(&self, _cols: u32, _rv: &mut ErrorResult) {
}
pub fn Disabled(&self) -> bool {
false
}
pub fn SetDisabled(&mut self, _disabled: bool, _rv: &mut ErrorResult) {
}
pub fn MaxLength(&self) -> i32 {
0
}
pub fn SetMaxLength(&self, _max_length: i32, _rv: &mut ErrorResult) {
}
pub fn Name(&self) -> DOMString {
null_string
}
pub fn SetName(&mut self, _name: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Placeholder(&self) -> DOMString {
null_string
}
pub fn SetPlaceholder(&mut self, _placeholder: &DOMString, _rv: &mut ErrorResult) {
}
pub fn ReadOnly(&self) -> bool {
false
}
pub fn SetReadOnly(&mut self, _read_only: bool, _rv: &mut ErrorResult) {
}
pub fn Required(&self) -> bool {
false
}
pub fn SetRequired(&mut self, _required: bool, _rv: &mut ErrorResult) {
}
pub fn Rows(&self) -> u32 {
0
}
pub fn SetRows(&self, _rows: u32, _rv: &mut ErrorResult) {
}
pub fn Wrap(&self) -> DOMString {
null_string
}
pub fn SetWrap(&mut self, _wrap: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Type(&self) -> DOMString {
null_string
}
pub fn SetType(&mut self, _type: &DOMString) {
}
pub fn DefaultValue(&self) -> DOMString {
null_string
}
pub fn SetDefaultValue(&mut self, _default_value: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Value(&self) -> DOMString {
null_string
}
pub fn SetValue(&mut self, _value: &DOMString) {
}
pub fn TextLength(&self) -> u32 {
0
}
pub fn SetTextLength(&self, _text_length: u32, _rv: &mut ErrorResult) {
}
pub fn WillValidate(&self) -> bool {
false
}
pub fn SetWillValidate(&mut self, _will_validate: bool, _rv: &mut ErrorResult) {
}
pub fn ValidationMessage(&self) -> DOMString {
null_string
}
pub fn CheckValidity(&self) -> bool {
false
}
pub fn SetCustomValidity(&self, _error: &DOMString) {
}
pub fn Select(&self) {
}
pub fn GetSelectionStart(&self, _rv: &mut ErrorResult) -> u32 {
0
}
pub fn SetSelectionStart(&self, _selection_start: u32, _rv: &mut ErrorResult) {
}
pub fn GetSelectionEnd(&self, _rv: &mut ErrorResult) -> u32 {
0
}
pub fn SetSelectionEnd(&self, _selection_end: u32, _rv: &mut ErrorResult) {
}
pub fn GetSelectionDirection(&self, _rv: &mut ErrorResult) -> DOMString {
null_string
}
pub fn SetSelectionDirection(&self, _selection_direction: &DOMString, _rv: &mut ErrorResult) {
}
pub fn SetRangeText(&self, _replacement: &DOMString) {
}
}

View file

@ -14,7 +14,8 @@ use dom::element::{HTMLElementTypeId,
HTMLSelectElementTypeId, HTMLSmallElementTypeId,
HTMLSpanElementTypeId, HTMLStyleElementTypeId, HTMLTableSectionElementTypeId,
HTMLTableCellElementTypeId, HTMLTableElementTypeId,
HTMLTableRowElementTypeId, HTMLTitleElementTypeId, HTMLUListElementTypeId,
HTMLTableRowElementTypeId, HTMLTextAreaElementTypeId,
HTMLTitleElementTypeId, HTMLUListElementTypeId,
UnknownElementTypeId};
use dom::element::{HTMLDivElement, HTMLFontElement, HTMLFormElement,
HTMLHeadElement, HTMLHeadingElement, HTMLHtmlElement,
@ -22,7 +23,7 @@ use dom::element::{HTMLDivElement, HTMLFontElement, HTMLFormElement,
HTMLOptionElement, HTMLParagraphElement, HTMLListItemElement,
HTMLSelectElement, HTMLSmallElement,
HTMLSpanElement,
HTMLTableCellElement, HTMLTableRowElement,
HTMLTableCellElement,
HTMLTitleElement, HTMLUListElement};
use dom::element::{HTMLHeadingElementTypeId, Heading1, Heading2, Heading3, Heading4, Heading5,
Heading6};
@ -37,7 +38,9 @@ use dom::htmlolistelement::HTMLOListElement;
use dom::htmlscriptelement::HTMLScriptElement;
use dom::htmlstyleelement::HTMLStyleElement;
use dom::htmltableelement::HTMLTableElement;
use dom::htmltablerowelement::HTMLTableRowElement;
use dom::htmltablesectionelement::HTMLTableSectionElement;
use dom::htmltextareaelement::HTMLTextAreaElement;
use dom::element::{Element, Attr};
use dom::htmlelement::HTMLElement;
use dom::node::{AbstractNode, Comment, Doctype, ElementNodeTypeId, Node, ScriptView};
@ -236,6 +239,7 @@ fn build_element_from_tag(cx: *JSContext, tag: &str) -> AbstractNode<ScriptView>
handle_element!(cx, tag, "tbody", HTMLTableSectionElementTypeId, HTMLTableSectionElement, []);
handle_element!(cx, tag, "td", HTMLTableCellElementTypeId, HTMLTableCellElement, []);
handle_element!(cx, tag, "table", HTMLTableElementTypeId, HTMLTableElement, []);
handle_element!(cx, tag, "textarea",HTMLTextAreaElementTypeId, HTMLTextAreaElement, []);
handle_element!(cx, tag, "tr", HTMLTableRowElementTypeId, HTMLTableRowElement, []);
handle_element!(cx, tag, "title", HTMLTitleElementTypeId, HTMLTitleElement, []);
handle_element!(cx, tag, "ul", HTMLUListElementTypeId, HTMLUListElement, []);

View file

@ -61,7 +61,9 @@ pub mod dom {
pub mod HTMLSpanElementBinding;
pub mod HTMLStyleElementBinding;
pub mod HTMLTableElementBinding;
pub mod HTMLTableRowElementBinding;
pub mod HTMLTableSectionElementBinding;
pub mod HTMLTextAreaElementBinding;
pub mod MouseEventBinding;
pub mod NodeBinding;
pub mod PrototypeList;
@ -96,7 +98,9 @@ pub mod dom {
pub mod htmlscriptelement;
pub mod htmlstyleelement;
pub mod htmltableelement;
pub mod htmltablerowelement;
pub mod htmltablesectionelement;
pub mod htmltextareaelement;
pub mod mouseevent;
pub mod node;
pub mod uievent;

View file

@ -21,11 +21,14 @@
<iframe></iframe>
<ol type="1"></ol>
<table>
<tbody></tbody>
<tbody>
<tr></tr>
</tbody>
</table>
<section>section</section>
<aside>aside</aside>
<b>b</b>
<i>i</i>
<textarea>textarea</textarea>
</body>
</html>

View file

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