mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
auto merge of #1839 : Ms2ger/servo/optional-test, r=jdm
This commit is contained in:
commit
968a2e1735
2 changed files with 55 additions and 0 deletions
|
@ -2,11 +2,16 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::bindings::js::JS;
|
||||
use dom::bindings::utils::{Reflector, Reflectable};
|
||||
use dom::blob::Blob;
|
||||
use dom::window::Window;
|
||||
use servo_util::str::DOMString;
|
||||
|
||||
#[deriving(Encodable)]
|
||||
pub struct TestBinding {
|
||||
reflector: Reflector,
|
||||
window: JS<Window>,
|
||||
}
|
||||
|
||||
impl TestBinding {
|
||||
|
@ -32,6 +37,10 @@ impl TestBinding {
|
|||
pub fn SetFloatAttribute(&self, _: f32) {}
|
||||
pub fn DoubleAttribute(&self) -> f64 { 0. }
|
||||
pub fn SetDoubleAttribute(&self, _: f64) {}
|
||||
pub fn StringAttribute(&self) -> DOMString { ~"" }
|
||||
pub fn SetStringAttribute(&self, _: DOMString) {}
|
||||
pub fn InterfaceAttribute(&self) -> JS<Blob> { Blob::new(&self.window) }
|
||||
pub fn SetInterfaceAttribute(&self, _: &JS<Blob>) {}
|
||||
|
||||
pub fn GetBooleanAttributeNullable(&self) -> Option<bool> { Some(false) }
|
||||
pub fn SetBooleanAttributeNullable(&self, _: Option<bool>) {}
|
||||
|
@ -55,6 +64,10 @@ impl TestBinding {
|
|||
pub fn SetFloatAttributeNullable(&self, _: Option<f32>) {}
|
||||
pub fn GetDoubleAttributeNullable(&self) -> Option<f64> { Some(0.) }
|
||||
pub fn SetDoubleAttributeNullable(&self, _: Option<f64>) {}
|
||||
pub fn GetStringAttributeNullable(&self) -> Option<DOMString> { Some(~"") }
|
||||
pub fn SetStringAttributeNullable(&self, _: Option<DOMString>) {}
|
||||
pub fn GetInterfaceAttributeNullable(&self) -> Option<JS<Blob>> { Some(Blob::new(&self.window)) }
|
||||
pub fn SetInterfaceAttributeNullable(&self, _: Option<JS<Blob>>) {}
|
||||
|
||||
// FIXME (issue #1813) Doesn't currently compile.
|
||||
// pub fn PassOptionalBoolean(&self, _: Option<bool>) {}
|
||||
|
@ -68,6 +81,22 @@ impl TestBinding {
|
|||
// pub fn PassOptionalUnsignedLongLong(&self, _: Option<u64>) {}
|
||||
// pub fn PassOptionalFloat(&self, _: Option<f32>) {}
|
||||
// pub fn PassOptionalDouble(&self, _: Option<f64>) {}
|
||||
pub fn PassOptionalString(&self, _: Option<DOMString>) {}
|
||||
pub fn PassOptionalInterface(&self, _: Option<JS<Blob>>) {}
|
||||
|
||||
// pub fn PassOptionalNullableBoolean(&self, _: Option<Option<bool>>) {}
|
||||
// pub fn PassOptionalNullableByte(&self, _: Option<Option<i8>>) {}
|
||||
// pub fn PassOptionalNullableOctet(&self, _: Option<Option<u8>>) {}
|
||||
// pub fn PassOptionalNullableShort(&self, _: Option<Option<i16>>) {}
|
||||
// pub fn PassOptionalNullableUnsignedShort(&self, _: Option<Option<u16>>) {}
|
||||
// pub fn PassOptionalNullableLong(&self, _: Option<Option<i32>>) {}
|
||||
// pub fn PassOptionalNullableUnsignedLong(&self, _: Option<Option<u32>>) {}
|
||||
// pub fn PassOptionalNullableLongLong(&self, _: Option<Option<i64>>) {}
|
||||
// pub fn PassOptionalNullableUnsignedLongLong(&self, _: Option<Option<u64>>) {}
|
||||
// pub fn PassOptionalNullableFloat(&self, _: Option<Option<f32>>) {}
|
||||
// pub fn PassOptionalNullableDouble(&self, _: Option<Option<f64>>) {}
|
||||
pub fn PassOptionalNullableString(&self, _: Option<Option<DOMString>>) {}
|
||||
// pub fn PassOptionalNullableInterface(&self, _: Option<Option<JS<Blob>>>) {}
|
||||
|
||||
pub fn PassOptionalBooleanWithDefault(&self, _: bool) {}
|
||||
pub fn PassOptionalByteWithDefault(&self, _: i8) {}
|
||||
|
@ -78,6 +107,7 @@ impl TestBinding {
|
|||
pub fn PassOptionalUnsignedLongWithDefault(&self, _: u32) {}
|
||||
pub fn PassOptionalLongLongWithDefault(&self, _: i64) {}
|
||||
pub fn PassOptionalUnsignedLongLongWithDefault(&self, _: u64) {}
|
||||
pub fn PassOptionalStringWithDefault(&self, _: DOMString) {}
|
||||
|
||||
pub fn PassOptionalNullableBooleanWithDefault(&self, _: Option<bool>) {}
|
||||
pub fn PassOptionalNullableByteWithDefault(&self, _: Option<i8>) {}
|
||||
|
@ -90,6 +120,8 @@ impl TestBinding {
|
|||
pub fn PassOptionalNullableUnsignedLongLongWithDefault(&self, _: Option<u64>) {}
|
||||
pub fn PassOptionalNullableFloatWithDefault(&self, _: Option<f32>) {}
|
||||
pub fn PassOptionalNullableDoubleWithDefault(&self, _: Option<f64>) {}
|
||||
// pub fn PassOptionalNullableStringWithDefault(&self, _: Option<DOMString>) {}
|
||||
pub fn PassOptionalNullableInterfaceWithDefault(&self, _: Option<JS<Blob>>) {}
|
||||
}
|
||||
|
||||
impl Reflectable for TestBinding {
|
||||
|
|
|
@ -14,6 +14,8 @@ interface TestBinding {
|
|||
attribute unsigned long long unsignedLongLongAttribute;
|
||||
attribute float floatAttribute;
|
||||
attribute double doubleAttribute;
|
||||
attribute DOMString stringAttribute;
|
||||
attribute Blob interfaceAttribute;
|
||||
|
||||
attribute boolean? booleanAttributeNullable;
|
||||
attribute byte? byteAttributeNullable;
|
||||
|
@ -26,6 +28,8 @@ interface TestBinding {
|
|||
attribute unsigned long long? unsignedLongLongAttributeNullable;
|
||||
attribute float? floatAttributeNullable;
|
||||
attribute double? doubleAttributeNullable;
|
||||
attribute DOMString? stringAttributeNullable;
|
||||
attribute Blob? interfaceAttributeNullable;
|
||||
|
||||
// FIXME (issue #1813) Doesn't currently compile.
|
||||
// void passOptionalBoolean(optional boolean arg);
|
||||
|
@ -39,6 +43,22 @@ interface TestBinding {
|
|||
// void passOptionalUnsignedLongLong(optional unsigned long long arg);
|
||||
// void passOptionalFloat(optional float arg);
|
||||
// void passOptionalDouble(optional double arg);
|
||||
void passOptionalString(optional DOMString arg);
|
||||
void passOptionalInterface(optional Blob arg);
|
||||
|
||||
// void passOptionalNullableBoolean(optional boolean? arg);
|
||||
// void passOptionalNullableByte(optional byte? arg);
|
||||
// void passOptionalNullableOctet(optional octet? arg);
|
||||
// void passOptionalNullableShort(optional short? arg);
|
||||
// void passOptionalNullableUnsignedShort(optional unsigned short? arg);
|
||||
// void passOptionalNullableLong(optional long? arg);
|
||||
// void passOptionalNullableUnsignedLong(optional unsigned long? arg);
|
||||
// void passOptionalNullableLongLong(optional long long? arg);
|
||||
// void passOptionalNullableUnsignedLongLong(optional unsigned long long? arg);
|
||||
// void passOptionalNullableFloat(optional float? arg);
|
||||
// void passOptionalNullableDouble(optional double? arg);
|
||||
void passOptionalNullableString(optional DOMString? arg);
|
||||
// void passOptionalNullableInterface(optional Blob? arg);
|
||||
|
||||
void passOptionalBooleanWithDefault(optional boolean arg = false);
|
||||
void passOptionalByteWithDefault(optional byte arg = 0);
|
||||
|
@ -49,6 +69,7 @@ interface TestBinding {
|
|||
void passOptionalUnsignedLongWithDefault(optional unsigned long arg = 6);
|
||||
void passOptionalLongLongWithDefault(optional long long arg = -12);
|
||||
void passOptionalUnsignedLongLongWithDefault(optional unsigned long long arg = 17);
|
||||
void passOptionalStringWithDefault(optional DOMString arg = "");
|
||||
|
||||
void passOptionalNullableBooleanWithDefault(optional boolean? arg = null);
|
||||
void passOptionalNullableByteWithDefault(optional byte? arg = null);
|
||||
|
@ -59,4 +80,6 @@ interface TestBinding {
|
|||
void passOptionalNullableUnsignedLongWithDefault(optional unsigned long? arg = null);
|
||||
void passOptionalNullableLongLongWithDefault(optional long long? arg = null);
|
||||
void passOptionalNullableUnsignedLongLongWithDefault(optional unsigned long long? arg = null);
|
||||
// void passOptionalNullableStringWithDefault(optional DOMString? arg = null);
|
||||
void passOptionalNullableInterfaceWithDefault(optional Blob? arg = null);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue