Split out is_element and is_text_node into a helper trait.

This commit is contained in:
Bobby Holley 2016-09-20 16:51:48 -07:00
parent 66c736194d
commit e6bbff110a
6 changed files with 50 additions and 39 deletions

View file

@ -32,7 +32,7 @@ use std::sync::{Arc, Mutex};
use std::sync::atomic::{AtomicBool, AtomicPtr, Ordering};
use style::arc_ptr_eq;
use style::context::{LocalStyleContextCreationInfo, ReflowGoal, SharedStyleContext};
use style::dom::{TDocument, TElement, TNode};
use style::dom::{NodeInfo, TDocument, TElement, TNode};
use style::error_reporting::StdoutErrorReporter;
use style::gecko_selector_impl::{GeckoSelectorImpl, PseudoElement};
use style::parallel;

View file

@ -40,7 +40,7 @@ use std::ptr;
use std::sync::Arc;
use style::data::PrivateStyleData;
use style::dom::{OpaqueNode, PresentationalHintsSynthetizer};
use style::dom::{TDocument, TElement, TNode, TRestyleDamage, UnsafeNode};
use style::dom::{NodeInfo, TDocument, TElement, TNode, TRestyleDamage, UnsafeNode};
use style::element_state::ElementState;
use style::error_reporting::StdoutErrorReporter;
use style::gecko_selector_impl::{GeckoSelectorImpl, NonTSPseudoClass, PseudoElement};
@ -125,6 +125,19 @@ impl BitOr for GeckoRestyleDamage {
}
impl<'ln> NodeInfo for GeckoNode<'ln> {
fn is_element(&self) -> bool {
unsafe {
Gecko_NodeIsElement(self.0)
}
}
fn is_text_node(&self) -> bool {
unsafe {
Gecko_IsTextNode(self.0)
}
}
}
impl<'ln> TNode for GeckoNode<'ln> {
type ConcreteDocument = GeckoDocument<'ln>;
@ -140,18 +153,6 @@ impl<'ln> TNode for GeckoNode<'ln> {
GeckoNode(&*(n.0 as *mut RawGeckoNode))
}
fn is_text_node(&self) -> bool {
unsafe {
Gecko_IsTextNode(self.0)
}
}
fn is_element(&self) -> bool {
unsafe {
Gecko_NodeIsElement(self.0)
}
}
fn dump(self) {
unimplemented!()
}