feat: Corner Smoothing CSS rule (Reland) (#46278)
* feat: Corner Smoothing CSS rule (Reland) Reland of #45185 * Fix patch conflicts * fixup! Fix patch conflicts * Update expected image The dashed border is subtly different. The new version is correct and the old one was incorrect.
This commit is contained in:
parent
fcd836e34f
commit
09135443a0
26 changed files with 1276 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