diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-09-03 20:48:35 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-03 20:48:35 -0500 |
commit | 1fd745a4084c28039746d63c81d49120199dcad4 (patch) | |
tree | 1aea0dab45fe6f5e2b10fc7c1d796dbab1f36c01 | |
parent | 04dbfe65bab358e15d831f0071184d5d93f98dc5 (diff) | |
parent | 9feea7604330c735c12b715fc57bbc05e0fcc78b (diff) | |
download | servo-1fd745a4084c28039746d63c81d49120199dcad4.tar.gz servo-1fd745a4084c28039746d63c81d49120199dcad4.zip |
Auto merge of #12957 - emilio:stylo-pseudos, r=bholley
stylo: Don't calculate restyle damage on text nodes
<!-- Please describe your changes on the following line: -->
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
<!-- Either: -->
- [x] There are tests for these changes (the Servo-side, that is)
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- 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/12957)
<!-- Reviewable:end -->
-rw-r--r-- | components/style/matching.rs | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/components/style/matching.rs b/components/style/matching.rs index aba47943e2d..30b60e465b9 100644 --- a/components/style/matching.rs +++ b/components/style/matching.rs @@ -878,21 +878,29 @@ pub trait MatchMethods : TNode { None => None, }; - let mut applicable_declarations_cache = - context.local_context().applicable_declarations_cache.borrow_mut(); - let (damage, restyle_result) = if self.is_text_node() { + // In the case we're styling a text node, we don't need to compute the + // restyle damage, since it's a subset of the restyle damage of the + // parent. + // + // In Gecko, we're done, we don't need anything else from text nodes. + // + // In Servo, this is also true, since text nodes generate UnscannedText + // fragments, which aren't repairable by incremental layout. + if self.is_text_node() { let mut data_ref = self.mutate_data().unwrap(); let mut data = &mut *data_ref; let cloned_parent_style = ComputedValues::style_for_child_text_node(parent_style.unwrap()); - let damage = - self.compute_restyle_damage(data.style.as_ref(), &cloned_parent_style, None); - data.style = Some(cloned_parent_style); - (damage, RestyleResult::Continue) - } else { + return RestyleResult::Continue; + } + + let mut applicable_declarations_cache = + context.local_context().applicable_declarations_cache.borrow_mut(); + + let (damage, restyle_result) = { let mut data_ref = self.mutate_data().unwrap(); let mut data = &mut *data_ref; let final_style = |