mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 03:25:13 +00:00
LibWeb: Do not calculate corner radii if no radius is set
The `as_corner()` and `floored_device_pixels()` functions popped up frequently in profiles when selecting text on some Tweakers.net pages. For every corner we're performing multiple device pixel calculations regardless of whether any radius was actually set. Add an early return if no radius is set. On my machine this reduces the time taken in both `as_corner()` and `floored_device_pixels()` by 46% (63% fewer calls).
This commit is contained in:
parent
cfeb916e61
commit
c2e21d33eb
Notes:
github-actions[bot]
2025-03-19 13:23:10 +00:00
Author: https://github.com/gmta Commit: https://github.com/LadybirdBrowser/ladybird/commit/c2e21d33eb1 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3999 Reviewed-by: https://github.com/kalenikaliaksandr ✅
1 changed files with 2 additions and 0 deletions
|
@ -93,6 +93,8 @@ struct BorderRadiiData {
|
|||
|
||||
inline CornerRadii as_corners(PaintContext const& context) const
|
||||
{
|
||||
if (!has_any_radius())
|
||||
return {};
|
||||
return CornerRadii {
|
||||
top_left.as_corner(context),
|
||||
top_right.as_corner(context),
|
||||
|
|
Loading…
Add table
Reference in a new issue