Skip to content
Permalink
Browse files

removed same_tree and has_parent_node methods

  • Loading branch information...
cynicaldevil committed Oct 19, 2017
1 parent 2e0bea8 commit 07e7e670985442c4eef7dd33a3a204dbec46f914
Showing with 13 additions and 19 deletions.
  1. +0 −8 components/script/dom/servoparser/async_html.rs
  2. +13 −11 components/script/dom/servoparser/mod.rs
@@ -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,
@@ -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| {

0 comments on commit 07e7e67

Please sign in to comment.
You can’t perform that action at this time.