Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync changes from mozilla-central gfx/wr #3850

Merged
merged 4 commits into from Feb 5, 2020
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Bug 1599327 - Use cluster scrollbar flags to select picture cache til…

…e size. r=gw

(cherry picked from commit 348b45266ac2c2c65dcc26705dc7cf144f5e0051)

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

[ghsync] From https://hg.mozilla.org/mozilla-central/rev/269ab6499d32ae39f0626858d05e13403787db69
  • Loading branch information
bpeersmoz authored and moz-gfx committed Feb 5, 2020
commit be14d08e339e07d1e9ab485076cde39639a63673
@@ -136,6 +136,7 @@ use std::fs::File;
use std::io::prelude::*;
#[cfg(feature = "capture")]
use std::path::PathBuf;
use crate::scene_building::{SliceFlags};

/// Specify whether a surface allows subpixel AA text rendering.
#[derive(Debug, Copy, Clone, PartialEq)]
@@ -1768,6 +1769,8 @@ pub struct TileCacheInstance {
/// between display lists - this seems very unlikely to occur on most pages, but
/// can be revisited if we ever notice that.
pub slice: usize,
/// Propagated information about the slice
pub slice_flags: SliceFlags,
/// The currently selected tile size to use for this cache
pub current_tile_size: DeviceIntSize,
/// The positioning node for this tile cache.
@@ -1858,13 +1861,15 @@ pub struct TileCacheInstance {
impl TileCacheInstance {
pub fn new(
slice: usize,
slice_flags: SliceFlags,
spatial_node_index: SpatialNodeIndex,
background_color: Option<ColorF>,
shared_clips: Vec<ClipDataHandle>,
shared_clip_chain: ClipChainId,
) -> Self {
TileCacheInstance {
slice,
slice_flags,
spatial_node_index,
tiles: FastHashMap::default(),
old_tiles: FastHashMap::default(),
@@ -2063,21 +2068,19 @@ impl TileCacheInstance {
// changing near a threshold value.
if self.frames_until_size_eval == 0 ||
self.tile_size_override != frame_context.config.tile_size_override {
const TILE_SIZE_TINY: f32 = 32.0;

// Work out what size tile is appropriate for this picture cache.
let desired_tile_size = match frame_context.config.tile_size_override {
Some(tile_size_override) => {
tile_size_override
}
None => {
// There's no need to check the other dimension. If we encounter a picture
// that is small on one dimension, it's a reasonable choice to use a scrollbar
// sized tile configuration regardless of the other dimension.
if pic_rect.size.width <= TILE_SIZE_TINY {
TILE_SIZE_SCROLLBAR_VERTICAL
} else if pic_rect.size.height <= TILE_SIZE_TINY {
TILE_SIZE_SCROLLBAR_HORIZONTAL
if self.slice_flags.contains(SliceFlags::IS_SCROLLBAR) {
if pic_rect.size.width <= pic_rect.size.height {
TILE_SIZE_SCROLLBAR_VERTICAL
} else {
TILE_SIZE_SCROLLBAR_HORIZONTAL
}
} else {
TILE_SIZE_DEFAULT
}
@@ -245,6 +245,14 @@ struct ClipChainPairInfo {
clip_chain_id: ClipChainId,
}

bitflags! {
/// Slice flags
pub struct SliceFlags : u8 {
/// Slice created by a cluster that has ClusterFlags::SCROLLBAR_CONTAINER
const IS_SCROLLBAR = 1;
}
}

/// Information about a set of primitive clusters that will form a picture cache slice.
struct Slice {
/// The spatial node root of the picture cache. If this is None, the slice
@@ -256,6 +264,8 @@ struct Slice {
/// A list of clips that are shared by all primitives in the slice. These can be
/// filtered out and applied when the tile cache is composited rather than per-item.
shared_clips: Option<Vec<ClipDataHandle>>,
/// Various flags describing properties of this slice
pub flags: SliceFlags,
}

impl Slice {
@@ -545,10 +555,16 @@ impl<'a> SceneBuilder<'a> {
prev_slice.pop_clip_instances(&clip_chain_instance_stack);
}

let slice_flags = if cluster.flags.contains(ClusterFlags::SCROLLBAR_CONTAINER) {
SliceFlags::IS_SCROLLBAR
} else {
SliceFlags::empty()
};
let mut slice = Slice {
cache_scroll_root: cluster.cache_scroll_root,
prim_list: PrimitiveList::empty(),
shared_clips: None,
flags: slice_flags
};

// Open up clip chains on the stack on the new slice
@@ -662,6 +678,7 @@ impl<'a> SceneBuilder<'a> {

let instance = create_tile_cache(
slice_index,
slice.flags,
scroll_root,
slice.prim_list,
background_color,
@@ -3994,6 +4011,7 @@ fn process_repeat_size(
/// that wraps the primitive list.
fn create_tile_cache(
slice: usize,
slice_flags: SliceFlags,
scroll_root: SpatialNodeIndex,
prim_list: PrimitiveList,
background_color: Option<ColorF>,
@@ -4048,6 +4066,7 @@ fn create_tile_cache(

let tile_cache = Box::new(TileCacheInstance::new(
slice,
slice_flags,
scroll_root,
background_color,
shared_clips,
Binary file not shown.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.