diff options
author | bors-servo <release+servo@mozilla.com> | 2013-08-07 10:36:38 -0700 |
---|---|---|
committer | bors-servo <release+servo@mozilla.com> | 2013-08-07 10:36:38 -0700 |
commit | b84552b89d29160240443e51a776d827df2116d0 (patch) | |
tree | 7297c3100079f2d892070d0852b19f1d4206db76 /src/components/script/dom | |
parent | 79bf91999d46fd154fa95ec8b96a946743f300ff (diff) | |
parent | 2e3cd1945cc7f071ce8a3b17febd0f8b404e897c (diff) | |
download | servo-b84552b89d29160240443e51a776d827df2116d0.tar.gz servo-b84552b89d29160240443e51a776d827df2116d0.zip |
auto merge of #683 : saneyuki/servo/webidl, r=jdm
Diffstat (limited to 'src/components/script/dom')
10 files changed, 244 insertions, 4 deletions
diff --git a/src/components/script/dom/bindings/codegen/Bindings.conf b/src/components/script/dom/bindings/codegen/Bindings.conf index 57877d06491..8becea9ceec 100644 --- a/src/components/script/dom/bindings/codegen/Bindings.conf +++ b/src/components/script/dom/bindings/codegen/Bindings.conf @@ -550,7 +550,10 @@ addHTMLElement('HTMLDivElement') addHTMLElement('HTMLElement') addHTMLElement('HTMLHeadElement') addHTMLElement('HTMLHtmlElement') +addHTMLElement('HTMLHRElement') addHTMLElement('HTMLImageElement') +addHTMLElement('HTMLParagraphElement') +addHTMLElement('HTMLScriptElement') addHTMLElement('HTMLSpanElement') # If you add one of these, you need to make sure nsDOMQS.h has the relevant diff --git a/src/components/script/dom/bindings/codegen/CodegenRust.py b/src/components/script/dom/bindings/codegen/CodegenRust.py index 9f8b319e80e..b64ae00afbb 100644 --- a/src/components/script/dom/bindings/codegen/CodegenRust.py +++ b/src/components/script/dom/bindings/codegen/CodegenRust.py @@ -4616,11 +4616,13 @@ class CGBindingRoot(CGThing): 'dom::node::{AbstractNode, Node, Text}', #XXXjdm 'dom::document::{Document, AbstractDocument}', #XXXjdm 'dom::element::{Element, HTMLHeadElement, HTMLHtmlElement}', #XXXjdm - 'dom::element::{HTMLDivElement, HTMLSpanElement}', #XXXjdm + 'dom::element::{HTMLDivElement, HTMLSpanElement, HTMLParagraphElement}', #XXXjdm 'dom::htmlanchorelement::HTMLAnchorElement', #XXXjdm 'dom::htmlelement::HTMLElement', #XXXjdm 'dom::htmldocument::HTMLDocument', #XXXjdm + 'dom::htmlhrelement::HTMLHRElement', 'dom::htmlimageelement::HTMLImageElement', #XXXjdm + 'dom::htmlscriptelement::HTMLScriptElement', 'dom::bindings::utils::*', 'dom::bindings::conversions::*', 'dom::blob::*', #XXXjdm diff --git a/src/components/script/dom/bindings/codegen/HTMLHRElement.webidl b/src/components/script/dom/bindings/codegen/HTMLHRElement.webidl new file mode 100644 index 00000000000..0495e43b314 --- /dev/null +++ b/src/components/script/dom/bindings/codegen/HTMLHRElement.webidl @@ -0,0 +1,30 @@ +/* -*- 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-hr-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-hr-element +interface HTMLHRElement : HTMLElement { +}; + +// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis +partial interface HTMLHRElement { + [SetterThrows] + attribute DOMString align; + [SetterThrows] + attribute DOMString color; + [SetterThrows] + attribute boolean noShade; + [SetterThrows] + attribute DOMString size; + [SetterThrows] + attribute DOMString width; +}; diff --git a/src/components/script/dom/bindings/codegen/HTMLParagraphElement.webidl b/src/components/script/dom/bindings/codegen/HTMLParagraphElement.webidl new file mode 100644 index 00000000000..2a626d25750 --- /dev/null +++ b/src/components/script/dom/bindings/codegen/HTMLParagraphElement.webidl @@ -0,0 +1,22 @@ +/* -*- 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-p-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-p-element +interface HTMLParagraphElement : HTMLElement { +}; + +// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis +partial interface HTMLParagraphElement { + [SetterThrows] + attribute DOMString align; +}; diff --git a/src/components/script/dom/bindings/codegen/HTMLScriptElement.webidl b/src/components/script/dom/bindings/codegen/HTMLScriptElement.webidl new file mode 100644 index 00000000000..979e38ca3ad --- /dev/null +++ b/src/components/script/dom/bindings/codegen/HTMLScriptElement.webidl @@ -0,0 +1,35 @@ +/* -*- 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-script-element + * http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis + */ + +interface HTMLScriptElement : HTMLElement { + [SetterThrows] + attribute DOMString src; + [SetterThrows] + attribute DOMString type; + [SetterThrows] + attribute DOMString charset; + [SetterThrows] + attribute boolean async; + [SetterThrows] + attribute boolean defer; + [SetterThrows] + attribute DOMString crossOrigin; + [SetterThrows] + attribute DOMString text; +}; + +// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis +partial interface HTMLScriptElement { + [SetterThrows] + attribute DOMString event; + [SetterThrows] + attribute DOMString htmlFor; +}; + diff --git a/src/components/script/dom/bindings/node.rs b/src/components/script/dom/bindings/node.rs index 76e618e98ca..710851e724d 100644 --- a/src/components/script/dom/bindings/node.rs +++ b/src/components/script/dom/bindings/node.rs @@ -8,9 +8,14 @@ use dom::bindings::utils; use dom::bindings::utils::{CacheableWrapper, WrapperCache, DerivedWrapper}; use dom::element::{HTMLHeadElementTypeId, HTMLHtmlElementTypeId, HTMLAnchorElementTypeId}; use dom::element::{HTMLDivElementTypeId, HTMLImageElementTypeId, HTMLSpanElementTypeId}; +use dom::element::{HTMLHRElementTypeId}; +use dom::element::{HTMLParagraphElementTypeId, HTMLScriptElementTypeId}; use dom::element::{HTMLHeadElement, HTMLHtmlElement, HTMLDivElement, HTMLSpanElement}; +use dom::element::{HTMLParagraphElement}; use dom::htmlanchorelement::HTMLAnchorElement; +use dom::htmlhrelement::HTMLHRElement; use dom::htmlimageelement::HTMLImageElement; +use dom::htmlscriptelement::HTMLScriptElement; use dom::node::{AbstractNode, Node, ElementNodeTypeId, TextNodeTypeId, CommentNodeTypeId}; use dom::node::{DoctypeNodeTypeId, ScriptView, Text}; @@ -79,8 +84,11 @@ pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> *JSObject ElementNodeTypeId(HTMLAnchorElementTypeId) => generate_element!(HTMLAnchorElement), ElementNodeTypeId(HTMLDivElementTypeId) => generate_element!(HTMLDivElement), ElementNodeTypeId(HTMLHeadElementTypeId) => generate_element!(HTMLHeadElement), + ElementNodeTypeId(HTMLHRElementTypeId) => generate_element!(HTMLHRElement), ElementNodeTypeId(HTMLHtmlElementTypeId) => generate_element!(HTMLHtmlElement), ElementNodeTypeId(HTMLImageElementTypeId) => generate_element!(HTMLImageElement), + ElementNodeTypeId(HTMLParagraphElementTypeId) => generate_element!(HTMLParagraphElement), + ElementNodeTypeId(HTMLScriptElementTypeId) => generate_element!(HTMLScriptElement), ElementNodeTypeId(HTMLSpanElementTypeId) => generate_element!(HTMLSpanElement), ElementNodeTypeId(_) => element::create(cx, node).ptr, CommentNodeTypeId | diff --git a/src/components/script/dom/bindings/utils.rs b/src/components/script/dom/bindings/utils.rs index 15cf1214da6..3b26659922c 100644 --- a/src/components/script/dom/bindings/utils.rs +++ b/src/components/script/dom/bindings/utils.rs @@ -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, ..36]); + let protoArray = @mut ([0 as *JSObject, ..39]); assert!(protoArray.len() == PrototypeList::id::_ID_Count as uint); unsafe { //XXXjdm we should be storing the box pointer instead of the inner diff --git a/src/components/script/dom/element.rs b/src/components/script/dom/element.rs index 6dead4db5ea..75b2868491f 100644 --- a/src/components/script/dom/element.rs +++ b/src/components/script/dom/element.rs @@ -6,6 +6,8 @@ use dom::bindings::codegen::{HTMLHeadElementBinding, HTMLHtmlElementBinding}; use dom::bindings::codegen::{HTMLAnchorElementBinding, HTMLDivElementBinding, HTMLSpanElementBinding}; +use dom::bindings::codegen::{HTMLHRElementBinding}; +use dom::bindings::codegen::{HTMLParagraphElementBinding, HTMLScriptElementBinding}; use dom::bindings::codegen::{HTMLImageElementBinding}; use dom::bindings::utils::{DOMString, null_string, ErrorResult}; use dom::bindings::utils::{CacheableWrapper, BindingObject, WrapperCache}; @@ -14,7 +16,9 @@ use dom::clientrectlist::ClientRectList; use dom::htmlanchorelement::HTMLAnchorElement; use dom::htmlcollection::HTMLCollection; use dom::htmlelement::HTMLElement; +use dom::htmlhrelement::HTMLHRElement; use dom::htmlimageelement::HTMLImageElement; +use dom::htmlscriptelement::HTMLScriptElement; use dom::node::{ElementNodeTypeId, Node, ScriptView, AbstractNode}; use layout_interface::{ContentBoxQuery, ContentBoxResponse, ContentBoxesQuery}; use layout_interface::{ContentBoxesResponse}; @@ -104,7 +108,6 @@ pub struct HTMLBoldElement { parent: HTMLElement } pub struct HTMLDivElement { parent: HTMLElement } pub struct HTMLFontElement { parent: HTMLElement } pub struct HTMLFormElement { parent: HTMLElement } -pub struct HTMLHRElement { parent: HTMLElement } pub struct HTMLHeadElement { parent: HTMLElement } pub struct HTMLHtmlElement { parent: HTMLElement } pub struct HTMLInputElement { parent: HTMLElement } @@ -115,7 +118,6 @@ pub struct HTMLMetaElement { parent: HTMLElement } pub struct HTMLOListElement { parent: HTMLElement } pub struct HTMLOptionElement { parent: HTMLElement } pub struct HTMLParagraphElement { parent: HTMLElement } -pub struct HTMLScriptElement { parent: HTMLElement } pub struct HTMLSectionElement { parent: HTMLElement } pub struct HTMLSelectElement { parent: HTMLElement } pub struct HTMLSmallElement { parent: HTMLElement } @@ -147,6 +149,15 @@ impl HTMLDivElement { } } +impl HTMLParagraphElement { + pub fn Align(&self) -> DOMString { + null_string + } + + pub fn SetAlign(&mut self, _align: &DOMString, _rv: &mut ErrorResult) { + } +} + pub macro_rules! generate_cacheable_wrapper( ($name: ident, $wrap: path) => ( impl CacheableWrapper for $name { @@ -174,6 +185,8 @@ pub macro_rules! generate_binding_object( generate_cacheable_wrapper!(HTMLHeadElement, HTMLHeadElementBinding::Wrap) generate_binding_object!(HTMLHeadElement) +generate_cacheable_wrapper!(HTMLHRElement, HTMLHRElementBinding::Wrap) +generate_binding_object!(HTMLHRElement) generate_cacheable_wrapper!(HTMLHtmlElement, HTMLHtmlElementBinding::Wrap) generate_binding_object!(HTMLHtmlElement) generate_cacheable_wrapper!(HTMLAnchorElement, HTMLAnchorElementBinding::Wrap) @@ -182,9 +195,14 @@ generate_cacheable_wrapper!(HTMLDivElement, HTMLDivElementBinding::Wrap) generate_binding_object!(HTMLDivElement) generate_cacheable_wrapper!(HTMLImageElement, HTMLImageElementBinding::Wrap) generate_binding_object!(HTMLImageElement) +generate_cacheable_wrapper!(HTMLParagraphElement, HTMLParagraphElementBinding::Wrap) +generate_binding_object!(HTMLParagraphElement) +generate_cacheable_wrapper!(HTMLScriptElement, HTMLScriptElementBinding::Wrap) +generate_binding_object!(HTMLScriptElement) generate_cacheable_wrapper!(HTMLSpanElement, HTMLSpanElementBinding::Wrap) generate_binding_object!(HTMLSpanElement) + // // Fancier elements // diff --git a/src/components/script/dom/htmlhrelement.rs b/src/components/script/dom/htmlhrelement.rs new file mode 100644 index 00000000000..d1a3bb0348e --- /dev/null +++ b/src/components/script/dom/htmlhrelement.rs @@ -0,0 +1,47 @@ +/* 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 HTMLHRElement { + parent: HTMLElement, +} + +impl HTMLHRElement { + pub fn Align(&self) -> DOMString { + null_string + } + + pub fn SetAlign(&mut self, _align: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn Color(&self) -> DOMString { + null_string + } + + pub fn SetColor(&mut self, _color: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn NoShade(&self) -> bool { + false + } + + pub fn SetNoShade(&self, _no_shade: bool, _rv: &mut ErrorResult) { + } + + pub fn Size(&self) -> DOMString { + null_string + } + + pub fn SetSize(&mut self, _size: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn Width(&self) -> DOMString { + null_string + } + + pub fn SetWidth(&mut self, _width: &DOMString, _rv: &mut ErrorResult) { + } +} diff --git a/src/components/script/dom/htmlscriptelement.rs b/src/components/script/dom/htmlscriptelement.rs new file mode 100644 index 00000000000..9556955eabe --- /dev/null +++ b/src/components/script/dom/htmlscriptelement.rs @@ -0,0 +1,75 @@ +/* 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 HTMLScriptElement { + parent: HTMLElement, +} + +impl HTMLScriptElement { + pub fn Src(&self) -> DOMString { + null_string + } + + pub fn SetSrc(&mut self, _src: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn Type(&self) -> DOMString { + null_string + } + + pub fn SetType(&mut self, _type: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn Charset(&self) -> DOMString { + null_string + } + + pub fn SetCharset(&mut self, _charset: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn Async(&self) -> bool { + false + } + + pub fn SetAsync(&self, _async: bool, _rv: &mut ErrorResult) { + } + + pub fn Defer(&self) -> bool { + false + } + + pub fn SetDefer(&self, _defer: bool, _rv: &mut ErrorResult) { + } + + pub fn CrossOrigin(&self) -> DOMString { + null_string + } + + pub fn SetCrossOrigin(&mut self, _cross_origin: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn Text(&self) -> DOMString { + null_string + } + + pub fn SetText(&mut self, _text: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn Event(&self) -> DOMString { + null_string + } + + pub fn SetEvent(&mut self, _event: &DOMString, _rv: &mut ErrorResult) { + } + + pub fn HtmlFor(&self) -> DOMString { + null_string + } + + pub fn SetHtmlFor(&mut self, _html_for: &DOMString, _rv: &mut ErrorResult) { + } +} |