mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Move AbastractNode::is_element to the TreeNodeRef trait.
This commit is contained in:
parent
6c41be9c13
commit
6d808fbdd0
8 changed files with 17 additions and 11 deletions
|
@ -14,7 +14,7 @@ use dom::node::{ElementNodeTypeId, Node, ScriptView, AbstractNode};
|
|||
use layout_interface::{ContentBoxQuery, ContentBoxResponse, ContentBoxesQuery};
|
||||
use layout_interface::{ContentBoxesResponse};
|
||||
use newcss::stylesheet::Stylesheet;
|
||||
use servo_util::tree::ElementLike;
|
||||
use servo_util::tree::{TreeNodeRef, ElementLike};
|
||||
|
||||
use js::jsapi::{JSContext, JSObject};
|
||||
|
||||
|
|
|
@ -154,6 +154,13 @@ impl<View> TreeNodeRef<Node<View>> for AbstractNode<View> {
|
|||
fn with_mut_base<R>(&self, callback: &fn(&mut Node<View>) -> R) -> R {
|
||||
self.transmute_mut(callback)
|
||||
}
|
||||
|
||||
fn is_element(self) -> bool {
|
||||
match self.type_id() {
|
||||
ElementNodeTypeId(*) => true,
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<View> TreeNodeRefAsElement<Node<View>, Element> for AbstractNode<View> {
|
||||
|
@ -317,13 +324,6 @@ impl<'self, View> AbstractNode<View> {
|
|||
self.transmute_mut(f)
|
||||
}
|
||||
|
||||
pub fn is_element(self) -> bool {
|
||||
match self.type_id() {
|
||||
ElementNodeTypeId(*) => true,
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: This should be doing dynamic borrow checking for safety.
|
||||
pub fn with_imm_element<R>(self, f: &fn(&Element) -> R) -> R {
|
||||
if !self.is_element() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue