Skip to content

Commit

Permalink
Make Filters implicitly set overflow hidden (#46145)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #46145

Filters clip children by default due to using `RenderEffect` we are keeping this behavior but we were clipping to the border box while Web clips to padding box.

To keep the clipping consistent we are enforcing `Overflow.HIDDEN` when a view contains a filter.

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D61630698

fbshipit-source-id: dcc3fd680546793096d8996f405724df0a834079
  • Loading branch information
jorge-cab authored and facebook-github-bot committed Aug 28, 2024
1 parent 3077db3 commit 8618eec
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ && needsIsolatedLayer()) {
@Override
protected void dispatchDraw(Canvas canvas) {
if (ReactNativeFeatureFlags.enableBackgroundStyleApplicator()) {
if (mOverflow != Overflow.VISIBLE) {
if (mOverflow != Overflow.VISIBLE || getTag(R.id.filter) != null) {
BackgroundStyleApplicator.clipToPaddingBox(this, canvas);
}
super.dispatchDraw(canvas);
Expand Down Expand Up @@ -1034,7 +1034,14 @@ protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
}

private void dispatchOverflowDraw(Canvas canvas) {
switch (mOverflow) {
Overflow tempOverflow = mOverflow;

// If the view contains a filter, we clip to the padding box.
if (getTag(R.id.filter) != null) {
tempOverflow = Overflow.HIDDEN;
}

switch (tempOverflow) {
case VISIBLE:
if (mPath != null) {
mPath.rewind();
Expand Down

0 comments on commit 8618eec

Please sign in to comment.