Skip to content

BackgroundStyleApplicator and boxShadow in vertical scroll views#45803

Closed
NickGerleman wants to merge 9 commits into
facebook:mainfrom
NickGerleman:export-D60409795
Closed

BackgroundStyleApplicator and boxShadow in vertical scroll views#45803
NickGerleman wants to merge 9 commits into
facebook:mainfrom
NickGerleman:export-D60409795

Conversation

@NickGerleman
Copy link
Copy Markdown
Contributor

Summary:
This makes the same rough changes as I made to images, to apply background styles in view manager layer, using BackgroundStyleApplicator, including new boxShadow style property.

Changelog: [Internal]

Differential Revision: D60409795

NickGerleman and others added 9 commits July 29, 2024 00:15
Differential Revision: D60265327
Differential Revision: D60265326
Differential Revision: D60266016
Differential Revision: D60367850
Summary:
D59300215 noticed that the drawable was leaking a clipping rect for the rest of the operations, and added a `save/restore` pair, but the save happens conditionally, so we can restore more often than we save.

Scope the save/restore, to just the area setting context then drawing onto the canvas.

```
java.lang.IllegalStateException: Underflow in restore - more restores than saves
                                                                                                    	at android.graphics.Canvas.restore(Canvas.java:647)
                                                                                                    	at com.facebook.react.uimanager.drawable.OutsetBoxShadowDrawable.draw(OutsetBoxShadowDrawable.kt:110)
                                                                                                    	at android.graphics.drawable.LayerDrawable.draw(LayerDrawable.java:1019)
```

Differential Revision: D60375357
Summary:
Android borders are drawn using a path generated by `addRoundRect()` inset by half the border width, using the full border width as stoke width. The edges of the ellipsis drawn for rounded borders do not line up with the math used to trace the bounding border-box path.

We inset the clipOut path, as if its bounding rectangle were about half a subpixel smaller, to mininally overlap the border on these edges. We then place the outer box shadows under the border in z-ordering, so that the minimal extra insetting is only visible with transparent backgrounds.

Differential Revision: D60389685
Summary:
This makes the same rough changes as I made to images, to apply background styles in view manager layer, using BackgroundStyleApplicator, including new boxShadow style property.

Changelog: [Internal]

Differential Revision: D60409795
@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels Jul 29, 2024
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D60409795

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request has been merged in d842fc6.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants