mirror of
https://github.com/servo/servo.git
synced 2025-09-09 06:28:22 +01:00
Auto merge of #13172 - bholley:display_enum, r=emilio
stylo: avoid traversing non element/text nodes in style and layout r? @emilio <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13172) <!-- Reviewable:end -->
This commit is contained in:
commit
614e9ca840
6 changed files with 86 additions and 52 deletions
|
@ -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;
|
||||
|
|
|
@ -39,8 +39,8 @@ use std::ops::BitOr;
|
|||
use std::ptr;
|
||||
use std::sync::Arc;
|
||||
use style::data::PrivateStyleData;
|
||||
use style::dom::{LayoutIterator, NodeInfo, TDocument, TElement, TNode, TRestyleDamage, UnsafeNode};
|
||||
use style::dom::{OpaqueNode, PresentationalHintsSynthetizer};
|
||||
use style::dom::{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!()
|
||||
}
|
||||
|
@ -160,12 +161,12 @@ impl<'ln> TNode for GeckoNode<'ln> {
|
|||
unimplemented!()
|
||||
}
|
||||
|
||||
fn children(self) -> GeckoChildrenIterator<'ln> {
|
||||
fn children(self) -> LayoutIterator<GeckoChildrenIterator<'ln>> {
|
||||
let maybe_iter = unsafe { Gecko_MaybeCreateStyleChildrenIterator(self.0) };
|
||||
if let Some(iter) = maybe_iter.into_owned_opt() {
|
||||
GeckoChildrenIterator::GeckoIterator(iter)
|
||||
LayoutIterator(GeckoChildrenIterator::GeckoIterator(iter))
|
||||
} else {
|
||||
GeckoChildrenIterator::Current(self.first_child())
|
||||
LayoutIterator(GeckoChildrenIterator::Current(self.first_child()))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue