Skip to content

Commit

Permalink
Make Filters implicitly set overflow hidden (facebook#46145)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#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.

Differential Revision: D61630698
  • Loading branch information
jorge-cab authored and facebook-github-bot committed Aug 22, 2024
1 parent 4ff3480 commit 9e870b6
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 9e870b6

Please sign in to comment.