mirror of
https://github.com/electron/electron.git
synced 2026-01-08 23:18:06 -05:00
fix: corner smoothing feature gate crash (#47759)
* fix: corner smoothing feature gate crash * Fix ElectronCornerSmoothing::CSSValueFromComputedStyleInternal
This commit is contained in:
@@ -149,7 +149,6 @@ void WebContentsPreferences::Clear() {
|
||||
preload_path_ = std::nullopt;
|
||||
v8_cache_options_ = blink::mojom::V8CacheOptions::kDefault;
|
||||
deprecated_paste_enabled_ = false;
|
||||
corner_smoothing_css_ = true;
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
scroll_bounce_ = false;
|
||||
@@ -229,8 +228,6 @@ void WebContentsPreferences::SetFromDictionary(
|
||||
if (web_preferences.Get(options::kDisableBlinkFeatures,
|
||||
&disable_blink_features))
|
||||
disable_blink_features_ = disable_blink_features;
|
||||
web_preferences.Get(options::kEnableCornerSmoothingCSS,
|
||||
&corner_smoothing_css_);
|
||||
|
||||
base::FilePath::StringType preload_path;
|
||||
if (web_preferences.Get(options::kPreloadScript, &preload_path)) {
|
||||
@@ -481,8 +478,6 @@ void WebContentsPreferences::OverrideWebkitPrefs(
|
||||
prefs->v8_cache_options = v8_cache_options_;
|
||||
|
||||
prefs->dom_paste_enabled = deprecated_paste_enabled_;
|
||||
|
||||
renderer_prefs->electron_corner_smoothing_css = corner_smoothing_css_;
|
||||
}
|
||||
|
||||
WEB_CONTENTS_USER_DATA_KEY_IMPL(WebContentsPreferences);
|
||||
|
||||
@@ -134,7 +134,6 @@ class WebContentsPreferences
|
||||
std::optional<base::FilePath> preload_path_;
|
||||
blink::mojom::V8CacheOptions v8_cache_options_;
|
||||
bool deprecated_paste_enabled_ = false;
|
||||
bool corner_smoothing_css_;
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
bool scroll_bounce_;
|
||||
|
||||
@@ -219,9 +219,6 @@ inline constexpr std::string_view kSpellcheck = "spellcheck";
|
||||
inline constexpr std::string_view kEnableDeprecatedPaste =
|
||||
"enableDeprecatedPaste";
|
||||
|
||||
// Whether the -electron-corner-smoothing CSS rule is enabled.
|
||||
inline constexpr std::string_view kEnableCornerSmoothingCSS =
|
||||
"enableCornerSmoothingCSS";
|
||||
} // namespace options
|
||||
|
||||
// Following are actually command line switches, should be moved to other files.
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <numbers>
|
||||
#include "base/check.h"
|
||||
#include "base/check_op.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
@@ -263,13 +264,14 @@ SkPath DrawSmoothRoundRect(float x,
|
||||
float top_right_radius,
|
||||
float bottom_right_radius,
|
||||
float bottom_left_radius) {
|
||||
DCHECK(0.0f <= smoothness && smoothness <= 1.0f);
|
||||
DCHECK_GE(smoothness, 0.0f);
|
||||
DCHECK_LE(smoothness, 1.0f);
|
||||
|
||||
// Assume the radii are already constrained within the rectangle size
|
||||
DCHECK(top_left_radius + top_right_radius <= width);
|
||||
DCHECK(bottom_left_radius + bottom_right_radius <= width);
|
||||
DCHECK(top_left_radius + bottom_left_radius <= height);
|
||||
DCHECK(top_right_radius + bottom_right_radius <= height);
|
||||
DCHECK_LE(top_left_radius + top_right_radius, width);
|
||||
DCHECK_LE(bottom_left_radius + bottom_right_radius, width);
|
||||
DCHECK_LE(top_left_radius + bottom_left_radius, height);
|
||||
DCHECK_LE(top_right_radius + bottom_right_radius, height);
|
||||
|
||||
if (width <= 0.0f || height <= 0.0f) {
|
||||
return SkPath();
|
||||
|
||||
Reference in New Issue
Block a user