mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Propagate CanGc
from Document::new()
(#33386)
* Add canGc as a parameter to autogenerated trait methods Signed-off-by: Andriy Sultanov <sultanovandriy@gmail.com> * Propagate CanGc from Document::new() Signed-off-by: Andriy Sultanov <sultanovandriy@gmail.com> --------- Signed-off-by: Andriy Sultanov <sultanovandriy@gmail.com>
This commit is contained in:
parent
10e5bb72d9
commit
e5150dbda1
41 changed files with 704 additions and 393 deletions
|
@ -19,6 +19,7 @@ use crate::dom::htmlimageelement::HTMLImageElement;
|
|||
use crate::dom::htmlmediaelement::HTMLMediaElement;
|
||||
use crate::dom::node::{BindContext, Node, UnbindContext};
|
||||
use crate::dom::virtualmethods::VirtualMethods;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct HTMLSourceElement {
|
||||
|
@ -54,10 +55,11 @@ impl HTMLSourceElement {
|
|||
|
||||
fn iterate_next_html_image_element_siblings(
|
||||
next_siblings_iterator: impl Iterator<Item = Root<Dom<Node>>>,
|
||||
_can_gc: CanGc,
|
||||
) {
|
||||
for next_sibling in next_siblings_iterator {
|
||||
if let Some(html_image_element_sibling) = next_sibling.downcast::<HTMLImageElement>() {
|
||||
html_image_element_sibling.update_the_image_data();
|
||||
html_image_element_sibling.update_the_image_data(CanGc::note());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +78,10 @@ impl VirtualMethods for HTMLSourceElement {
|
|||
&local_name!("media") |
|
||||
&local_name!("type") => {
|
||||
let next_sibling_iterator = self.upcast::<Node>().following_siblings();
|
||||
HTMLSourceElement::iterate_next_html_image_element_siblings(next_sibling_iterator);
|
||||
HTMLSourceElement::iterate_next_html_image_element_siblings(
|
||||
next_sibling_iterator,
|
||||
CanGc::note(),
|
||||
);
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
@ -87,17 +92,23 @@ impl VirtualMethods for HTMLSourceElement {
|
|||
self.super_type().unwrap().bind_to_tree(context);
|
||||
let parent = self.upcast::<Node>().GetParentNode().unwrap();
|
||||
if let Some(media) = parent.downcast::<HTMLMediaElement>() {
|
||||
media.handle_source_child_insertion();
|
||||
media.handle_source_child_insertion(CanGc::note());
|
||||
}
|
||||
let next_sibling_iterator = self.upcast::<Node>().following_siblings();
|
||||
HTMLSourceElement::iterate_next_html_image_element_siblings(next_sibling_iterator);
|
||||
HTMLSourceElement::iterate_next_html_image_element_siblings(
|
||||
next_sibling_iterator,
|
||||
CanGc::note(),
|
||||
);
|
||||
}
|
||||
|
||||
fn unbind_from_tree(&self, context: &UnbindContext) {
|
||||
self.super_type().unwrap().unbind_from_tree(context);
|
||||
if let Some(next_sibling) = context.next_sibling {
|
||||
let next_sibling_iterator = next_sibling.inclusively_following_siblings();
|
||||
HTMLSourceElement::iterate_next_html_image_element_siblings(next_sibling_iterator);
|
||||
HTMLSourceElement::iterate_next_html_image_element_siblings(
|
||||
next_sibling_iterator,
|
||||
CanGc::note(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue