aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCameron McCormack <cam@mcc.id.au>2016-12-04 23:06:22 -1000
committerCameron McCormack <cam@mcc.id.au>2016-12-04 23:35:03 -1000
commit68af62f15f0a38e01ff9be59f5371bbf6b34ad97 (patch)
treedcaa99d4bb761f2ebad580887937ba516ac7a088
parent07a3e9b2266c87493cb70c6f50e36a0d2dfe8a66 (diff)
downloadservo-68af62f15f0a38e01ff9be59f5371bbf6b34ad97.tar.gz
servo-68af62f15f0a38e01ff9be59f5371bbf6b34ad97.zip
Allow the style bloom filter to recover from switch to a node with no common ancestor with the old node.
-rw-r--r--components/style/bloom.rs18
1 files changed, 16 insertions, 2 deletions
diff --git a/components/style/bloom.rs b/components/style/bloom.rs
index d3ed204fb1e..4dd880d8ea7 100644
--- a/components/style/bloom.rs
+++ b/components/style/bloom.rs
@@ -214,11 +214,25 @@ impl StyleBloom {
//
// Not-so-happy case: Parent's don't match, so we need to keep going up
// until we find a common ancestor.
+ //
+ // Gecko currently models native anonymous content that conceptually hangs
+ // off the document (such as scrollbars) as a separate subtree from the
+ // document root. Thus it's possible with Gecko that we do not find any
+ // common ancestor.
while *self.elements.last().unwrap() != common_parent.as_node().to_unsafe() {
parents_to_insert.push(common_parent);
- common_parent =
- common_parent.parent_element().expect("We were lied again?");
self.pop::<E>().unwrap();
+ common_parent = match common_parent.parent_element() {
+ Some(parent) => parent,
+ None => {
+ debug_assert!(self.elements.is_empty());
+ if cfg!(feature = "gecko") {
+ break;
+ } else {
+ panic!("should have found a common ancestor");
+ }
+ }
+ }
}
// Now the parents match, so insert the stack of elements we have been