mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Bug 1355343: Take all the snapshots into account. r=bholley
I've chosen this approach mainly because there's no other good way to guarantee the model is correct than holding the snapshots alive until a style refresh. What I tried before this (storing them in a sort of "immutable element data") is a pain, since we call into style from the frame constructor and other content notifications, which makes keeping track of which snapshots should be cleared an which shouldn't an insane task. Ideally we'd have a single entry-point for style, but that's not the case right now, and changing that requires pretty non-trivial changes to the frame constructor. MozReview-Commit-ID: FF1KWZv2iBM Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
parent
7d45aad9b4
commit
46bf5d61f0
16 changed files with 439 additions and 308 deletions
|
@ -39,6 +39,7 @@ use dom::characterdata::LayoutCharacterDataHelpers;
|
|||
use dom::document::{Document, LayoutDocumentHelpers, PendingRestyle};
|
||||
use dom::element::{Element, LayoutElementHelpers, RawLayoutElementHelpers};
|
||||
use dom::node::{CAN_BE_FRAGMENTED, DIRTY_ON_VIEWPORT_SIZE_CHANGE, HAS_DIRTY_DESCENDANTS, IS_IN_DOC};
|
||||
use dom::node::{HANDLED_SNAPSHOT, HAS_SNAPSHOT};
|
||||
use dom::node::{LayoutNodeHelpers, Node};
|
||||
use dom::text::Text;
|
||||
use gfx_traits::ByteIndex;
|
||||
|
@ -413,6 +414,18 @@ impl<'le> TElement for ServoLayoutElement<'le> {
|
|||
unsafe { self.as_node().node.get_flag(HAS_DIRTY_DESCENDANTS) }
|
||||
}
|
||||
|
||||
fn has_snapshot(&self) -> bool {
|
||||
unsafe { self.as_node().node.get_flag(HAS_SNAPSHOT) }
|
||||
}
|
||||
|
||||
fn handled_snapshot(&self) -> bool {
|
||||
unsafe { self.as_node().node.get_flag(HANDLED_SNAPSHOT) }
|
||||
}
|
||||
|
||||
unsafe fn set_handled_snapshot(&self) {
|
||||
self.as_node().node.set_flag(HANDLED_SNAPSHOT, true);
|
||||
}
|
||||
|
||||
unsafe fn note_descendants<B: DescendantsBit<Self>>(&self) {
|
||||
debug_assert!(self.get_data().is_some());
|
||||
style::dom::raw_note_descendants::<Self, B>(*self);
|
||||
|
@ -509,6 +522,14 @@ impl<'le> ServoLayoutElement<'le> {
|
|||
}
|
||||
}
|
||||
|
||||
pub unsafe fn unset_snapshot_flags(&self) {
|
||||
self.as_node().node.set_flag(HAS_SNAPSHOT | HANDLED_SNAPSHOT, false);
|
||||
}
|
||||
|
||||
pub unsafe fn set_has_snapshot(&self) {
|
||||
self.as_node().node.set_flag(HAS_SNAPSHOT, true);
|
||||
}
|
||||
|
||||
// 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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue