mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Usage of JSRef<Attr> in before_remove_attr & after_set_attr
JSRef<Attr> does not require allocating a DOMString for value, which are unused in most cases. It also provides more access to Attr data.
This commit is contained in:
parent
f5e8df9dac
commit
bbab8831e0
18 changed files with 255 additions and 225 deletions
|
@ -2,6 +2,8 @@
|
|||
* 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::attr::Attr;
|
||||
use dom::attr::AttrHelpers;
|
||||
use dom::bindings::codegen::Bindings::AttrBinding::AttrMethods;
|
||||
use dom::bindings::codegen::Bindings::HTMLObjectElementBinding;
|
||||
use dom::bindings::codegen::Bindings::HTMLObjectElementBinding::HTMLObjectElementMethods;
|
||||
|
@ -99,15 +101,18 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLObjectElement> {
|
|||
Some(htmlelement as &VirtualMethods)
|
||||
}
|
||||
|
||||
fn after_set_attr(&self, name: &Atom, value: DOMString) {
|
||||
fn after_set_attr(&self, attr: JSRef<Attr>) {
|
||||
match self.super_type() {
|
||||
Some(ref s) => s.after_set_attr(name, value),
|
||||
_ => (),
|
||||
Some(ref s) => s.after_set_attr(attr),
|
||||
_ => ()
|
||||
}
|
||||
|
||||
if "data" == name.as_slice() {
|
||||
let window = window_from_node(*self).root();
|
||||
self.process_data_url(window.image_cache_task().clone());
|
||||
match attr.local_name() {
|
||||
&atom!("data") => {
|
||||
let window = window_from_node(*self).root();
|
||||
self.process_data_url(window.image_cache_task().clone());
|
||||
},
|
||||
_ => ()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue