servo: Merge #17991 - style: Avoid branching on the origin for each selector when inserting in the cascade data (from emilio:dumb-branches); r=heycam

This is on top of #17990, and it's intended to help with bug 1386045.

Source-Repo: https://github.com/servo/servo
Source-Revision: 806540cabdbca1799dd14bb1c67bd0c86b21f6a7

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 618224ec519ee0cb985d6e345c0ea1dedad3f5e8
This commit is contained in:
Emilio Cobos Álvarez 2017-08-07 05:15:37 -05:00
Родитель e8713ffdd1
Коммит 288d392ecd
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -458,6 +458,10 @@ impl Stylist {
self.effective_media_query_results.saw_effective(stylesheet);
let origin = stylesheet.origin(guard);
let origin_cascade_data =
self.cascade_data.borrow_mut_for_origin(&origin);
for rule in stylesheet.effective_rules(&self.device, guard) {
match *rule {
CssRule::Style(ref locked) => {
@ -469,8 +473,7 @@ impl Stylist {
let hashes =
AncestorHashes::new(&selector, self.quirks_mode);
self.cascade_data
.borrow_mut_for_origin(&origin)
origin_cascade_data
.borrow_mut_for_pseudo_or_insert(selector.pseudo_element())
.insert(
Rule::new(selector.clone(),