diff options
author | Dan Robertson <dan@dlrobertson.com> | 2018-12-14 03:59:03 +0000 |
---|---|---|
committer | Dan Robertson <dan@dlrobertson.com> | 2018-12-17 15:28:42 +0000 |
commit | c46508e497e503c8fd42deb26aa536060334a9c9 (patch) | |
tree | 526fba0f92f508c9e54559cde967241dd118378f /components/script/dom/macros.rs | |
parent | 1e983d86c05d988779177775ee1ef9b835400960 (diff) | |
download | servo-c46508e497e503c8fd42deb26aa536060334a9c9.tar.gz servo-c46508e497e503c8fd42deb26aa536060334a9c9.zip |
Update src/href attributes to be a USVString
The following IDLs have the src/href attributes typed as a DOMString
while in the spec the attribute has been updated to be a USVString:
- HTMLIFrameElement
- HTMLImageElement
- HTMLInputElement
- HTMLLinkElement
- HTMLMediaElement
- HTMLScriptElement
Diffstat (limited to 'components/script/dom/macros.rs')
-rw-r--r-- | components/script/dom/macros.rs | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/components/script/dom/macros.rs b/components/script/dom/macros.rs index 62a4394bc87..454f1a678f8 100644 --- a/components/script/dom/macros.rs +++ b/components/script/dom/macros.rs @@ -96,7 +96,7 @@ macro_rules! make_uint_getter( #[macro_export] macro_rules! make_url_getter( ( $attr:ident, $htmlname:tt ) => ( - fn $attr(&self) -> DOMString { + fn $attr(&self) -> USVString { use crate::dom::bindings::inheritance::Castable; use crate::dom::element::Element; let element = self.upcast::<Element>(); @@ -106,6 +106,19 @@ macro_rules! make_url_getter( ); #[macro_export] +macro_rules! make_url_setter( + ( $attr:ident, $htmlname:tt ) => ( + fn $attr(&self, value: USVString) { + use crate::dom::bindings::inheritance::Castable; + use crate::dom::element::Element; + let element = self.upcast::<Element>(); + element.set_string_attribute(&local_name!($htmlname), + DOMString::from(value.0)); + } + ); +); + +#[macro_export] macro_rules! make_form_action_getter( ( $attr:ident, $htmlname:tt ) => ( fn $attr(&self) -> DOMString { @@ -172,18 +185,6 @@ macro_rules! make_bool_setter( ); #[macro_export] -macro_rules! make_url_setter( - ( $attr:ident, $htmlname:tt ) => ( - fn $attr(&self, value: DOMString) { - use dom::bindings::inheritance::Castable; - use dom::element::Element; - let element = self.upcast::<Element>(); - element.set_url_attribute(&local_name!($htmlname), value); - } - ); -); - -#[macro_export] macro_rules! make_uint_setter( ($attr:ident, $htmlname:tt, $default:expr) => ( fn $attr(&self, value: u32) { |