mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 16:25:38 +00:00
Bug 1647222 - Improve detection of real scroll frames. r=jnicol
We detect empty scroll roots by checking the valid scrollable size of a frame, in order to avoid attaching picture cache slices to these redundant scroll frames. However, under some fractional zoom scenarios, rounding CSS pixels to device pixels can result in small rounding errors. Apply the same epsilon check that Gecko uses in APZ code in order to detect if a scroll frame is actually scrollable. Differential Revision: https://phabricator.services.mozilla.com/D80943
This commit is contained in:
parent
a674c80bfb
commit
d4a5cd3f1d
@ -59,6 +59,11 @@ impl SpatialNodeIndex {
|
||||
pub const ROOT_SPATIAL_NODE_INDEX: SpatialNodeIndex = SpatialNodeIndex(0);
|
||||
const TOPMOST_SCROLL_NODE_INDEX: SpatialNodeIndex = SpatialNodeIndex(1);
|
||||
|
||||
// In some cases, the conversion from CSS pixels to device pixels can result in small
|
||||
// rounding errors when calculating the scrollable distance of a scroll frame. Apply
|
||||
// a small epsilon so that we don't detect these frames as "real" scroll frames.
|
||||
const MIN_SCROLLABLE_AMOUNT: f32 = 0.01;
|
||||
|
||||
impl SpatialNodeIndex {
|
||||
pub fn new(index: usize) -> Self {
|
||||
debug_assert!(index < ::std::u32::MAX as usize);
|
||||
@ -658,8 +663,8 @@ impl SpatialTree {
|
||||
// consider it. This helps pages that have a nested scroll root
|
||||
// within a redundant scroll root to avoid selecting the wrong
|
||||
// reference spatial node for a picture cache.
|
||||
if info.scrollable_size.width > 0.0 ||
|
||||
info.scrollable_size.height > 0.0 {
|
||||
if info.scrollable_size.width > MIN_SCROLLABLE_AMOUNT ||
|
||||
info.scrollable_size.height > MIN_SCROLLABLE_AMOUNT {
|
||||
// Since we are skipping redundant scroll roots, we may end up
|
||||
// selecting inner scroll roots that are very small. There is
|
||||
// no performance benefit to creating a slice for these roots,
|
||||
|
Loading…
Reference in New Issue
Block a user