diff options
author | bors-servo <release+servo@mozilla.com> | 2014-05-03 14:25:22 -0400 |
---|---|---|
committer | bors-servo <release+servo@mozilla.com> | 2014-05-03 14:25:22 -0400 |
commit | 731e66ff132e41cdc49bc5324c0e15be19c46ec2 (patch) | |
tree | ccce9b42e8a6c54245e53620082efe0b9840eae1 /src/components/script/dom/htmltablecellelement.rs | |
parent | 4051a8096d7ba7e7f9c86e76d0b4bffd83e85805 (diff) | |
parent | 91278da9dd55582401154e07f9eea34425a332c2 (diff) | |
download | servo-731e66ff132e41cdc49bc5324c0e15be19c46ec2.tar.gz servo-731e66ff132e41cdc49bc5324c0e15be19c46ec2.zip |
auto merge of #2101 : jdm/servo/newroot_rebase, r=Ms2ger
As described in #1764, this strategy uses the following properties:
* DOM members are `JS<T>` types. These cannot be used with being explicitly rooted, but they are required for compiler-derived trace hooks.
* Methods that take DOM type arguments receive `&[mut] JSRef<T>`. These are rooted value references that are cloneable but cannot escape.
* Methods that return DOM values use `Unrooted<T>`. These are values that may or may not be rooted elsewhere, but callers must root them in order to interact with them in any way. One unsoundness hole exists - `Unrooted` values must be rooted ASAP, or there exists the danger that JSAPI calls could be made that could cause the underlying JS value to be GCed.
* All methods are implemented on `JSRef<T>`, enforcing the requirement that all DOM values are rooted for the duration of a method call (with a few exceptions for layout-related code, which cannot root values and therefore interacts with `JS<T>` and `&T` values - this is safe under the assumption that layout code interacts with DOM nodes that are in the tree, therefore rooted, and does not run concurrently with content code)
Diffstat (limited to 'src/components/script/dom/htmltablecellelement.rs')
-rw-r--r-- | src/components/script/dom/htmltablecellelement.rs | 100 |
1 files changed, 66 insertions, 34 deletions
diff --git a/src/components/script/dom/htmltablecellelement.rs b/src/components/script/dom/htmltablecellelement.rs index b00c1d78fcd..d03e2d83d72 100644 --- a/src/components/script/dom/htmltablecellelement.rs +++ b/src/components/script/dom/htmltablecellelement.rs @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::InheritTypes::HTMLTableCellElementDerived; -use dom::bindings::js::JS; +use dom::bindings::js::JSRef; use dom::bindings::error::ErrorResult; use dom::document::Document; use dom::element::{ElementTypeId, HTMLTableDataCellElementTypeId, HTMLTableHeaderCellElementTypeId}; @@ -28,132 +28,164 @@ impl HTMLTableCellElementDerived for EventTarget { } impl HTMLTableCellElement { - pub fn new_inherited(type_id: ElementTypeId, tag_name: DOMString, document: JS<Document>) -> HTMLTableCellElement { + pub fn new_inherited(type_id: ElementTypeId, tag_name: DOMString, document: &JSRef<Document>) -> HTMLTableCellElement { HTMLTableCellElement { htmlelement: HTMLElement::new_inherited(type_id, tag_name, document) } } } -impl HTMLTableCellElement { - pub fn ColSpan(&self) -> u32 { +pub trait HTMLTableCellElementMethods { + fn ColSpan(&self) -> u32; + fn SetColSpan(&self, _col_span: u32) -> ErrorResult; + fn RowSpan(&self) -> u32; + fn SetRowSpan(&self, _col_span: u32) -> ErrorResult; + fn Headers(&self) -> DOMString; + fn SetHeaders(&self, _headers: DOMString) -> ErrorResult; + fn CellIndex(&self) -> i32; + fn GetCellIndex(&self, _cell_index: i32) -> ErrorResult; + fn Abbr(&self) -> DOMString; + fn SetAbbr(&self, _abbr: DOMString) -> ErrorResult; + fn Scope(&self) -> DOMString; + fn SetScope(&self, _abbr: DOMString) -> ErrorResult; + fn Align(&self) -> DOMString; + fn SetAlign(&self, _align: DOMString) -> ErrorResult; + fn Axis(&self) -> DOMString; + fn SetAxis(&self, _axis: DOMString) -> ErrorResult; + fn Height(&self) -> DOMString; + fn SetHeight(&self, _height: DOMString) -> ErrorResult; + fn Width(&self) -> DOMString; + fn SetWidth(&self, _width: DOMString) -> ErrorResult; + fn Ch(&self) -> DOMString; + fn SetCh(&self, _ch: DOMString) -> ErrorResult; + fn ChOff(&self) -> DOMString; + fn SetChOff(&self, _ch_off: DOMString) -> ErrorResult; + fn NoWrap(&self) -> bool; + fn SetNoWrap(&self, _no_wrap: bool) -> ErrorResult; + fn VAlign(&self) -> DOMString; + fn SetVAlign(&self, _valign: DOMString) -> ErrorResult; + fn BgColor(&self) -> DOMString; + fn SetBgColor(&self, _bg_color: DOMString) -> ErrorResult; +} + +impl<'a> HTMLTableCellElementMethods for JSRef<'a, HTMLTableCellElement> { + fn ColSpan(&self) -> u32 { 0 } - pub fn SetColSpan(&self, _col_span: u32) -> ErrorResult { + fn SetColSpan(&self, _col_span: u32) -> ErrorResult { Ok(()) } - pub fn RowSpan(&self) -> u32 { + fn RowSpan(&self) -> u32 { 0 } - pub fn SetRowSpan(&self, _col_span: u32) -> ErrorResult { + fn SetRowSpan(&self, _col_span: u32) -> ErrorResult { Ok(()) } - pub fn Headers(&self) -> DOMString { + fn Headers(&self) -> DOMString { ~"" } - pub fn SetHeaders(&self, _headers: DOMString) -> ErrorResult { + fn SetHeaders(&self, _headers: DOMString) -> ErrorResult { Ok(()) } - pub fn CellIndex(&self) -> i32 { + fn CellIndex(&self) -> i32 { 0 } - pub fn GetCellIndex(&self, _cell_index: i32) -> ErrorResult { + fn GetCellIndex(&self, _cell_index: i32) -> ErrorResult { Ok(()) } - pub fn Abbr(&self) -> DOMString { + fn Abbr(&self) -> DOMString { ~"" } - pub fn SetAbbr(&self, _abbr: DOMString) -> ErrorResult { + fn SetAbbr(&self, _abbr: DOMString) -> ErrorResult { Ok(()) } - pub fn Scope(&self) -> DOMString { + fn Scope(&self) -> DOMString { ~"" } - pub fn SetScope(&self, _abbr: DOMString) -> ErrorResult { + fn SetScope(&self, _abbr: DOMString) -> ErrorResult { Ok(()) } - pub fn Align(&self) -> DOMString { + fn Align(&self) -> DOMString { ~"" } - pub fn SetAlign(&self, _align: DOMString) -> ErrorResult { + fn SetAlign(&self, _align: DOMString) -> ErrorResult { Ok(()) } - pub fn Axis(&self) -> DOMString { + fn Axis(&self) -> DOMString { ~"" } - pub fn SetAxis(&self, _axis: DOMString) -> ErrorResult { + fn SetAxis(&self, _axis: DOMString) -> ErrorResult { Ok(()) } - pub fn Height(&self) -> DOMString { + fn Height(&self) -> DOMString { ~"" } - pub fn SetHeight(&self, _height: DOMString) -> ErrorResult { + fn SetHeight(&self, _height: DOMString) -> ErrorResult { Ok(()) } - pub fn Width(&self) -> DOMString { + fn Width(&self) -> DOMString { ~"" } - pub fn SetWidth(&self, _width: DOMString) -> ErrorResult { + fn SetWidth(&self, _width: DOMString) -> ErrorResult { Ok(()) } - pub fn Ch(&self) -> DOMString { + fn Ch(&self) -> DOMString { ~"" } - pub fn SetCh(&self, _ch: DOMString) -> ErrorResult { + fn SetCh(&self, _ch: DOMString) -> ErrorResult { Ok(()) } - pub fn ChOff(&self) -> DOMString { + fn ChOff(&self) -> DOMString { ~"" } - pub fn SetChOff(&self, _ch_off: DOMString) -> ErrorResult { + fn SetChOff(&self, _ch_off: DOMString) -> ErrorResult { Ok(()) } - pub fn NoWrap(&self) -> bool { + fn NoWrap(&self) -> bool { false } - pub fn SetNoWrap(&self, _no_wrap: bool) -> ErrorResult { + fn SetNoWrap(&self, _no_wrap: bool) -> ErrorResult { Ok(()) } - pub fn VAlign(&self) -> DOMString { + fn VAlign(&self) -> DOMString { ~"" } - pub fn SetVAlign(&self, _valign: DOMString) -> ErrorResult { + fn SetVAlign(&self, _valign: DOMString) -> ErrorResult { Ok(()) } - pub fn BgColor(&self) -> DOMString { + fn BgColor(&self) -> DOMString { ~"" } - pub fn SetBgColor(&self, _bg_color: DOMString) -> ErrorResult { + fn SetBgColor(&self, _bg_color: DOMString) -> ErrorResult { Ok(()) } } - |