mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1782317 - Fix segment building scrolled local clip bug. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D153428
This commit is contained in:
parent
114aa88738
commit
6e214817ef
@ -5,7 +5,7 @@
|
||||
use api::{ColorF, DebugFlags, FontRenderMode, PremultipliedColorF};
|
||||
use api::units::*;
|
||||
use crate::batch::{BatchBuilder, AlphaBatchBuilder, AlphaBatchContainer, CommandBufferList};
|
||||
use crate::clip::ClipStore;
|
||||
use crate::clip::{ClipStore, ClipTree};
|
||||
use crate::spatial_tree::{SpatialTree, SpatialNodeIndex};
|
||||
use crate::composite::{CompositorKind, CompositeState, CompositeStatePreallocator};
|
||||
use crate::debug_item::DebugItem;
|
||||
@ -164,6 +164,7 @@ pub struct FrameBuildingState<'a> {
|
||||
pub plane_splitters: &'a mut [PlaneSplitter],
|
||||
pub surface_builder: SurfaceBuilder,
|
||||
pub cmd_buffers: &'a mut CommandBufferList,
|
||||
pub clip_tree: &'a ClipTree,
|
||||
}
|
||||
|
||||
impl<'a> FrameBuildingState<'a> {
|
||||
@ -378,6 +379,7 @@ impl FrameBuilder {
|
||||
plane_splitters: &mut scene.plane_splitters,
|
||||
surface_builder: SurfaceBuilder::new(),
|
||||
cmd_buffers,
|
||||
clip_tree: &mut scene.clip_tree,
|
||||
};
|
||||
|
||||
// Push a default dirty region which culls primitives
|
||||
|
@ -1219,6 +1219,7 @@ pub fn update_brush_segment_clip_task(
|
||||
|
||||
fn write_brush_segment_description(
|
||||
prim_local_rect: LayoutRect,
|
||||
prim_local_clip_rect: LayoutRect,
|
||||
clip_chain: &ClipChainInstance,
|
||||
segment_builder: &mut SegmentBuilder,
|
||||
clip_store: &ClipStore,
|
||||
@ -1230,10 +1231,17 @@ fn write_brush_segment_description(
|
||||
return false;
|
||||
}
|
||||
|
||||
// NOTE: The local clip rect passed to the segment builder must be the unmodified
|
||||
// local clip rect from the clip leaf, not the local_clip_rect from the
|
||||
// clip-chain instance. The clip-chain instance may have been reduced by
|
||||
// clips that are in the same coordinate system, but not the same spatial
|
||||
// node as the primitive. This can result in the clip for the segment building
|
||||
// being affected by scrolling clips, which we can't handle (since the segments
|
||||
// are not invalidated during frame building after being built).
|
||||
segment_builder.initialize(
|
||||
prim_local_rect,
|
||||
None,
|
||||
clip_chain.local_clip_rect
|
||||
prim_local_clip_rect,
|
||||
);
|
||||
|
||||
// Segment the primitive on all the local-space clip sources that we can.
|
||||
@ -1375,9 +1383,11 @@ fn build_segments_if_needed(
|
||||
|
||||
if *segment_instance_index == SegmentInstanceIndex::INVALID {
|
||||
let mut segments: SmallVec<[BrushSegment; 8]> = SmallVec::new();
|
||||
let clip_leaf = frame_state.clip_tree.get_leaf(instance.clip_leaf_id);
|
||||
|
||||
if write_brush_segment_description(
|
||||
prim_local_rect,
|
||||
clip_leaf.local_clip_rect,
|
||||
prim_clip_chain,
|
||||
&mut frame_state.segment_builder,
|
||||
frame_state.clip_store,
|
||||
|
Loading…
Reference in New Issue
Block a user