diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-03-25 01:09:47 -0600 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-03-25 01:09:47 -0600 |
commit | e77c4e2d76104855c42d1eee09caf36b61acccad (patch) | |
tree | b7326c18e51d1fe294ff0c554487d4902e07b779 /components/script/dom | |
parent | 8b5df113f0202e889195e3772e13c037c4d33cc7 (diff) | |
parent | 39191daaed4d11045fcf1f0dbaa74cd2d721c253 (diff) | |
download | servo-e77c4e2d76104855c42d1eee09caf36b61acccad.tar.gz servo-e77c4e2d76104855c42d1eee09caf36b61acccad.zip |
auto merge of #5346 : saneyuki/servo/binding, r=jdm
- Fix #707
- Take over from #5106
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 39 | ||||
-rw-r--r-- | components/script/dom/bindings/conversions.rs | 44 | ||||
-rw-r--r-- | components/script/dom/bindings/mod.rs | 1 | ||||
-rw-r--r-- | components/script/dom/bindings/num.rs | 43 | ||||
-rw-r--r-- | components/script/dom/canvasgradient.rs | 5 | ||||
-rw-r--r-- | components/script/dom/canvasrenderingcontext2d.rs | 128 | ||||
-rw-r--r-- | components/script/dom/domrect.rs | 27 | ||||
-rw-r--r-- | components/script/dom/performance.rs | 6 | ||||
-rw-r--r-- | components/script/dom/testbinding.rs | 79 | ||||
-rw-r--r-- | components/script/dom/webidls/CanvasRenderingContext2D.webidl | 69 | ||||
-rw-r--r-- | components/script/dom/webidls/TestBinding.webidl | 26 |
11 files changed, 370 insertions, 97 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 92b05cb5780..2e511e342e9 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -80,8 +80,10 @@ builtinNames = { IDLType.Tags.uint16: 'u16', IDLType.Tags.uint32: 'u32', IDLType.Tags.uint64: 'u64', - IDLType.Tags.float: 'f32', - IDLType.Tags.double: 'f64' + IDLType.Tags.unrestricted_float: 'f32', + IDLType.Tags.float: 'Finite<f32>', + IDLType.Tags.unrestricted_double: 'f64', + IDLType.Tags.double: 'Finite<f64>' } numericTags = [ @@ -89,7 +91,8 @@ numericTags = [ IDLType.Tags.int16, IDLType.Tags.uint16, IDLType.Tags.int32, IDLType.Tags.uint32, IDLType.Tags.int64, IDLType.Tags.uint64, - IDLType.Tags.float, IDLType.Tags.double + IDLType.Tags.unrestricted_float, IDLType.Tags.float, + IDLType.Tags.unrestricted_double, IDLType.Tags.double ] class CastableObjectUnwrapper(): @@ -884,12 +887,23 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None, if type.nullable(): declType = CGWrapper(declType, pre="Option<", post=">") - #XXXjdm support conversionBehavior here - template = ( - "match FromJSValConvertible::from_jsval(cx, ${val}, ()) {\n" - " Ok(v) => v,\n" - " Err(_) => { %s }\n" - "}" % exceptionCode) + template = "" + if type.isFloat() and not type.isUnrestricted(): + template = ( + "match FromJSValConvertible::from_jsval(cx, ${val}, ()) {\n" + " Ok(v) => v,\n" + " Err(_) => {\n" + " throw_type_error(cx, \"this argument is not a finite floating-point value\");\n" + " %s\n" + " }\n" + "}" % exceptionCode) + else: + #XXXjdm support conversionBehavior here + template = ( + "match FromJSValConvertible::from_jsval(cx, ${val}, ()) {\n" + " Ok(v) => v,\n" + " Err(_) => { %s }\n" + "}" % exceptionCode) if defaultValue is not None: if isinstance(defaultValue, IDLNullValue): @@ -962,7 +976,8 @@ def convertConstIDLValueToJSVal(value): return "DoubleVal(%s)" % (value.value) if tag == IDLType.Tags.bool: return "BoolVal(true)" if value.value else "BoolVal(false)" - if tag in [IDLType.Tags.float, IDLType.Tags.double]: + if tag in [IDLType.Tags.unrestricted_float, IDLType.Tags.float, + IDLType.Tags.unrestricted_double, IDLType.Tags.double]: return "DoubleVal(%s)" % (value.value) raise TypeError("Const value of unhandled type: " + value.type) @@ -2880,7 +2895,8 @@ def convertConstIDLValueToRust(value): IDLType.Tags.int16, IDLType.Tags.uint16, IDLType.Tags.int32, IDLType.Tags.uint32, IDLType.Tags.int64, IDLType.Tags.uint64, - IDLType.Tags.float, IDLType.Tags.double]: + IDLType.Tags.unrestricted_float, IDLType.Tags.float, + IDLType.Tags.unrestricted_double, IDLType.Tags.double]: return str(value.value) if tag == IDLType.Tags.bool: @@ -4683,6 +4699,7 @@ class CGBindingRoot(CGThing): 'dom::bindings::proxyhandler', 'dom::bindings::proxyhandler::{fill_property_descriptor, get_expando_object}', 'dom::bindings::proxyhandler::{get_property_descriptor}', + 'dom::bindings::num::Finite', 'dom::bindings::str::ByteString', 'dom::bindings::str::USVString', 'libc', diff --git a/components/script/dom/bindings/conversions.rs b/components/script/dom/bindings/conversions.rs index 56f647ce841..1a96dc7c948 100644 --- a/components/script/dom/bindings/conversions.rs +++ b/components/script/dom/bindings/conversions.rs @@ -16,8 +16,10 @@ //! | unsigned long | `u32` | //! | long long | `i64` | //! | unsigned long long | `u64` | -//! | float | `f32` | -//! | double | `f64` | +//! | unrestricted float | `f32` | +//! | float | `Finite<f32>` | +//! | unrestricted double | `f64` | +//! | double | `Finite<f64>` | //! | DOMString | `DOMString` | //! | USVString | `USVString` | //! | ByteString | `ByteString` | @@ -32,6 +34,7 @@ use dom::bindings::codegen::PrototypeList; use dom::bindings::js::{JSRef, Root, Unrooted}; +use dom::bindings::num::Finite; use dom::bindings::str::{ByteString, USVString}; use dom::bindings::utils::{Reflectable, Reflector, DOMClass}; use util::str::DOMString; @@ -254,6 +257,24 @@ impl FromJSValConvertible for f32 { } } +impl ToJSValConvertible for Finite<f32> { + fn to_jsval(&self, cx: *mut JSContext) -> JSVal { + let value = **self; + value.to_jsval(cx) + } +} + +impl FromJSValConvertible for Finite<f32> { + type Config = (); + fn from_jsval(cx: *mut JSContext, val: JSVal, option: ()) -> Result<Finite<f32>, ()> { + let result = FromJSValConvertible::from_jsval(cx, val, option); + let result = result.and_then(|v| { + Finite::<f32>::new(v).ok_or(()) + }); + result + } +} + impl ToJSValConvertible for f64 { fn to_jsval(&self, _cx: *mut JSContext) -> JSVal { unsafe { @@ -269,6 +290,25 @@ impl FromJSValConvertible for f64 { } } +impl ToJSValConvertible for Finite<f64> { + #[inline] + fn to_jsval(&self, cx: *mut JSContext) -> JSVal { + let value = **self; + value.to_jsval(cx) + } +} + +impl FromJSValConvertible for Finite<f64> { + type Config = (); + fn from_jsval(cx: *mut JSContext, val: JSVal, option: ()) -> Result<Finite<f64>, ()> { + let result = FromJSValConvertible::from_jsval(cx, val, option); + let result = result.and_then(|v| { + Finite::<f64>::new(v).ok_or(()) + }); + result + } +} + impl ToJSValConvertible for str { fn to_jsval(&self, cx: *mut JSContext) -> JSVal { unsafe { diff --git a/components/script/dom/bindings/mod.rs b/components/script/dom/bindings/mod.rs index 2775f513525..f2cfb642131 100644 --- a/components/script/dom/bindings/mod.rs +++ b/components/script/dom/bindings/mod.rs @@ -37,6 +37,7 @@ pub mod callback; pub mod error; pub mod conversions; pub mod proxyhandler; +pub mod num; pub mod str; pub mod structuredclone; pub mod trace; diff --git a/components/script/dom/bindings/num.rs b/components/script/dom/bindings/num.rs new file mode 100644 index 00000000000..353a395784b --- /dev/null +++ b/components/script/dom/bindings/num.rs @@ -0,0 +1,43 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +//! The `Finite<T>` struct. + +use core::nonzero::Zeroable; +use std::num::Float; +use std::ops::Deref; + +/// Encapsulates the IDL restricted float type. +#[derive(Clone,Eq,PartialEq)] +#[jstraceable] +pub struct Finite<T: Float>(T); + +unsafe impl<T: Float> Zeroable for Finite<T> {} + +impl<T: Float> Finite<T> { + /// Create a new `Finite<T: Float>` safely. + pub fn new(value: T) -> Option<Finite<T>> { + if value.is_finite() { + Some(Finite(value)) + } else { + None + } + } + + /// Create a new `Finite<T: Float>`. + #[inline] + pub fn wrap(value: T) -> Finite<T> { + assert!(value.is_finite(), "Finite<T> doesn't encapsulate unrestricted value."); + Finite(value) + } +} + +impl<T: Float> Deref for Finite<T> { + type Target = T; + + fn deref(&self) -> &T { + let &Finite(ref value) = self; + value + } +} diff --git a/components/script/dom/canvasgradient.rs b/components/script/dom/canvasgradient.rs index c1e61a12c26..349d434114c 100644 --- a/components/script/dom/canvasgradient.rs +++ b/components/script/dom/canvasgradient.rs @@ -9,6 +9,7 @@ use dom::bindings::codegen::Bindings::CanvasGradientBinding; use dom::bindings::codegen::Bindings::CanvasGradientBinding::CanvasGradientMethods; use dom::bindings::global::GlobalRef; use dom::bindings::js::{JSRef, Temporary}; +use dom::bindings::num::Finite; use dom::bindings::utils::{Reflector, reflect_dom_object}; use dom::canvasrenderingcontext2d::parse_color; @@ -41,7 +42,7 @@ impl CanvasGradient { } impl<'a> CanvasGradientMethods for JSRef<'a, CanvasGradient> { - fn AddColorStop(self, offset: f32, color: String) { + fn AddColorStop(self, offset: Finite<f32>, color: String) { let default_black = RGBA { red: 0.0, green: 0.0, @@ -50,7 +51,7 @@ impl<'a> CanvasGradientMethods for JSRef<'a, CanvasGradient> { }; self.stops.borrow_mut().push(CanvasGradientStop { - offset: offset as f64, + offset: (*offset) as f64, color: parse_color(color.as_slice()).unwrap_or(default_black), }); } diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs index 58f3b51ab05..37108922fc5 100644 --- a/components/script/dom/canvasrenderingcontext2d.rs +++ b/components/script/dom/canvasrenderingcontext2d.rs @@ -8,10 +8,11 @@ use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasWin use dom::bindings::codegen::Bindings::ImageDataBinding::ImageDataMethods; use dom::bindings::codegen::UnionTypes::HTMLCanvasElementOrCanvasRenderingContext2D; use dom::bindings::codegen::UnionTypes::StringOrCanvasGradientOrCanvasPattern; -use dom::bindings::error::Error::{IndexSize, TypeError}; +use dom::bindings::error::Error::{IndexSize, NotSupported, TypeError}; use dom::bindings::error::Fallible; use dom::bindings::global::{GlobalRef, GlobalField}; use dom::bindings::js::{JS, JSRef, LayoutJS, Temporary}; +use dom::bindings::num::Finite; use dom::bindings::utils::{Reflector, reflect_dom_object}; use dom::canvasgradient::{CanvasGradient, CanvasGradientStyle, ToFillOrStrokeStyle}; use dom::htmlcanvaselement::{HTMLCanvasElement, HTMLCanvasElementHelpers}; @@ -206,22 +207,44 @@ impl LayoutCanvasRenderingContext2DHelpers for LayoutJS<CanvasRenderingContext2D } } +// We add a guard to each of methods by the spec: +// http://www.w3.org/html/wg/drafts/2dcontext/html5_canvas_CR/ +// +// > Except where otherwise specified, for the 2D context interface, +// > any method call with a numeric argument whose value is infinite or a NaN value must be ignored. +// +// Restricted values are guarded in glue code. Therefore we need not add a guard. +// +// FIXME: this behavior should might be generated by some annotattions to idl. impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> { fn Canvas(self) -> Temporary<HTMLCanvasElement> { Temporary::new(self.canvas) } fn Scale(self, x: f64, y: f64) { + if !(x.is_finite() && y.is_finite()) { + return; + } + self.transform.set(self.transform.get().scale(x as f32, y as f32)); self.update_transform() } fn Translate(self, x: f64, y: f64) { + if !(x.is_finite() && y.is_finite()) { + return; + } + self.transform.set(self.transform.get().translate(x as f32, y as f32)); self.update_transform() } fn Transform(self, a: f64, b: f64, c: f64, d: f64, e: f64, f: f64) { + if !(a.is_finite() && b.is_finite() && c.is_finite() && + d.is_finite() && e.is_finite() && f.is_finite()) { + return; + } + self.transform.set(self.transform.get().mul(&Matrix2D::new(a as f32, b as f32, c as f32, @@ -232,6 +255,11 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> } fn SetTransform(self, a: f64, b: f64, c: f64, d: f64, e: f64, f: f64) { + if !(a.is_finite() && b.is_finite() && c.is_finite() && + d.is_finite() && e.is_finite() && f.is_finite()) { + return; + } + self.transform.set(Matrix2D::new(a as f32, b as f32, c as f32, @@ -242,16 +270,31 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> } fn FillRect(self, x: f64, y: f64, width: f64, height: f64) { + if !(x.is_finite() && y.is_finite() && + width.is_finite() && height.is_finite()) { + return; + } + let rect = Rect(Point2D(x as f32, y as f32), Size2D(width as f32, height as f32)); self.renderer.send(CanvasMsg::FillRect(rect)).unwrap(); } fn ClearRect(self, x: f64, y: f64, width: f64, height: f64) { + if !(x.is_finite() && y.is_finite() && + width.is_finite() && height.is_finite()) { + return; + } + let rect = Rect(Point2D(x as f32, y as f32), Size2D(width as f32, height as f32)); self.renderer.send(CanvasMsg::ClearRect(rect)).unwrap(); } fn StrokeRect(self, x: f64, y: f64, width: f64, height: f64) { + if !(x.is_finite() && y.is_finite() && + width.is_finite() && height.is_finite()) { + return; + } + let rect = Rect(Point2D(x as f32, y as f32), Size2D(width as f32, height as f32)); self.renderer.send(CanvasMsg::StrokeRect(rect)).unwrap(); } @@ -271,6 +314,9 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> // https://html.spec.whatwg.org/multipage/scripting.html#dom-context-2d-drawimage fn DrawImage(self, image: HTMLCanvasElementOrCanvasRenderingContext2D, dx: f64, dy: f64) -> Fallible<()> { + if !(dx.is_finite() && dy.is_finite()) { + return Ok(()); + } // From rules described in the spec: // If the sx, sy, sw, and sh arguments are omitted, they must default to 0, 0, @@ -310,6 +356,10 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> // https://html.spec.whatwg.org/multipage/scripting.html#dom-context-2d-drawimage fn DrawImage_(self, image: HTMLCanvasElementOrCanvasRenderingContext2D, dx: f64, dy: f64, dw: f64, dh: f64) -> Fallible<()> { + if !(dx.is_finite() && dy.is_finite() && + dw.is_finite() && dh.is_finite()) { + return Ok(()); + } // From rules described in the spec: // If the sx, sy, sw, and sh arguments are omitted, they must default to 0, 0, @@ -346,6 +396,11 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> fn DrawImage__(self, image: HTMLCanvasElementOrCanvasRenderingContext2D, sx: f64, sy: f64, sw: f64, sh: f64, dx: f64, dy: f64, dw: f64, dh: f64) -> Fallible<()> { + if !(sx.is_finite() && sy.is_finite() && sw.is_finite() && sh.is_finite() && + dx.is_finite() && dy.is_finite() && dw.is_finite() && dh.is_finite()) { + return Ok(()); + } + match image { HTMLCanvasElementOrCanvasRenderingContext2D::eHTMLCanvasElement(image) => { let canvas = image.root(); @@ -365,25 +420,49 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> } fn MoveTo(self, x: f64, y: f64) { + if !(x.is_finite() && y.is_finite()) { + return; + } + self.renderer.send(CanvasMsg::MoveTo(Point2D(x as f32, y as f32))).unwrap(); } fn LineTo(self, x: f64, y: f64) { + if !(x.is_finite() && y.is_finite()) { + return; + } + self.renderer.send(CanvasMsg::LineTo(Point2D(x as f32, y as f32))).unwrap(); } fn QuadraticCurveTo(self, cpx: f64, cpy: f64, x: f64, y: f64) { + if !(cpx.is_finite() && cpy.is_finite() && + x.is_finite() && y.is_finite()) { + return; + } + self.renderer.send(CanvasMsg::QuadraticCurveTo(Point2D(cpx as f32, cpy as f32), Point2D(x as f32, y as f32))).unwrap(); } fn BezierCurveTo(self, cp1x: f64, cp1y: f64, cp2x: f64, cp2y: f64, x: f64, y: f64) { + if !(cp1x.is_finite() && cp1y.is_finite() && cp2x.is_finite() && cp2y.is_finite() && + x.is_finite() && y.is_finite()) { + return; + } + self.renderer.send(CanvasMsg::BezierCurveTo(Point2D(cp1x as f32, cp1y as f32), Point2D(cp2x as f32, cp2y as f32), Point2D(x as f32, y as f32))).unwrap(); } - fn Arc(self, x: f64, y: f64, r: f64, start: f64, end: f64, ccw: bool) { + fn Arc(self, x: Finite<f64>, y: Finite<f64>, r: Finite<f64>, start: Finite<f64>, end: Finite<f64>, ccw: bool) { + let x = *x; + let y = *y; + let r = *r; + let start = *start; + let end = *end; + self.renderer.send(CanvasMsg::Arc(Point2D(x as f32, y as f32), r as f32, start as f32, end as f32, ccw)).unwrap(); } @@ -456,6 +535,10 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> } fn CreateImageData(self, sw: f64, sh: f64) -> Fallible<Temporary<ImageData>> { + if !(sw.is_finite() && sh.is_finite()) { + return Err(NotSupported); + } + if sw == 0.0 || sh == 0.0 { return Err(IndexSize) } @@ -467,7 +550,10 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> Ok(ImageData::new(self.global.root().r(), imagedata.Width(), imagedata.Height(), None)) } - fn GetImageData(self, sx: f64, sy: f64, sw: f64, sh: f64) -> Fallible<Temporary<ImageData>> { + fn GetImageData(self, sx: Finite<f64>, sy: Finite<f64>, sw: Finite<f64>, sh: Finite<f64>) -> Fallible<Temporary<ImageData>> { + let sw = *sw; + let sh = *sh; + if sw == 0.0 || sh == 0.0 { return Err(IndexSize) } @@ -480,15 +566,27 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> Ok(ImageData::new(self.global.root().r(), sw.abs().to_u32().unwrap(), sh.abs().to_u32().unwrap(), Some(data))) } - fn PutImageData(self, imagedata: JSRef<ImageData>, dx: f64, dy: f64) { + fn PutImageData(self, imagedata: JSRef<ImageData>, dx: Finite<f64>, dy: Finite<f64>) { + // XXX: + // By the spec: http://www.w3.org/html/wg/drafts/2dcontext/html5_canvas_CR/#dom-context-2d-putimagedata + // "If any of the arguments to the method are infinite or NaN, the method must throw a NotSupportedError exception" + // But this arguments are stricted value, so if they are not finite values, + // they will be TypeError by WebIDL spec before call this methods. + let data = imagedata.get_data_array(&self.global.root().r()); let image_data_rect = Rect(Point2D(dx.to_i32().unwrap(), dy.to_i32().unwrap()), imagedata.get_size()); let dirty_rect = None; self.renderer.send(CanvasMsg::PutImageData(data, image_data_rect, dirty_rect)).unwrap() } - fn PutImageData_(self, imagedata: JSRef<ImageData>, dx: f64, dy: f64, - dirtyX: f64, dirtyY: f64, dirtyWidth: f64, dirtyHeight: f64) { + fn PutImageData_(self, imagedata: JSRef<ImageData>, dx: Finite<f64>, dy: Finite<f64>, + dirtyX: Finite<f64>, dirtyY: Finite<f64>, dirtyWidth: Finite<f64>, dirtyHeight: Finite<f64>) { + // XXX: + // By the spec: http://www.w3.org/html/wg/drafts/2dcontext/html5_canvas_CR/#dom-context-2d-putimagedata + // "If any of the arguments to the method are infinite or NaN, the method must throw a NotSupportedError exception" + // But this arguments are stricted value, so if they are not finite values, + // they will be TypeError by WebIDL spec before call this methods. + let data = imagedata.get_data_array(&self.global.root().r()); let image_data_rect = Rect(Point2D(dx.to_i32().unwrap(), dy.to_i32().unwrap()), Size2D(imagedata.Width().to_i32().unwrap(), @@ -499,7 +597,13 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> self.renderer.send(CanvasMsg::PutImageData(data, image_data_rect, dirty_rect)).unwrap() } - fn CreateLinearGradient(self, x0: f64, y0: f64, x1: f64, y1: f64) -> Fallible<Temporary<CanvasGradient>> { + fn CreateLinearGradient(self, x0: Finite<f64>, y0: Finite<f64>, + x1: Finite<f64>, y1: Finite<f64>) -> Fallible<Temporary<CanvasGradient>> { + let x0 = *x0; + let y0 = *y0; + let x1 = *x1; + let y1 = *y1; + if [x0, y0, x1, y1].iter().any(|x| x.is_nan() || x.is_infinite()) { return Err(TypeError("One of the arguments of createLinearGradient() is not a finite floating-point value.".to_owned())); } @@ -507,7 +611,15 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D> CanvasGradientStyle::Linear(LinearGradientStyle::new(x0, y0, x1, y1, Vec::new())))) } - fn CreateRadialGradient(self, x0: f64, y0: f64, r0: f64, x1: f64, y1: f64, r1: f64) -> Fallible<Temporary<CanvasGradient>> { + fn CreateRadialGradient(self, x0: Finite<f64>, y0: Finite<f64>, r0: Finite<f64>, + x1: Finite<f64>, y1: Finite<f64>, r1: Finite<f64>) -> Fallible<Temporary<CanvasGradient>> { + let x0 = *x0; + let y0 = *y0; + let r0 = *r0; + let x1 = *x1; + let y1 = *y1; + let r1 = *r1; + if [x0, y0, r0, x1, y1, r1].iter().any(|x| x.is_nan() || x.is_infinite()) { return Err(TypeError("One of the arguments of createRadialGradient() is not a finite floating-point value.".to_owned())); } diff --git a/components/script/dom/domrect.rs b/components/script/dom/domrect.rs index 513e96ef28d..08cacc09be2 100644 --- a/components/script/dom/domrect.rs +++ b/components/script/dom/domrect.rs @@ -6,6 +6,7 @@ use dom::bindings::codegen::Bindings::DOMRectBinding; use dom::bindings::codegen::Bindings::DOMRectBinding::DOMRectMethods; use dom::bindings::global::GlobalRef; use dom::bindings::js::{JSRef, Temporary}; +use dom::bindings::num::Finite; use dom::bindings::utils::{Reflector, reflect_dom_object}; use dom::window::Window; use util::geometry::Au; @@ -41,28 +42,30 @@ impl DOMRect { } impl<'a> DOMRectMethods for JSRef<'a, DOMRect> { - fn Top(self) -> f32 { - self.top + fn Top(self) -> Finite<f32> { + Finite::wrap(self.top) } - fn Bottom(self) -> f32 { - self.bottom + fn Bottom(self) -> Finite<f32> { + Finite::wrap(self.bottom) } - fn Left(self) -> f32 { - self.left + fn Left(self) -> Finite<f32> { + Finite::wrap(self.left) } - fn Right(self) -> f32 { - self.right + fn Right(self) -> Finite<f32> { + Finite::wrap(self.right) } - fn Width(self) -> f32 { - (self.right - self.left).abs() + fn Width(self) -> Finite<f32> { + let result = (self.right - self.left).abs(); + Finite::wrap(result) } - fn Height(self) -> f32 { - (self.bottom - self.top).abs() + fn Height(self) -> Finite<f32> { + let result = (self.bottom - self.top).abs(); + Finite::wrap(result) } } diff --git a/components/script/dom/performance.rs b/components/script/dom/performance.rs index 31f0fd3b31e..45fa9ffe002 100644 --- a/components/script/dom/performance.rs +++ b/components/script/dom/performance.rs @@ -6,12 +6,13 @@ use dom::bindings::codegen::Bindings::PerformanceBinding; use dom::bindings::codegen::Bindings::PerformanceBinding::PerformanceMethods; use dom::bindings::global::GlobalRef; use dom::bindings::js::{JS, JSRef, Temporary}; +use dom::bindings::num::Finite; use dom::bindings::utils::{Reflector, reflect_dom_object}; use dom::performancetiming::{PerformanceTiming, PerformanceTimingHelpers}; use dom::window::Window; use time; -pub type DOMHighResTimeStamp = f64; +pub type DOMHighResTimeStamp = Finite<f64>; #[dom_struct] pub struct Performance { @@ -50,7 +51,8 @@ impl<'a> PerformanceMethods for JSRef<'a, Performance> { // https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/HighResolutionTime/Overview.html#dom-performance-now fn Now(self) -> DOMHighResTimeStamp { let navStart = self.timing.root().r().NavigationStartPrecise(); - (time::precise_time_ns() as f64 - navStart) * 1000000u as DOMHighResTimeStamp + let now = (time::precise_time_ns() as f64 - navStart) * 1000000u as f64; + Finite::wrap(now) } } diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs index 5a88db06fdc..2b42f26f294 100644 --- a/components/script/dom/testbinding.rs +++ b/components/script/dom/testbinding.rs @@ -14,6 +14,7 @@ use dom::bindings::codegen::UnionTypes::HTMLElementOrLong; use dom::bindings::codegen::UnionTypes::HTMLElementOrLong::eLong; use dom::bindings::global::GlobalField; use dom::bindings::js::{JSRef, Temporary}; +use dom::bindings::num::Finite; use dom::bindings::str::{ByteString, USVString}; use dom::bindings::utils::{Reflector, Reflectable}; use dom::blob::Blob; @@ -49,10 +50,14 @@ impl<'a> TestBindingMethods for JSRef<'a, TestBinding> { fn SetLongLongAttribute(self, _: i64) {} fn UnsignedLongLongAttribute(self) -> u64 { 0 } fn SetUnsignedLongLongAttribute(self, _: u64) {} - fn FloatAttribute(self) -> f32 { 0. } - fn SetFloatAttribute(self, _: f32) {} - fn DoubleAttribute(self) -> f64 { 0. } - fn SetDoubleAttribute(self, _: f64) {} + fn UnrestrictedFloatAttribute(self) -> f32 { 0. } + fn SetUnrestrictedFloatAttribute(self, _: f32) {} + fn FloatAttribute(self) -> Finite<f32> { Finite::wrap(0.) } + fn SetFloatAttribute(self, _: Finite<f32>) {} + fn UnrestrictedDoubleAttribute(self) -> f64 { 0. } + fn SetUnrestrictedDoubleAttribute(self, _: f64) {} + fn DoubleAttribute(self) -> Finite<f64> { Finite::wrap(0.) } + fn SetDoubleAttribute(self, _: Finite<f64>) {} fn StringAttribute(self) -> DOMString { "".to_owned() } fn SetStringAttribute(self, _: DOMString) {} fn UsvstringAttribute(self) -> USVString { USVString("".to_owned()) } @@ -92,10 +97,14 @@ impl<'a> TestBindingMethods for JSRef<'a, TestBinding> { fn SetLongLongAttributeNullable(self, _: Option<i64>) {} fn GetUnsignedLongLongAttributeNullable(self) -> Option<u64> { Some(0) } fn SetUnsignedLongLongAttributeNullable(self, _: Option<u64>) {} - fn GetFloatAttributeNullable(self) -> Option<f32> { Some(0.) } - fn SetFloatAttributeNullable(self, _: Option<f32>) {} - fn GetDoubleAttributeNullable(self) -> Option<f64> { Some(0.) } - fn SetDoubleAttributeNullable(self, _: Option<f64>) {} + fn GetUnrestrictedFloatAttributeNullable(self) -> Option<f32> { Some(0.) } + fn SetUnrestrictedFloatAttributeNullable(self, _: Option<f32>) {} + fn GetFloatAttributeNullable(self) -> Option<Finite<f32>> { Some(Finite::wrap(0.)) } + fn SetFloatAttributeNullable(self, _: Option<Finite<f32>>) {} + fn GetUnrestrictedDoubleAttributeNullable(self) -> Option<f64> { Some(0.) } + fn SetUnrestrictedDoubleAttributeNullable(self, _: Option<f64>) {} + fn GetDoubleAttributeNullable(self) -> Option<Finite<f64>> { Some(Finite::wrap(0.)) } + fn SetDoubleAttributeNullable(self, _: Option<Finite<f64>>) {} fn GetByteStringAttributeNullable(self) -> Option<ByteString> { Some(ByteString::new(vec!())) } fn SetByteStringAttributeNullable(self, _: Option<ByteString>) {} fn GetStringAttributeNullable(self) -> Option<DOMString> { Some("".to_owned()) } @@ -125,8 +134,10 @@ impl<'a> TestBindingMethods for JSRef<'a, TestBinding> { fn ReceiveUnsignedLong(self) -> u32 { 0 } fn ReceiveLongLong(self) -> i64 { 0 } fn ReceiveUnsignedLongLong(self) -> u64 { 0 } - fn ReceiveFloat(self) -> f32 { 0. } - fn ReceiveDouble(self) -> f64 { 0. } + fn ReceiveUnrestrictedFloat(self) -> f32 { 0. } + fn ReceiveFloat(self) -> Finite<f32> { Finite::wrap(0.) } + fn ReceiveUnrestrictedDouble(self) -> f64 { 0. } + fn ReceiveDouble(self) -> Finite<f64> { Finite::wrap(0.) } fn ReceiveString(self) -> DOMString { "".to_owned() } fn ReceiveUsvstring(self) -> USVString { USVString("".to_owned()) } fn ReceiveByteString(self) -> ByteString { ByteString::new(vec!()) } @@ -148,8 +159,10 @@ impl<'a> TestBindingMethods for JSRef<'a, TestBinding> { fn ReceiveNullableUnsignedLong(self) -> Option<u32> { Some(0) } fn ReceiveNullableLongLong(self) -> Option<i64> { Some(0) } fn ReceiveNullableUnsignedLongLong(self) -> Option<u64> { Some(0) } - fn ReceiveNullableFloat(self) -> Option<f32> { Some(0.) } - fn ReceiveNullableDouble(self) -> Option<f64> { Some(0.) } + fn ReceiveNullableUnrestrictedFloat(self) -> Option<f32> { Some(0.) } + fn ReceiveNullableFloat(self) -> Option<Finite<f32>> { Some(Finite::wrap(0.)) } + fn ReceiveNullableUnrestrictedDouble(self) -> Option<f64> { Some(0.) } + fn ReceiveNullableDouble(self) -> Option<Finite<f64>> { Some(Finite::wrap(0.)) } fn ReceiveNullableString(self) -> Option<DOMString> { Some("".to_owned()) } fn ReceiveNullableUsvstring(self) -> Option<USVString> { Some(USVString("".to_owned())) } fn ReceiveNullableByteString(self) -> Option<ByteString> { Some(ByteString::new(vec!())) } @@ -170,8 +183,10 @@ impl<'a> TestBindingMethods for JSRef<'a, TestBinding> { fn PassUnsignedLong(self, _: u32) {} fn PassLongLong(self, _: i64) {} fn PassUnsignedLongLong(self, _: u64) {} - fn PassFloat(self, _: f32) {} - fn PassDouble(self, _: f64) {} + fn PassUnrestrictedFloat(self, _: f32) {} + fn PassFloat(self, _: Finite<f32>) {} + fn PassUnrestrictedDouble(self, _: f64) {} + fn PassDouble(self, _: Finite<f64>) {} fn PassString(self, _: DOMString) {} fn PassUsvstring(self, _: USVString) {} fn PassByteString(self, _: ByteString) {} @@ -193,8 +208,10 @@ impl<'a> TestBindingMethods for JSRef<'a, TestBinding> { fn PassNullableUnsignedLong(self, _: Option<u32>) {} fn PassNullableLongLong(self, _: Option<i64>) {} fn PassNullableUnsignedLongLong(self, _: Option<u64>) {} - fn PassNullableFloat(self, _: Option<f32>) {} - fn PassNullableDouble(self, _: Option<f64>) {} + fn PassNullableUnrestrictedFloat(self, _: Option<f32>) {} + fn PassNullableFloat(self, _: Option<Finite<f32>>) {} + fn PassNullableUnrestrictedDouble(self, _: Option<f64>) {} + fn PassNullableDouble(self, _: Option<Finite<f64>>) {} fn PassNullableString(self, _: Option<DOMString>) {} fn PassNullableUsvstring(self, _: Option<USVString>) {} fn PassNullableByteString(self, _: Option<ByteString>) {} @@ -214,8 +231,10 @@ impl<'a> TestBindingMethods for JSRef<'a, TestBinding> { fn PassOptionalUnsignedLong(self, _: Option<u32>) {} fn PassOptionalLongLong(self, _: Option<i64>) {} fn PassOptionalUnsignedLongLong(self, _: Option<u64>) {} - fn PassOptionalFloat(self, _: Option<f32>) {} - fn PassOptionalDouble(self, _: Option<f64>) {} + fn PassOptionalUnrestrictedFloat(self, _: Option<f32>) {} + fn PassOptionalFloat(self, _: Option<Finite<f32>>) {} + fn PassOptionalUnrestrictedDouble(self, _: Option<f64>) {} + fn PassOptionalDouble(self, _: Option<Finite<f64>>) {} fn PassOptionalString(self, _: Option<DOMString>) {} fn PassOptionalUsvstring(self, _: Option<USVString>) {} fn PassOptionalByteString(self, _: Option<ByteString>) {} @@ -236,8 +255,10 @@ impl<'a> TestBindingMethods for JSRef<'a, TestBinding> { fn PassOptionalNullableUnsignedLong(self, _: Option<Option<u32>>) {} fn PassOptionalNullableLongLong(self, _: Option<Option<i64>>) {} fn PassOptionalNullableUnsignedLongLong(self, _: Option<Option<u64>>) {} - fn PassOptionalNullableFloat(self, _: Option<Option<f32>>) {} - fn PassOptionalNullableDouble(self, _: Option<Option<f64>>) {} + fn PassOptionalNullableUnrestrictedFloat(self, _: Option<Option<f32>>) {} + fn PassOptionalNullableFloat(self, _: Option<Option<Finite<f32>>>) {} + fn PassOptionalNullableUnrestrictedDouble(self, _: Option<Option<f64>>) {} + fn PassOptionalNullableDouble(self, _: Option<Option<Finite<f64>>>) {} fn PassOptionalNullableString(self, _: Option<Option<DOMString>>) {} fn PassOptionalNullableUsvstring(self, _: Option<Option<USVString>>) {} fn PassOptionalNullableByteString(self, _: Option<Option<ByteString>>) {} @@ -270,8 +291,10 @@ impl<'a> TestBindingMethods for JSRef<'a, TestBinding> { fn PassOptionalNullableUnsignedLongWithDefault(self, _: Option<u32>) {} fn PassOptionalNullableLongLongWithDefault(self, _: Option<i64>) {} fn PassOptionalNullableUnsignedLongLongWithDefault(self, _: Option<u64>) {} - // fn PassOptionalNullableFloatWithDefault(self, _: Option<f32>) {} - // fn PassOptionalNullableDoubleWithDefault(self, _: Option<f64>) {} + // fn PassOptionalNullableUnrestrictedFloatWithDefault(self, _: Option<f32>) {} + // fn PassOptionalNullableFloatWithDefault(self, _: Option<Finite<f32>>) {} + // fn PassOptionalNullableUnrestrictedDoubleWithDefault(self, _: Option<f64>) {} + // fn PassOptionalNullableDoubleWithDefault(self, _: Option<Finite<f64>>) {} fn PassOptionalNullableStringWithDefault(self, _: Option<DOMString>) {} fn PassOptionalNullableUsvstringWithDefault(self, _: Option<USVString>) {} fn PassOptionalNullableByteStringWithDefault(self, _: Option<ByteString>) {} @@ -292,8 +315,10 @@ impl<'a> TestBindingMethods for JSRef<'a, TestBinding> { fn PassOptionalNullableUnsignedLongWithNonNullDefault(self, _: Option<u32>) {} fn PassOptionalNullableLongLongWithNonNullDefault(self, _: Option<i64>) {} fn PassOptionalNullableUnsignedLongLongWithNonNullDefault(self, _: Option<u64>) {} - // fn PassOptionalNullableFloatWithNonNullDefault(self, _: Option<f32>) {} - // fn PassOptionalNullableDoubleWithNonNullDefault(self, _: Option<f64>) {} + // fn PassOptionalNullableUnrestrictedFloatWithNonNullDefault(self, _: Option<f32>) {} + // fn PassOptionalNullableFloatWithNonNullDefault(self, _: Option<Finite<f32>>) {} + // fn PassOptionalNullableUnrestrictedDoubleWithNonNullDefault(self, _: Option<f64>) {} + // fn PassOptionalNullableDoubleWithNonNullDefault(self, _: Option<Finite<f64>>) {} fn PassOptionalNullableStringWithNonNullDefault(self, _: Option<DOMString>) {} fn PassOptionalNullableUsvstringWithNonNullDefault(self, _: Option<USVString>) {} // fn PassOptionalNullableEnumWithNonNullDefault(self, _: Option<TestEnum>) {} @@ -307,8 +332,10 @@ impl<'a> TestBindingMethods for JSRef<'a, TestBinding> { fn PassVariadicUnsignedLong(self, _: Vec<u32>) {} fn PassVariadicLongLong(self, _: Vec<i64>) {} fn PassVariadicUnsignedLongLong(self, _: Vec<u64>) {} - fn PassVariadicFloat(self, _: Vec<f32>) {} - fn PassVariadicDouble(self, _: Vec<f64>) {} + fn PassVariadicUnrestrictedFloat(self, _: Vec<f32>) {} + fn PassVariadicFloat(self, _: Vec<Finite<f32>>) {} + fn PassVariadicUnrestrictedDouble(self, _: Vec<f64>) {} + fn PassVariadicDouble(self, _: Vec<Finite<f64>>) {} fn PassVariadicString(self, _: Vec<DOMString>) {} fn PassVariadicUsvstring(self, _: Vec<USVString>) {} fn PassVariadicByteString(self, _: Vec<ByteString>) {} diff --git a/components/script/dom/webidls/CanvasRenderingContext2D.webidl b/components/script/dom/webidls/CanvasRenderingContext2D.webidl index 0218600bba1..6d686307f46 100644 --- a/components/script/dom/webidls/CanvasRenderingContext2D.webidl +++ b/components/script/dom/webidls/CanvasRenderingContext2D.webidl @@ -31,21 +31,21 @@ interface CanvasRenderingContext2D { // transformations (default transform is the identity matrix) // attribute SVGMatrix currentTransform; - void scale(/*unrestricted*/ double x, /*unrestricted*/ double y); + void scale(unrestricted double x, unrestricted double y); //void rotate(unrestricted double angle); - void translate(/*unrestricted*/ double x, /*unrestricted*/ double y); - void transform(/*unrestricted*/ double a, - /*unrestricted*/ double b, - /*unrestricted*/ double c, - /*unrestricted*/ double d, - /*unrestricted*/ double e, - /*unrestricted*/ double f); - void setTransform(/*unrestricted*/ double a, - /*unrestricted*/ double b, - /*unrestricted*/ double c, - /*unrestricted*/ double d, - /*unrestricted*/ double e, - /*unrestricted*/ double f); + void translate(unrestricted double x, unrestricted double y); + void transform(unrestricted double a, + unrestricted double b, + unrestricted double c, + unrestricted double d, + unrestricted double e, + unrestricted double f); + void setTransform(unrestricted double a, + unrestricted double b, + unrestricted double c, + unrestricted double d, + unrestricted double e, + unrestricted double f); //void resetTransform(); // compositing @@ -71,15 +71,12 @@ interface CanvasRenderingContext2D { // attribute DOMString shadowColor; // (default transparent black) // rects - //void clearRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h); //[LenientFloat] - void clearRect(double x, double y, double w, double h); - //void fillRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h); + void clearRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h); //[LenientFloat] - void fillRect(double x, double y, double w, double h); - //void strokeRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h); + void fillRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h); //[LenientFloat] - void strokeRect(double x, double y, double w, double h); + void strokeRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h); // path API (see also CanvasPathMethods) void beginPath(); @@ -108,11 +105,15 @@ interface CanvasRenderingContext2D { // drawing images [Throws] - void drawImage(CanvasImageSource image, /* unrestricted */ double dx, /* unrestricted */ double dy); + void drawImage(CanvasImageSource image, unrestricted double dx, unrestricted double dy); [Throws] - void drawImage(CanvasImageSource image, /* unrestricted */ double dx, /* unrestricted */ double dy, /* unrestricted */ double dw, /* unrestricted */ double dh); + void drawImage(CanvasImageSource image, unrestricted double dx, unrestricted double dy, + unrestricted double dw, unrestricted double dh); [Throws] - void drawImage(CanvasImageSource image, /* unrestricted */ double sx, /* unrestricted */ double sy, /* unrestricted */ double sw, /* unrestricted */ double sh, /* unrestricted */ double dx, /* unrestricted */ double dy, /* unrestricted */ double dw, /* unrestricted */ double dh); + void drawImage(CanvasImageSource image, unrestricted double sx, unrestricted double sy, + unrestricted double sw, unrestricted double sh, + unrestricted double dx, unrestricted double dy, + unrestricted double dw, unrestricted double dh); // hit regions //void addHitRegion(optional HitRegionOptions options); @@ -120,7 +121,7 @@ interface CanvasRenderingContext2D { // pixel manipulation [Throws] - ImageData createImageData(double sw, double sh); + ImageData createImageData(unrestricted double sw, unrestricted double sh); [Throws] ImageData createImageData(ImageData imagedata); [Throws] @@ -133,16 +134,16 @@ interface CanvasRenderingContext2D { interface CanvasPathMethods { // shared path API methods void closePath(); - void moveTo(/*unrestricted*/ double x, /*unrestricted*/ double y); - void lineTo(double x, double y); - void quadraticCurveTo(double cpx, double cpy, double x, double y); - - void bezierCurveTo(/*unrestricted*/ double cp1x, - /*unrestricted*/ double cp1y, - /*unrestricted*/ double cp2x, - /*unrestricted*/ double cp2y, - /*unrestricted*/ double x, - /*unrestricted*/ double y); + void moveTo(unrestricted double x, unrestricted double y); + void lineTo(unrestricted double x, unrestricted double y); + void quadraticCurveTo(unrestricted double cpx, unrestricted double cpy, unrestricted double x, unrestricted double y); + + void bezierCurveTo(unrestricted double cp1x, + unrestricted double cp1y, + unrestricted double cp2x, + unrestricted double cp2y, + unrestricted double x, + unrestricted double y); //void arcTo(double x1, double y1, double x2, double y2, double radius); // NOT IMPLEMENTED [LenientFloat] void arcTo(double x1, double y1, double x2, double y2, double radiusX, double radiusY, double rotation); diff --git a/components/script/dom/webidls/TestBinding.webidl b/components/script/dom/webidls/TestBinding.webidl index 4c98746a9f1..e5c5aa1772c 100644 --- a/components/script/dom/webidls/TestBinding.webidl +++ b/components/script/dom/webidls/TestBinding.webidl @@ -14,7 +14,9 @@ dictionary TestDictionary { unsigned long unsignedLongValue; long long longLongValue; unsigned long long unsignedLongLongValue; + unrestricted float unrestrictedFloatValue; float floatValue; + unrestricted double unrestrictedDoubleValue; double doubleValue; DOMString stringValue; USVString usvstringValue; @@ -33,7 +35,9 @@ dictionary TestDictionaryDefaults { unsigned long unsignedLongValue = 7; long long longLongValue = 7; unsigned long long unsignedLongLongValue = 7; + // unrestricted float unrestrictedFloatValue = 7.0; // float floatValue = 7.0; + // unrestricted double UnrestrictedDoubleValue = 7.0; // double doubleValue = 7.0; DOMString stringValue = "foo"; USVString usvstringValue = "foo"; @@ -49,7 +53,9 @@ dictionary TestDictionaryDefaults { unsigned long? nullableUnsignedLongValue = 7; long long? nullableLongLongValue = 7; unsigned long long? nullableUnsignedLongLongValue = 7; + // unrestricted float? nullableUnrestrictedFloatValue = 7.0; // float? nullableFloatValue = 7.0; + // unrestricted double? nullableUnrestrictedDoubleValue = 7.0; // double? nullableDoubleValue = 7.0; DOMString? nullableStringValue = "foo"; USVString? nullableUsvstringValue = "foo"; @@ -66,7 +72,9 @@ interface TestBinding { attribute unsigned long unsignedLongAttribute; attribute long long longLongAttribute; attribute unsigned long long unsignedLongLongAttribute; + attribute unrestricted float unrestrictedFloatAttribute; attribute float floatAttribute; + attribute unrestricted double unrestrictedDoubleAttribute; attribute double doubleAttribute; attribute DOMString stringAttribute; attribute USVString usvstringAttribute; @@ -87,7 +95,9 @@ interface TestBinding { attribute unsigned long? unsignedLongAttributeNullable; attribute long long? longLongAttributeNullable; attribute unsigned long long? unsignedLongLongAttributeNullable; + attribute unrestricted float? unrestrictedFloatAttributeNullable; attribute float? floatAttributeNullable; + attribute unrestricted double? unrestrictedDoubleAttributeNullable; attribute double? doubleAttributeNullable; attribute DOMString? stringAttributeNullable; attribute USVString? usvstringAttributeNullable; @@ -109,7 +119,9 @@ interface TestBinding { unsigned long receiveUnsignedLong(); long long receiveLongLong(); unsigned long long receiveUnsignedLongLong(); + unrestricted float receiveUnrestrictedFloat(); float receiveFloat(); + unrestricted double receiveUnrestrictedDouble(); double receiveDouble(); DOMString receiveString(); USVString receiveUsvstring(); @@ -129,7 +141,9 @@ interface TestBinding { unsigned long? receiveNullableUnsignedLong(); long long? receiveNullableLongLong(); unsigned long long? receiveNullableUnsignedLongLong(); + unrestricted float? receiveNullableUnrestrictedFloat(); float? receiveNullableFloat(); + unrestricted double? receiveNullableUnrestrictedDouble(); double? receiveNullableDouble(); DOMString? receiveNullableString(); USVString? receiveNullableUsvstring(); @@ -148,7 +162,9 @@ interface TestBinding { void passUnsignedLong(unsigned long arg); void passLongLong(long long arg); void passUnsignedLongLong(unsigned long long arg); + void passUnrestrictedFloat(unrestricted float arg); void passFloat(float arg); + void passUnrestrictedDouble(unrestricted double arg); void passDouble(double arg); void passString(DOMString arg); void passUsvstring(USVString arg); @@ -171,7 +187,9 @@ interface TestBinding { void passNullableUnsignedLong(unsigned long? arg); void passNullableLongLong(long long? arg); void passNullableUnsignedLongLong(unsigned long long? arg); + void passNullableUnrestrictedFloat(unrestricted float? arg); void passNullableFloat(float? arg); + void passNullableUnrestrictedDouble(unrestricted double? arg); void passNullableDouble(double? arg); void passNullableString(DOMString? arg); void passNullableUsvstring(USVString? arg); @@ -192,7 +210,9 @@ interface TestBinding { void passOptionalUnsignedLong(optional unsigned long arg); void passOptionalLongLong(optional long long arg); void passOptionalUnsignedLongLong(optional unsigned long long arg); + void passOptionalUnrestrictedFloat(optional unrestricted float arg); void passOptionalFloat(optional float arg); + void passOptionalUnrestrictedDouble(optional unrestricted double arg); void passOptionalDouble(optional double arg); void passOptionalString(optional DOMString arg); void passOptionalUsvstring(optional USVString arg); @@ -214,7 +234,9 @@ interface TestBinding { void passOptionalNullableUnsignedLong(optional unsigned long? arg); void passOptionalNullableLongLong(optional long long? arg); void passOptionalNullableUnsignedLongLong(optional unsigned long long? arg); + void passOptionalNullableUnrestrictedFloat(optional unrestricted float? arg); void passOptionalNullableFloat(optional float? arg); + void passOptionalNullableUnrestrictedDouble(optional unrestricted double? arg); void passOptionalNullableDouble(optional double? arg); void passOptionalNullableString(optional DOMString? arg); void passOptionalNullableUsvstring(optional USVString? arg); @@ -270,7 +292,9 @@ interface TestBinding { void passOptionalNullableUnsignedLongWithNonNullDefault(optional unsigned long? arg = 7); void passOptionalNullableLongLongWithNonNullDefault(optional long long? arg = 7); void passOptionalNullableUnsignedLongLongWithNonNullDefault(optional unsigned long long? arg = 7); + // void passOptionalNullableUnrestrictedFloatWithNonNullDefault(optional unrestricted float? arg = 0.0); // void passOptionalNullableFloatWithNonNullDefault(optional float? arg = 0.0); + // void passOptionalNullableUnrestrictedDoubleWithNonNullDefault(optional unrestricted double? arg = 0.0); // void passOptionalNullableDoubleWithNonNullDefault(optional double? arg = 0.0); void passOptionalNullableStringWithNonNullDefault(optional DOMString? arg = "x"); void passOptionalNullableUsvstringWithNonNullDefault(optional USVString? arg = "x"); @@ -287,7 +311,9 @@ interface TestBinding { void passVariadicUnsignedLong(unsigned long... args); void passVariadicLongLong(long long... args); void passVariadicUnsignedLongLong(unsigned long long... args); + void passVariadicUnrestrictedFloat(unrestricted float... args); void passVariadicFloat(float... args); + void passVariadicUnrestrictedDouble(unrestricted double... args); void passVariadicDouble(double... args); void passVariadicString(DOMString... args); void passVariadicUsvstring(USVString... args); |