feat: Corner Smoothing CSS rule (#45185)
* feat: Corner Smoothing * Patch Blink to add CSS rule and Painting * Add `system-ui` keyword * Add `cornerSmoothingCSS` web preference * Add tests * Documentation * fixup! Documentation * fix: initialize smoothness value * Use a 1.0 scale factor in tests * Fix tests for CI * Fix tests * fixup! Merge branch 'main' into clavin/corner-smoothing * Add code docs * Document `system-ui` keyword values * Address review comments * fixup! Address review comments * Address review comments * Update patch to address upstream changes The patch went from 694 lines to 505 lines, which is a 27.2% smaller! * fixup! Update patch to address upstream changes
This commit is contained in:
parent
9ec14b91e7
commit
b75e802280
26 changed files with 1313 additions and 1 deletions
36
shell/renderer/electron_smooth_round_rect.h
Normal file
36
shell/renderer/electron_smooth_round_rect.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
// Copyright (c) 2024 Salesforce, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ELECTRON_SHELL_RENDERER_API_ELECTRON_SMOOTH_ROUND_RECT_H_
|
||||
#define ELECTRON_SHELL_RENDERER_API_ELECTRON_SMOOTH_ROUND_RECT_H_
|
||||
|
||||
#include "third_party/skia/include/core/SkPath.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
// Draws a rectangle that has smooth round corners for a given "smoothness"
|
||||
// value between 0.0 and 1.0 (representing 0% to 100%).
|
||||
//
|
||||
// The smoothness value determines how much edge length can be consumed by each
|
||||
// corner, scaling with respect to that corner's radius. The smoothness will
|
||||
// dynamically scale back if there is not enough edge length, similar to how
|
||||
// the corner radius backs off when there isn't enough edge length.
|
||||
//
|
||||
// Each corner's radius can be supplied independently. Corner radii are expected
|
||||
// to already be balanced (Radius1 + Radius2 <= Length, for each given side).
|
||||
//
|
||||
// Elliptical corner radii are not currently supported.
|
||||
SkPath DrawSmoothRoundRect(float x,
|
||||
float y,
|
||||
float width,
|
||||
float height,
|
||||
float smoothness,
|
||||
float top_left_radius,
|
||||
float top_right_radius,
|
||||
float bottom_right_radius,
|
||||
float bottom_left_radius);
|
||||
|
||||
} // namespace electron
|
||||
|
||||
#endif // ELECTRON_SHELL_RENDERER_API_ELECTRON_SMOOTH_ROUND_RECT_H_
|
Loading…
Add table
Add a link
Reference in a new issue