mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Add spec links
This commit is contained in:
parent
f039827dcd
commit
233a769c67
61 changed files with 284 additions and 87 deletions
|
@ -98,7 +98,7 @@ impl<'a> BlobHelpers for &'a Blob {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> BlobMethods for &'a Blob {
|
impl<'a> BlobMethods for &'a Blob {
|
||||||
// http://dev.w3.org/2006/webapi/FileAPI/#dfn-size
|
// https://dev.w3.org/2006/webapi/FileAPI/#dfn-size
|
||||||
fn Size(self) -> u64{
|
fn Size(self) -> u64{
|
||||||
match self.bytes {
|
match self.bytes {
|
||||||
None => 0,
|
None => 0,
|
||||||
|
@ -106,12 +106,12 @@ impl<'a> BlobMethods for &'a Blob {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dev.w3.org/2006/webapi/FileAPI/#dfn-type
|
// https://dev.w3.org/2006/webapi/FileAPI/#dfn-type
|
||||||
fn Type(self) -> DOMString {
|
fn Type(self) -> DOMString {
|
||||||
self.typeString.clone()
|
self.typeString.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dev.w3.org/2006/webapi/FileAPI/#slice-method-algo
|
// https://dev.w3.org/2006/webapi/FileAPI/#slice-method-algo
|
||||||
fn Slice(self, start: Option<i64>, end: Option<i64>,
|
fn Slice(self, start: Option<i64>, end: Option<i64>,
|
||||||
contentType: Option<DOMString>) -> Root<Blob> {
|
contentType: Option<DOMString>) -> Root<Blob> {
|
||||||
let size: i64 = self.Size().to_i64().unwrap();
|
let size: i64 = self.Size().to_i64().unwrap();
|
||||||
|
|
|
@ -69,14 +69,17 @@ impl CloseEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> CloseEventMethods for &'a CloseEvent {
|
impl<'a> CloseEventMethods for &'a CloseEvent {
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-closeevent-wasclean
|
||||||
fn WasClean(self) -> bool {
|
fn WasClean(self) -> bool {
|
||||||
self.wasClean
|
self.wasClean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-closeevent-code
|
||||||
fn Code(self) -> u16 {
|
fn Code(self) -> u16 {
|
||||||
self.code
|
self.code
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-closeevent-reason
|
||||||
fn Reason(self) -> DOMString {
|
fn Reason(self) -> DOMString {
|
||||||
self.reason.clone()
|
self.reason.clone()
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ impl<'a> ConsoleMethods for &'a Console {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Web/API/Console
|
||||||
fn Debug(self, messages: Vec<DOMString>) {
|
fn Debug(self, messages: Vec<DOMString>) {
|
||||||
for message in messages {
|
for message in messages {
|
||||||
println!("{}", message);
|
println!("{}", message);
|
||||||
|
|
|
@ -41,8 +41,8 @@ impl Crypto {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> CryptoMethods for &'a Crypto {
|
impl<'a> CryptoMethods for &'a Crypto {
|
||||||
// https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#Crypto-method-getRandomValues
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
|
// https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#Crypto-method-getRandomValues
|
||||||
fn GetRandomValues(self, _cx: *mut JSContext, input: *mut JSObject)
|
fn GetRandomValues(self, _cx: *mut JSContext, input: *mut JSObject)
|
||||||
-> Fallible<*mut JSObject> {
|
-> Fallible<*mut JSObject> {
|
||||||
let mut length = 0;
|
let mut length = 0;
|
||||||
|
|
|
@ -92,7 +92,7 @@ impl<'a> PrivateCSSStyleDeclarationHelpers for &'a CSSStyleDeclaration {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> CSSStyleDeclarationMethods for &'a CSSStyleDeclaration {
|
impl<'a> CSSStyleDeclarationMethods for &'a CSSStyleDeclaration {
|
||||||
// http://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-length
|
// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-length
|
||||||
fn Length(self) -> u32 {
|
fn Length(self) -> u32 {
|
||||||
let owner = self.owner.root();
|
let owner = self.owner.root();
|
||||||
let elem = ElementCast::from_ref(owner.r());
|
let elem = ElementCast::from_ref(owner.r());
|
||||||
|
@ -103,7 +103,7 @@ impl<'a> CSSStyleDeclarationMethods for &'a CSSStyleDeclaration {
|
||||||
len as u32
|
len as u32
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-item
|
// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-item
|
||||||
fn Item(self, index: u32) -> DOMString {
|
fn Item(self, index: u32) -> DOMString {
|
||||||
let index = index as usize;
|
let index = index as usize;
|
||||||
let owner = self.owner.root();
|
let owner = self.owner.root();
|
||||||
|
@ -124,7 +124,7 @@ impl<'a> CSSStyleDeclarationMethods for &'a CSSStyleDeclaration {
|
||||||
result.unwrap_or("".to_owned())
|
result.unwrap_or("".to_owned())
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-getpropertyvalue
|
// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-getpropertyvalue
|
||||||
fn GetPropertyValue(self, property: DOMString) -> DOMString {
|
fn GetPropertyValue(self, property: DOMString) -> DOMString {
|
||||||
// Step 1
|
// Step 1
|
||||||
let property = Atom::from_slice(&property.to_ascii_lowercase());
|
let property = Atom::from_slice(&property.to_ascii_lowercase());
|
||||||
|
@ -159,7 +159,7 @@ impl<'a> CSSStyleDeclarationMethods for &'a CSSStyleDeclaration {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-getpropertypriority
|
// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-getpropertypriority
|
||||||
fn GetPropertyPriority(self, property: DOMString) -> DOMString {
|
fn GetPropertyPriority(self, property: DOMString) -> DOMString {
|
||||||
// Step 1
|
// Step 1
|
||||||
let property = Atom::from_slice(&property.to_ascii_lowercase());
|
let property = Atom::from_slice(&property.to_ascii_lowercase());
|
||||||
|
@ -183,7 +183,7 @@ impl<'a> CSSStyleDeclarationMethods for &'a CSSStyleDeclaration {
|
||||||
"".to_owned()
|
"".to_owned()
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-setproperty
|
// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-setproperty
|
||||||
fn SetProperty(self, property: DOMString, value: DOMString,
|
fn SetProperty(self, property: DOMString, value: DOMString,
|
||||||
priority: DOMString) -> ErrorResult {
|
priority: DOMString) -> ErrorResult {
|
||||||
// Step 1
|
// Step 1
|
||||||
|
@ -244,7 +244,7 @@ impl<'a> CSSStyleDeclarationMethods for &'a CSSStyleDeclaration {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-setpropertypriority
|
// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-setpropertypriority
|
||||||
fn SetPropertyPriority(self, property: DOMString, priority: DOMString) -> ErrorResult {
|
fn SetPropertyPriority(self, property: DOMString, priority: DOMString) -> ErrorResult {
|
||||||
// Step 1
|
// Step 1
|
||||||
if self.readonly {
|
if self.readonly {
|
||||||
|
@ -287,12 +287,12 @@ impl<'a> CSSStyleDeclarationMethods for &'a CSSStyleDeclaration {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-setpropertyvalue
|
// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-setpropertyvalue
|
||||||
fn SetPropertyValue(self, property: DOMString, value: DOMString) -> ErrorResult {
|
fn SetPropertyValue(self, property: DOMString, value: DOMString) -> ErrorResult {
|
||||||
self.SetProperty(property, value, "".to_owned())
|
self.SetProperty(property, value, "".to_owned())
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-removeproperty
|
// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-removeproperty
|
||||||
fn RemoveProperty(self, property: DOMString) -> Fallible<DOMString> {
|
fn RemoveProperty(self, property: DOMString) -> Fallible<DOMString> {
|
||||||
// Step 1
|
// Step 1
|
||||||
if self.readonly {
|
if self.readonly {
|
||||||
|
@ -326,17 +326,17 @@ impl<'a> CSSStyleDeclarationMethods for &'a CSSStyleDeclaration {
|
||||||
Ok(value)
|
Ok(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-cssfloat
|
// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-cssfloat
|
||||||
fn CssFloat(self) -> DOMString {
|
fn CssFloat(self) -> DOMString {
|
||||||
self.GetPropertyValue("float".to_owned())
|
self.GetPropertyValue("float".to_owned())
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-cssfloat
|
// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-cssfloat
|
||||||
fn SetCssFloat(self, value: DOMString) -> ErrorResult {
|
fn SetCssFloat(self, value: DOMString) -> ErrorResult {
|
||||||
self.SetPropertyValue("float".to_owned(), value)
|
self.SetPropertyValue("float".to_owned(), value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface
|
// https://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface
|
||||||
fn IndexedGetter(self, index: u32, found: &mut bool) -> DOMString {
|
fn IndexedGetter(self, index: u32, found: &mut bool) -> DOMString {
|
||||||
let rval = self.Item(index);
|
let rval = self.Item(index);
|
||||||
*found = index < self.Length();
|
*found = index < self.Length();
|
||||||
|
|
|
@ -1738,10 +1738,12 @@ impl<'a> DocumentMethods for &'a Document {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-document-bgcolor
|
||||||
fn BgColor(self) -> DOMString {
|
fn BgColor(self) -> DOMString {
|
||||||
self.get_body_attribute(&atom!("bgcolor"))
|
self.get_body_attribute(&atom!("bgcolor"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-document-bgcolor
|
||||||
fn SetBgColor(self, value: DOMString) {
|
fn SetBgColor(self, value: DOMString) {
|
||||||
self.set_body_attribute(&atom!("bgcolor"), value)
|
self.set_body_attribute(&atom!("bgcolor"), value)
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,34 +34,42 @@ impl DOMPoint {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> DOMPointMethods for &'a DOMPoint {
|
impl<'a> DOMPointMethods for &'a DOMPoint {
|
||||||
// http://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-x
|
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-x
|
||||||
fn X(self) -> f64 {
|
fn X(self) -> f64 {
|
||||||
self.point.X()
|
self.point.X()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-x
|
||||||
fn SetX(self, value: f64) {
|
fn SetX(self, value: f64) {
|
||||||
self.point.SetX(value);
|
self.point.SetX(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-y
|
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-y
|
||||||
fn Y(self) -> f64 {
|
fn Y(self) -> f64 {
|
||||||
self.point.Y()
|
self.point.Y()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-y
|
||||||
fn SetY(self, value: f64) {
|
fn SetY(self, value: f64) {
|
||||||
self.point.SetY(value);
|
self.point.SetY(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-z
|
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-z
|
||||||
fn Z(self) -> f64 {
|
fn Z(self) -> f64 {
|
||||||
self.point.Z()
|
self.point.Z()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-z
|
||||||
fn SetZ(self, value: f64) {
|
fn SetZ(self, value: f64) {
|
||||||
self.point.SetZ(value);
|
self.point.SetZ(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-w
|
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-w
|
||||||
fn W(self) -> f64 {
|
fn W(self) -> f64 {
|
||||||
self.point.W()
|
self.point.W()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-w
|
||||||
fn SetW(self, value: f64) {
|
fn SetW(self, value: f64) {
|
||||||
self.point.SetW(value);
|
self.point.SetW(value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,22 +41,22 @@ impl DOMPointReadOnly {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> DOMPointReadOnlyMethods for &'a DOMPointReadOnly {
|
impl<'a> DOMPointReadOnlyMethods for &'a DOMPointReadOnly {
|
||||||
// http://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-x
|
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-x
|
||||||
fn X(self) -> f64 {
|
fn X(self) -> f64 {
|
||||||
self.x.get()
|
self.x.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-y
|
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-y
|
||||||
fn Y(self) -> f64 {
|
fn Y(self) -> f64 {
|
||||||
self.y.get()
|
self.y.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-z
|
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-z
|
||||||
fn Z(self) -> f64 {
|
fn Z(self) -> f64 {
|
||||||
self.z.get()
|
self.z.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-w
|
// https://dev.w3.org/fxtf/geometry/Overview.html#dom-dompointreadonly-w
|
||||||
fn W(self) -> f64 {
|
fn W(self) -> f64 {
|
||||||
self.w.get()
|
self.w.get()
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,27 +41,33 @@ impl DOMRect {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> DOMRectMethods for &'a DOMRect {
|
impl<'a> DOMRectMethods for &'a DOMRect {
|
||||||
|
// https://drafts.fxtf.org/geometry/#dom-domrectreadonly-top
|
||||||
fn Top(self) -> Finite<f32> {
|
fn Top(self) -> Finite<f32> {
|
||||||
Finite::wrap(self.top)
|
Finite::wrap(self.top)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://drafts.fxtf.org/geometry/#dom-domrectreadonly-bottom
|
||||||
fn Bottom(self) -> Finite<f32> {
|
fn Bottom(self) -> Finite<f32> {
|
||||||
Finite::wrap(self.bottom)
|
Finite::wrap(self.bottom)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://drafts.fxtf.org/geometry/#dom-domrectreadonly-left
|
||||||
fn Left(self) -> Finite<f32> {
|
fn Left(self) -> Finite<f32> {
|
||||||
Finite::wrap(self.left)
|
Finite::wrap(self.left)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://drafts.fxtf.org/geometry/#dom-domrectreadonly-right
|
||||||
fn Right(self) -> Finite<f32> {
|
fn Right(self) -> Finite<f32> {
|
||||||
Finite::wrap(self.right)
|
Finite::wrap(self.right)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://drafts.fxtf.org/geometry/#dom-domrectreadonly-width
|
||||||
fn Width(self) -> Finite<f32> {
|
fn Width(self) -> Finite<f32> {
|
||||||
let result = (self.right - self.left).abs();
|
let result = (self.right - self.left).abs();
|
||||||
Finite::wrap(result)
|
Finite::wrap(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://drafts.fxtf.org/geometry/#dom-domrectreadonly-height
|
||||||
fn Height(self) -> Finite<f32> {
|
fn Height(self) -> Finite<f32> {
|
||||||
let result = (self.bottom - self.top).abs();
|
let result = (self.bottom - self.top).abs();
|
||||||
Finite::wrap(result)
|
Finite::wrap(result)
|
||||||
|
|
|
@ -33,10 +33,12 @@ impl DOMRectList {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> DOMRectListMethods for &'a DOMRectList {
|
impl<'a> DOMRectListMethods for &'a DOMRectList {
|
||||||
|
// https://drafts.fxtf.org/geometry/#dom-domrectlist-length
|
||||||
fn Length(self) -> u32 {
|
fn Length(self) -> u32 {
|
||||||
self.rects.len() as u32
|
self.rects.len() as u32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://drafts.fxtf.org/geometry/#dom-domrectlist-item
|
||||||
fn Item(self, index: u32) -> Option<Root<DOMRect>> {
|
fn Item(self, index: u32) -> Option<Root<DOMRect>> {
|
||||||
let rects = &self.rects;
|
let rects = &self.rects;
|
||||||
if index < rects.len() as u32 {
|
if index < rects.len() as u32 {
|
||||||
|
@ -46,6 +48,7 @@ impl<'a> DOMRectListMethods for &'a DOMRectList {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check-tidy: no specs after this line
|
||||||
fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<Root<DOMRect>> {
|
fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<Root<DOMRect>> {
|
||||||
*found = index < self.rects.len() as u32;
|
*found = index < self.rects.len() as u32;
|
||||||
self.Item(index)
|
self.Item(index)
|
||||||
|
|
|
@ -35,20 +35,24 @@ impl DOMStringMap {
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#domstringmap
|
// https://html.spec.whatwg.org/#domstringmap
|
||||||
impl<'a> DOMStringMapMethods for &'a DOMStringMap {
|
impl<'a> DOMStringMapMethods for &'a DOMStringMap {
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-domstringmap-additem
|
||||||
fn NamedCreator(self, name: DOMString, value: DOMString) -> ErrorResult {
|
fn NamedCreator(self, name: DOMString, value: DOMString) -> ErrorResult {
|
||||||
self.NamedSetter(name, value)
|
self.NamedSetter(name, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-domstringmap-removeitem
|
||||||
fn NamedDeleter(self, name: DOMString) {
|
fn NamedDeleter(self, name: DOMString) {
|
||||||
let element = self.element.root();
|
let element = self.element.root();
|
||||||
element.r().delete_custom_attr(name)
|
element.r().delete_custom_attr(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-domstringmap-setitem
|
||||||
fn NamedSetter(self, name: DOMString, value: DOMString) -> ErrorResult {
|
fn NamedSetter(self, name: DOMString, value: DOMString) -> ErrorResult {
|
||||||
let element = self.element.root();
|
let element = self.element.root();
|
||||||
element.r().set_custom_attr(name, value)
|
element.r().set_custom_attr(name, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-domstringmap-nameditem
|
||||||
fn NamedGetter(self, name: DOMString, found: &mut bool) -> DOMString {
|
fn NamedGetter(self, name: DOMString, found: &mut bool) -> DOMString {
|
||||||
let element = self.element.root();
|
let element = self.element.root();
|
||||||
match element.r().get_custom_attr(name) {
|
match element.r().get_custom_attr(name) {
|
||||||
|
|
|
@ -82,12 +82,6 @@ impl<'a> DOMTokenListMethods for &'a DOMTokenList {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<DOMString> {
|
|
||||||
let item = self.Item(index);
|
|
||||||
*found = item.is_some();
|
|
||||||
item
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#dom-domtokenlist-contains
|
// https://dom.spec.whatwg.org/#dom-domtokenlist-contains
|
||||||
fn Contains(self, token: DOMString) -> Fallible<bool> {
|
fn Contains(self, token: DOMString) -> Fallible<bool> {
|
||||||
self.check_token_exceptions(&token).map(|token| {
|
self.check_token_exceptions(&token).map(|token| {
|
||||||
|
@ -160,4 +154,11 @@ impl<'a> DOMTokenListMethods for &'a DOMTokenList {
|
||||||
let tokenlist = self.element.root().r().get_tokenlist_attribute(&self.local_name);
|
let tokenlist = self.element.root().r().get_tokenlist_attribute(&self.local_name);
|
||||||
str_join(&tokenlist, "\x20")
|
str_join(&tokenlist, "\x20")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check-tidy: no specs after this line
|
||||||
|
fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<DOMString> {
|
||||||
|
let item = self.Item(index);
|
||||||
|
*found = item.is_some();
|
||||||
|
item
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1291,7 +1291,7 @@ impl<'a> ElementMethods for &'a Element {
|
||||||
HTMLCollection::by_class_name(window.r(), NodeCast::from_ref(self), classes)
|
HTMLCollection::by_class_name(window.r(), NodeCast::from_ref(self), classes)
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dev.w3.org/csswg/cssom-view/#dom-element-getclientrects
|
// https://drafts.csswg.org/cssom-view/#dom-element-getclientrects
|
||||||
fn GetClientRects(self) -> Root<DOMRectList> {
|
fn GetClientRects(self) -> Root<DOMRectList> {
|
||||||
let win = window_from_node(self);
|
let win = window_from_node(self);
|
||||||
let node = NodeCast::from_ref(self);
|
let node = NodeCast::from_ref(self);
|
||||||
|
@ -1304,7 +1304,7 @@ impl<'a> ElementMethods for &'a Element {
|
||||||
DOMRectList::new(win.r(), rects)
|
DOMRectList::new(win.r(), rects)
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dev.w3.org/csswg/cssom-view/#dom-element-getboundingclientrect
|
// https://drafts.csswg.org/cssom-view/#dom-element-getboundingclientrect
|
||||||
fn GetBoundingClientRect(self) -> Root<DOMRect> {
|
fn GetBoundingClientRect(self) -> Root<DOMRect> {
|
||||||
let win = window_from_node(self);
|
let win = window_from_node(self);
|
||||||
let node = NodeCast::from_ref(self);
|
let node = NodeCast::from_ref(self);
|
||||||
|
@ -1317,21 +1317,25 @@ impl<'a> ElementMethods for &'a Element {
|
||||||
rect.origin.x + rect.size.width)
|
rect.origin.x + rect.size.width)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://drafts.csswg.org/cssom-view/#dom-element-clienttop
|
||||||
fn ClientTop(self) -> i32 {
|
fn ClientTop(self) -> i32 {
|
||||||
let node = NodeCast::from_ref(self);
|
let node = NodeCast::from_ref(self);
|
||||||
node.get_client_rect().origin.y
|
node.get_client_rect().origin.y
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://drafts.csswg.org/cssom-view/#dom-element-clientleft
|
||||||
fn ClientLeft(self) -> i32 {
|
fn ClientLeft(self) -> i32 {
|
||||||
let node = NodeCast::from_ref(self);
|
let node = NodeCast::from_ref(self);
|
||||||
node.get_client_rect().origin.x
|
node.get_client_rect().origin.x
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://drafts.csswg.org/cssom-view/#dom-element-clientwidth
|
||||||
fn ClientWidth(self) -> i32 {
|
fn ClientWidth(self) -> i32 {
|
||||||
let node = NodeCast::from_ref(self);
|
let node = NodeCast::from_ref(self);
|
||||||
node.get_client_rect().size.width
|
node.get_client_rect().size.width
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://drafts.csswg.org/cssom-view/#dom-element-clientheight
|
||||||
fn ClientHeight(self) -> i32 {
|
fn ClientHeight(self) -> i32 {
|
||||||
let node = NodeCast::from_ref(self);
|
let node = NodeCast::from_ref(self);
|
||||||
node.get_client_rect().size.height
|
node.get_client_rect().size.height
|
||||||
|
|
|
@ -114,22 +114,27 @@ impl ErrorEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ErrorEventMethods for &'a ErrorEvent {
|
impl<'a> ErrorEventMethods for &'a ErrorEvent {
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-errorevent-lineno
|
||||||
fn Lineno(self) -> u32 {
|
fn Lineno(self) -> u32 {
|
||||||
self.lineno.get()
|
self.lineno.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-errorevent-colno
|
||||||
fn Colno(self) -> u32 {
|
fn Colno(self) -> u32 {
|
||||||
self.colno.get()
|
self.colno.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-errorevent-message
|
||||||
fn Message(self) -> DOMString {
|
fn Message(self) -> DOMString {
|
||||||
self.message.borrow().clone()
|
self.message.borrow().clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-errorevent-filename
|
||||||
fn Filename(self) -> DOMString {
|
fn Filename(self) -> DOMString {
|
||||||
self.filename.borrow().clone()
|
self.filename.borrow().clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-errorevent-error
|
||||||
fn Error(self, _cx: *mut JSContext) -> JSVal {
|
fn Error(self, _cx: *mut JSContext) -> JSVal {
|
||||||
self.error.get()
|
self.error.get()
|
||||||
}
|
}
|
||||||
|
|
|
@ -288,6 +288,7 @@ impl<'a> EventTargetHelpers for &'a EventTarget {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> EventTargetMethods for &'a EventTarget {
|
impl<'a> EventTargetMethods for &'a EventTarget {
|
||||||
|
// https://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener
|
||||||
fn AddEventListener(self,
|
fn AddEventListener(self,
|
||||||
ty: DOMString,
|
ty: DOMString,
|
||||||
listener: Option<Rc<EventListener>>,
|
listener: Option<Rc<EventListener>>,
|
||||||
|
@ -313,6 +314,7 @@ impl<'a> EventTargetMethods for &'a EventTarget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://dom.spec.whatwg.org/#dom-eventtarget-removeeventlistener
|
||||||
fn RemoveEventListener(self,
|
fn RemoveEventListener(self,
|
||||||
ty: DOMString,
|
ty: DOMString,
|
||||||
listener: Option<Rc<EventListener>>,
|
listener: Option<Rc<EventListener>>,
|
||||||
|
@ -336,6 +338,7 @@ impl<'a> EventTargetMethods for &'a EventTarget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://dom.spec.whatwg.org/#dom-eventtarget-dispatchevent
|
||||||
fn DispatchEvent(self, event: &Event) -> Fallible<bool> {
|
fn DispatchEvent(self, event: &Event) -> Fallible<bool> {
|
||||||
if event.dispatching() || !event.initialized() {
|
if event.dispatching() || !event.initialized() {
|
||||||
return Err(InvalidState);
|
return Err(InvalidState);
|
||||||
|
|
|
@ -40,6 +40,7 @@ impl File {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> FileMethods for &'a File {
|
impl<'a> FileMethods for &'a File {
|
||||||
|
// https://w3c.github.io/FileAPI/#dfn-name
|
||||||
fn Name(self) -> DOMString {
|
fn Name(self) -> DOMString {
|
||||||
self.name.clone()
|
self.name.clone()
|
||||||
}
|
}
|
||||||
|
|
|
@ -280,7 +280,7 @@ impl<'a> FileReaderMethods for &'a FileReader {
|
||||||
event_handler!(loadend, GetOnloadend, SetOnloadend);
|
event_handler!(loadend, GetOnloadend, SetOnloadend);
|
||||||
|
|
||||||
//TODO https://w3c.github.io/FileAPI/#dfn-readAsArrayBuffer
|
//TODO https://w3c.github.io/FileAPI/#dfn-readAsArrayBuffer
|
||||||
//https://w3c.github.io/FileAPI/#dfn-readAsDataURL
|
// https://w3c.github.io/FileAPI/#dfn-readAsDataURL
|
||||||
fn ReadAsDataURL(self, blob: &Blob) -> ErrorResult {
|
fn ReadAsDataURL(self, blob: &Blob) -> ErrorResult {
|
||||||
let global = self.global.root();
|
let global = self.global.root();
|
||||||
// Step 1
|
// Step 1
|
||||||
|
@ -340,14 +340,17 @@ impl<'a> FileReaderMethods for &'a FileReader {
|
||||||
self.dispatch_progress_event("loadend".to_owned(), 0, None);
|
self.dispatch_progress_event("loadend".to_owned(), 0, None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/FileAPI/#dfn-error
|
||||||
fn GetError(self) -> Option<Root<DOMException>> {
|
fn GetError(self) -> Option<Root<DOMException>> {
|
||||||
self.error.get().map(|error| error.root())
|
self.error.get().map(|error| error.root())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/FileAPI/#dfn-result
|
||||||
fn GetResult(self) -> Option<DOMString> {
|
fn GetResult(self) -> Option<DOMString> {
|
||||||
self.result.borrow().clone()
|
self.result.borrow().clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/FileAPI/#dfn-readyState
|
||||||
fn ReadyState(self) -> u16 {
|
fn ReadyState(self) -> u16 {
|
||||||
self.ready_state.get() as u16
|
self.ready_state.get() as u16
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,7 @@ impl FormData {
|
||||||
|
|
||||||
impl<'a> FormDataMethods for &'a FormData {
|
impl<'a> FormDataMethods for &'a FormData {
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
|
// https://xhr.spec.whatwg.org/#dom-formdata-append
|
||||||
fn Append(self, name: DOMString, value: &Blob, filename: Option<DOMString>) {
|
fn Append(self, name: DOMString, value: &Blob, filename: Option<DOMString>) {
|
||||||
let file = FormDatum::FileData(JS::from_rooted(&self.get_file_from_blob(value, filename)));
|
let file = FormDatum::FileData(JS::from_rooted(&self.get_file_from_blob(value, filename)));
|
||||||
let mut data = self.data.borrow_mut();
|
let mut data = self.data.borrow_mut();
|
||||||
|
@ -69,6 +70,7 @@ impl<'a> FormDataMethods for &'a FormData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://xhr.spec.whatwg.org/#dom-formdata-append
|
||||||
fn Append_(self, name: DOMString, value: DOMString) {
|
fn Append_(self, name: DOMString, value: DOMString) {
|
||||||
let mut data = self.data.borrow_mut();
|
let mut data = self.data.borrow_mut();
|
||||||
match data.entry(name) {
|
match data.entry(name) {
|
||||||
|
@ -77,11 +79,13 @@ impl<'a> FormDataMethods for &'a FormData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://xhr.spec.whatwg.org/#dom-formdata-delete
|
||||||
fn Delete(self, name: DOMString) {
|
fn Delete(self, name: DOMString) {
|
||||||
self.data.borrow_mut().remove(&name);
|
self.data.borrow_mut().remove(&name);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
|
// https://xhr.spec.whatwg.org/#dom-formdata-get
|
||||||
fn Get(self, name: DOMString) -> Option<FileOrString> {
|
fn Get(self, name: DOMString) -> Option<FileOrString> {
|
||||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||||
let data = self.data.borrow();
|
let data = self.data.borrow();
|
||||||
|
@ -97,18 +101,22 @@ impl<'a> FormDataMethods for &'a FormData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://xhr.spec.whatwg.org/#dom-formdata-has
|
||||||
fn Has(self, name: DOMString) -> bool {
|
fn Has(self, name: DOMString) -> bool {
|
||||||
self.data.borrow().contains_key(&name)
|
self.data.borrow().contains_key(&name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://xhr.spec.whatwg.org/#dom-formdata-set
|
||||||
|
fn Set_(self, name: DOMString, value: DOMString) {
|
||||||
|
self.data.borrow_mut().insert(name, vec!(FormDatum::StringData(value)));
|
||||||
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
|
// https://xhr.spec.whatwg.org/#dom-formdata-set
|
||||||
fn Set(self, name: DOMString, value: &Blob, filename: Option<DOMString>) {
|
fn Set(self, name: DOMString, value: &Blob, filename: Option<DOMString>) {
|
||||||
let file = FormDatum::FileData(JS::from_rooted(&self.get_file_from_blob(value, filename)));
|
let file = FormDatum::FileData(JS::from_rooted(&self.get_file_from_blob(value, filename)));
|
||||||
self.data.borrow_mut().insert(name, vec!(file));
|
self.data.borrow_mut().insert(name, vec!(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Set_(self, name: DOMString, value: DOMString) {
|
|
||||||
self.data.borrow_mut().insert(name, vec!(FormDatum::StringData(value)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
trait PrivateFormDataHelpers{
|
trait PrivateFormDataHelpers{
|
||||||
|
|
|
@ -78,16 +78,19 @@ impl<'a> VirtualMethods for &'a HTMLAnchorElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HTMLAnchorElementMethods for &'a HTMLAnchorElement {
|
impl<'a> HTMLAnchorElementMethods for &'a HTMLAnchorElement {
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-a-text
|
||||||
fn Text(self) -> DOMString {
|
fn Text(self) -> DOMString {
|
||||||
let node = NodeCast::from_ref(self);
|
let node = NodeCast::from_ref(self);
|
||||||
node.GetTextContent().unwrap()
|
node.GetTextContent().unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-a-text
|
||||||
fn SetText(self, value: DOMString) {
|
fn SetText(self, value: DOMString) {
|
||||||
let node = NodeCast::from_ref(self);
|
let node = NodeCast::from_ref(self);
|
||||||
node.SetTextContent(Some(value))
|
node.SetTextContent(Some(value))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-a-rellist
|
||||||
fn RelList(self) -> Root<DOMTokenList> {
|
fn RelList(self) -> Root<DOMTokenList> {
|
||||||
self.rel_list.or_init(|| {
|
self.rel_list.or_init(|| {
|
||||||
DOMTokenList::new(ElementCast::from_ref(self), &atom!("rel"))
|
DOMTokenList::new(ElementCast::from_ref(self), &atom!("rel"))
|
||||||
|
|
|
@ -67,6 +67,7 @@ impl<'a> VirtualMethods for &'a HTMLAreaElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HTMLAreaElementMethods for &'a HTMLAreaElement {
|
impl<'a> HTMLAreaElementMethods for &'a HTMLAreaElement {
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-area-rellist
|
||||||
fn RelList(self) -> Root<DOMTokenList> {
|
fn RelList(self) -> Root<DOMTokenList> {
|
||||||
self.rel_list.or_init(|| {
|
self.rel_list.or_init(|| {
|
||||||
DOMTokenList::new(ElementCast::from_ref(self), &atom!("rel"))
|
DOMTokenList::new(ElementCast::from_ref(self), &atom!("rel"))
|
||||||
|
|
|
@ -66,16 +66,17 @@ impl HTMLBodyElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HTMLBodyElementMethods for &'a HTMLBodyElement {
|
impl<'a> HTMLBodyElementMethods for &'a HTMLBodyElement {
|
||||||
|
// https://html.spec.whatwg.org/multipage#dom-body-bgcolor
|
||||||
// https://html.spec.whatwg.org/#dom-body-bgcolor
|
|
||||||
make_getter!(BgColor, "bgcolor");
|
make_getter!(BgColor, "bgcolor");
|
||||||
make_setter!(SetBgColor, "bgcolor");
|
make_setter!(SetBgColor, "bgcolor");
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#the-body-element
|
||||||
fn GetOnunload(self) -> Option<Rc<EventHandlerNonNull>> {
|
fn GetOnunload(self) -> Option<Rc<EventHandlerNonNull>> {
|
||||||
let win = window_from_node(self);
|
let win = window_from_node(self);
|
||||||
win.r().GetOnunload()
|
win.r().GetOnunload()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#the-body-element
|
||||||
fn SetOnunload(self, listener: Option<Rc<EventHandlerNonNull>>) {
|
fn SetOnunload(self, listener: Option<Rc<EventHandlerNonNull>>) {
|
||||||
let win = window_from_node(self);
|
let win = window_from_node(self);
|
||||||
win.r().SetOnunload(listener)
|
win.r().SetOnunload(listener)
|
||||||
|
|
|
@ -72,6 +72,7 @@ impl HTMLButtonElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HTMLButtonElementMethods for &'a HTMLButtonElement {
|
impl<'a> HTMLButtonElementMethods for &'a HTMLButtonElement {
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-cva-validity
|
||||||
fn Validity(self) -> Root<ValidityState> {
|
fn Validity(self) -> Root<ValidityState> {
|
||||||
let window = window_from_node(self);
|
let window = window_from_node(self);
|
||||||
ValidityState::new(window.r())
|
ValidityState::new(window.r())
|
||||||
|
|
|
@ -215,24 +215,29 @@ impl<'a> HTMLCanvasElementHelpers for &'a HTMLCanvasElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HTMLCanvasElementMethods for &'a HTMLCanvasElement {
|
impl<'a> HTMLCanvasElementMethods for &'a HTMLCanvasElement {
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-canvas-width
|
||||||
fn Width(self) -> u32 {
|
fn Width(self) -> u32 {
|
||||||
self.width.get()
|
self.width.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-canvas-width
|
||||||
fn SetWidth(self, width: u32) {
|
fn SetWidth(self, width: u32) {
|
||||||
let elem = ElementCast::from_ref(self);
|
let elem = ElementCast::from_ref(self);
|
||||||
elem.set_uint_attribute(&atom!("width"), width)
|
elem.set_uint_attribute(&atom!("width"), width)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-canvas-height
|
||||||
fn Height(self) -> u32 {
|
fn Height(self) -> u32 {
|
||||||
self.height.get()
|
self.height.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-canvas-height
|
||||||
fn SetHeight(self, height: u32) {
|
fn SetHeight(self, height: u32) {
|
||||||
let elem = ElementCast::from_ref(self);
|
let elem = ElementCast::from_ref(self);
|
||||||
elem.set_uint_attribute(&atom!("height"), height)
|
elem.set_uint_attribute(&atom!("height"), height)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-canvas-getcontext
|
||||||
fn GetContext(self,
|
fn GetContext(self,
|
||||||
cx: *mut JSContext,
|
cx: *mut JSContext,
|
||||||
id: DOMString,
|
id: DOMString,
|
||||||
|
|
|
@ -229,12 +229,14 @@ impl<'a> HTMLCollectionMethods for &'a HTMLCollection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://dom.spec.whatwg.org/#dom-htmlcollection-item
|
||||||
fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<Root<Element>> {
|
fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<Root<Element>> {
|
||||||
let maybe_elem = self.Item(index);
|
let maybe_elem = self.Item(index);
|
||||||
*found = maybe_elem.is_some();
|
*found = maybe_elem.is_some();
|
||||||
maybe_elem
|
maybe_elem
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check-tidy: no specs after this line
|
||||||
fn NamedGetter(self, name: DOMString, found: &mut bool) -> Option<Root<Element>> {
|
fn NamedGetter(self, name: DOMString, found: &mut bool) -> Option<Root<Element>> {
|
||||||
let maybe_elem = self.NamedItem(name);
|
let maybe_elem = self.NamedItem(name);
|
||||||
*found = maybe_elem.is_some();
|
*found = maybe_elem.is_some();
|
||||||
|
|
|
@ -49,6 +49,7 @@ impl HTMLDataListElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HTMLDataListElementMethods for &'a HTMLDataListElement {
|
impl<'a> HTMLDataListElementMethods for &'a HTMLDataListElement {
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-datalist-options
|
||||||
fn Options(self) -> Root<HTMLCollection> {
|
fn Options(self) -> Root<HTMLCollection> {
|
||||||
#[derive(JSTraceable)]
|
#[derive(JSTraceable)]
|
||||||
struct HTMLDataListOptionsFilter;
|
struct HTMLDataListOptionsFilter;
|
||||||
|
|
|
@ -131,6 +131,7 @@ impl<'a> PrivateHTMLElementHelpers for &'a HTMLElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HTMLElementMethods for &'a HTMLElement {
|
impl<'a> HTMLElementMethods for &'a HTMLElement {
|
||||||
|
// https://html.spec.whatwg.org/multipage/#the-style-attribute
|
||||||
fn Style(self) -> Root<CSSStyleDeclaration> {
|
fn Style(self) -> Root<CSSStyleDeclaration> {
|
||||||
self.style_decl.or_init(|| {
|
self.style_decl.or_init(|| {
|
||||||
let global = window_from_node(self);
|
let global = window_from_node(self);
|
||||||
|
@ -155,6 +156,7 @@ impl<'a> HTMLElementMethods for &'a HTMLElement {
|
||||||
self.dataset.or_init(|| DOMStringMap::new(self))
|
self.dataset.or_init(|| DOMStringMap::new(self))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#handler-onload
|
||||||
fn GetOnload(self) -> Option<Rc<EventHandlerNonNull>> {
|
fn GetOnload(self) -> Option<Rc<EventHandlerNonNull>> {
|
||||||
if self.is_body_or_frameset() {
|
if self.is_body_or_frameset() {
|
||||||
let win = window_from_node(self);
|
let win = window_from_node(self);
|
||||||
|
@ -165,6 +167,7 @@ impl<'a> HTMLElementMethods for &'a HTMLElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#handler-onload
|
||||||
fn SetOnload(self, listener: Option<Rc<EventHandlerNonNull>>) {
|
fn SetOnload(self, listener: Option<Rc<EventHandlerNonNull>>) {
|
||||||
if self.is_body_or_frameset() {
|
if self.is_body_or_frameset() {
|
||||||
let win = window_from_node(self);
|
let win = window_from_node(self);
|
||||||
|
|
|
@ -71,6 +71,7 @@ impl<'a> HTMLFieldSetElementMethods for &'a HTMLFieldSetElement {
|
||||||
HTMLCollection::create(window.r(), node, filter)
|
HTMLCollection::create(window.r(), node, filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-cva-validity
|
||||||
fn Validity(self) -> Root<ValidityState> {
|
fn Validity(self) -> Root<ValidityState> {
|
||||||
let window = window_from_node(self);
|
let window = window_from_node(self);
|
||||||
ValidityState::new(window.r())
|
ValidityState::new(window.r())
|
||||||
|
|
|
@ -254,26 +254,31 @@ pub fn Navigate(iframe: &HTMLIFrameElement, direction: NavigationDirection) -> F
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HTMLIFrameElementMethods for &'a HTMLIFrameElement {
|
impl<'a> HTMLIFrameElementMethods for &'a HTMLIFrameElement {
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-iframe-src
|
||||||
fn Src(self) -> DOMString {
|
fn Src(self) -> DOMString {
|
||||||
let element = ElementCast::from_ref(self);
|
let element = ElementCast::from_ref(self);
|
||||||
element.get_string_attribute(&atom!("src"))
|
element.get_string_attribute(&atom!("src"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-iframe-src
|
||||||
fn SetSrc(self, src: DOMString) {
|
fn SetSrc(self, src: DOMString) {
|
||||||
let element = ElementCast::from_ref(self);
|
let element = ElementCast::from_ref(self);
|
||||||
element.set_url_attribute(&atom!("src"), src)
|
element.set_url_attribute(&atom!("src"), src)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-iframe-sandbox
|
||||||
fn Sandbox(self) -> DOMString {
|
fn Sandbox(self) -> DOMString {
|
||||||
let element = ElementCast::from_ref(self);
|
let element = ElementCast::from_ref(self);
|
||||||
element.get_string_attribute(&atom!("sandbox"))
|
element.get_string_attribute(&atom!("sandbox"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-iframe-sandbox
|
||||||
fn SetSandbox(self, sandbox: DOMString) {
|
fn SetSandbox(self, sandbox: DOMString) {
|
||||||
let element = ElementCast::from_ref(self);
|
let element = ElementCast::from_ref(self);
|
||||||
element.set_tokenlist_attribute(&atom!("sandbox"), sandbox);
|
element.set_tokenlist_attribute(&atom!("sandbox"), sandbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-iframe-contentwindow
|
||||||
fn GetContentWindow(self) -> Option<Root<Window>> {
|
fn GetContentWindow(self) -> Option<Root<Window>> {
|
||||||
self.subpage_id.get().and_then(|subpage_id| {
|
self.subpage_id.get().and_then(|subpage_id| {
|
||||||
let window = window_from_node(self);
|
let window = window_from_node(self);
|
||||||
|
@ -286,6 +291,7 @@ impl<'a> HTMLIFrameElementMethods for &'a HTMLIFrameElement {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-iframe-contentdocument
|
||||||
fn GetContentDocument(self) -> Option<Root<Document>> {
|
fn GetContentDocument(self) -> Option<Root<Document>> {
|
||||||
self.GetContentWindow().and_then(|window| {
|
self.GetContentWindow().and_then(|window| {
|
||||||
let self_url = match self.get_url() {
|
let self_url = match self.get_url() {
|
||||||
|
@ -319,6 +325,7 @@ impl<'a> HTMLIFrameElementMethods for &'a HTMLIFrameElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-mozbrowser
|
||||||
fn SetMozbrowser(self, value: bool) -> ErrorResult {
|
fn SetMozbrowser(self, value: bool) -> ErrorResult {
|
||||||
if opts::experimental_enabled() {
|
if opts::experimental_enabled() {
|
||||||
let element = ElementCast::from_ref(self);
|
let element = ElementCast::from_ref(self);
|
||||||
|
|
|
@ -220,33 +220,39 @@ impl<'a> HTMLImageElementMethods for &'a HTMLImageElement {
|
||||||
|
|
||||||
make_bool_getter!(IsMap);
|
make_bool_getter!(IsMap);
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-img-ismap
|
||||||
fn SetIsMap(self, is_map: bool) {
|
fn SetIsMap(self, is_map: bool) {
|
||||||
let element = ElementCast::from_ref(self);
|
let element = ElementCast::from_ref(self);
|
||||||
element.set_string_attribute(&atom!("ismap"), is_map.to_string())
|
element.set_string_attribute(&atom!("ismap"), is_map.to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-img-width
|
||||||
fn Width(self) -> u32 {
|
fn Width(self) -> u32 {
|
||||||
let node = NodeCast::from_ref(self);
|
let node = NodeCast::from_ref(self);
|
||||||
let rect = node.get_bounding_content_box();
|
let rect = node.get_bounding_content_box();
|
||||||
rect.size.width.to_px() as u32
|
rect.size.width.to_px() as u32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-img-width
|
||||||
fn SetWidth(self, width: u32) {
|
fn SetWidth(self, width: u32) {
|
||||||
let elem = ElementCast::from_ref(self);
|
let elem = ElementCast::from_ref(self);
|
||||||
elem.set_uint_attribute(&atom!("width"), width)
|
elem.set_uint_attribute(&atom!("width"), width)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-img-height
|
||||||
fn Height(self) -> u32 {
|
fn Height(self) -> u32 {
|
||||||
let node = NodeCast::from_ref(self);
|
let node = NodeCast::from_ref(self);
|
||||||
let rect = node.get_bounding_content_box();
|
let rect = node.get_bounding_content_box();
|
||||||
rect.size.height.to_px() as u32
|
rect.size.height.to_px() as u32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-img-height
|
||||||
fn SetHeight(self, height: u32) {
|
fn SetHeight(self, height: u32) {
|
||||||
let elem = ElementCast::from_ref(self);
|
let elem = ElementCast::from_ref(self);
|
||||||
elem.set_uint_attribute(&atom!("height"), height)
|
elem.set_uint_attribute(&atom!("height"), height)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-img-naturalwidth
|
||||||
fn NaturalWidth(self) -> u32 {
|
fn NaturalWidth(self) -> u32 {
|
||||||
let image = self.image.borrow();
|
let image = self.image.borrow();
|
||||||
|
|
||||||
|
@ -256,6 +262,7 @@ impl<'a> HTMLImageElementMethods for &'a HTMLImageElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-img-naturalheight
|
||||||
fn NaturalHeight(self) -> u32 {
|
fn NaturalHeight(self) -> u32 {
|
||||||
let image = self.image.borrow();
|
let image = self.image.borrow();
|
||||||
|
|
||||||
|
@ -265,6 +272,7 @@ impl<'a> HTMLImageElementMethods for &'a HTMLImageElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-img-complete
|
||||||
fn Complete(self) -> bool {
|
fn Complete(self) -> bool {
|
||||||
let image = self.image.borrow();
|
let image = self.image.borrow();
|
||||||
image.is_some()
|
image.is_some()
|
||||||
|
|
|
@ -231,6 +231,7 @@ impl<'a> HTMLLinkElementMethods for &'a HTMLLinkElement {
|
||||||
make_getter!(Type);
|
make_getter!(Type);
|
||||||
make_setter!(SetType, "type");
|
make_setter!(SetType, "type");
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-link-rellist
|
||||||
fn RelList(self) -> Root<DOMTokenList> {
|
fn RelList(self) -> Root<DOMTokenList> {
|
||||||
self.rel_list.or_init(|| {
|
self.rel_list.or_init(|| {
|
||||||
DOMTokenList::new(ElementCast::from_ref(self), &atom!("rel"))
|
DOMTokenList::new(ElementCast::from_ref(self), &atom!("rel"))
|
||||||
|
|
|
@ -85,6 +85,7 @@ pub fn is_image_data(uri: &str) -> bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HTMLObjectElementMethods for &'a HTMLObjectElement {
|
impl<'a> HTMLObjectElementMethods for &'a HTMLObjectElement {
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-cva-validity
|
||||||
fn Validity(self) -> Root<ValidityState> {
|
fn Validity(self) -> Root<ValidityState> {
|
||||||
let window = window_from_node(self);
|
let window = window_from_node(self);
|
||||||
ValidityState::new(window.r())
|
ValidityState::new(window.r())
|
||||||
|
|
|
@ -47,6 +47,7 @@ impl HTMLOutputElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HTMLOutputElementMethods for &'a HTMLOutputElement {
|
impl<'a> HTMLOutputElementMethods for &'a HTMLOutputElement {
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-cva-validity
|
||||||
fn Validity(self) -> Root<ValidityState> {
|
fn Validity(self) -> Root<ValidityState> {
|
||||||
let window = window_from_node(self);
|
let window = window_from_node(self);
|
||||||
ValidityState::new(window.r())
|
ValidityState::new(window.r())
|
||||||
|
|
|
@ -59,12 +59,14 @@ impl HTMLSelectElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HTMLSelectElementMethods for &'a HTMLSelectElement {
|
impl<'a> HTMLSelectElementMethods for &'a HTMLSelectElement {
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-cva-validity
|
||||||
fn Validity(self) -> Root<ValidityState> {
|
fn Validity(self) -> Root<ValidityState> {
|
||||||
let window = window_from_node(self);
|
let window = window_from_node(self);
|
||||||
ValidityState::new(window.r())
|
ValidityState::new(window.r())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: this function currently only exists for test_union.html.
|
// Note: this function currently only exists for test_union.html.
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-select-add
|
||||||
fn Add(self, _element: HTMLOptionElementOrHTMLOptGroupElement, _before: Option<HTMLElementOrLong>) {
|
fn Add(self, _element: HTMLOptionElementOrHTMLOptGroupElement, _before: Option<HTMLElementOrLong>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ impl HTMLTableElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> HTMLTableElementMethods for &'a HTMLTableElement {
|
impl<'a> HTMLTableElementMethods for &'a HTMLTableElement {
|
||||||
// https://www.whatwg.org/html/#dom-table-caption
|
// https://html.spec.whatwg.org/multipage/#dom-table-caption
|
||||||
fn GetCaption(self) -> Option<Root<HTMLTableCaptionElement>> {
|
fn GetCaption(self) -> Option<Root<HTMLTableCaptionElement>> {
|
||||||
let node = NodeCast::from_ref(self);
|
let node = NodeCast::from_ref(self);
|
||||||
node.children()
|
node.children()
|
||||||
|
@ -75,7 +75,7 @@ impl<'a> HTMLTableElementMethods for &'a HTMLTableElement {
|
||||||
.next()
|
.next()
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.whatwg.org/html/#dom-table-caption
|
// https://html.spec.whatwg.org/multipage/#dom-table-caption
|
||||||
fn SetCaption(self, new_caption: Option<&HTMLTableCaptionElement>) {
|
fn SetCaption(self, new_caption: Option<&HTMLTableCaptionElement>) {
|
||||||
let node = NodeCast::from_ref(self);
|
let node = NodeCast::from_ref(self);
|
||||||
|
|
||||||
|
|
|
@ -761,6 +761,7 @@ impl KeyEventProperties {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> KeyboardEventMethods for &'a KeyboardEvent {
|
impl<'a> KeyboardEventMethods for &'a KeyboardEvent {
|
||||||
|
// https://w3c.github.io/uievents/#widl-KeyboardEvent-initKeyboardEvent
|
||||||
fn InitKeyboardEvent(self,
|
fn InitKeyboardEvent(self,
|
||||||
typeArg: DOMString,
|
typeArg: DOMString,
|
||||||
canBubbleArg: bool,
|
canBubbleArg: bool,
|
||||||
|
@ -783,38 +784,47 @@ impl<'a> KeyboardEventMethods for &'a KeyboardEvent {
|
||||||
self.repeat.set(repeat);
|
self.repeat.set(repeat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/uievents/#widl-KeyboardEvent-key
|
||||||
fn Key(self) -> DOMString {
|
fn Key(self) -> DOMString {
|
||||||
self.key_string.borrow().clone()
|
self.key_string.borrow().clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/uievents/#widl-KeyboardEvent-code
|
||||||
fn Code(self) -> DOMString {
|
fn Code(self) -> DOMString {
|
||||||
self.code.borrow().clone()
|
self.code.borrow().clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/uievents/#widl-KeyboardEvent-location
|
||||||
fn Location(self) -> u32 {
|
fn Location(self) -> u32 {
|
||||||
self.location.get()
|
self.location.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/uievents/#widl-KeyboardEvent-ctrlKey
|
||||||
fn CtrlKey(self) -> bool {
|
fn CtrlKey(self) -> bool {
|
||||||
self.ctrl.get()
|
self.ctrl.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/uievents/#widl-KeyboardEvent-shiftKey
|
||||||
fn ShiftKey(self) -> bool {
|
fn ShiftKey(self) -> bool {
|
||||||
self.shift.get()
|
self.shift.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/uievents/#widl-KeyboardEvent-altKey
|
||||||
fn AltKey(self) -> bool {
|
fn AltKey(self) -> bool {
|
||||||
self.alt.get()
|
self.alt.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/uievents/#widl-KeyboardEvent-metaKey
|
||||||
fn MetaKey(self) -> bool {
|
fn MetaKey(self) -> bool {
|
||||||
self.meta.get()
|
self.meta.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/uievents/#widl-KeyboardEvent-repeat
|
||||||
fn Repeat(self) -> bool {
|
fn Repeat(self) -> bool {
|
||||||
self.repeat.get()
|
self.repeat.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/uievents/#widl-KeyboardEvent-isComposing
|
||||||
fn IsComposing(self) -> bool {
|
fn IsComposing(self) -> bool {
|
||||||
self.is_composing.get()
|
self.is_composing.get()
|
||||||
}
|
}
|
||||||
|
@ -832,14 +842,17 @@ impl<'a> KeyboardEventMethods for &'a KeyboardEvent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/uievents/#widl-KeyboardEvent-charCode
|
||||||
fn CharCode(self) -> u32 {
|
fn CharCode(self) -> u32 {
|
||||||
self.char_code.get().unwrap_or(0)
|
self.char_code.get().unwrap_or(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/uievents/#widl-KeyboardEvent-keyCode
|
||||||
fn KeyCode(self) -> u32 {
|
fn KeyCode(self) -> u32 {
|
||||||
self.key_code.get()
|
self.key_code.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/uievents/#widl-KeyboardEvent-which
|
||||||
fn Which(self) -> u32 {
|
fn Which(self) -> u32 {
|
||||||
self.char_code.get().unwrap_or(self.KeyCode())
|
self.char_code.get().unwrap_or(self.KeyCode())
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,14 +90,17 @@ impl MessageEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> MessageEventMethods for &'a MessageEvent {
|
impl<'a> MessageEventMethods for &'a MessageEvent {
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-messageevent-data
|
||||||
fn Data(self, _cx: *mut JSContext) -> JSVal {
|
fn Data(self, _cx: *mut JSContext) -> JSVal {
|
||||||
self.data.get()
|
self.data.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-messageevent-origin
|
||||||
fn Origin(self) -> DOMString {
|
fn Origin(self) -> DOMString {
|
||||||
self.origin.clone()
|
self.origin.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-messageevent-lasteventid
|
||||||
fn LastEventId(self) -> DOMString {
|
fn LastEventId(self) -> DOMString {
|
||||||
self.lastEventId.clone()
|
self.lastEventId.clone()
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,42 +116,52 @@ impl MouseEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> MouseEventMethods for &'a MouseEvent {
|
impl<'a> MouseEventMethods for &'a MouseEvent {
|
||||||
|
// https://w3c.github.io/uievents/#widl-MouseEvent-screenX
|
||||||
fn ScreenX(self) -> i32 {
|
fn ScreenX(self) -> i32 {
|
||||||
self.screen_x.get()
|
self.screen_x.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/uievents/#widl-MouseEvent-screenY
|
||||||
fn ScreenY(self) -> i32 {
|
fn ScreenY(self) -> i32 {
|
||||||
self.screen_y.get()
|
self.screen_y.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/uievents/#widl-MouseEvent-clientX
|
||||||
fn ClientX(self) -> i32 {
|
fn ClientX(self) -> i32 {
|
||||||
self.client_x.get()
|
self.client_x.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/uievents/#widl-MouseEvent-clientY
|
||||||
fn ClientY(self) -> i32 {
|
fn ClientY(self) -> i32 {
|
||||||
self.client_y.get()
|
self.client_y.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/uievents/#widl-MouseEvent-ctrlKey
|
||||||
fn CtrlKey(self) -> bool {
|
fn CtrlKey(self) -> bool {
|
||||||
self.ctrl_key.get()
|
self.ctrl_key.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/uievents/#widl-MouseEvent-shiftKey
|
||||||
fn ShiftKey(self) -> bool {
|
fn ShiftKey(self) -> bool {
|
||||||
self.shift_key.get()
|
self.shift_key.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/uievents/#widl-MouseEvent-altKey
|
||||||
fn AltKey(self) -> bool {
|
fn AltKey(self) -> bool {
|
||||||
self.alt_key.get()
|
self.alt_key.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/uievents/#widl-MouseEvent-metaKey
|
||||||
fn MetaKey(self) -> bool {
|
fn MetaKey(self) -> bool {
|
||||||
self.meta_key.get()
|
self.meta_key.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/uievents/#widl-MouseEvent-button
|
||||||
fn Button(self) -> i16 {
|
fn Button(self) -> i16 {
|
||||||
self.button.get()
|
self.button.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/uievents/#widl-MouseEvent-relatedTarget
|
||||||
fn GetRelatedTarget(self) -> Option<Root<EventTarget>> {
|
fn GetRelatedTarget(self) -> Option<Root<EventTarget>> {
|
||||||
self.related_target.get().map(Root::from_rooted)
|
self.related_target.get().map(Root::from_rooted)
|
||||||
}
|
}
|
||||||
|
@ -160,6 +170,7 @@ impl<'a> MouseEventMethods for &'a MouseEvent {
|
||||||
// - https://github.com/servo/servo/issues/6643
|
// - https://github.com/servo/servo/issues/6643
|
||||||
// - https://bugzilla.mozilla.org/show_bug.cgi?id=1186125
|
// - https://bugzilla.mozilla.org/show_bug.cgi?id=1186125
|
||||||
// This returns the same result as current gecko.
|
// This returns the same result as current gecko.
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/which
|
||||||
fn Which(self) -> i32 {
|
fn Which(self) -> i32 {
|
||||||
if opts::experimental_enabled() {
|
if opts::experimental_enabled() {
|
||||||
(self.button.get() + 1) as i32
|
(self.button.get() + 1) as i32
|
||||||
|
@ -168,6 +179,7 @@ impl<'a> MouseEventMethods for &'a MouseEvent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/uievents/#widl-MouseEvent-initMouseEvent
|
||||||
fn InitMouseEvent(self,
|
fn InitMouseEvent(self,
|
||||||
typeArg: DOMString,
|
typeArg: DOMString,
|
||||||
canBubbleArg: bool,
|
canBubbleArg: bool,
|
||||||
|
|
|
@ -91,12 +91,14 @@ impl<'a> NamedNodeMapMethods for &'a NamedNodeMap {
|
||||||
owner.remove_attribute(&ns, &Atom::from_slice(&local_name)).ok_or(Error::NotFound)
|
owner.remove_attribute(&ns, &Atom::from_slice(&local_name)).ok_or(Error::NotFound)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://dom.spec.whatwg.org/#dom-namednodemap-item
|
||||||
fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<Root<Attr>> {
|
fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<Root<Attr>> {
|
||||||
let item = self.Item(index);
|
let item = self.Item(index);
|
||||||
*found = item.is_some();
|
*found = item.is_some();
|
||||||
item
|
item
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check-tidy: no specs after this line
|
||||||
fn NamedGetter(self, name: DOMString, found: &mut bool) -> Option<Root<Attr>> {
|
fn NamedGetter(self, name: DOMString, found: &mut bool) -> Option<Root<Attr>> {
|
||||||
let item = self.GetNamedItem(name);
|
let item = self.GetNamedItem(name);
|
||||||
*found = item.is_some();
|
*found = item.is_some();
|
||||||
|
|
|
@ -31,30 +31,37 @@ impl Navigator {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> NavigatorMethods for &'a Navigator {
|
impl<'a> NavigatorMethods for &'a Navigator {
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-navigator-product
|
||||||
fn Product(self) -> DOMString {
|
fn Product(self) -> DOMString {
|
||||||
navigatorinfo::Product()
|
navigatorinfo::Product()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-navigator-taintenabled
|
||||||
fn TaintEnabled(self) -> bool {
|
fn TaintEnabled(self) -> bool {
|
||||||
navigatorinfo::TaintEnabled()
|
navigatorinfo::TaintEnabled()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-navigator-appname
|
||||||
fn AppName(self) -> DOMString {
|
fn AppName(self) -> DOMString {
|
||||||
navigatorinfo::AppName()
|
navigatorinfo::AppName()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-navigator-appcodename
|
||||||
fn AppCodeName(self) -> DOMString {
|
fn AppCodeName(self) -> DOMString {
|
||||||
navigatorinfo::AppCodeName()
|
navigatorinfo::AppCodeName()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-navigator-platform
|
||||||
fn Platform(self) -> DOMString {
|
fn Platform(self) -> DOMString {
|
||||||
navigatorinfo::Platform()
|
navigatorinfo::Platform()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-navigator-useragent
|
||||||
fn UserAgent(self) -> DOMString {
|
fn UserAgent(self) -> DOMString {
|
||||||
navigatorinfo::UserAgent()
|
navigatorinfo::UserAgent()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-navigator-appversion
|
||||||
fn AppVersion(self) -> DOMString {
|
fn AppVersion(self) -> DOMString {
|
||||||
navigatorinfo::AppVersion()
|
navigatorinfo::AppVersion()
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,7 @@ impl<'a> NodeListMethods for &'a NodeList {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://dom.spec.whatwg.org/#dom-nodelist-item
|
||||||
fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<Root<Node>> {
|
fn IndexedGetter(self, index: u32, found: &mut bool) -> Option<Root<Node>> {
|
||||||
let item = self.Item(index);
|
let item = self.Item(index);
|
||||||
*found = item.is_some();
|
*found = item.is_some();
|
||||||
|
|
|
@ -44,6 +44,7 @@ impl Performance {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> PerformanceMethods for &'a Performance {
|
impl<'a> PerformanceMethods for &'a Performance {
|
||||||
|
// https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html#performance-timing-attribute
|
||||||
fn Timing(self) -> Root<PerformanceTiming> {
|
fn Timing(self) -> Root<PerformanceTiming> {
|
||||||
self.timing.root()
|
self.timing.root()
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,8 @@ impl PerformanceTiming {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> PerformanceTimingMethods for &'a PerformanceTiming {
|
impl<'a> PerformanceTimingMethods for &'a PerformanceTiming {
|
||||||
|
// https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/
|
||||||
|
// NavigationTiming/Overview.html#dom-performancetiming-navigationstart
|
||||||
fn NavigationStart(self) -> u64 {
|
fn NavigationStart(self) -> u64 {
|
||||||
self.navigationStart
|
self.navigationStart
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,12 +62,17 @@ impl ProgressEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ProgressEventMethods for &'a ProgressEvent {
|
impl<'a> ProgressEventMethods for &'a ProgressEvent {
|
||||||
|
// https://xhr.spec.whatwg.org/#dom-progressevent-lengthcomputable
|
||||||
fn LengthComputable(self) -> bool {
|
fn LengthComputable(self) -> bool {
|
||||||
self.length_computable
|
self.length_computable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://xhr.spec.whatwg.org/#dom-progressevent-loaded
|
||||||
fn Loaded(self) -> u64{
|
fn Loaded(self) -> u64{
|
||||||
self.loaded
|
self.loaded
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://xhr.spec.whatwg.org/#dom-progressevent-total
|
||||||
fn Total(self) -> u64 {
|
fn Total(self) -> u64 {
|
||||||
self.total
|
self.total
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,22 +95,22 @@ impl<'a> RangeHelpers<'a> for &'a Range {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> RangeMethods for &'a Range {
|
impl<'a> RangeMethods for &'a Range {
|
||||||
// http://dom.spec.whatwg.org/#dom-range-startcontainer
|
// https://dom.spec.whatwg.org/#dom-range-startcontainer
|
||||||
fn StartContainer(self) -> Root<Node> {
|
fn StartContainer(self) -> Root<Node> {
|
||||||
self.inner().borrow().start.node()
|
self.inner().borrow().start.node()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// http://dom.spec.whatwg.org/#dom-range-startoffset
|
// https://dom.spec.whatwg.org/#dom-range-startoffset
|
||||||
fn StartOffset(self) -> u32 {
|
fn StartOffset(self) -> u32 {
|
||||||
self.inner().borrow().start.offset
|
self.inner().borrow().start.offset
|
||||||
}
|
}
|
||||||
|
|
||||||
/// http://dom.spec.whatwg.org/#dom-range-endcontainer
|
// https://dom.spec.whatwg.org/#dom-range-endcontainer
|
||||||
fn EndContainer(self) -> Root<Node> {
|
fn EndContainer(self) -> Root<Node> {
|
||||||
self.inner().borrow().end.node()
|
self.inner().borrow().end.node()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// http://dom.spec.whatwg.org/#dom-range-endoffset
|
// https://dom.spec.whatwg.org/#dom-range-endoffset
|
||||||
fn EndOffset(self) -> u32 {
|
fn EndOffset(self) -> u32 {
|
||||||
self.inner().borrow().end.offset
|
self.inner().borrow().end.offset
|
||||||
}
|
}
|
||||||
|
@ -448,7 +448,7 @@ impl<'a> RangeMethods for &'a Range {
|
||||||
Ok(fragment)
|
Ok(fragment)
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-range-detach
|
// https://dom.spec.whatwg.org/#dom-range-detach
|
||||||
fn Detach(self) {
|
fn Detach(self) {
|
||||||
// This method intentionally left blank.
|
// This method intentionally left blank.
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,10 +29,12 @@ impl Screen {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ScreenMethods for &'a Screen {
|
impl<'a> ScreenMethods for &'a Screen {
|
||||||
|
// https://drafts.csswg.org/cssom-view/#dom-screen-colordepth
|
||||||
fn ColorDepth(self) -> u32 {
|
fn ColorDepth(self) -> u32 {
|
||||||
24
|
24
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://drafts.csswg.org/cssom-view/#dom-screen-pixeldepth
|
||||||
fn PixelDepth(self) -> u32 {
|
fn PixelDepth(self) -> u32 {
|
||||||
24
|
24
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,7 @@ impl Storage {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> StorageMethods for &'a Storage {
|
impl<'a> StorageMethods for &'a Storage {
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-storage-length
|
||||||
fn Length(self) -> u32 {
|
fn Length(self) -> u32 {
|
||||||
let (sender, receiver) = ipc::channel().unwrap();
|
let (sender, receiver) = ipc::channel().unwrap();
|
||||||
|
|
||||||
|
@ -65,6 +66,7 @@ impl<'a> StorageMethods for &'a Storage {
|
||||||
receiver.recv().unwrap() as u32
|
receiver.recv().unwrap() as u32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-storage-key
|
||||||
fn Key(self, index: u32) -> Option<DOMString> {
|
fn Key(self, index: u32) -> Option<DOMString> {
|
||||||
let (sender, receiver) = ipc::channel().unwrap();
|
let (sender, receiver) = ipc::channel().unwrap();
|
||||||
|
|
||||||
|
@ -72,6 +74,7 @@ impl<'a> StorageMethods for &'a Storage {
|
||||||
receiver.recv().unwrap()
|
receiver.recv().unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-storage-getitem
|
||||||
fn GetItem(self, name: DOMString) -> Option<DOMString> {
|
fn GetItem(self, name: DOMString) -> Option<DOMString> {
|
||||||
let (sender, receiver) = ipc::channel().unwrap();
|
let (sender, receiver) = ipc::channel().unwrap();
|
||||||
|
|
||||||
|
@ -80,12 +83,7 @@ impl<'a> StorageMethods for &'a Storage {
|
||||||
receiver.recv().unwrap()
|
receiver.recv().unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn NamedGetter(self, name: DOMString, found: &mut bool) -> Option<DOMString> {
|
// https://html.spec.whatwg.org/multipage/#dom-storage-setitem
|
||||||
let item = self.GetItem(name);
|
|
||||||
*found = item.is_some();
|
|
||||||
item
|
|
||||||
}
|
|
||||||
|
|
||||||
fn SetItem(self, name: DOMString, value: DOMString) {
|
fn SetItem(self, name: DOMString, value: DOMString) {
|
||||||
let (sender, receiver) = ipc::channel().unwrap();
|
let (sender, receiver) = ipc::channel().unwrap();
|
||||||
|
|
||||||
|
@ -97,14 +95,7 @@ impl<'a> StorageMethods for &'a Storage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn NamedSetter(self, name: DOMString, value: DOMString) {
|
// https://html.spec.whatwg.org/multipage/#dom-storage-removeitem
|
||||||
self.SetItem(name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn NamedCreator(self, name: DOMString, value: DOMString) {
|
|
||||||
self.SetItem(name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn RemoveItem(self, name: DOMString) {
|
fn RemoveItem(self, name: DOMString) {
|
||||||
let (sender, receiver) = ipc::channel().unwrap();
|
let (sender, receiver) = ipc::channel().unwrap();
|
||||||
|
|
||||||
|
@ -115,10 +106,7 @@ impl<'a> StorageMethods for &'a Storage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn NamedDeleter(self, name: DOMString) {
|
// https://html.spec.whatwg.org/multipage/#dom-storage-clear
|
||||||
self.RemoveItem(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn Clear(self) {
|
fn Clear(self) {
|
||||||
let (sender, receiver) = ipc::channel().unwrap();
|
let (sender, receiver) = ipc::channel().unwrap();
|
||||||
|
|
||||||
|
@ -127,6 +115,25 @@ impl<'a> StorageMethods for &'a Storage {
|
||||||
self.broadcast_change_notification(None, None, None);
|
self.broadcast_change_notification(None, None, None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check-tidy: no specs after this line
|
||||||
|
fn NamedGetter(self, name: DOMString, found: &mut bool) -> Option<DOMString> {
|
||||||
|
let item = self.GetItem(name);
|
||||||
|
*found = item.is_some();
|
||||||
|
item
|
||||||
|
}
|
||||||
|
|
||||||
|
fn NamedSetter(self, name: DOMString, value: DOMString) {
|
||||||
|
self.SetItem(name, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn NamedCreator(self, name: DOMString, value: DOMString) {
|
||||||
|
self.SetItem(name, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn NamedDeleter(self, name: DOMString) {
|
||||||
|
self.RemoveItem(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
trait PrivateStorageHelpers {
|
trait PrivateStorageHelpers {
|
||||||
|
|
|
@ -88,24 +88,28 @@ impl StorageEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> StorageEventMethods for &'a StorageEvent {
|
impl<'a> StorageEventMethods for &'a StorageEvent {
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-storageevent-key
|
||||||
fn GetKey(self) -> Option<DOMString> {
|
fn GetKey(self) -> Option<DOMString> {
|
||||||
self.key.borrow().clone()
|
self.key.borrow().clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-storageevent-oldvalue
|
||||||
fn GetOldValue(self) -> Option<DOMString> {
|
fn GetOldValue(self) -> Option<DOMString> {
|
||||||
self.oldValue.borrow().clone()
|
self.oldValue.borrow().clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-storageevent-newvalue
|
||||||
fn GetNewValue(self) -> Option<DOMString> {
|
fn GetNewValue(self) -> Option<DOMString> {
|
||||||
self.newValue.borrow().clone()
|
self.newValue.borrow().clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-storageevent-url
|
||||||
fn Url(self) -> DOMString {
|
fn Url(self) -> DOMString {
|
||||||
self.url.borrow().clone()
|
self.url.borrow().clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-storageevent-storagearea
|
||||||
fn GetStorageArea(self) -> Option<Root<Storage>> {
|
fn GetStorageArea(self) -> Option<Root<Storage>> {
|
||||||
self.storageArea.get().map(Root::from_rooted)
|
self.storageArea.get().map(Root::from_rooted)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
// check-tidy: no specs after this line
|
||||||
|
|
||||||
use dom::bindings::codegen::Bindings::TestBindingBinding::TestBindingMethods;
|
use dom::bindings::codegen::Bindings::TestBindingBinding::TestBindingMethods;
|
||||||
use dom::bindings::codegen::Bindings::TestBindingBinding::TestEnum;
|
use dom::bindings::codegen::Bindings::TestBindingBinding::TestEnum;
|
||||||
use dom::bindings::codegen::Bindings::TestBindingBinding::TestEnum::_empty;
|
use dom::bindings::codegen::Bindings::TestBindingBinding::TestEnum::_empty;
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* 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
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
// check-tidy: no specs after this line
|
||||||
|
|
||||||
use dom::bindings::codegen::Bindings::TestBindingProxyBinding::TestBindingProxyMethods;
|
use dom::bindings::codegen::Bindings::TestBindingProxyBinding::TestBindingProxyMethods;
|
||||||
use dom::bindings::utils::Reflector;
|
use dom::bindings::utils::Reflector;
|
||||||
use util::str::DOMString;
|
use util::str::DOMString;
|
||||||
|
|
|
@ -73,15 +73,18 @@ impl TextDecoder {
|
||||||
|
|
||||||
|
|
||||||
impl<'a> TextDecoderMethods for &'a TextDecoder {
|
impl<'a> TextDecoderMethods for &'a TextDecoder {
|
||||||
|
// https://encoding.spec.whatwg.org/#dom-textdecoder-encoding
|
||||||
fn Encoding(self) -> DOMString {
|
fn Encoding(self) -> DOMString {
|
||||||
self.encoding.whatwg_name().unwrap().to_owned()
|
self.encoding.whatwg_name().unwrap().to_owned()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://encoding.spec.whatwg.org/#dom-textdecoder-fatal
|
||||||
fn Fatal(self) -> bool {
|
fn Fatal(self) -> bool {
|
||||||
self.fatal
|
self.fatal
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
|
// https://encoding.spec.whatwg.org/#dom-textdecoder-decode
|
||||||
fn Decode(self, _cx: *mut JSContext, input: Option<*mut JSObject>)
|
fn Decode(self, _cx: *mut JSContext, input: Option<*mut JSObject>)
|
||||||
-> Fallible<USVString> {
|
-> Fallible<USVString> {
|
||||||
let input = match input {
|
let input = match input {
|
||||||
|
@ -108,5 +111,4 @@ impl<'a> TextDecoderMethods for &'a TextDecoder {
|
||||||
Err(_) => Err(Error::Type("Decoding failed".to_owned())),
|
Err(_) => Err(Error::Type("Decoding failed".to_owned())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,8 +75,8 @@ impl<'a> TextEncoderMethods for &'a TextEncoder {
|
||||||
self.encoding.clone()
|
self.encoding.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://encoding.spec.whatwg.org/#dom-textencoder-encode
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
|
// https://encoding.spec.whatwg.org/#dom-textencoder-encode
|
||||||
fn Encode(self, cx: *mut JSContext, input: USVString) -> *mut JSObject {
|
fn Encode(self, cx: *mut JSContext, input: USVString) -> *mut JSObject {
|
||||||
unsafe {
|
unsafe {
|
||||||
let encoded = self.encoder.encode(&input.0, EncoderTrap::Strict).unwrap();
|
let encoded = self.encoder.encode(&input.0, EncoderTrap::Strict).unwrap();
|
||||||
|
|
|
@ -77,16 +77,17 @@ impl UIEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> UIEventMethods for &'a UIEvent {
|
impl<'a> UIEventMethods for &'a UIEvent {
|
||||||
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#widl-UIEvent-view
|
// https://w3c.github.io/uievents/#widl-UIEvent-view
|
||||||
fn GetView(self) -> Option<Root<Window>> {
|
fn GetView(self) -> Option<Root<Window>> {
|
||||||
self.view.get().map(Root::from_rooted)
|
self.view.get().map(Root::from_rooted)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#widl-UIEvent-detail
|
// https://w3c.github.io/uievents/#widl-UIEvent-detail
|
||||||
fn Detail(self) -> i32 {
|
fn Detail(self) -> i32 {
|
||||||
self.detail.get()
|
self.detail.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://w3c.github.io/uievents/#widl-UIEvent-initUIEvent
|
||||||
fn InitUIEvent(self,
|
fn InitUIEvent(self,
|
||||||
type_: DOMString,
|
type_: DOMString,
|
||||||
can_bubble: bool,
|
can_bubble: bool,
|
||||||
|
|
|
@ -35,14 +35,17 @@ impl WebGLActiveInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> WebGLActiveInfoMethods for &'a WebGLActiveInfo {
|
impl<'a> WebGLActiveInfoMethods for &'a WebGLActiveInfo {
|
||||||
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.11.1
|
||||||
fn Size(self) -> i32 {
|
fn Size(self) -> i32 {
|
||||||
self.size
|
self.size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.11.1
|
||||||
fn Type(self) -> u32 {
|
fn Type(self) -> u32 {
|
||||||
self.ty
|
self.ty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.11.1
|
||||||
fn Name(self) -> DOMString {
|
fn Name(self) -> DOMString {
|
||||||
self.name.clone()
|
self.name.clone()
|
||||||
}
|
}
|
||||||
|
|
|
@ -276,8 +276,8 @@ impl<'a> WebGLRenderingContextMethods for &'a WebGLRenderingContext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
|
||||||
fn BufferData(self, _cx: *mut JSContext, target: u32, data: Option<*mut JSObject>, usage: u32) {
|
fn BufferData(self, _cx: *mut JSContext, target: u32, data: Option<*mut JSObject>, usage: u32) {
|
||||||
let data = match data {
|
let data = match data {
|
||||||
Some(data) => data,
|
Some(data) => data,
|
||||||
|
@ -345,9 +345,9 @@ impl<'a> WebGLRenderingContextMethods for &'a WebGLRenderingContext {
|
||||||
WebGLProgram::maybe_new(self.global.root().r(), self.ipc_renderer.clone())
|
WebGLProgram::maybe_new(self.global.root().r(), self.ipc_renderer.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
|
|
||||||
// TODO(ecoal95): Check if constants are cross-platform or if we must make a translation
|
// TODO(ecoal95): Check if constants are cross-platform or if we must make a translation
|
||||||
// between WebGL constants and native ones.
|
// between WebGL constants and native ones.
|
||||||
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
|
||||||
fn CreateShader(self, shader_type: u32) -> Option<Root<WebGLShader>> {
|
fn CreateShader(self, shader_type: u32) -> Option<Root<WebGLShader>> {
|
||||||
WebGLShader::maybe_new(self.global.root().r(), self.ipc_renderer.clone(), shader_type)
|
WebGLShader::maybe_new(self.global.root().r(), self.ipc_renderer.clone(), shader_type)
|
||||||
}
|
}
|
||||||
|
@ -474,8 +474,8 @@ impl<'a> WebGLRenderingContextMethods for &'a WebGLRenderingContext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
|
||||||
fn Uniform4fv(self,
|
fn Uniform4fv(self,
|
||||||
_cx: *mut JSContext,
|
_cx: *mut JSContext,
|
||||||
uniform: Option<&WebGLUniformLocation>,
|
uniform: Option<&WebGLUniformLocation>,
|
||||||
|
|
|
@ -39,14 +39,17 @@ impl WebGLShaderPrecisionFormat {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> WebGLShaderPrecisionFormatMethods for &'a WebGLShaderPrecisionFormat {
|
impl<'a> WebGLShaderPrecisionFormatMethods for &'a WebGLShaderPrecisionFormat {
|
||||||
|
// https://www.khronos.org/registry/webgl/specs/1.0/#5.12.1
|
||||||
fn RangeMin(self) -> i32 {
|
fn RangeMin(self) -> i32 {
|
||||||
self.range_min
|
self.range_min
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://www.khronos.org/registry/webgl/specs/1.0/#5.12.1
|
||||||
fn RangeMax(self) -> i32 {
|
fn RangeMax(self) -> i32 {
|
||||||
self.range_max
|
self.range_max
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://www.khronos.org/registry/webgl/specs/1.0/#5.12.1
|
||||||
fn Precision(self) -> i32 {
|
fn Precision(self) -> i32 {
|
||||||
self.precision
|
self.precision
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,14 +172,17 @@ impl<'a> WebSocketMethods for &'a WebSocket {
|
||||||
event_handler!(close, GetOnclose, SetOnclose);
|
event_handler!(close, GetOnclose, SetOnclose);
|
||||||
event_handler!(error, GetOnerror, SetOnerror);
|
event_handler!(error, GetOnerror, SetOnerror);
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-websocket-url
|
||||||
fn Url(self) -> DOMString {
|
fn Url(self) -> DOMString {
|
||||||
self.url.serialize()
|
self.url.serialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-websocket-readystate
|
||||||
fn ReadyState(self) -> u16 {
|
fn ReadyState(self) -> u16 {
|
||||||
self.ready_state.get() as u16
|
self.ready_state.get() as u16
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-websocket-send
|
||||||
fn Send(self, data: Option<USVString>) -> Fallible<()> {
|
fn Send(self, data: Option<USVString>) -> Fallible<()> {
|
||||||
match self.ready_state.get() {
|
match self.ready_state.get() {
|
||||||
WebSocketRequestState::Connecting => {
|
WebSocketRequestState::Connecting => {
|
||||||
|
@ -206,6 +209,7 @@ impl<'a> WebSocketMethods for &'a WebSocket {
|
||||||
return Ok(())
|
return Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-websocket-close
|
||||||
fn Close(self, code: Option<u16>, reason: Option<USVString>) -> Fallible<()>{
|
fn Close(self, code: Option<u16>, reason: Option<USVString>) -> Fallible<()>{
|
||||||
fn send_close(this: &WebSocket) {
|
fn send_close(this: &WebSocket) {
|
||||||
this.ready_state.set(WebSocketRequestState::Closing);
|
this.ready_state.set(WebSocketRequestState::Closing);
|
||||||
|
|
|
@ -339,10 +339,12 @@ impl<'a> WindowMethods for &'a Window {
|
||||||
println!("ALERT: {}", s);
|
println!("ALERT: {}", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-window-close
|
||||||
fn Close(self) {
|
fn Close(self) {
|
||||||
self.script_chan.send(ScriptMsg::ExitWindow(self.id.clone())).unwrap();
|
self.script_chan.send(ScriptMsg::ExitWindow(self.id.clone())).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-document-0
|
||||||
fn Document(self) -> Root<Document> {
|
fn Document(self) -> Root<Document> {
|
||||||
self.browsing_context().as_ref().unwrap().active_document()
|
self.browsing_context().as_ref().unwrap().active_document()
|
||||||
}
|
}
|
||||||
|
@ -362,10 +364,12 @@ impl<'a> WindowMethods for &'a Window {
|
||||||
self.local_storage.or_init(|| Storage::new(&GlobalRef::Window(self), StorageType::Local))
|
self.local_storage.or_init(|| Storage::new(&GlobalRef::Window(self), StorageType::Local))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Web/API/Console
|
||||||
fn Console(self) -> Root<Console> {
|
fn Console(self) -> Root<Console> {
|
||||||
self.console.or_init(|| Console::new(GlobalRef::Window(self)))
|
self.console.or_init(|| Console::new(GlobalRef::Window(self)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#dfn-GlobalCrypto
|
||||||
fn Crypto(self) -> Root<Crypto> {
|
fn Crypto(self) -> Root<Crypto> {
|
||||||
self.crypto.or_init(|| Crypto::new(GlobalRef::Window(self)))
|
self.crypto.or_init(|| Crypto::new(GlobalRef::Window(self)))
|
||||||
}
|
}
|
||||||
|
@ -430,10 +434,12 @@ impl<'a> WindowMethods for &'a Window {
|
||||||
self.ClearTimeout(handle);
|
self.ClearTimeout(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-window
|
||||||
fn Window(self) -> Root<Window> {
|
fn Window(self) -> Root<Window> {
|
||||||
Root::from_ref(self)
|
Root::from_ref(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-self
|
||||||
fn Self_(self) -> Root<Window> {
|
fn Self_(self) -> Root<Window> {
|
||||||
self.Window()
|
self.Window()
|
||||||
}
|
}
|
||||||
|
@ -457,6 +463,8 @@ impl<'a> WindowMethods for &'a Window {
|
||||||
window
|
window
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/
|
||||||
|
// NavigationTiming/Overview.html#sec-window.performance-attribute
|
||||||
fn Performance(self) -> Root<Performance> {
|
fn Performance(self) -> Root<Performance> {
|
||||||
self.performance.or_init(|| {
|
self.performance.or_init(|| {
|
||||||
Performance::new(self, self.navigation_start,
|
Performance::new(self, self.navigation_start,
|
||||||
|
@ -468,29 +476,17 @@ impl<'a> WindowMethods for &'a Window {
|
||||||
event_handler!(unload, GetOnunload, SetOnunload);
|
event_handler!(unload, GetOnunload, SetOnunload);
|
||||||
error_event_handler!(error, GetOnerror, SetOnerror);
|
error_event_handler!(error, GetOnerror, SetOnerror);
|
||||||
|
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Web/API/Window/screen
|
||||||
fn Screen(self) -> Root<Screen> {
|
fn Screen(self) -> Root<Screen> {
|
||||||
self.screen.or_init(|| Screen::new(self))
|
self.screen.or_init(|| Screen::new(self))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Debug(self, message: DOMString) {
|
// https://html.spec.whatwg.org/multipage/#dom-windowbase64-btoa
|
||||||
debug!("{}", message);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
|
||||||
fn Gc(self) {
|
|
||||||
unsafe {
|
|
||||||
JS_GC(JS_GetRuntime(self.get_cx()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn Trap(self) {
|
|
||||||
breakpoint();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn Btoa(self, btoa: DOMString) -> Fallible<DOMString> {
|
fn Btoa(self, btoa: DOMString) -> Fallible<DOMString> {
|
||||||
base64_btoa(btoa)
|
base64_btoa(btoa)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-windowbase64-atob
|
||||||
fn Atob(self, atob: DOMString) -> Fallible<DOMString> {
|
fn Atob(self, atob: DOMString) -> Fallible<DOMString> {
|
||||||
base64_atob(atob)
|
base64_atob(atob)
|
||||||
}
|
}
|
||||||
|
@ -513,6 +509,22 @@ impl<'a> WindowMethods for &'a Window {
|
||||||
doc.r().cancel_animation_frame(ident);
|
doc.r().cancel_animation_frame(ident);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check-tidy: no specs after this line
|
||||||
|
fn Debug(self, message: DOMString) {
|
||||||
|
debug!("{}", message);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(unsafe_code)]
|
||||||
|
fn Gc(self) {
|
||||||
|
unsafe {
|
||||||
|
JS_GC(JS_GetRuntime(self.get_cx()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn Trap(self) {
|
||||||
|
breakpoint();
|
||||||
|
}
|
||||||
|
|
||||||
fn WebdriverCallback(self, cx: *mut JSContext, val: HandleValue) {
|
fn WebdriverCallback(self, cx: *mut JSContext, val: HandleValue) {
|
||||||
let rv = jsval_to_webdriver(cx, val);
|
let rv = jsval_to_webdriver(cx, val);
|
||||||
let opt_chan = self.webdriver_script_chan.borrow_mut().take();
|
let opt_chan = self.webdriver_script_chan.borrow_mut().take();
|
||||||
|
|
|
@ -138,6 +138,7 @@ impl Worker {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> WorkerMethods for &'a Worker {
|
impl<'a> WorkerMethods for &'a Worker {
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-dedicatedworkerglobalscope-postmessage
|
||||||
fn PostMessage(self, cx: *mut JSContext, message: HandleValue) -> ErrorResult {
|
fn PostMessage(self, cx: *mut JSContext, message: HandleValue) -> ErrorResult {
|
||||||
let data = try!(StructuredCloneData::write(cx, message));
|
let data = try!(StructuredCloneData::write(cx, message));
|
||||||
let address = Trusted::new(cx, self, self.global.root().r().script_chan().clone());
|
let address = Trusted::new(cx, self, self.global.root().r().script_chan().clone());
|
||||||
|
|
|
@ -173,22 +173,27 @@ impl<'a> WorkerGlobalScopeMethods for &'a WorkerGlobalScope {
|
||||||
self.navigator.or_init(|| WorkerNavigator::new(self))
|
self.navigator.or_init(|| WorkerNavigator::new(self))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/console
|
||||||
fn Console(self) -> Root<Console> {
|
fn Console(self) -> Root<Console> {
|
||||||
self.console.or_init(|| Console::new(GlobalRef::Worker(self)))
|
self.console.or_init(|| Console::new(GlobalRef::Worker(self)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dfn-Crypto
|
||||||
fn Crypto(self) -> Root<Crypto> {
|
fn Crypto(self) -> Root<Crypto> {
|
||||||
self.crypto.or_init(|| Crypto::new(GlobalRef::Worker(self)))
|
self.crypto.or_init(|| Crypto::new(GlobalRef::Worker(self)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-windowbase64-btoa
|
||||||
fn Btoa(self, btoa: DOMString) -> Fallible<DOMString> {
|
fn Btoa(self, btoa: DOMString) -> Fallible<DOMString> {
|
||||||
base64_btoa(btoa)
|
base64_btoa(btoa)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-windowbase64-atob
|
||||||
fn Atob(self, atob: DOMString) -> Fallible<DOMString> {
|
fn Atob(self, atob: DOMString) -> Fallible<DOMString> {
|
||||||
base64_atob(atob)
|
base64_atob(atob)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-windowtimers-setinterval
|
||||||
fn SetTimeout(self, _cx: *mut JSContext, callback: Rc<Function>, timeout: i32, args: Vec<HandleValue>) -> i32 {
|
fn SetTimeout(self, _cx: *mut JSContext, callback: Rc<Function>, timeout: i32, args: Vec<HandleValue>) -> i32 {
|
||||||
self.timers.set_timeout_or_interval(TimerCallback::FunctionTimerCallback(callback),
|
self.timers.set_timeout_or_interval(TimerCallback::FunctionTimerCallback(callback),
|
||||||
args,
|
args,
|
||||||
|
@ -198,6 +203,7 @@ impl<'a> WorkerGlobalScopeMethods for &'a WorkerGlobalScope {
|
||||||
self.script_chan())
|
self.script_chan())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-windowtimers-setinterval
|
||||||
fn SetTimeout_(self, _cx: *mut JSContext, callback: DOMString, timeout: i32, args: Vec<HandleValue>) -> i32 {
|
fn SetTimeout_(self, _cx: *mut JSContext, callback: DOMString, timeout: i32, args: Vec<HandleValue>) -> i32 {
|
||||||
self.timers.set_timeout_or_interval(TimerCallback::StringTimerCallback(callback),
|
self.timers.set_timeout_or_interval(TimerCallback::StringTimerCallback(callback),
|
||||||
args,
|
args,
|
||||||
|
@ -207,10 +213,12 @@ impl<'a> WorkerGlobalScopeMethods for &'a WorkerGlobalScope {
|
||||||
self.script_chan())
|
self.script_chan())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-windowtimers-clearinterval
|
||||||
fn ClearTimeout(self, handle: i32) {
|
fn ClearTimeout(self, handle: i32) {
|
||||||
self.timers.clear_timeout_or_interval(handle);
|
self.timers.clear_timeout_or_interval(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-windowtimers-setinterval
|
||||||
fn SetInterval(self, _cx: *mut JSContext, callback: Rc<Function>, timeout: i32, args: Vec<HandleValue>) -> i32 {
|
fn SetInterval(self, _cx: *mut JSContext, callback: Rc<Function>, timeout: i32, args: Vec<HandleValue>) -> i32 {
|
||||||
self.timers.set_timeout_or_interval(TimerCallback::FunctionTimerCallback(callback),
|
self.timers.set_timeout_or_interval(TimerCallback::FunctionTimerCallback(callback),
|
||||||
args,
|
args,
|
||||||
|
@ -220,6 +228,7 @@ impl<'a> WorkerGlobalScopeMethods for &'a WorkerGlobalScope {
|
||||||
self.script_chan())
|
self.script_chan())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-windowtimers-setinterval
|
||||||
fn SetInterval_(self, _cx: *mut JSContext, callback: DOMString, timeout: i32, args: Vec<HandleValue>) -> i32 {
|
fn SetInterval_(self, _cx: *mut JSContext, callback: DOMString, timeout: i32, args: Vec<HandleValue>) -> i32 {
|
||||||
self.timers.set_timeout_or_interval(TimerCallback::StringTimerCallback(callback),
|
self.timers.set_timeout_or_interval(TimerCallback::StringTimerCallback(callback),
|
||||||
args,
|
args,
|
||||||
|
@ -229,6 +238,7 @@ impl<'a> WorkerGlobalScopeMethods for &'a WorkerGlobalScope {
|
||||||
self.script_chan())
|
self.script_chan())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-windowtimers-clearinterval
|
||||||
fn ClearInterval(self, handle: i32) {
|
fn ClearInterval(self, handle: i32) {
|
||||||
self.ClearTimeout(handle);
|
self.ClearTimeout(handle);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,30 +32,37 @@ impl WorkerNavigator {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> WorkerNavigatorMethods for &'a WorkerNavigator {
|
impl<'a> WorkerNavigatorMethods for &'a WorkerNavigator {
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-navigator-product
|
||||||
fn Product(self) -> DOMString {
|
fn Product(self) -> DOMString {
|
||||||
navigatorinfo::Product()
|
navigatorinfo::Product()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-navigator-taintenabled
|
||||||
fn TaintEnabled(self) -> bool {
|
fn TaintEnabled(self) -> bool {
|
||||||
navigatorinfo::TaintEnabled()
|
navigatorinfo::TaintEnabled()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-navigator-appname
|
||||||
fn AppName(self) -> DOMString {
|
fn AppName(self) -> DOMString {
|
||||||
navigatorinfo::AppName()
|
navigatorinfo::AppName()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-navigator-appcodename
|
||||||
fn AppCodeName(self) -> DOMString {
|
fn AppCodeName(self) -> DOMString {
|
||||||
navigatorinfo::AppCodeName()
|
navigatorinfo::AppCodeName()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-navigator-platform
|
||||||
fn Platform(self) -> DOMString {
|
fn Platform(self) -> DOMString {
|
||||||
navigatorinfo::Platform()
|
navigatorinfo::Platform()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-navigator-useragent
|
||||||
fn UserAgent(self) -> DOMString {
|
fn UserAgent(self) -> DOMString {
|
||||||
navigatorinfo::UserAgent()
|
navigatorinfo::UserAgent()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#dom-navigator-appversion
|
||||||
fn AppVersion(self) -> DOMString {
|
fn AppVersion(self) -> DOMString {
|
||||||
navigatorinfo::AppVersion()
|
navigatorinfo::AppVersion()
|
||||||
}
|
}
|
||||||
|
|
|
@ -662,8 +662,8 @@ impl<'a> XMLHttpRequestMethods for &'a XMLHttpRequest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://xhr.spec.whatwg.org/#the-response-attribute
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
|
// https://xhr.spec.whatwg.org/#the-response-attribute
|
||||||
fn Response(self, cx: *mut JSContext) -> JSVal {
|
fn Response(self, cx: *mut JSContext) -> JSVal {
|
||||||
let mut rval = RootedValue::new(cx, UndefinedValue());
|
let mut rval = RootedValue::new(cx, UndefinedValue());
|
||||||
match self.response_type.get() {
|
match self.response_type.get() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue