mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Support unions that contain USVStrings.
This commit is contained in:
parent
a67eaa2d82
commit
7ccc5ad7da
3 changed files with 9 additions and 0 deletions
|
@ -2000,6 +2000,7 @@ def UnionTypes(descriptors, dictionaries, callbacks, config):
|
||||||
'dom::bindings::conversions::StringificationBehavior',
|
'dom::bindings::conversions::StringificationBehavior',
|
||||||
'dom::bindings::error::throw_not_in_union',
|
'dom::bindings::error::throw_not_in_union',
|
||||||
'dom::bindings::js::Root',
|
'dom::bindings::js::Root',
|
||||||
|
'dom::bindings::str::USVString',
|
||||||
'dom::types::*',
|
'dom::types::*',
|
||||||
'js::jsapi::JSContext',
|
'js::jsapi::JSContext',
|
||||||
'js::jsapi::{HandleValue, MutableHandleValue}',
|
'js::jsapi::{HandleValue, MutableHandleValue}',
|
||||||
|
@ -3492,6 +3493,9 @@ def getUnionTypeTemplateVars(type, descriptorProvider):
|
||||||
elif type.isDOMString():
|
elif type.isDOMString():
|
||||||
name = type.name
|
name = type.name
|
||||||
typeName = "DOMString"
|
typeName = "DOMString"
|
||||||
|
elif type.isUSVString():
|
||||||
|
name = type.name
|
||||||
|
typeName = "USVString"
|
||||||
elif type.isPrimitive():
|
elif type.isPrimitive():
|
||||||
name = type.name
|
name = type.name
|
||||||
typeName = builtinNames[type.tag()]
|
typeName = builtinNames[type.tag()]
|
||||||
|
|
|
@ -12,6 +12,8 @@ use dom::bindings::codegen::Bindings::TestBindingBinding::TestEnum::_empty;
|
||||||
use dom::bindings::codegen::UnionTypes::BlobOrString;
|
use dom::bindings::codegen::UnionTypes::BlobOrString;
|
||||||
use dom::bindings::codegen::UnionTypes::EventOrString;
|
use dom::bindings::codegen::UnionTypes::EventOrString;
|
||||||
use dom::bindings::codegen::UnionTypes::EventOrString::eString;
|
use dom::bindings::codegen::UnionTypes::EventOrString::eString;
|
||||||
|
use dom::bindings::codegen::UnionTypes::EventOrUSVString;
|
||||||
|
use dom::bindings::codegen::UnionTypes::EventOrUSVString::eUSVString;
|
||||||
use dom::bindings::codegen::UnionTypes::HTMLElementOrLong;
|
use dom::bindings::codegen::UnionTypes::HTMLElementOrLong;
|
||||||
use dom::bindings::codegen::UnionTypes::HTMLElementOrLong::eLong;
|
use dom::bindings::codegen::UnionTypes::HTMLElementOrLong::eLong;
|
||||||
use dom::bindings::global::{GlobalField, GlobalRef};
|
use dom::bindings::global::{GlobalField, GlobalRef};
|
||||||
|
@ -77,6 +79,8 @@ impl TestBindingMethods for TestBinding {
|
||||||
fn SetUnionAttribute(&self, _: HTMLElementOrLong) {}
|
fn SetUnionAttribute(&self, _: HTMLElementOrLong) {}
|
||||||
fn Union2Attribute(&self) -> EventOrString { eString("".to_owned()) }
|
fn Union2Attribute(&self) -> EventOrString { eString("".to_owned()) }
|
||||||
fn SetUnion2Attribute(&self, _: EventOrString) {}
|
fn SetUnion2Attribute(&self, _: EventOrString) {}
|
||||||
|
fn Union3Attribute(&self) -> EventOrUSVString { eUSVString(USVString("".to_owned())) }
|
||||||
|
fn SetUnion3Attribute(&self, _: EventOrUSVString) {}
|
||||||
fn ArrayAttribute(&self, _: *mut JSContext) -> *mut JSObject { NullValue().to_object_or_null() }
|
fn ArrayAttribute(&self, _: *mut JSContext) -> *mut JSObject { NullValue().to_object_or_null() }
|
||||||
fn AnyAttribute(&self, _: *mut JSContext) -> JSVal { NullValue() }
|
fn AnyAttribute(&self, _: *mut JSContext) -> JSVal { NullValue() }
|
||||||
fn SetAnyAttribute(&self, _: *mut JSContext, _: HandleValue) {}
|
fn SetAnyAttribute(&self, _: *mut JSContext, _: HandleValue) {}
|
||||||
|
|
|
@ -89,6 +89,7 @@ interface TestBinding {
|
||||||
attribute Blob interfaceAttribute;
|
attribute Blob interfaceAttribute;
|
||||||
attribute (HTMLElement or long) unionAttribute;
|
attribute (HTMLElement or long) unionAttribute;
|
||||||
attribute (Event or DOMString) union2Attribute;
|
attribute (Event or DOMString) union2Attribute;
|
||||||
|
attribute (Event or USVString) union3Attribute;
|
||||||
readonly attribute Uint8ClampedArray arrayAttribute;
|
readonly attribute Uint8ClampedArray arrayAttribute;
|
||||||
attribute any anyAttribute;
|
attribute any anyAttribute;
|
||||||
attribute object objectAttribute;
|
attribute object objectAttribute;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue