aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_2020/display_list
diff options
context:
space:
mode:
authorEnnui Langeweile <85590273+EnnuiL@users.noreply.github.com>2023-10-09 09:51:51 -0300
committerGitHub <noreply@github.com>2023-10-09 12:51:51 +0000
commit84dd447d9d9e35b22da6eaa0ae8fbacd6038a544 (patch)
tree2866d478051b893e5ba1d3e72f428f4dac2fa2b1 /components/layout_2020/display_list
parent5eed4e978c7dedeb33d2b2aa7db25ad006546617 (diff)
downloadservo-84dd447d9d9e35b22da6eaa0ae8fbacd6038a544.tar.gz
servo-84dd447d9d9e35b22da6eaa0ae8fbacd6038a544.zip
Fix filter clipping caused by `overflow: hidden` (#30517)
* Partially fix filter clipping * Clean up the logic * Update components/layout_2020/display_list/stacking_context.rs --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/layout_2020/display_list')
-rw-r--r--components/layout_2020/display_list/stacking_context.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/components/layout_2020/display_list/stacking_context.rs b/components/layout_2020/display_list/stacking_context.rs
index f526b195012..2613deeb648 100644
--- a/components/layout_2020/display_list/stacking_context.rs
+++ b/components/layout_2020/display_list/stacking_context.rs
@@ -271,6 +271,9 @@ pub struct StackingContext {
/// things like preserve-3d.
spatial_id: wr::SpatialId,
+ /// The clip chain id of this stacking context if it has one. Used for filter clipping.
+ clip_chain_id: Option<wr::ClipChainId>,
+
/// The fragment that established this stacking context.
initializing_fragment_style: Option<ServoArc<ComputedValues>>,
@@ -330,11 +333,13 @@ impl StackingContext {
fn create_descendant(
&self,
spatial_id: wr::SpatialId,
+ clip_chain_id: Option<wr::ClipChainId>,
initializing_fragment_style: ServoArc<ComputedValues>,
context_type: StackingContextType,
) -> Self {
Self {
spatial_id,
+ clip_chain_id: clip_chain_id,
initializing_fragment_style: Some(initializing_fragment_style),
context_type,
contents: vec![],
@@ -348,6 +353,7 @@ impl StackingContext {
pub(crate) fn create_root(wr: &wr::DisplayListBuilder, debug: &DebugOptions) -> Self {
Self {
spatial_id: wr::SpaceAndClipInfo::root_scroll(wr.pipeline_id).spatial_id,
+ clip_chain_id: None,
initializing_fragment_style: None,
context_type: StackingContextType::RealStackingContext,
contents: vec![],
@@ -430,6 +436,8 @@ impl StackingContext {
return false;
}
+ let clip_id = self.clip_chain_id.map(wr::ClipId::ClipChain);
+
// Create the filter pipeline.
let current_color = style.clone_color();
let mut filters: Vec<wr::FilterOp> = effects
@@ -455,7 +463,7 @@ impl StackingContext {
LayoutPoint::zero(), // origin
self.spatial_id,
style.get_webrender_primitive_flags(),
- None, // clip_chain_id
+ clip_id,
style.get_used_transform_style().to_webrender(),
effects.mix_blend_mode.to_webrender(),
&filters,
@@ -982,6 +990,7 @@ impl BoxFragment {
let mut child_stacking_context = parent_stacking_context.create_descendant(
containing_block.scroll_node_id.spatial_id,
+ Some(containing_block.clip_chain_id),
self.style.clone(),
context_type,
);