auto merge of #698 : jdm/servo/elements, r=jdm

Rebased from #694.
This commit is contained in:
bors-servo 2013-08-08 08:51:39 -07:00
commit a8b03857fc
14 changed files with 330 additions and 10 deletions

View file

@ -554,10 +554,13 @@ addHTMLElement('HTMLHtmlElement')
addHTMLElement('HTMLHRElement')
addHTMLElement('HTMLIFrameElement')
addHTMLElement('HTMLImageElement')
addHTMLElement('HTMLMetaElement')
addHTMLElement('HTMLOListElement')
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

@ -4624,8 +4624,11 @@ class CGBindingRoot(CGThing):
'dom::htmlhrelement::HTMLHRElement',
'dom::htmliframeelement::HTMLIFrameElement', #XXXjdm
'dom::htmlimageelement::HTMLImageElement', #XXXjdm
'dom::htmlmetaelement::HTMLMetaElement',
'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,28 @@
/* -*- 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-meta-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.
*/
// http://www.whatwg.org/specs/web-apps/current-work/#the-meta-element
interface HTMLMetaElement : HTMLElement {
[SetterThrows, Pure]
attribute DOMString name;
[SetterThrows, Pure]
attribute DOMString httpEquiv;
[SetterThrows, Pure]
attribute DOMString content;
};
// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
partial interface HTMLMetaElement {
[SetterThrows, Pure]
attribute DOMString scheme;
};

View file

@ -0,0 +1,23 @@
/* -*- 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-style-element
* http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
*/
interface HTMLStyleElement : HTMLElement {
[Pure]
attribute boolean disabled;
[SetterThrows, Pure]
attribute DOMString media;
[SetterThrows, Pure]
attribute DOMString type;
[SetterThrows, Pure]
attribute boolean scoped;
};
// TODO:
// HTMLStyleElement implements LinkStyle;

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

@ -9,8 +9,8 @@ use dom::bindings::utils::{CacheableWrapper, WrapperCache, DerivedWrapper};
use dom::element::{HTMLHeadElementTypeId, HTMLHtmlElementTypeId, HTMLAnchorElementTypeId};
use dom::element::{HTMLDivElementTypeId, HTMLImageElementTypeId, HTMLSpanElementTypeId};
use dom::element::{HTMLBodyElementTypeId, HTMLHRElementTypeId, HTMLIframeElementTypeId};
use dom::element::{HTMLParagraphElementTypeId, HTMLScriptElementTypeId};
use dom::element::{HTMLOListElementTypeId};
use dom::element::{HTMLParagraphElementTypeId, HTMLScriptElementTypeId, HTMLMetaElementTypeId};
use dom::element::{HTMLOListElementTypeId, HTMLStyleElementTypeId, HTMLTableElementTypeId};
use dom::element::{HTMLHeadElement, HTMLHtmlElement, HTMLDivElement, HTMLSpanElement};
use dom::element::{HTMLParagraphElement};
use dom::htmlanchorelement::HTMLAnchorElement;
@ -18,8 +18,11 @@ use dom::htmlbodyelement::HTMLBodyElement;
use dom::htmlhrelement::HTMLHRElement;
use dom::htmliframeelement::HTMLIFrameElement;
use dom::htmlimageelement::HTMLImageElement;
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};
@ -93,10 +96,13 @@ pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> *JSObject
ElementNodeTypeId(HTMLHtmlElementTypeId) => generate_element!(HTMLHtmlElement),
ElementNodeTypeId(HTMLIframeElementTypeId) => generate_element!(HTMLIFrameElement),
ElementNodeTypeId(HTMLImageElementTypeId) => generate_element!(HTMLImageElement),
ElementNodeTypeId(HTMLMetaElementTypeId) => generate_element!(HTMLMetaElement),
ElementNodeTypeId(HTMLOListElementTypeId) => generate_element!(HTMLOListElement),
ElementNodeTypeId(HTMLParagraphElementTypeId) => generate_element!(HTMLParagraphElement),
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, ..42]);
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

@ -10,6 +10,8 @@ use dom::bindings::codegen::{HTMLHRElementBinding, HTMLIFrameElementBinding};
use dom::bindings::codegen::{HTMLParagraphElementBinding, HTMLScriptElementBinding};
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;
@ -21,8 +23,11 @@ use dom::htmlelement::HTMLElement;
use dom::htmlhrelement::HTMLHRElement;
use dom::htmliframeelement::HTMLIFrameElement;
use dom::htmlimageelement::HTMLImageElement;
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};
@ -112,17 +117,14 @@ pub struct HTMLInputElement { parent: HTMLElement }
pub struct HTMLItalicElement { parent: HTMLElement }
pub struct HTMLLinkElement { parent: HTMLElement }
pub struct HTMLListItemElement { parent: HTMLElement }
pub struct HTMLMetaElement { parent: HTMLElement }
pub struct HTMLOptionElement { parent: HTMLElement }
pub struct HTMLParagraphElement { parent: HTMLElement }
pub struct HTMLSectionElement { parent: HTMLElement }
pub struct HTMLSelectElement { parent: HTMLElement }
pub struct HTMLSmallElement { parent: HTMLElement }
pub struct HTMLSpanElement { parent: HTMLElement }
pub struct HTMLStyleElement { 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 }
@ -196,6 +198,8 @@ generate_cacheable_wrapper!(HTMLIFrameElement, HTMLIFrameElementBinding::Wrap)
generate_binding_object!(HTMLIFrameElement)
generate_cacheable_wrapper!(HTMLImageElement, HTMLImageElementBinding::Wrap)
generate_binding_object!(HTMLImageElement)
generate_cacheable_wrapper!(HTMLMetaElement, HTMLMetaElementBinding::Wrap)
generate_binding_object!(HTMLMetaElement)
generate_cacheable_wrapper!(HTMLOListElement, HTMLOListElementBinding::Wrap)
generate_binding_object!(HTMLOListElement)
generate_cacheable_wrapper!(HTMLParagraphElement, HTMLParagraphElementBinding::Wrap)
@ -204,6 +208,10 @@ generate_cacheable_wrapper!(HTMLScriptElement, HTMLScriptElementBinding::Wrap)
generate_binding_object!(HTMLScriptElement)
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,40 @@
/* 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 HTMLMetaElement {
parent: HTMLElement,
}
impl HTMLMetaElement {
pub fn Name(&self) -> DOMString {
null_string
}
pub fn SetName(&mut self, _name: &DOMString, _rv: &mut ErrorResult) {
}
pub fn HttpEquiv(&self) -> DOMString {
null_string
}
pub fn SetHttpEquiv(&mut self, _http_equiv: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Content(&self) -> DOMString {
null_string
}
pub fn SetContent(&mut self, _content: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Scheme(&self) -> DOMString {
null_string
}
pub fn SetScheme(&mut self, _scheme: &DOMString, _rv: &mut ErrorResult) {
}
}

View file

@ -0,0 +1,40 @@
/* 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 HTMLStyleElement {
parent: HTMLElement,
}
impl HTMLStyleElement {
pub fn Disabled(&self) -> bool {
false
}
pub fn SetDisabled(&self, _disabled: bool) {
}
pub fn Media(&self) -> DOMString {
null_string
}
pub fn SetMedia(&mut self, _media: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Type(&self) -> DOMString {
null_string
}
pub fn SetType(&mut self, _type: &DOMString, _rv: &mut ErrorResult) {
}
pub fn Scoped(&self) -> bool {
false
}
pub fn SetScoped(&self, _scoped: bool, _rv: &mut ErrorResult) {
}
}

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

@ -19,11 +19,10 @@ use dom::element::{HTMLAsideElement, HTMLBRElement,
HTMLBoldElement, HTMLDivElement, HTMLFontElement, HTMLFormElement,
HTMLHeadElement, HTMLHeadingElement, HTMLHtmlElement,
HTMLInputElement, HTMLItalicElement, HTMLLinkElement,
HTMLListItemElement, HTMLMetaElement,
HTMLOptionElement, HTMLParagraphElement,
HTMLOptionElement, HTMLParagraphElement, HTMLListItemElement,
HTMLSectionElement, HTMLSelectElement, HTMLSmallElement,
HTMLSpanElement, HTMLStyleElement, HTMLTableBodyElement,
HTMLTableCellElement, HTMLTableElement, HTMLTableRowElement,
HTMLSpanElement, HTMLTableBodyElement,
HTMLTableCellElement, HTMLTableRowElement,
HTMLTitleElement, HTMLUListElement};
use dom::element::{HTMLHeadingElementTypeId, Heading1, Heading2, Heading3, Heading4, Heading5,
Heading6};
@ -32,8 +31,11 @@ use dom::htmlbodyelement::HTMLBodyElement;
use dom::htmlhrelement::HTMLHRElement;
use dom::htmliframeelement::HTMLIFrameElement;
use dom::htmlimageelement::HTMLImageElement;
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

@ -53,10 +53,13 @@ pub mod dom {
pub mod HTMLHtmlElementBinding;
pub mod HTMLIFrameElementBinding;
pub mod HTMLImageElementBinding;
pub mod HTMLMetaElementBinding;
pub mod HTMLOListElementBinding;
pub mod HTMLParagraphElementBinding;
pub mod HTMLScriptElementBinding;
pub mod HTMLSpanElementBinding;
pub mod HTMLStyleElementBinding;
pub mod HTMLTableElementBinding;
pub mod MouseEventBinding;
pub mod NodeBinding;
pub mod PrototypeList;
@ -85,8 +88,11 @@ pub mod dom {
pub mod htmlhrelement;
pub mod htmliframeelement;
pub mod htmlimageelement;
pub mod htmlmetaelement;
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>