aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/restyle_hints.rs
diff options
context:
space:
mode:
authorBobby Holley <bobbyholley@gmail.com>2015-11-04 18:15:30 -0800
committerBobby Holley <bobbyholley@gmail.com>2015-11-04 19:01:50 -0800
commitd89816bb5fa90421a4dea49ff6387f635ce7b389 (patch)
tree66b7b5ac4b42591bde1ecca3dccb13c3c278e132 /components/style/restyle_hints.rs
parent77c253fd43a8ef1723c48709b5fececa742ba4fa (diff)
downloadservo-d89816bb5fa90421a4dea49ff6387f635ce7b389.tar.gz
servo-d89816bb5fa90421a4dea49ff6387f635ce7b389.zip
Consider all the pseudo-classes in a given compound selector when computing restyle hints, not just the rightmost one.
For some reason when I wrote this code I mixed up the rules for pseudo-elements (rightmost, maximum of one) with those of pseudo-classes (which have no such restriction). This caused a correctness issue which can be demonstrated with the associated reftest modification.
Diffstat (limited to 'components/style/restyle_hints.rs')
-rw-r--r--components/style/restyle_hints.rs19
1 files changed, 10 insertions, 9 deletions
diff --git a/components/style/restyle_hints.rs b/components/style/restyle_hints.rs
index acb521b0f10..fe143c3e315 100644
--- a/components/style/restyle_hints.rs
+++ b/components/style/restyle_hints.rs
@@ -220,15 +220,16 @@ impl StateDependencySet {
let mut cur = selector;
let mut combinator: Option<Combinator> = None;
loop {
- if let Some(rightmost) = cur.simple_selectors.last() {
- let state_dep = selector_to_state(rightmost);
- if !state_dep.is_empty() {
- self.deps.push(StateDependency {
- selector: cur.clone(),
- combinator: combinator,
- state: state_dep,
- });
- }
+ let mut deps = ElementState::empty();
+ for s in &cur.simple_selectors {
+ deps.insert(selector_to_state(s));
+ }
+ if !deps.is_empty() {
+ self.deps.push(StateDependency {
+ selector: cur.clone(),
+ combinator: combinator,
+ state: deps,
+ });
}
cur = match cur.next {