removed same_tree and has_parent_node methods

This commit is contained in:
Nikhil Shagrithaya 2017-10-19 11:02:22 +05:30
parent 2e0bea898e
commit 07e7e67098
2 changed files with 13 additions and 19 deletions

View file

@ -586,10 +586,6 @@ impl TreeSink for Sink {
target.qual_name.as_ref().expect("Expected qual name of node!").expanded()
}
fn same_tree(&self, _: &Self::Handle, _: &Self::Handle) -> bool {
unreachable!();
}
fn create_element(&mut self, name: QualName, html_attrs: Vec<HtmlAttribute>, _flags: ElementFlags)
-> Self::Handle {
let mut node = self.new_parse_node();
@ -632,10 +628,6 @@ impl TreeSink for Sink {
node
}
fn has_parent_node(&self, _: &Self::Handle) -> bool {
unreachable!();
}
fn associate_with_form(
&mut self,
target: &Self::Handle,

View file

@ -751,6 +751,19 @@ pub struct Sink {
script: MutNullableDom<HTMLScriptElement>,
}
impl Sink {
fn same_tree(&self, x: &Dom<Node>, y: &Dom<Node>) -> bool {
let x = x.downcast::<Element>().expect("Element node expected");
let y = y.downcast::<Element>().expect("Element node expected");
x.is_in_same_home_subtree(y)
}
fn has_parent_node(&self, node: &Dom<Node>) -> bool {
node.GetParentNode().is_some()
}
}
#[allow(unrooted_must_root)] // FIXME: really?
impl TreeSink for Sink {
type Output = Self;
@ -781,13 +794,6 @@ impl TreeSink for Sink {
}
}
fn same_tree(&self, x: &Dom<Node>, y: &Dom<Node>) -> bool {
let x = x.downcast::<Element>().expect("Element node expected");
let y = y.downcast::<Element>().expect("Element node expected");
x.is_in_same_home_subtree(y)
}
fn create_element(&mut self, name: QualName, attrs: Vec<Attribute>, _flags: ElementFlags)
-> Dom<Node> {
let is = attrs.iter()
@ -820,10 +826,6 @@ impl TreeSink for Sink {
Dom::from_ref(pi.upcast())
}
fn has_parent_node(&self, node: &Dom<Node>) -> bool {
node.GetParentNode().is_some()
}
fn associate_with_form(&mut self, target: &Dom<Node>, form: &Dom<Node>, nodes: (&Dom<Node>, Option<&Dom<Node>>)) {
let (element, prev_element) = nodes;
let tree_node = prev_element.map_or(element, |prev| {