aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/layout_wrapper.rs
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2017-03-30 22:42:21 +0200
committerEmilio Cobos Álvarez <emilio@crisal.io>2017-03-31 11:39:19 +0200
commita4bc106e07c408563b1cdc3d144c18b7f63d1b9e (patch)
treeb2d0e79e32a2d1413729fb49772165d589d5a785 /components/script/layout_wrapper.rs
parent54e2b7b2d5eaa2b59c8d922de2344677871370a1 (diff)
downloadservo-a4bc106e07c408563b1cdc3d144c18b7f63d1b9e.tar.gz
servo-a4bc106e07c408563b1cdc3d144c18b7f63d1b9e.zip
style: Make the servo and gecko implementations of Element::note_descendants equivalent.
Diffstat (limited to 'components/script/layout_wrapper.rs')
-rw-r--r--components/script/layout_wrapper.rs24
1 files changed, 16 insertions, 8 deletions
diff --git a/components/script/layout_wrapper.rs b/components/script/layout_wrapper.rs
index 661d3289671..9a672ae7da9 100644
--- a/components/script/layout_wrapper.rs
+++ b/components/script/layout_wrapper.rs
@@ -59,13 +59,13 @@ use std::marker::PhantomData;
use std::mem::transmute;
use std::sync::Arc;
use std::sync::atomic::Ordering;
+use style;
use style::attr::AttrValue;
use style::computed_values::display;
use style::context::{QuirksMode, SharedStyleContext};
use style::data::ElementData;
-use style::dom::{DirtyDescendants, LayoutIterator, NodeInfo, OpaqueNode, PresentationalHintsSynthetizer};
-use style::dom::{TElement, TNode};
-use style::dom::UnsafeNode;
+use style::dom::{DescendantsBit, DirtyDescendants, LayoutIterator, NodeInfo, OpaqueNode};
+use style::dom::{PresentationalHintsSynthetizer, TElement, TNode, UnsafeNode};
use style::element_state::*;
use style::properties::{ComputedValues, PropertyDeclarationBlock};
use style::selector_parser::{NonTSPseudoClass, PseudoElement, SelectorImpl};
@@ -409,6 +409,11 @@ impl<'le> TElement for ServoLayoutElement<'le> {
unsafe { self.as_node().node.get_flag(HAS_DIRTY_DESCENDANTS) }
}
+ unsafe fn note_descendants<B: DescendantsBit<Self>>(&self) {
+ debug_assert!(self.get_data().is_some());
+ style::dom::raw_note_descendants::<Self, B>(*self);
+ }
+
unsafe fn set_dirty_descendants(&self) {
debug_assert!(self.as_node().node.get_flag(IS_IN_DOC));
self.as_node().node.set_flag(HAS_DIRTY_DESCENDANTS, true)
@@ -488,19 +493,22 @@ impl<'le> ServoLayoutElement<'le> {
}
}
- // FIXME(bholley): This should be merged with TElement::note_dirty_descendants,
+ // FIXME(bholley): This should be merged with TElement::note_descendants,
// but that requires re-testing and possibly fixing the broken callers given
// the FIXME below, which I don't have time to do right now.
+ //
+ // FIXME(emilio): We'd also need to relax the invariant in note_descendants
+ // re. the data already available I think.
pub unsafe fn note_dirty_descendant(&self) {
use ::selectors::Element;
let mut current = Some(*self);
while let Some(el) = current {
// FIXME(bholley): Ideally we'd have the invariant that any element
- // with has_dirty_descendants also has the bit set on all its ancestors.
- // However, there are currently some corner-cases where we get that wrong.
- // I have in-flight patches to fix all this stuff up, so we just always
- // propagate this bit for now.
+ // with has_dirty_descendants also has the bit set on all its
+ // ancestors. However, there are currently some corner-cases where
+ // we get that wrong. I have in-flight patches to fix all this
+ // stuff up, so we just always propagate this bit for now.
el.set_dirty_descendants();
current = el.parent_element();
}