Commit 6cbf3f75 authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

Make macOS respect FormControlsRefresh feature

The FormControlsRefresh feature will make macOS use the Aura theme (and
the refresh theme, where it is implemented).

Add a runtime feature, FormControlsRefresh, to control this in blink.

Bug: 846357, 956778
Change-Id: I4eefee7ef06748b95d4f2df361a38001a4989b0e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1611108Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: ccameron <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659730}
parent 90ef5dc1
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include "third_party/blink/public/resources/grit/blink_resources.h" #include "third_party/blink/public/resources/grit/blink_resources.h"
#include "third_party/zlib/google/compression_utils.h" #include "third_party/zlib/google/compression_utils.h"
#include "ui/base/layout.h" #include "ui/base/layout.h"
#include "ui/base/ui_base_features.h"
#include "ui/events/gestures/blink/web_gesture_curve_impl.h" #include "ui/events/gestures/blink/web_gesture_curve_impl.h"
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
...@@ -77,6 +78,8 @@ std::unique_ptr<blink::WebThemeEngine> GetWebThemeEngine() { ...@@ -77,6 +78,8 @@ std::unique_ptr<blink::WebThemeEngine> GetWebThemeEngine() {
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
return std::make_unique<WebThemeEngineAndroid>(); return std::make_unique<WebThemeEngineAndroid>();
#elif defined(OS_MACOSX) #elif defined(OS_MACOSX)
if (features::IsFormControlsRefreshEnabled())
return std::make_unique<WebThemeEngineDefault>();
return std::make_unique<WebThemeEngineMac>(); return std::make_unique<WebThemeEngineMac>();
#else #else
return std::make_unique<WebThemeEngineDefault>(); return std::make_unique<WebThemeEngineDefault>();
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "services/network/public/cpp/features.h" #include "services/network/public/cpp/features.h"
#include "third_party/blink/public/common/features.h" #include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/platform/web_runtime_features.h" #include "third_party/blink/public/platform/web_runtime_features.h"
#include "ui/base/ui_base_features.h"
#include "ui/events/blink/blink_features.h" #include "ui/events/blink/blink_features.h"
#include "ui/gfx/switches.h" #include "ui/gfx/switches.h"
#include "ui/gl/gl_switches.h" #include "ui/gl/gl_switches.h"
...@@ -501,6 +502,9 @@ void SetIndividualRuntimeFeatures( ...@@ -501,6 +502,9 @@ void SetIndividualRuntimeFeatures(
WebRuntimeFeatures::EnableDisplayLocking( WebRuntimeFeatures::EnableDisplayLocking(
base::FeatureList::IsEnabled(blink::features::kDisplayLocking)); base::FeatureList::IsEnabled(blink::features::kDisplayLocking));
WebRuntimeFeatures::EnableFormControlsRefresh(
features::IsFormControlsRefreshEnabled());
} }
} // namespace } // namespace
......
...@@ -103,6 +103,7 @@ class WebRuntimeFeatures { ...@@ -103,6 +103,7 @@ class WebRuntimeFeatures {
BLINK_PLATFORM_EXPORT static void EnableFirstContentfulPaintPlusPlus(bool); BLINK_PLATFORM_EXPORT static void EnableFirstContentfulPaintPlusPlus(bool);
BLINK_PLATFORM_EXPORT static void EnableForceSynchronousHTMLParsing(bool); BLINK_PLATFORM_EXPORT static void EnableForceSynchronousHTMLParsing(bool);
BLINK_PLATFORM_EXPORT static void EnableForceTallerSelectPopup(bool); BLINK_PLATFORM_EXPORT static void EnableForceTallerSelectPopup(bool);
BLINK_PLATFORM_EXPORT static void EnableFormControlsRefresh(bool);
BLINK_PLATFORM_EXPORT static void EnableGenericSensor(bool); BLINK_PLATFORM_EXPORT static void EnableGenericSensor(bool);
BLINK_PLATFORM_EXPORT static void EnableGenericSensorExtraClasses(bool); BLINK_PLATFORM_EXPORT static void EnableGenericSensorExtraClasses(bool);
BLINK_PLATFORM_EXPORT static void EnableHeapCompaction(bool); BLINK_PLATFORM_EXPORT static void EnableHeapCompaction(bool);
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#import "third_party/blink/renderer/core/fileapi/file_list.h" #import "third_party/blink/renderer/core/fileapi/file_list.h"
#import "third_party/blink/renderer/core/html_names.h" #import "third_party/blink/renderer/core/html_names.h"
#import "third_party/blink/renderer/core/layout/layout_progress.h" #import "third_party/blink/renderer/core/layout/layout_progress.h"
#import "third_party/blink/renderer/core/layout/layout_theme_default.h"
#import "third_party/blink/renderer/core/layout/layout_view.h" #import "third_party/blink/renderer/core/layout/layout_view.h"
#import "third_party/blink/renderer/core/style/shadow_list.h" #import "third_party/blink/renderer/core/style/shadow_list.h"
#import "third_party/blink/renderer/platform/data_resource_helper.h" #import "third_party/blink/renderer/platform/data_resource_helper.h"
...@@ -138,6 +139,13 @@ namespace blink { ...@@ -138,6 +139,13 @@ namespace blink {
namespace { namespace {
class LayoutThemeMacRefresh final : public LayoutThemeDefault {
public:
static scoped_refptr<LayoutTheme> Create() {
return base::AdoptRef(new LayoutThemeMacRefresh());
}
};
// Inflate an IntRect to account for specific padding around margins. // Inflate an IntRect to account for specific padding around margins.
enum { kTopMargin = 0, kRightMargin = 1, kBottomMargin = 2, kLeftMargin = 3 }; enum { kTopMargin = 0, kRightMargin = 1, kBottomMargin = 2, kLeftMargin = 3 };
...@@ -1011,8 +1019,14 @@ NSView* FlippedView() { ...@@ -1011,8 +1019,14 @@ NSView* FlippedView() {
} }
LayoutTheme& LayoutTheme::NativeTheme() { LayoutTheme& LayoutTheme::NativeTheme() {
DEFINE_STATIC_REF(LayoutTheme, layout_theme, (LayoutThemeMac::Create())); if (RuntimeEnabledFeatures::FormControlsRefreshEnabled()) {
return *layout_theme; DEFINE_STATIC_REF(LayoutTheme, layout_theme,
(LayoutThemeMacRefresh::Create()));
return *layout_theme;
} else {
DEFINE_STATIC_REF(LayoutTheme, layout_theme, (LayoutThemeMac::Create()));
return *layout_theme;
}
} }
scoped_refptr<LayoutTheme> LayoutThemeMac::Create() { scoped_refptr<LayoutTheme> LayoutThemeMac::Create() {
......
...@@ -188,6 +188,10 @@ void WebRuntimeFeatures::EnableForceTallerSelectPopup(bool enable) { ...@@ -188,6 +188,10 @@ void WebRuntimeFeatures::EnableForceTallerSelectPopup(bool enable) {
RuntimeEnabledFeatures::SetForceTallerSelectPopupEnabled(enable); RuntimeEnabledFeatures::SetForceTallerSelectPopupEnabled(enable);
} }
void WebRuntimeFeatures::EnableFormControlsRefresh(bool enable) {
RuntimeEnabledFeatures::SetFormControlsRefreshEnabled(enable);
}
void WebRuntimeFeatures::EnableGenericSensor(bool enable) { void WebRuntimeFeatures::EnableGenericSensor(bool enable) {
RuntimeEnabledFeatures::SetSensorEnabled(enable); RuntimeEnabledFeatures::SetSensorEnabled(enable);
} }
......
...@@ -601,6 +601,11 @@ ...@@ -601,6 +601,11 @@
name: "FormAssociatedCustomElements", name: "FormAssociatedCustomElements",
status: "experimental", status: "experimental",
}, },
// This is to communicate features::FormControlsRefresh from ui (and can be
// removed when the feature launches).
{
name: "FormControlsRefresh",
},
{ {
name: "FormDataEvent", name: "FormDataEvent",
status: "experimental", status: "experimental",
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
#include "ui/gfx/skia_util.h" #include "ui/gfx/skia_util.h"
#include "ui/native_theme/common_theme.h" #include "ui/native_theme/common_theme.h"
#include "ui/native_theme/native_theme_aura.h"
namespace { namespace {
...@@ -152,6 +153,8 @@ namespace ui { ...@@ -152,6 +153,8 @@ namespace ui {
// static // static
NativeTheme* NativeTheme::GetInstanceForWeb() { NativeTheme* NativeTheme::GetInstanceForWeb() {
if (features::IsFormControlsRefreshEnabled())
return NativeThemeAura::web_instance();
return NativeThemeMac::instance(); return NativeThemeMac::instance();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment