diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-06-13 04:56:09 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-13 04:56:09 -0700 |
commit | 07f6e114850896eae2fd206351808fb31cceaaf0 (patch) | |
tree | d152244847f5c5c302a01fdfedf927d43eacec18 /components/script | |
parent | 5a339128821cb16f169ff4d44f98ba562e86be20 (diff) | |
parent | 30252ee829aee04c5acb4a9748a30a6be613de36 (diff) | |
download | servo-07f6e114850896eae2fd206351808fb31cceaaf0.tar.gz servo-07f6e114850896eae2fd206351808fb31cceaaf0.zip |
Auto merge of #17292 - emilio:better-style-invalidation, r=heycam
style: Implement a more fine-grained invalidation method.
<!-- 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/17292)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/document.rs | 13 | ||||
-rw-r--r-- | components/script/dom/element.rs | 4 |
2 files changed, 12 insertions, 5 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 8211830e9eb..39c617c8099 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -131,7 +131,7 @@ use std::rc::Rc; use std::time::{Duration, Instant}; use style::attr::AttrValue; use style::context::{QuirksMode, ReflowGoal}; -use style::restyle_hints::{RestyleHint, RESTYLE_STYLE_ATTRIBUTE}; +use style::invalidation::element::restyle_hints::{RestyleHint, RESTYLE_SELF, RESTYLE_STYLE_ATTRIBUTE}; use style::selector_parser::{RestyleDamage, Snapshot}; use style::shared_lock::SharedRwLock as StyleSharedRwLock; use style::str::{HTML_SPACE_CHARACTERS, split_html_space_chars, str_join}; @@ -2376,17 +2376,24 @@ impl Document { entry.snapshot = Some(Snapshot::new(el.html_element_in_html_document())); } if attr.local_name() == &local_name!("style") { - entry.hint.insert(RestyleHint::for_replacements(RESTYLE_STYLE_ATTRIBUTE)); + entry.hint.insert(RESTYLE_STYLE_ATTRIBUTE); } // FIXME(emilio): This should become something like // element.is_attribute_mapped(attr.local_name()). if attr.local_name() == &local_name!("width") || attr.local_name() == &local_name!("height") { - entry.hint.insert(RestyleHint::for_self()); + entry.hint.insert(RESTYLE_SELF); } let mut snapshot = entry.snapshot.as_mut().unwrap(); + if attr.local_name() == &local_name!("id") { + snapshot.id_changed = true; + } else if attr.local_name() == &local_name!("class") { + snapshot.class_changed = true; + } else { + snapshot.other_attributes_changed = true; + } if snapshot.attrs.is_none() { let attrs = el.attrs() .iter() diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index ebeef51de89..7e01bc66764 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -102,9 +102,9 @@ use style::applicable_declarations::ApplicableDeclarationBlock; use style::attr::{AttrValue, LengthOrPercentageOrAuto}; use style::context::{QuirksMode, ReflowGoal}; use style::element_state::*; +use style::invalidation::element::restyle_hints::RESTYLE_SELF; use style::properties::{Importance, PropertyDeclaration, PropertyDeclarationBlock, parse_style_attribute}; use style::properties::longhands::{self, background_image, border_spacing, font_family, font_size, overflow_x}; -use style::restyle_hints::RestyleHint; use style::rule_tree::CascadeLevel; use style::selector_parser::{NonTSPseudoClass, PseudoElement, RestyleDamage, SelectorImpl, SelectorParser}; use style::selector_parser::extended_filtering; @@ -253,7 +253,7 @@ impl Element { // FIXME(bholley): I think we should probably only do this for // NodeStyleDamaged, but I'm preserving existing behavior. - restyle.hint.insert(RestyleHint::for_self()); + restyle.hint.insert(RESTYLE_SELF); if damage == NodeDamage::OtherNodeDamage { restyle.damage = RestyleDamage::rebuild_and_reflow(); |