mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Inline node_is_element and node_is_document into their only callers.
This commit is contained in:
parent
54b9dc6563
commit
8f58dafbd6
1 changed files with 8 additions and 16 deletions
|
@ -89,20 +89,6 @@ pub trait TLayoutNode {
|
||||||
/// call and as such is marked `unsafe`.
|
/// call and as such is marked `unsafe`.
|
||||||
unsafe fn get_jsmanaged<'a>(&'a self) -> &'a LayoutJS<Node>;
|
unsafe fn get_jsmanaged<'a>(&'a self) -> &'a LayoutJS<Node>;
|
||||||
|
|
||||||
fn node_is_element(&self) -> bool {
|
|
||||||
match self.type_id() {
|
|
||||||
Some(NodeTypeId::Element(..)) => true,
|
|
||||||
_ => false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn node_is_document(&self) -> bool {
|
|
||||||
match self.type_id() {
|
|
||||||
Some(NodeTypeId::Document(..)) => true,
|
|
||||||
_ => false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// If this is an image element, returns its URL. If this is not an image element, fails.
|
/// If this is an image element, returns its URL. If this is not an image element, fails.
|
||||||
///
|
///
|
||||||
/// FIXME(pcwalton): Don't copy URLs.
|
/// FIXME(pcwalton): Don't copy URLs.
|
||||||
|
@ -358,11 +344,17 @@ impl<'ln> TNode for LayoutNode<'ln> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_element(&self) -> bool {
|
fn is_element(&self) -> bool {
|
||||||
self.node_is_element()
|
match self.type_id() {
|
||||||
|
Some(NodeTypeId::Element(..)) => true,
|
||||||
|
_ => false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_document(&self) -> bool {
|
fn is_document(&self) -> bool {
|
||||||
self.node_is_document()
|
match self.type_id() {
|
||||||
|
Some(NodeTypeId::Document(..)) => true,
|
||||||
|
_ => false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn match_attr<F>(&self, attr: &AttrSelector, test: F) -> bool where F: Fn(&str) -> bool {
|
fn match_attr<F>(&self, attr: &AttrSelector, test: F) -> bool where F: Fn(&str) -> bool {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue