diff options
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; } |