diff options
author | Bobby Holley <bobbyholley@gmail.com> | 2016-11-14 14:46:59 -0800 |
---|---|---|
committer | Bobby Holley <bobbyholley@gmail.com> | 2016-11-16 12:09:47 -0800 |
commit | f1043f630563a7c4a4f3fcff11f6f63b3e9afaa2 (patch) | |
tree | c1795b05784a4122f00492edbb22b4dba15afe24 /components/script/dom/element.rs | |
parent | 0547a6b313072cde5870a61b97be10ee62ce65ad (diff) | |
download | servo-f1043f630563a7c4a4f3fcff11f6f63b3e9afaa2.tar.gz servo-f1043f630563a7c4a4f3fcff11f6f63b3e9afaa2.zip |
Track all node damage with PendingRestyles.
Diffstat (limited to 'components/script/dom/element.rs')
-rw-r--r-- | components/script/dom/element.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index ac65c01e24c..b348220c0fb 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -84,13 +84,15 @@ use std::fmt; use std::sync::Arc; use std::sync::atomic::{AtomicUsize, Ordering}; use style::attr::{AttrValue, LengthOrPercentageOrAuto}; +use style::dom::TRestyleDamage; use style::element_state::*; use style::matching::{common_style_affecting_attributes, rare_style_affecting_attributes}; use style::parser::ParserContextExtraData; use style::properties::{DeclaredValue, Importance}; use style::properties::{PropertyDeclaration, PropertyDeclarationBlock, parse_style_attribute}; use style::properties::longhands::{background_image, border_spacing, font_family, font_size, overflow_x}; -use style::selector_impl::{NonTSPseudoClass, ServoSelectorImpl}; +use style::restyle_hints::RESTYLE_SELF; +use style::selector_impl::{NonTSPseudoClass, RestyleDamage, ServoSelectorImpl}; use style::selector_matching::ApplicableDeclarationBlock; use style::sink::Push; use style::values::CSSFloat; @@ -201,6 +203,19 @@ impl Element { ElementBinding::Wrap) } + pub fn restyle(&self, damage: NodeDamage) { + let doc = self.node.owner_doc(); + let mut restyle = doc.ensure_pending_restyle(self); + + // FIXME(bholley): I think we should probably only do this for + // NodeStyleDamaged, but I'm preserving existing behavior. + restyle.hint |= RESTYLE_SELF; + + if damage == NodeDamage::OtherNodeDamage { + restyle.damage = RestyleDamage::rebuild_and_reflow(); + } + } + // https://drafts.csswg.org/cssom-view/#css-layout-box // Elements that have a computed value of the display property // that is table-column or table-column-group |