diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2017-05-07 16:36:47 +0200 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2017-05-10 12:05:39 +0200 |
commit | 46bf5d61f0e72dd56de1c696efeab64fef424dc7 (patch) | |
tree | 6e2351dfe9fe8b3aef9ba04d79b762efadd18533 /components/script/dom/node.rs | |
parent | 7d45aad9b45d4a054a7f2526e7521db57b8a470d (diff) | |
download | servo-46bf5d61f0e72dd56de1c696efeab64fef424dc7.tar.gz servo-46bf5d61f0e72dd56de1c696efeab64fef424dc7.zip |
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>
Diffstat (limited to 'components/script/dom/node.rs')
-rw-r--r-- | components/script/dom/node.rs | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 6f65faaed07..31e48b5b695 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -144,29 +144,40 @@ pub struct Node { bitflags! { #[doc = "Flags for node items."] #[derive(JSTraceable, HeapSizeOf)] - pub flags NodeFlags: u8 { + pub flags NodeFlags: u16 { #[doc = "Specifies whether this node is in a document."] - const IS_IN_DOC = 0x01, + const IS_IN_DOC = 1 << 0, + #[doc = "Specifies whether this node needs style recalc on next reflow."] - const HAS_DIRTY_DESCENDANTS = 0x08, + const HAS_DIRTY_DESCENDANTS = 1 << 1, // TODO: find a better place to keep this (#4105) // https://critic.hoppipolla.co.uk/showcomment?chain=8873 // Perhaps using a Set in Document? #[doc = "Specifies whether or not there is an authentic click in progress on \ this element."] - const CLICK_IN_PROGRESS = 0x10, + const CLICK_IN_PROGRESS = 1 << 2, #[doc = "Specifies whether this node is focusable and whether it is supposed \ to be reachable with using sequential focus navigation."] - const SEQUENTIALLY_FOCUSABLE = 0x20, + const SEQUENTIALLY_FOCUSABLE = 1 << 3, /// Whether any ancestor is a fragmentation container - const CAN_BE_FRAGMENTED = 0x40, + const CAN_BE_FRAGMENTED = 1 << 4, + #[doc = "Specifies whether this node needs to be dirted when viewport size changed."] - const DIRTY_ON_VIEWPORT_SIZE_CHANGE = 0x80, + const DIRTY_ON_VIEWPORT_SIZE_CHANGE = 1 << 5, #[doc = "Specifies whether the parser has set an associated form owner for \ this element. Only applicable for form-associatable elements."] - const PARSER_ASSOCIATED_FORM_OWNER = 0x90, + const PARSER_ASSOCIATED_FORM_OWNER = 1 << 6, + + /// Whether this element has a snapshot stored due to a style or + /// attribute change. + /// + /// See the `style::restyle_hints` module. + const HAS_SNAPSHOT = 1 << 7, + + /// Whether this element has already handled the stored snapshot. + const HANDLED_SNAPSHOT = 1 << 8, } } @@ -289,7 +300,9 @@ impl Node { for node in child.traverse_preorder() { // Out-of-document elements never have the descendants flag set. - node.set_flag(IS_IN_DOC | HAS_DIRTY_DESCENDANTS, false); + node.set_flag(IS_IN_DOC | HAS_DIRTY_DESCENDANTS | + HAS_SNAPSHOT | HANDLED_SNAPSHOT, + false); } for node in child.traverse_preorder() { // This needs to be in its own loop, because unbind_from_tree may |