diff options
author | Boris Zbarsky <bzbarsky@mit.edu> | 2017-06-01 23:30:26 -0400 |
---|---|---|
committer | Boris Zbarsky <bzbarsky@mit.edu> | 2017-06-05 12:51:51 -0400 |
commit | 98f95a32da4b2a58db2fec829c36b85d5e671645 (patch) | |
tree | 24b7c0fe9adfe8df52954737957a860d50af290e /components/style/bloom.rs | |
parent | a36edb9970dbb658c17c008cfb22a7dc4f3e76ce (diff) | |
download | servo-98f95a32da4b2a58db2fec829c36b85d5e671645.tar.gz servo-98f95a32da4b2a58db2fec829c36b85d5e671645.zip |
Fix the handling of the Bloom filter in the style sharing cache.
Diffstat (limited to 'components/style/bloom.rs')
-rw-r--r-- | components/style/bloom.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/components/style/bloom.rs b/components/style/bloom.rs index f5df67e6a3f..8ffe2d2a968 100644 --- a/components/style/bloom.rs +++ b/components/style/bloom.rs @@ -158,6 +158,14 @@ impl<E: TElement> StyleBloom<E> { } } + /// Get the element that represents the chain of things inserted + /// into the filter right now. That chain is the given element + /// (if any) and its ancestors. + #[inline] + pub fn current_parent(&self) -> Option<E> { + self.elements.last().map(|el| **el) + } + /// Insert the parents of an element in the bloom filter, trying to recover /// the filter if the last element inserted doesn't match. /// @@ -185,7 +193,7 @@ impl<E: TElement> StyleBloom<E> { } }; - if self.elements.last().map(|el| **el) == Some(parent_element) { + if self.current_parent() == Some(parent_element) { // Ta da, cache hit, we're all done. return; } |