aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/element.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-11-17 12:25:52 -0600
committerGitHub <noreply@github.com>2016-11-17 12:25:52 -0600
commite4a27c4d16ee0e80ccd4ffd97a93c2b2a4f05391 (patch)
tree300b2b3a8a73c1746bb5a252b041d125a57cb8ee /components/script/dom/element.rs
parent870841099a5306e75766e6364296cf6d495467a0 (diff)
parent95a49863c72cc11ba41608e8a1216becc5dad75c (diff)
downloadservo-e4a27c4d16ee0e80ccd4ffd97a93c2b2a4f05391.tar.gz
servo-e4a27c4d16ee0e80ccd4ffd97a93c2b2a4f05391.zip
Auto merge of #14214 - bholley:dirtiness_overhaul, r=emilio
Overhaul dirtiness handling in Servo to prepare for the new incremental restyle architecture <!-- 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/14214) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/element.rs')
-rw-r--r--components/script/dom/element.rs17
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