Bug 1517723 - Update webrender to commit a40a5ffd1649d6bf6f55b76c7d633e4d157d4478 (WR PR #3467). r=kats

https://github.com/servo/webrender/pull/3467

Differential Revision: https://phabricator.services.mozilla.com/D15722

--HG--
extra : moz-landing-system : lando
This commit is contained in:
WR Updater Bot 2019-01-04 13:26:28 +00:00
Родитель ea90d7794d
Коммит fb2720172a
2 изменённых файлов: 47 добавлений и 15 удалений

Просмотреть файл

@ -1 +1 @@
8a7212b628ae39e7251201b0a9761c74bab42c5d
a40a5ffd1649d6bf6f55b76c7d633e4d157d4478

Просмотреть файл

@ -113,6 +113,9 @@ pub struct Tile {
pub local_rect: LayoutRect,
/// The valid rect within this tile.
valid_rect: WorldRect,
/// The currently visible rect within this tile, updated per frame.
/// If None, this tile is not currently visible.
visible_rect: Option<WorldRect>,
/// Uniquely describes the content of this tile, in a way that can be
/// (reasonably) efficiently hashed and compared.
descriptor: TileDescriptor,
@ -136,6 +139,7 @@ impl Tile {
local_rect: LayoutRect::zero(),
world_rect: WorldRect::zero(),
valid_rect: WorldRect::zero(),
visible_rect: None,
handle: TextureCacheHandle::invalid(),
descriptor: TileDescriptor::new(),
is_valid: false,
@ -491,6 +495,17 @@ impl TileCache {
.intersection(&device_world_rect)
.expect("todo: handle clipped device rect");
// Expand the needed device rect vertically by a small number of tiles. This
// ensures that as tiles are scrolled in/out of view, they are retained for
// a while before being discarded.
// TODO(gw): On some pages it might be worth also inflating horizontally.
// (is this locale specific?). It might be possible to make a good
// guess based on the size of the picture rect for the tile cache.
let needed_device_rect = needed_device_rect.inflate(
0.0,
3.0 * TILE_SIZE_HEIGHT as f32,
);
let p0 = needed_device_rect.origin;
let p1 = needed_device_rect.bottom_right();
@ -554,6 +569,8 @@ impl TileCache {
.unmap(&tile.world_rect)
.expect("bug: can't unmap world rect");
tile.visible_rect = tile.world_rect.intersection(&frame_context.screen_world_rect);
self.tiles.push(tile);
}
}
@ -610,7 +627,6 @@ impl TileCache {
resource_cache: &ResourceCache,
opacity_binding_store: &OpacityBindingStorage,
image_instances: &ImageInstanceStorage,
screen_world_rect: &WorldRect,
) {
if !self.needs_update {
return;
@ -766,10 +782,13 @@ impl TileCache {
);
if let Some(clip_world_rect) = self.map_local_to_world.map(&local_rect) {
world_clip_rect = match world_clip_rect.intersection(&clip_world_rect) {
Some(rect) => rect,
None => return,
};
// Even if this ends up getting clipped out by the current clip
// stack, we want to ensure the primitive gets added to the tiles
// below, to ensure invalidation isn't tripped up by the wrong
// number of primitives that affect this tile.
world_clip_rect = world_clip_rect
.intersection(&clip_world_rect)
.unwrap_or(WorldRect::zero());
}
false
@ -819,14 +838,31 @@ impl TileCache {
let index = (y * self.tile_count.width + x) as usize;
let tile = &mut self.tiles[index];
// TODO(gw): For now, we need to always build the dependencies each
// frame, so can't early exit here. In future, we should
// support retaining the tile descriptor from when the
// tile goes off-screen, which will mean we can then
// compare against that next time it becomes visible.
let visible_rect = match tile.visible_rect {
Some(visible_rect) => visible_rect,
None => WorldRect::zero(),
};
// Work out the needed rect for the primitive on this tile.
// TODO(gw): We should be able to remove this for any tile that is not
// a partially clipped tile, which would be a significant
// optimization for the common case (non-clipped tiles).
let needed_rect = match world_clip_rect.intersection(&tile.world_rect).and_then(|r| r.intersection(screen_world_rect)) {
Some(rect) => rect.translate(&-tile.world_rect.origin.to_vector()),
None => continue,
};
// Get the required tile-local rect that this primitive occupies.
// Ensure that even if it's currently clipped out of this tile,
// we still insert a rect of zero size, so that the tile descriptor's
// needed rects array matches.
let needed_rect = world_clip_rect
.intersection(&visible_rect)
.map(|rect| {
rect.translate(&-tile.world_rect.origin.to_vector())
})
.unwrap_or(WorldRect::zero());
tile.descriptor.needed_rects.push(needed_rect);
@ -930,10 +966,7 @@ impl TileCache {
tile.is_valid = false;
}
let visible_rect = match tile
.world_rect
.intersection(&frame_context.screen_world_rect)
{
let visible_rect = match tile.visible_rect {
Some(rect) => rect,
None => continue,
};
@ -2010,7 +2043,6 @@ impl PicturePrimitive {
resource_cache,
opacity_binding_store,
image_instances,
&frame_context.screen_world_rect,
);
}
}