Remove FormControlsRefresh and ColorSchemeUARendering flags and code
Both of these are now fully-launched (in M91) so the flags and associated code are no longer needed. This CL should cause no behavior changes, and the form controls appearance is widely covered by web_tests and a few browser_tests. Bug: 1099951, 1208983 Change-Id: I8d87355e0b86cde9969caee886bf9779c77ad61e Cq-Do-Not-Cancel-Tryjobs: true Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2895047 Reviewed-by: Joey Arhar <jarhar@chromium.org> Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> Reviewed-by: Philip Rogers <pdr@chromium.org> Reviewed-by: Scott Violet <sky@chromium.org> Reviewed-by: Bo <boliu@chromium.org> Reviewed-by: Andrey Kosyakov <caseq@chromium.org> Commit-Queue: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/master@{#885605}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
01e5e64e47
commit
972aab37ea
android_webview/java/src/org/chromium/android_webview/common
chrome/browser
about_flags.ccflag-metadata.jsonflag_descriptions.ccflag_descriptions.hfocus_ring_browsertest.ccrenderer_preferences_util.cc
content
app_shim_remote_cocoa
popup_window_mac.hpopup_window_mac.mmrender_widget_host_ns_view_bridge.hrender_widget_host_ns_view_bridge.mm
browser
child
common
headless/lib/browser
testing/variations
third_party/blink
public
renderer
core
css
exported
frame
html
forms
chooser_resource_loader.ccchooser_resource_loader.hcolor_chooser_popup_ui_controller.cccolor_input_type.ccdate_time_chooser_impl.cchtml_input_element.cchtml_select_element.ccinternal_popup_menu.ccmultiple_fields_temporal_input_type_view.ccpicker_indicator_element.cc
resources
calendarPicker.csscalendarPicker.jscalendar_picker_refresh.csscolorSuggestionPicker.csscolorSuggestionPicker.jscolor_picker_common.jsdatetimelocal_picker.jslistPicker.csslistPicker.jsmonth_picker.jspickerButton.csspickerCommon.jssuggestionPicker.csssuggestionPicker.js
select_type.ccslider_thumb_element.cclayout
layout_text_control_single_line_test.cclayout_theme.cclayout_theme_android.cclayout_theme_android.hlayout_theme_default.cclayout_theme_mac.mmlayout_theme_test.ccscrollbars_test.cc
paint
scroll
style
testing
platform
web_tests
FlagExpectations
TestExpectationsVirtualTestSuitesfast
forms
calendar-picker
color-scheme
month-picker
http
tests
forms
virtual
system-color-compute
ui
base
native_theme
views
widget
@ -122,8 +122,6 @@ public final class ProductionSupportedFlagList {
|
||||
"Enables the new Java/JS Bridge code path with mojo implementation."),
|
||||
Flag.baseFeature(
|
||||
AwFeatures.WEBVIEW_ORIGIN_TRIALS, "Enables Origin Trials support on WebView."),
|
||||
Flag.baseFeature(UiFeatures.FORM_CONTROLS_REFRESH,
|
||||
"Enables the Form Controls visual improvements and dark mode."),
|
||||
Flag.baseFeature(
|
||||
BlinkFeatures.LAYOUT_NG_TABLE, "Enables Blink's next generation table layout."),
|
||||
Flag.baseFeature(
|
||||
|
@ -5685,17 +5685,6 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
FEATURE_VALUE_TYPE(
|
||||
policy::features::kPolicyBlocklistThrottleRequiresPoliciesLoaded)},
|
||||
|
||||
#if !defined(OS_ANDROID)
|
||||
{"form-controls-dark-mode", flag_descriptions::kFormControlsDarkModeName,
|
||||
flag_descriptions::kFormControlsDarkModeDescription, kOsDesktop,
|
||||
FEATURE_VALUE_TYPE(features::kCSSColorSchemeUARendering)},
|
||||
#endif // !defined(OS_ANDROID)
|
||||
|
||||
{"form-controls-refresh", flag_descriptions::kFormControlsRefreshName,
|
||||
flag_descriptions::kFormControlsRefreshDescription,
|
||||
kOsWin | kOsLinux | kOsCrOS | kOsAndroid,
|
||||
FEATURE_VALUE_TYPE(features::kFormControlsRefresh)},
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
{"auto-screen-brightness", flag_descriptions::kAutoScreenBrightnessName,
|
||||
flag_descriptions::kAutoScreenBrightnessDescription, kOsCrOS,
|
||||
|
@ -3003,16 +3003,6 @@
|
||||
"owners": [ "almaher@microsoft.com" ],
|
||||
"expiry_milestone": 95
|
||||
},
|
||||
{
|
||||
"name": "form-controls-dark-mode",
|
||||
"owners": [ "sasebree@microsoft.com", "masonf", "yuzhehan", "//third_party/blink/renderer/core/OWNERS" ],
|
||||
"expiry_milestone": 92
|
||||
},
|
||||
{
|
||||
"name": "form-controls-refresh",
|
||||
"owners": [ "iopopesc@microsoft.com", "masonf", "yuzhehan", "//third_party/blink/renderer/core/OWNERS" ],
|
||||
"expiry_milestone": 92
|
||||
},
|
||||
{
|
||||
"name": "fractional-scroll-offsets",
|
||||
"owners": [ "bokan" ],
|
||||
|
@ -1280,16 +1280,6 @@ const char kForceUiDirectionDescription[] =
|
||||
"Explicitly force the UI to left-to-right (LTR) or right-to-left (RTL) "
|
||||
"mode, overriding the default direction of the UI language.";
|
||||
|
||||
const char kFormControlsDarkModeName[] = "Web Platform Controls Dark Mode";
|
||||
const char kFormControlsDarkModeDescription[] =
|
||||
"If enabled, forms controls and scrollbars will be rendered with a dark "
|
||||
"theme, only on web pages that support dark color schemes, and when the "
|
||||
"OS is switched to dark theme.";
|
||||
|
||||
const char kFormControlsRefreshName[] = "Web Platform Controls updated UI";
|
||||
const char kFormControlsRefreshDescription[] =
|
||||
"If enabled, HTML forms elements will be rendered using an updated style.";
|
||||
|
||||
const char kGlobalMediaControlsName[] = "Global Media Controls";
|
||||
const char kGlobalMediaControlsDescription[] =
|
||||
"Enables the Global Media Controls UI in the toolbar.";
|
||||
|
@ -750,12 +750,6 @@ extern const char kForceDirectionRtl[];
|
||||
extern const char kForceUiDirectionName[];
|
||||
extern const char kForceUiDirectionDescription[];
|
||||
|
||||
extern const char kFormControlsDarkModeName[];
|
||||
extern const char kFormControlsDarkModeDescription[];
|
||||
|
||||
extern const char kFormControlsRefreshName[];
|
||||
extern const char kFormControlsRefreshDescription[];
|
||||
|
||||
extern const char kGlobalMediaControlsName[];
|
||||
extern const char kGlobalMediaControlsDescription[];
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/test/scoped_feature_list.h"
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
#include "cc/test/pixel_comparator.h"
|
||||
@ -55,12 +54,6 @@ const cc::FuzzyPixelComparator mac_loose_comparator(
|
||||
|
||||
class FocusRingBrowserTest : public InProcessBrowserTest {
|
||||
public:
|
||||
FocusRingBrowserTest() {
|
||||
feature_list_.InitWithFeatures(
|
||||
{features::kFormControlsRefresh, features::kCSSColorSchemeUARendering},
|
||||
{});
|
||||
}
|
||||
|
||||
void SetUp() override {
|
||||
EnablePixelOutput(/*force_device_scale_factor=*/1.f);
|
||||
InProcessBrowserTest::SetUp();
|
||||
@ -84,9 +77,6 @@ class FocusRingBrowserTest : public InProcessBrowserTest {
|
||||
const cc::PixelComparator& comparator) {
|
||||
base::ScopedAllowBlockingForTesting allow_blocking;
|
||||
|
||||
ASSERT_TRUE(features::IsFormControlsRefreshEnabled());
|
||||
ASSERT_TRUE(features::IsCSSColorSchemeUARenderingEnabled());
|
||||
|
||||
base::FilePath dir_test_data;
|
||||
ASSERT_TRUE(base::PathService::Get(chrome::DIR_TEST_DATA, &dir_test_data));
|
||||
|
||||
@ -119,9 +109,6 @@ class FocusRingBrowserTest : public InProcessBrowserTest {
|
||||
web_contents, golden_filepath,
|
||||
gfx::Size(screenshot_width, screenshot_height), comparator));
|
||||
}
|
||||
|
||||
private:
|
||||
base::test::ScopedFeatureList feature_list_;
|
||||
};
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(FocusRingBrowserTest, Checkbox) {
|
||||
|
@ -208,13 +208,11 @@ void UpdateFromSystemSettings(blink::RendererPreferences* prefs,
|
||||
ConvertExplicitlyAllowedNetworkPortsPref(local_state);
|
||||
}
|
||||
|
||||
if (::features::IsFormControlsRefreshEnabled()) {
|
||||
#if defined(OS_MAC)
|
||||
prefs->focus_ring_color = SkColorSetRGB(0x00, 0x5F, 0xCC);
|
||||
#else
|
||||
prefs->focus_ring_color = SkColorSetRGB(0x10, 0x10, 0x10);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace renderer_preferences_util
|
||||
|
@ -21,7 +21,6 @@ namespace remote_cocoa {
|
||||
class PopupWindowMac {
|
||||
public:
|
||||
PopupWindowMac(const gfx::Rect& content_rect,
|
||||
bool has_shadow,
|
||||
RenderWidgetHostViewCocoa* cocoa_view);
|
||||
~PopupWindowMac();
|
||||
|
||||
|
@ -88,7 +88,6 @@
|
||||
namespace remote_cocoa {
|
||||
|
||||
PopupWindowMac::PopupWindowMac(const gfx::Rect& content_rect,
|
||||
bool has_shadow,
|
||||
RenderWidgetHostViewCocoa* cocoa_view)
|
||||
: cocoa_view_(cocoa_view) {
|
||||
[cocoa_view_ setCloseOnDeactivate:YES];
|
||||
@ -99,7 +98,7 @@ PopupWindowMac::PopupWindowMac(const gfx::Rect& content_rect,
|
||||
styleMask:NSBorderlessWindowMask
|
||||
backing:NSBackingStoreBuffered
|
||||
defer:NO]);
|
||||
[popup_window_ setHasShadow:has_shadow];
|
||||
[popup_window_ setHasShadow:YES];
|
||||
[popup_window_ setLevel:NSPopUpMenuWindowLevel];
|
||||
[popup_window_ setReleasedWhenClosed:NO];
|
||||
[popup_window_ makeKeyAndOrderFront:nil];
|
||||
|
@ -43,7 +43,7 @@ class RenderWidgetHostNSViewBridge : public mojom::RenderWidgetHostNSView,
|
||||
RenderWidgetHostViewCocoa* GetNSView();
|
||||
|
||||
// mojom::RenderWidgetHostNSView implementation.
|
||||
void InitAsPopup(const gfx::Rect& content_rect, bool has_shadow) override;
|
||||
void InitAsPopup(const gfx::Rect& content_rect) override;
|
||||
void SetParentWebContentsNSView(uint64_t parent_ns_view_id) override;
|
||||
void DisableDisplay() override;
|
||||
void MakeFirstResponder() override;
|
||||
|
@ -61,10 +61,8 @@ RenderWidgetHostViewCocoa* RenderWidgetHostNSViewBridge::GetNSView() {
|
||||
return cocoa_view_;
|
||||
}
|
||||
|
||||
void RenderWidgetHostNSViewBridge::InitAsPopup(const gfx::Rect& content_rect,
|
||||
bool has_shadow) {
|
||||
popup_window_ =
|
||||
std::make_unique<PopupWindowMac>(content_rect, has_shadow, cocoa_view_);
|
||||
void RenderWidgetHostNSViewBridge::InitAsPopup(const gfx::Rect& content_rect) {
|
||||
popup_window_ = std::make_unique<PopupWindowMac>(content_rect, cocoa_view_);
|
||||
}
|
||||
|
||||
void RenderWidgetHostNSViewBridge::SetParentWebContentsNSView(
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/test/scoped_feature_list.h"
|
||||
#include "build/build_config.h"
|
||||
#include "build/chromeos_buildflags.h"
|
||||
#include "cc/test/pixel_comparator.h"
|
||||
@ -44,12 +43,6 @@ namespace content {
|
||||
|
||||
class FormControlsBrowserTest : public ContentBrowserTest {
|
||||
public:
|
||||
FormControlsBrowserTest() {
|
||||
feature_list_.InitWithFeatures(
|
||||
{features::kFormControlsRefresh, features::kCSSColorSchemeUARendering},
|
||||
{});
|
||||
}
|
||||
|
||||
void SetUp() override {
|
||||
EnablePixelOutput(/*force_device_scale_factor=*/1.f);
|
||||
ContentBrowserTest::SetUp();
|
||||
@ -72,9 +65,6 @@ class FormControlsBrowserTest : public ContentBrowserTest {
|
||||
int screenshot_height) {
|
||||
base::ScopedAllowBlockingForTesting allow_blocking;
|
||||
|
||||
ASSERT_TRUE(features::IsFormControlsRefreshEnabled());
|
||||
ASSERT_TRUE(features::IsCSSColorSchemeUARenderingEnabled());
|
||||
|
||||
std::string platform_suffix;
|
||||
#if defined(OS_MAC)
|
||||
platform_suffix = "_mac";
|
||||
@ -163,9 +153,6 @@ class FormControlsBrowserTest : public ContentBrowserTest {
|
||||
#endif // defined(OS_WIN)
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
base::test::ScopedFeatureList feature_list_;
|
||||
};
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(FormControlsBrowserTest, Checkbox) {
|
||||
|
@ -384,10 +384,7 @@ void RenderWidgetHostViewMac::InitAsPopup(
|
||||
SetContentBackgroundColor(SK_ColorTRANSPARENT);
|
||||
|
||||
// This path is used by the time/date picker.
|
||||
// When FormControlsRefresh is enabled the popup window should use
|
||||
// the native shadow.
|
||||
bool has_shadow = features::IsFormControlsRefreshEnabled();
|
||||
ns_view_->InitAsPopup(pos, has_shadow);
|
||||
ns_view_->InitAsPopup(pos);
|
||||
}
|
||||
|
||||
RenderWidgetHostViewBase*
|
||||
|
@ -130,14 +130,6 @@ void SetRuntimeFeatureDefaultsForPlatform(
|
||||
WebRuntimeFeatures::EnableMediaControlsExpandGesture(
|
||||
base::FeatureList::IsEnabled(media::kMediaControlsExpandGesture));
|
||||
#endif
|
||||
|
||||
#if defined(OS_ANDROID)
|
||||
WebRuntimeFeatures::EnableCSSColorSchemeUARendering(
|
||||
// Combining form-controls-refresh and form-controls-dark-mode
|
||||
// to be launched together on Android. Only one about flags
|
||||
// for both features.
|
||||
base::FeatureList::IsEnabled(features::kFormControlsRefresh));
|
||||
#endif
|
||||
}
|
||||
|
||||
enum RuntimeFeatureEnableOptions {
|
||||
@ -357,7 +349,6 @@ void SetRuntimeFeaturesFromChromiumFeatures() {
|
||||
{"CompositeAfterPaint", blink::features::kCompositeAfterPaint},
|
||||
{"ComputePressure", blink::features::kComputePressure,
|
||||
kSetOnlyIfOverridden},
|
||||
{"CSSColorSchemeUARendering", features::kCSSColorSchemeUARendering},
|
||||
{"DeclarativeShadowDOM", blink::features::kDeclarativeShadowDOM},
|
||||
{"DocumentTransition", blink::features::kDocumentTransition},
|
||||
{"FeaturePolicyForClientHints",
|
||||
|
@ -23,7 +23,7 @@ import "ui/gfx/range/mojom/range.mojom";
|
||||
interface RenderWidgetHostNSView {
|
||||
// Specify that the NSView will a popup (e.g, date/time picker) that will
|
||||
// create its own NSWindow.
|
||||
InitAsPopup(gfx.mojom.Rect content_rect, bool has_shadow);
|
||||
InitAsPopup(gfx.mojom.Rect content_rect);
|
||||
|
||||
// Set this to be a child NSView of the NSView mapped to by
|
||||
// |parent_ns_view_id|.
|
||||
|
@ -65,16 +65,11 @@ void UpdatePrefsFromSystemSettings(blink::RendererPreferences* prefs) {
|
||||
#endif
|
||||
|
||||
// The values were copied from chrome/browser/renderer_preferences_util.cc.
|
||||
#if defined(USE_AURA)
|
||||
prefs->focus_ring_color = SkColorSetRGB(0x4D, 0x90, 0xFE);
|
||||
#endif
|
||||
if (::features::IsFormControlsRefreshEnabled()) {
|
||||
#if defined(OS_MAC)
|
||||
prefs->focus_ring_color = SkColorSetRGB(0x00, 0x5F, 0xCC);
|
||||
#else
|
||||
prefs->focus_ring_color = SkColorSetRGB(0x10, 0x10, 0x10);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -3613,41 +3613,6 @@
|
||||
]
|
||||
}
|
||||
],
|
||||
"FormControlsDarkMode": [
|
||||
{
|
||||
"platforms": [
|
||||
"chromeos",
|
||||
"chromeos_lacros",
|
||||
"linux",
|
||||
"mac",
|
||||
"windows"
|
||||
],
|
||||
"experiments": [
|
||||
{
|
||||
"name": "Enabled",
|
||||
"enable_features": [
|
||||
"CSSColorSchemeUARendering"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"FormControlsRefreshAndroid": [
|
||||
{
|
||||
"platforms": [
|
||||
"android",
|
||||
"android_webview"
|
||||
],
|
||||
"experiments": [
|
||||
{
|
||||
"name": "Enabled",
|
||||
"enable_features": [
|
||||
"FormControlsRefresh"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"FuzzyAppSearch": [
|
||||
{
|
||||
"platforms": [
|
||||
|
1
third_party/blink/public/blink_resources.grd
vendored
1
third_party/blink/public/blink_resources.grd
vendored
@ -47,7 +47,6 @@
|
||||
<include name="IDR_TIME_PICKER_CSS" file="../renderer/core/html/forms/resources/time_picker.css" type="BINDATA" compress="gzip"/>
|
||||
<include name="IDR_TIME_PICKER_JS" file="../renderer/core/html/forms/resources/time_picker.js" type="BINDATA" compress="gzip"/>
|
||||
<include name="IDR_DATETIMELOCAL_PICKER_JS" file="../renderer/core/html/forms/resources/datetimelocal_picker.js" type="BINDATA" compress="gzip"/>
|
||||
<include name="IDR_PICKER_BUTTON_CSS" file="../renderer/core/html/forms/resources/pickerButton.css" type="BINDATA" compress="gzip"/>
|
||||
<include name="IDR_SUGGESTION_PICKER_CSS" file="../renderer/core/html/forms/resources/suggestionPicker.css" type="BINDATA" compress="gzip"/>
|
||||
<include name="IDR_SUGGESTION_PICKER_JS" file="../renderer/core/html/forms/resources/suggestionPicker.js" type="BINDATA" compress="gzip"/>
|
||||
<include name="IDR_COLOR_PICKER_COMMON_JS" file="../renderer/core/html/forms/resources/color_picker_common.js" type="BINDATA" compress="gzip"/>
|
||||
|
@ -243,7 +243,6 @@ class WebRuntimeFeatures {
|
||||
|
||||
BLINK_PLATFORM_EXPORT static void EnableParseUrlProtocolHandler(bool);
|
||||
|
||||
BLINK_PLATFORM_EXPORT static void EnableCSSColorSchemeUARendering(bool);
|
||||
BLINK_PLATFORM_EXPORT static void EnableDocumentTransition(bool);
|
||||
|
||||
private:
|
||||
|
@ -2426,8 +2426,6 @@ TEST_F(StyleEngineTest, ColorSchemeBaseBackgroundChange) {
|
||||
}
|
||||
|
||||
TEST_F(StyleEngineTest, ColorSchemeOverride) {
|
||||
ScopedCSSColorSchemeUARenderingForTest enable_color_scheme_ua(true);
|
||||
|
||||
ColorSchemeHelper color_scheme_helper(GetDocument());
|
||||
color_scheme_helper.SetPreferredColorScheme(
|
||||
mojom::blink::PreferredColorScheme::kLight);
|
||||
|
@ -3170,8 +3170,7 @@ void WebViewImpl::UpdateRendererPreferences(
|
||||
}
|
||||
#endif
|
||||
|
||||
if (::features::IsFormControlsRefreshEnabled() &&
|
||||
renderer_preferences_.use_custom_colors) {
|
||||
if (renderer_preferences_.use_custom_colors) {
|
||||
SetFocusRingColor(renderer_preferences_.focus_ring_color);
|
||||
}
|
||||
|
||||
|
@ -2799,8 +2799,6 @@ TEST_P(VisualViewportTest, InSubtreeOfPageScale) {
|
||||
}
|
||||
|
||||
TEST_F(VisualViewportSimTest, UsedColorSchemeFromRootElement) {
|
||||
ScopedCSSColorSchemeUARenderingForTest color_scheme_ua_enabled(true);
|
||||
|
||||
ColorSchemeHelper color_scheme_helper(*(WebView().GetPage()));
|
||||
color_scheme_helper.SetPreferredColorScheme(
|
||||
mojom::blink::PreferredColorScheme::kDark);
|
||||
|
@ -29,15 +29,6 @@ Vector<char> ChooserResourceLoader::GetSuggestionPickerJS() {
|
||||
#endif
|
||||
}
|
||||
|
||||
Vector<char> ChooserResourceLoader::GetPickerButtonStyleSheet() {
|
||||
#if !defined(OS_ANDROID)
|
||||
return UncompressResourceAsBinary(IDR_PICKER_BUTTON_CSS);
|
||||
#else
|
||||
NOTREACHED();
|
||||
return Vector<char>();
|
||||
#endif
|
||||
}
|
||||
|
||||
Vector<char> ChooserResourceLoader::GetPickerCommonStyleSheet() {
|
||||
#if !defined(OS_ANDROID)
|
||||
return UncompressResourceAsBinary(IDR_PICKER_COMMON_CSS);
|
||||
|
@ -20,9 +20,6 @@ class ChooserResourceLoader {
|
||||
// Returns the picker common javascript as a string.
|
||||
static Vector<char> GetPickerCommonJS();
|
||||
|
||||
// Returns the picker button stylesheet as a string.
|
||||
static Vector<char> GetPickerButtonStyleSheet();
|
||||
|
||||
// Returns the suggestion picker stylesheet as a string.
|
||||
static Vector<char> GetSuggestionPickerStyleSheet();
|
||||
|
||||
|
@ -44,7 +44,6 @@ namespace blink {
|
||||
|
||||
// Keep in sync with Actions in colorSuggestionPicker.js.
|
||||
enum ColorPickerPopupAction {
|
||||
kColorPickerPopupActionChooseOtherColor = -2,
|
||||
kColorPickerPopupActionCancel = -1,
|
||||
kColorPickerPopupActionSetValue = 0
|
||||
};
|
||||
@ -70,11 +69,7 @@ void ColorChooserPopupUIController::Trace(Visitor* visitor) const {
|
||||
}
|
||||
|
||||
void ColorChooserPopupUIController::OpenUI() {
|
||||
if (client_->ShouldShowSuggestions() ||
|
||||
features::IsFormControlsRefreshEnabled())
|
||||
OpenPopup();
|
||||
else
|
||||
OpenColorChooser();
|
||||
}
|
||||
|
||||
void ColorChooserPopupUIController::EndChooser() {
|
||||
@ -96,8 +91,6 @@ void ColorChooserPopupUIController::WriteDocument(SharedBuffer* data) {
|
||||
|
||||
void ColorChooserPopupUIController::WriteColorPickerDocument(
|
||||
SharedBuffer* data) {
|
||||
DCHECK(features::IsFormControlsRefreshEnabled());
|
||||
|
||||
IntRect anchor_rect_in_screen = chrome_client_->ViewportToScreen(
|
||||
client_->ElementRectRelativeToViewport(), frame_->View());
|
||||
|
||||
@ -119,8 +112,7 @@ void ColorChooserPopupUIController::WriteColorPickerDocument(
|
||||
AddProperty("shouldShowColorSuggestionPicker", false, data);
|
||||
AddProperty("isEyeDropperEnabled", features::IsEyeDropperEnabled(), data);
|
||||
#if defined(OS_MAC)
|
||||
AddProperty("isBorderTransparent", features::IsFormControlsRefreshEnabled(),
|
||||
data);
|
||||
AddProperty("isBorderTransparent", true, data);
|
||||
#endif
|
||||
// We don't create PagePopups on Android, so these strings are excluded
|
||||
// from blink_strings.grd on Android to save binary size. We have to
|
||||
@ -169,7 +161,6 @@ void ColorChooserPopupUIController::WriteColorSuggestionPickerDocument(
|
||||
data);
|
||||
data->Append(ChooserResourceLoader::GetPickerCommonStyleSheet());
|
||||
data->Append(ChooserResourceLoader::GetColorSuggestionPickerStyleSheet());
|
||||
if (features::IsFormControlsRefreshEnabled())
|
||||
data->Append(ChooserResourceLoader::GetColorPickerStyleSheet());
|
||||
PagePopupClient::AddString(
|
||||
"</style></head><body>\n"
|
||||
@ -179,24 +170,18 @@ void ColorChooserPopupUIController::WriteColorSuggestionPickerDocument(
|
||||
PagePopupClient::AddProperty("values", suggestion_values, data);
|
||||
PagePopupClient::AddLocalizedProperty("otherColorLabel",
|
||||
IDS_FORM_OTHER_COLOR_LABEL, data);
|
||||
if (features::IsFormControlsRefreshEnabled()) {
|
||||
PagePopupClient::AddProperty("selectedColor",
|
||||
client_->CurrentColor().Serialized(), data);
|
||||
}
|
||||
AddProperty("anchorRectInScreen", anchor_rect_in_screen, data);
|
||||
AddProperty("zoomFactor", ScaledZoomFactor(), data);
|
||||
AddProperty("shouldShowColorSuggestionPicker", true, data);
|
||||
AddProperty("isFormControlsRefreshEnabled",
|
||||
features::IsFormControlsRefreshEnabled(), data);
|
||||
AddProperty("isEyeDropperEnabled", features::IsEyeDropperEnabled(), data);
|
||||
#if defined(OS_MAC)
|
||||
AddProperty("isBorderTransparent", features::IsFormControlsRefreshEnabled(),
|
||||
data);
|
||||
AddProperty("isBorderTransparent", true, data);
|
||||
#endif
|
||||
PagePopupClient::AddString("};\n", data);
|
||||
data->Append(ChooserResourceLoader::GetPickerCommonJS());
|
||||
data->Append(ChooserResourceLoader::GetColorSuggestionPickerJS());
|
||||
if (features::IsFormControlsRefreshEnabled())
|
||||
data->Append(ChooserResourceLoader::GetColorPickerJS());
|
||||
data->Append(ChooserResourceLoader::GetColorPickerCommonJS());
|
||||
PagePopupClient::AddString("</script></body>\n", data);
|
||||
@ -213,10 +198,6 @@ void ColorChooserPopupUIController::SetValueAndClosePopup(
|
||||
DCHECK(client_);
|
||||
if (num_value == kColorPickerPopupActionSetValue)
|
||||
SetValue(string_value);
|
||||
if (num_value == kColorPickerPopupActionChooseOtherColor) {
|
||||
DCHECK(!features::IsFormControlsRefreshEnabled());
|
||||
OpenColorChooser();
|
||||
}
|
||||
CancelPopup();
|
||||
}
|
||||
|
||||
|
@ -160,8 +160,7 @@ void ColorInputType::HandleDOMActivateEvent(Event& event) {
|
||||
: WebFeature::kColorInputTypeChooserByUntrustedClick);
|
||||
chooser_ = chrome_client->OpenColorChooser(document.GetFrame(), this,
|
||||
ValueAsColor());
|
||||
if (::features::IsFormControlsRefreshEnabled() &&
|
||||
GetElement().GetLayoutObject()) {
|
||||
if (GetElement().GetLayoutObject()) {
|
||||
// Invalidate paint to ensure that the focus ring is removed.
|
||||
GetElement().GetLayoutObject()->SetShouldDoFullPaintInvalidation();
|
||||
}
|
||||
@ -213,8 +212,7 @@ void ColorInputType::DidChooseColor(const Color& color) {
|
||||
void ColorInputType::DidEndChooser() {
|
||||
GetElement().EnqueueChangeEvent();
|
||||
chooser_.Clear();
|
||||
if (::features::IsFormControlsRefreshEnabled() &&
|
||||
GetElement().GetLayoutObject()) {
|
||||
if (GetElement().GetLayoutObject()) {
|
||||
// Invalidate paint to ensure that the focus ring is shown.
|
||||
GetElement().GetLayoutObject()->SetShouldDoFullPaintInvalidation();
|
||||
}
|
||||
|
@ -129,17 +129,13 @@ void DateTimeChooserImpl::WriteDocument(SharedBuffer* data) {
|
||||
data);
|
||||
|
||||
data->Append(ChooserResourceLoader::GetPickerCommonStyleSheet());
|
||||
if (!features::IsFormControlsRefreshEnabled())
|
||||
data->Append(ChooserResourceLoader::GetPickerButtonStyleSheet());
|
||||
data->Append(ChooserResourceLoader::GetSuggestionPickerStyleSheet());
|
||||
data->Append(ChooserResourceLoader::GetCalendarPickerStyleSheet());
|
||||
if (features::IsFormControlsRefreshEnabled()) {
|
||||
data->Append(ChooserResourceLoader::GetCalendarPickerRefreshStyleSheet());
|
||||
if (parameters_->type == input_type_names::kTime ||
|
||||
parameters_->type == input_type_names::kDatetimeLocal) {
|
||||
data->Append(ChooserResourceLoader::GetTimePickerStyleSheet());
|
||||
}
|
||||
}
|
||||
AddString(
|
||||
"</style></head><body><div id=main>Loading...</div><script>\n"
|
||||
"window.dialogArguments = {\n",
|
||||
@ -182,11 +178,8 @@ void DateTimeChooserImpl::WriteDocument(SharedBuffer* data) {
|
||||
AddProperty("ampmLabels", locale_->TimeAMPMLabels(), data);
|
||||
AddProperty("isLocaleRTL", locale_->IsRTL(), data);
|
||||
AddProperty("isRTL", parameters_->is_anchor_element_rtl, data);
|
||||
AddProperty("isFormControlsRefreshEnabled",
|
||||
features::IsFormControlsRefreshEnabled(), data);
|
||||
#if defined(OS_MAC)
|
||||
AddProperty("isBorderTransparent", features::IsFormControlsRefreshEnabled(),
|
||||
data);
|
||||
AddProperty("isBorderTransparent", true, data);
|
||||
#endif
|
||||
AddProperty("mode", parameters_->type.GetString(), data);
|
||||
AddProperty("isAMPMFirst", parameters_->is_ampm_first, data);
|
||||
@ -236,7 +229,6 @@ void DateTimeChooserImpl::WriteDocument(SharedBuffer* data) {
|
||||
|
||||
data->Append(ChooserResourceLoader::GetPickerCommonJS());
|
||||
data->Append(ChooserResourceLoader::GetSuggestionPickerJS());
|
||||
if (features::IsFormControlsRefreshEnabled()) {
|
||||
data->Append(ChooserResourceLoader::GetMonthPickerJS());
|
||||
if (parameters_->type == input_type_names::kTime) {
|
||||
data->Append(ChooserResourceLoader::GetTimePickerJS());
|
||||
@ -244,7 +236,6 @@ void DateTimeChooserImpl::WriteDocument(SharedBuffer* data) {
|
||||
data->Append(ChooserResourceLoader::GetTimePickerJS());
|
||||
data->Append(ChooserResourceLoader::GetDateTimeLocalPickerJS());
|
||||
}
|
||||
}
|
||||
data->Append(ChooserResourceLoader::GetCalendarPickerJS());
|
||||
AddString("</script></body>\n", data);
|
||||
}
|
||||
|
@ -305,10 +305,8 @@ bool HTMLInputElement::MayTriggerVirtualKeyboard() const {
|
||||
}
|
||||
|
||||
bool HTMLInputElement::ShouldHaveFocusAppearance() const {
|
||||
// For FormControlsRefresh don't draw focus ring for an input that has its
|
||||
// popup open.
|
||||
if (::features::IsFormControlsRefreshEnabled() &&
|
||||
input_type_view_->HasOpenedPopup())
|
||||
// Don't draw focus ring for an input that has its popup open.
|
||||
if (input_type_view_->HasOpenedPopup())
|
||||
return false;
|
||||
|
||||
return TextControlElement::ShouldHaveFocusAppearance();
|
||||
|
@ -363,9 +363,8 @@ bool HTMLSelectElement::MayTriggerVirtualKeyboard() const {
|
||||
}
|
||||
|
||||
bool HTMLSelectElement::ShouldHaveFocusAppearance() const {
|
||||
// For FormControlsRefresh don't draw focus ring for a select that has its
|
||||
// popup open.
|
||||
if (::features::IsFormControlsRefreshEnabled() && PopupIsVisible())
|
||||
// Don't draw focus ring for a select that has its popup open.
|
||||
if (PopupIsVisible())
|
||||
return false;
|
||||
|
||||
return HTMLFormControlElementWithState::ShouldHaveFocusAppearance();
|
||||
|
@ -357,8 +357,6 @@ void InternalPopupMenu::WriteDocument(SharedBuffer* data) {
|
||||
AddProperty("scaleFactor", scale_factor, data);
|
||||
bool is_rtl = !owner_style->IsLeftToRightDirection();
|
||||
AddProperty("isRTL", is_rtl, data);
|
||||
AddProperty("isFormControlsRefreshEnabled",
|
||||
features::IsFormControlsRefreshEnabled(), data);
|
||||
AddProperty("paddingStart",
|
||||
is_rtl ? owner_element.ClientPaddingRight().ToDouble()
|
||||
: owner_element.ClientPaddingLeft().ToDouble(),
|
||||
|
@ -296,8 +296,7 @@ void MultipleFieldsTemporalInputTypeView::PickerIndicatorChooseValue(
|
||||
if (input_type_->FormControlType() == input_type_names::kTime) {
|
||||
if (date.ParseTime(value, 0, end) && end == value.length())
|
||||
edit->SetOnlyTime(date);
|
||||
} else if (features::IsFormControlsRefreshEnabled() &&
|
||||
input_type_->FormControlType() ==
|
||||
} else if (input_type_->FormControlType() ==
|
||||
input_type_names::kDatetimeLocal) {
|
||||
if (date.ParseDateTimeLocal(value, 0, end) && end == value.length())
|
||||
edit->SetDateTimeLocal(date);
|
||||
@ -397,18 +396,6 @@ void MultipleFieldsTemporalInputTypeView::CreateShadowSubtree() {
|
||||
MakeGarbageCollected<DateTimeEditElement, Document&,
|
||||
DateTimeEditElement::EditControlOwner&>(document,
|
||||
*this));
|
||||
if (!features::IsFormControlsRefreshEnabled()) {
|
||||
GetElement().UpdateView();
|
||||
container->AppendChild(
|
||||
MakeGarbageCollected<ClearButtonElement, Document&,
|
||||
ClearButtonElement::ClearButtonOwner&>(document,
|
||||
*this));
|
||||
container->AppendChild(
|
||||
MakeGarbageCollected<SpinButtonElement, Document&,
|
||||
SpinButtonElement::SpinButtonOwner&>(document,
|
||||
*this));
|
||||
}
|
||||
|
||||
if (LayoutTheme::GetTheme().SupportsCalendarPicker(
|
||||
input_type_->FormControlType()))
|
||||
picker_indicator_is_always_visible_ = true;
|
||||
@ -497,8 +484,7 @@ void MultipleFieldsTemporalInputTypeView::HandleKeydownEvent(
|
||||
return;
|
||||
if (picker_indicator_is_visible_ &&
|
||||
((event.key() == "ArrowDown" && event.getModifierState("Alt")) ||
|
||||
(event.key() == "F4") ||
|
||||
(features::IsFormControlsRefreshEnabled() && event.key() == " "))) {
|
||||
event.key() == "F4" || event.key() == " ")) {
|
||||
if (PickerIndicatorElement* element = GetPickerIndicatorElement())
|
||||
element->OpenPopup();
|
||||
event.SetDefaultHandled();
|
||||
|
@ -51,13 +51,6 @@ PickerIndicatorElement::PickerIndicatorElement(
|
||||
picker_indicator_owner_(&picker_indicator_owner) {
|
||||
SetShadowPseudoId(AtomicString("-webkit-calendar-picker-indicator"));
|
||||
setAttribute(html_names::kIdAttr, shadow_element_names::kIdPickerIndicator);
|
||||
if (!features::IsFormControlsRefreshEnabled()) {
|
||||
setAttribute(html_names::kStyleAttr,
|
||||
"display:list-item; list-style:disclosure-open inside; "
|
||||
"block-size:1em;");
|
||||
// Do not expose list-item role.
|
||||
setAttribute(html_names::kAriaHiddenAttr, "true");
|
||||
}
|
||||
}
|
||||
|
||||
PickerIndicatorElement::~PickerIndicatorElement() {
|
||||
@ -109,8 +102,7 @@ void PickerIndicatorElement::DidChooseValue(double value) {
|
||||
void PickerIndicatorElement::DidEndChooser() {
|
||||
chooser_.Clear();
|
||||
picker_indicator_owner_->DidEndChooser();
|
||||
if (::features::IsFormControlsRefreshEnabled() &&
|
||||
OwnerElement().GetLayoutObject()) {
|
||||
if (OwnerElement().GetLayoutObject()) {
|
||||
// Invalidate paint to ensure that the focus ring is shown.
|
||||
OwnerElement().GetLayoutObject()->SetShouldDoFullPaintInvalidation();
|
||||
}
|
||||
@ -128,8 +120,7 @@ void PickerIndicatorElement::OpenPopup() {
|
||||
return;
|
||||
chooser_ = GetDocument().GetPage()->GetChromeClient().OpenDateTimeChooser(
|
||||
GetDocument().GetFrame(), this, parameters);
|
||||
if (::features::IsFormControlsRefreshEnabled() &&
|
||||
OwnerElement().GetLayoutObject()) {
|
||||
if (OwnerElement().GetLayoutObject()) {
|
||||
// Invalidate paint to ensure that the focus ring is removed.
|
||||
OwnerElement().GetLayoutObject()->SetShouldDoFullPaintInvalidation();
|
||||
}
|
||||
|
@ -193,16 +193,6 @@ body {
|
||||
padding-bottom: 2px;
|
||||
}
|
||||
|
||||
.today-button::after {
|
||||
content: "";
|
||||
display: block;
|
||||
border-radius: 3px;
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
background-color: #6e6e6e;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.calendar-navigation-button {
|
||||
-webkit-align-self: center;
|
||||
width: 24px;
|
||||
|
@ -58,7 +58,6 @@ var global = {
|
||||
'Nov', 'Dec'
|
||||
],
|
||||
isLocaleRTL: false,
|
||||
isFormControlsRefreshEnabled: false,
|
||||
isBorderTransparent: false,
|
||||
mode: 'date',
|
||||
isAMPMFirst: false,
|
||||
@ -1011,15 +1010,11 @@ function closePicker() {
|
||||
|
||||
function openSuggestionPicker() {
|
||||
closePicker();
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
document.body.classList.add('controls-refresh');
|
||||
}
|
||||
global.picker = new SuggestionPicker($('main'), global.params);
|
||||
};
|
||||
|
||||
function openCalendarPicker() {
|
||||
closePicker();
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
if (global.params.mode == 'month') {
|
||||
return initializeMonthPicker(global.params);
|
||||
} else if (global.params.mode == 'time') {
|
||||
@ -1027,7 +1022,6 @@ function openCalendarPicker() {
|
||||
} else if (global.params.mode == 'datetime-local') {
|
||||
return initializeDateTimeLocalPicker(global.params);
|
||||
}
|
||||
}
|
||||
|
||||
global.picker = new CalendarPicker(global.params.mode, global.params);
|
||||
global.picker.attachTo($('main'));
|
||||
@ -1816,15 +1810,11 @@ ListCell.prototype.setSelected = function(selected) {
|
||||
this._selected = selected;
|
||||
if (this._selected) {
|
||||
this.element.classList.add('selected');
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
this.element.setAttribute('aria-selected', true);
|
||||
}
|
||||
} else {
|
||||
this.element.classList.remove('selected');
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
this.element.setAttribute('aria-selected', false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@ -2513,22 +2503,15 @@ function YearListCell(shortMonthLabels) {
|
||||
YearListCell.prototype = Object.create(ListCell.prototype);
|
||||
|
||||
YearListCell._Height = hasInaccuratePointingDevice() ? 31 : 25;
|
||||
YearListCell._HeightRefresh = 25;
|
||||
YearListCell._Height = 25;
|
||||
YearListCell.GetHeight = function() {
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
return YearListCell._HeightRefresh;
|
||||
}
|
||||
return YearListCell._Height;
|
||||
};
|
||||
YearListCell.BorderBottomWidth = 1;
|
||||
YearListCell.ButtonRows = 3;
|
||||
YearListCell.ButtonColumns = 4;
|
||||
YearListCell._SelectedHeight = hasInaccuratePointingDevice() ? 127 : 121;
|
||||
YearListCell._SelectedHeightRefresh = 128;
|
||||
YearListCell._SelectedHeight = 128;
|
||||
YearListCell.GetSelectedHeight = function() {
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
return YearListCell._SelectedHeightRefresh;
|
||||
}
|
||||
return YearListCell._SelectedHeight;
|
||||
};
|
||||
YearListCell.ClassNameYearListCell = 'year-list-cell';
|
||||
@ -2591,12 +2574,6 @@ function YearListView(minimumMonth, maximumMonth, config) {
|
||||
ListView.call(this);
|
||||
this.element.classList.add('year-list-view');
|
||||
|
||||
/**
|
||||
* @type {?Month}
|
||||
*/
|
||||
if (!global.params.isFormControlsRefreshEnabled) {
|
||||
this.highlightedMonth = null;
|
||||
}
|
||||
/**
|
||||
* @type {?Month}
|
||||
*/
|
||||
@ -2646,14 +2623,8 @@ function YearListView(minimumMonth, maximumMonth, config) {
|
||||
this.scrubbyScrollBar.attachTo(this);
|
||||
|
||||
this.element.addEventListener('keydown', this.onKeyDown, false);
|
||||
if (!global.params.isFormControlsRefreshEnabled) {
|
||||
this.element.addEventListener('mouseover', this.onMouseOver, false);
|
||||
this.element.addEventListener('mouseout', this.onMouseOut, false);
|
||||
this.element.addEventListener('touchstart', this.onTouchStart, false);
|
||||
}
|
||||
|
||||
if (global.params.isFormControlsRefreshEnabled && config &&
|
||||
config.mode == 'month') {
|
||||
if (config && config.mode == 'month') {
|
||||
this.type = 'month';
|
||||
this._dateTypeConstructor = Month;
|
||||
|
||||
@ -2674,7 +2645,7 @@ function YearListView(minimumMonth, maximumMonth, config) {
|
||||
}
|
||||
|
||||
this._initialSelectedMonth = this._selectedMonth;
|
||||
} else if (global.params.isFormControlsRefreshEnabled) {
|
||||
} else {
|
||||
// This is a month switcher menu embedded in another calendar control.
|
||||
// Set up our config so that getNearestValidRangeLookingForward(Backward)
|
||||
// when called on this YearListView will navigate by month.
|
||||
@ -2690,64 +2661,15 @@ function YearListView(minimumMonth, maximumMonth, config) {
|
||||
YearListView.prototype = Object.create(ListView.prototype);
|
||||
Object.assign(YearListView.prototype, DateRangeManager);
|
||||
|
||||
YearListView._Height = YearListCell._SelectedHeight - 1;
|
||||
YearListView._VisibleYearsRefresh = 4;
|
||||
YearListView._HeightRefresh = YearListCell._SelectedHeightRefresh - 1 +
|
||||
YearListView._VisibleYearsRefresh * YearListCell._HeightRefresh;
|
||||
YearListView._VisibleYears = 4;
|
||||
YearListView._Height = YearListCell._SelectedHeight - 1 +
|
||||
YearListView._VisibleYears * YearListCell._Height;
|
||||
YearListView.GetHeight = function() {
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
return YearListView._HeightRefresh;
|
||||
}
|
||||
return YearListView._Height;
|
||||
};
|
||||
YearListView.EventTypeYearListViewDidHide = 'yearListViewDidHide';
|
||||
YearListView.EventTypeYearListViewDidSelectMonth = 'yearListViewDidSelectMonth';
|
||||
|
||||
/**
|
||||
* @param {?Event} event
|
||||
*/
|
||||
YearListView.prototype.onTouchStart = function(event) {
|
||||
var touch = event.touches[0];
|
||||
var monthButtonElement = enclosingNodeOrSelfWithClass(
|
||||
touch.target, YearListCell.ClassNameMonthButton);
|
||||
if (!monthButtonElement)
|
||||
return;
|
||||
var cellElement = enclosingNodeOrSelfWithClass(
|
||||
monthButtonElement, YearListCell.ClassNameYearListCell);
|
||||
var cell = cellElement.$view;
|
||||
this.highlightMonth(
|
||||
new Month(cell.row + 1, parseInt(monthButtonElement.dataset.month, 10)));
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Event} event
|
||||
*/
|
||||
YearListView.prototype.onMouseOver = function(event) {
|
||||
var monthButtonElement = enclosingNodeOrSelfWithClass(
|
||||
event.target, YearListCell.ClassNameMonthButton);
|
||||
if (!monthButtonElement)
|
||||
return;
|
||||
var cellElement = enclosingNodeOrSelfWithClass(
|
||||
monthButtonElement, YearListCell.ClassNameYearListCell);
|
||||
var cell = cellElement.$view;
|
||||
this.highlightMonth(
|
||||
new Month(cell.row + 1, parseInt(monthButtonElement.dataset.month, 10)));
|
||||
this._ignoreMouseOutUntillNextMouseOver = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Event} event
|
||||
*/
|
||||
YearListView.prototype.onMouseOut = function(event) {
|
||||
if (this._ignoreMouseOutUntillNextMouseOver)
|
||||
return;
|
||||
var monthButtonElement = enclosingNodeOrSelfWithClass(
|
||||
event.target, YearListCell.ClassNameMonthButton);
|
||||
if (!monthButtonElement) {
|
||||
this.dehighlightMonth();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {!number} width Width in pixels.
|
||||
* @override
|
||||
@ -2836,11 +2758,6 @@ YearListView.prototype.onClick = function(event) {
|
||||
if (this.selectedRow !== oldSelectedRow) {
|
||||
// Always start with first month when changing the year.
|
||||
const month = new Month(year, 0);
|
||||
if (!global.params.isFormControlsRefreshEnabled) {
|
||||
this.highlightMonth(month);
|
||||
this.dispatchEvent(
|
||||
YearListView.EventTypeYearListViewDidSelectMonth, this, month);
|
||||
}
|
||||
this.scrollView.scrollTo(this.selectedRow * YearListCell.GetHeight(), true);
|
||||
} else {
|
||||
var monthButton = enclosingNodeOrSelfWithClass(
|
||||
@ -2851,9 +2768,6 @@ YearListView.prototype.onClick = function(event) {
|
||||
this.dispatchEvent(
|
||||
YearListView.EventTypeYearListViewDidSelectMonth, this,
|
||||
new Month(year, month));
|
||||
if (!global.params.isFormControlsRefreshEnabled) {
|
||||
this.hide();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -2924,7 +2838,7 @@ YearListView.prototype.prepareNewCell = function(row) {
|
||||
for (var i = 0; i < cell.monthButtons.length; ++i) {
|
||||
var month = new Month(row + 1, i);
|
||||
cell.monthButtons[i].id = month.toString();
|
||||
if (global.params.isFormControlsRefreshEnabled && this.type === 'month') {
|
||||
if (this.type === 'month') {
|
||||
cell.monthButtons[i].setAttribute(
|
||||
'aria-disabled', this.isValid(month) ? 'false' : 'true');
|
||||
} else {
|
||||
@ -2936,25 +2850,12 @@ YearListView.prototype.prepareNewCell = function(row) {
|
||||
cell.monthButtons[i].setAttribute('aria-label', month.toLocaleString());
|
||||
cell.monthButtons[i].setAttribute('aria-selected', false);
|
||||
}
|
||||
if (!global.params.isFormControlsRefreshEnabled && this.highlightedMonth &&
|
||||
row === this.highlightedMonth.year - 1) {
|
||||
var monthButton = cell.monthButtons[this.highlightedMonth.month];
|
||||
monthButton.classList.add(YearListCell.ClassNameHighlighted);
|
||||
// aria-activedescendant assumes both elements have layoutObjects, and
|
||||
// |monthButton| might have no layoutObject yet.
|
||||
var element = this.element;
|
||||
setTimeout(function() {
|
||||
element.setAttribute('aria-activedescendant', monthButton.id);
|
||||
}, 0);
|
||||
}
|
||||
if (this._selectedMonth && (this._selectedMonth.year - 1) === row) {
|
||||
var monthButton = cell.monthButtons[this._selectedMonth.month];
|
||||
monthButton.classList.add(YearListCell.ClassNameSelected);
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
this.element.setAttribute('aria-activedescendant', monthButton.id);
|
||||
monthButton.setAttribute('aria-selected', true);
|
||||
}
|
||||
}
|
||||
const todayMonth = Month.createFromToday();
|
||||
if ((todayMonth.year - 1) === row) {
|
||||
var monthButton = cell.monthButtons[todayMonth.month];
|
||||
@ -3038,10 +2939,6 @@ YearListView.prototype.select = function(row) {
|
||||
this.selectedRow, YearListView.RowAnimationDirection.Opening);
|
||||
if (selectedCell)
|
||||
selectedCell.setSelected(true);
|
||||
if (!global.params.isFormControlsRefreshEnabled) {
|
||||
var month = this.highlightedMonth ? this.highlightedMonth.month : 0;
|
||||
this.highlightMonth(new Month(this.selectedRow + 1, month));
|
||||
}
|
||||
}
|
||||
this.setNeedsUpdateCells(true);
|
||||
};
|
||||
@ -3149,9 +3046,6 @@ YearListView.prototype.show = function(month) {
|
||||
|
||||
this.scrollToRow(month.year - 1, false);
|
||||
this.selectWithoutAnimating(month.year - 1);
|
||||
if (!global.params.isFormControlsRefreshEnabled) {
|
||||
this.highlightMonth(month);
|
||||
}
|
||||
this.showSelectedMonth();
|
||||
};
|
||||
|
||||
@ -3165,12 +3059,6 @@ YearListView.prototype.hide = function() {
|
||||
YearListView.prototype._moveHighlightTo = function(month) {
|
||||
this.highlightMonth(month);
|
||||
this.select(this.highlightedMonth.year - 1);
|
||||
|
||||
if (!global.params.isFormControlsRefreshEnabled) {
|
||||
this.dispatchEvent(
|
||||
YearListView.EventTypeYearListViewDidSelectMonth, this, month);
|
||||
}
|
||||
|
||||
this.scrollView.scrollTo(this.selectedRow * YearListCell.GetHeight(), true);
|
||||
return true;
|
||||
};
|
||||
@ -3181,17 +3069,7 @@ YearListView.prototype._moveHighlightTo = function(month) {
|
||||
YearListView.prototype.onKeyDown = function(event) {
|
||||
var key = event.key;
|
||||
var eventHandled = false;
|
||||
if (key == 't') {
|
||||
if (!global.params.isFormControlsRefreshEnabled) {
|
||||
eventHandled = this._moveHighlightTo(Month.createFromToday());
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
this.dispatchEvent(
|
||||
YearListView.EventTypeYearListViewDidSelectMonth, this,
|
||||
this.highlightedMonth);
|
||||
}
|
||||
}
|
||||
} else if (
|
||||
global.params.isFormControlsRefreshEnabled && this._selectedMonth) {
|
||||
if (this._selectedMonth) {
|
||||
if (global.params.isLocaleRTL ? key == 'ArrowRight' : key == 'ArrowLeft') {
|
||||
var newSelection = this.getNearestValidRangeLookingBackward(
|
||||
this._selectedMonth.previous());
|
||||
@ -3256,32 +3134,6 @@ YearListView.prototype.onKeyDown = function(event) {
|
||||
eventHandled = true;
|
||||
}
|
||||
}
|
||||
} else if (
|
||||
!global.params.isFormControlsRefreshEnabled && this.highlightedMonth) {
|
||||
if (global.params.isLocaleRTL ? key == 'ArrowRight' : key == 'ArrowLeft')
|
||||
eventHandled = this._moveHighlightTo(this.highlightedMonth.previous());
|
||||
else if (key == 'ArrowUp')
|
||||
eventHandled = this._moveHighlightTo(
|
||||
this.highlightedMonth.previous(YearListCell.ButtonColumns));
|
||||
else if (
|
||||
global.params.isLocaleRTL ? key == 'ArrowLeft' : key == 'ArrowRight')
|
||||
eventHandled = this._moveHighlightTo(this.highlightedMonth.next());
|
||||
else if (key == 'ArrowDown')
|
||||
eventHandled = this._moveHighlightTo(
|
||||
this.highlightedMonth.next(YearListCell.ButtonColumns));
|
||||
else if (key == 'PageUp')
|
||||
eventHandled =
|
||||
this._moveHighlightTo(this.highlightedMonth.previous(MonthsPerYear));
|
||||
else if (key == 'PageDown')
|
||||
eventHandled =
|
||||
this._moveHighlightTo(this.highlightedMonth.next(MonthsPerYear));
|
||||
else if (key == 'Enter') {
|
||||
this.dispatchEvent(
|
||||
YearListView.EventTypeYearListViewDidSelectMonth, this,
|
||||
this.highlightedMonth);
|
||||
this.hide();
|
||||
eventHandled = true;
|
||||
}
|
||||
} else if (key == 'ArrowUp') {
|
||||
this.scrollView.scrollBy(-YearListCell.GetHeight(), true);
|
||||
eventHandled = true;
|
||||
@ -3332,8 +3184,7 @@ MonthPopupView.ClassNameMonthPopupView = 'month-popup-view';
|
||||
|
||||
MonthPopupView.prototype.show = function(initialMonth, calendarTableRect) {
|
||||
this.isVisible = true;
|
||||
if (global.params.isFormControlsRefreshEnabled &&
|
||||
global.params.mode == 'datetime-local') {
|
||||
if (global.params.mode == 'datetime-local') {
|
||||
// Place the month popup under the datetimelocal-picker element so that the
|
||||
// datetimelocal-picker element receives its keyboard and click events.
|
||||
// For other calendar control types, these events are handled via the body element.
|
||||
@ -3618,31 +3469,6 @@ function CalendarHeaderView(calendarPicker) {
|
||||
this._previousMonthButton.element.setAttribute(
|
||||
'aria-label', global.params.axShowPreviousMonth);
|
||||
|
||||
if (!global.params.isFormControlsRefreshEnabled) {
|
||||
/**
|
||||
* @type {!CalendarNavigationButton}
|
||||
* @const
|
||||
*/
|
||||
this._todayButton = new CalendarNavigationButton();
|
||||
this._todayButton.attachTo(this);
|
||||
this._todayButton.on(
|
||||
CalendarNavigationButton.EventTypeButtonClick,
|
||||
this.onNavigationButtonClick);
|
||||
this._todayButton.element.classList.add(
|
||||
CalendarHeaderView.GetClassNameTodayButton());
|
||||
if (this.calendarPicker.type === 'week') {
|
||||
this._todayButton.setDisabled(isWeekOutsideOfRange(
|
||||
Week.createFromToday(), this.calendarPicker.config.minimum,
|
||||
this.calendarPicker.config.maximum));
|
||||
} else {
|
||||
this._todayButton.setDisabled(isDayOutsideOfRange(
|
||||
Day.createFromToday(), this.calendarPicker.config.minimum,
|
||||
this.calendarPicker.config.maximum));
|
||||
}
|
||||
this._todayButton.element.setAttribute(
|
||||
'aria-label', global.params.todayLabel);
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {!CalendarNavigationButton}
|
||||
* @const
|
||||
@ -3675,46 +3501,32 @@ CalendarHeaderView.prototype = Object.create(View.prototype);
|
||||
|
||||
CalendarHeaderView.Height = 24;
|
||||
CalendarHeaderView.BottomMargin = 10;
|
||||
CalendarHeaderView.ClassNameCalendarNavigationButtonIconRefresh =
|
||||
'navigation-button-icon-refresh';
|
||||
CalendarHeaderView._ForwardTriangle =
|
||||
'<svg width=\'4\' height=\'7\'><polygon points=\'0,7 0,0, 4,3.5\' style=\'fill:#6e6e6e;\' /></svg>';
|
||||
CalendarHeaderView._ForwardTriangleRefresh = `<svg class="${
|
||||
CalendarHeaderView.ClassNameCalendarNavigationButtonIcon =
|
||||
'navigation-button-icon';
|
||||
CalendarHeaderView._ForwardTriangle = `<svg class="${
|
||||
CalendarHeaderView
|
||||
.ClassNameCalendarNavigationButtonIconRefresh}" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
.ClassNameCalendarNavigationButtonIcon}" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path class="${
|
||||
CalendarHeaderView
|
||||
.ClassNameCalendarNavigationButtonIconRefresh}" d="M15.3516 8.60156L8 15.9531L0.648438 8.60156L1.35156 7.89844L7.5 14.0469V0H8.5V14.0469L14.6484 7.89844L15.3516 8.60156Z" fill="#101010"/>
|
||||
.ClassNameCalendarNavigationButtonIcon}" d="M15.3516 8.60156L8 15.9531L0.648438 8.60156L1.35156 7.89844L7.5 14.0469V0H8.5V14.0469L14.6484 7.89844L15.3516 8.60156Z" fill="#101010"/>
|
||||
</svg>`;
|
||||
CalendarHeaderView.GetForwardTriangle = function() {
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
return CalendarHeaderView._ForwardTriangleRefresh;
|
||||
}
|
||||
return CalendarHeaderView._ForwardTriangle;
|
||||
};
|
||||
CalendarHeaderView._BackwardTriangle =
|
||||
'<svg width=\'4\' height=\'7\'><polygon points=\'0,3.5 4,7 4,0\' style=\'fill:#6e6e6e;\' /></svg>';
|
||||
CalendarHeaderView._BackwardTriangleRefresh = `<svg class="${
|
||||
CalendarHeaderView._BackwardTriangle = `<svg class="${
|
||||
CalendarHeaderView
|
||||
.ClassNameCalendarNavigationButtonIconRefresh}" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
.ClassNameCalendarNavigationButtonIcon}" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path class="${
|
||||
CalendarHeaderView
|
||||
.ClassNameCalendarNavigationButtonIconRefresh}" d="M14.6484 8.10156L8.5 1.95312V16H7.5V1.95312L1.35156 8.10156L0.648438 7.39844L8 0.046875L15.3516 7.39844L14.6484 8.10156Z" fill="#101010"/>
|
||||
.ClassNameCalendarNavigationButtonIcon}" d="M14.6484 8.10156L8.5 1.95312V16H7.5V1.95312L1.35156 8.10156L0.648438 7.39844L8 0.046875L15.3516 7.39844L14.6484 8.10156Z" fill="#101010"/>
|
||||
</svg>`;
|
||||
CalendarHeaderView.GetBackwardTriangle = function() {
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
return CalendarHeaderView._BackwardTriangleRefresh;
|
||||
}
|
||||
return CalendarHeaderView._BackwardTriangle;
|
||||
};
|
||||
CalendarHeaderView.ClassNameCalendarHeaderView = 'calendar-header-view';
|
||||
CalendarHeaderView.ClassNameCalendarTitle = 'calendar-title';
|
||||
CalendarHeaderView.ClassNameTodayButton = 'today-button';
|
||||
CalendarHeaderView.ClassNameTodayButtonRefresh = 'today-button-refresh';
|
||||
CalendarHeaderView.GetClassNameTodayButton = function() {
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
return CalendarHeaderView.ClassNameTodayButtonRefresh;
|
||||
}
|
||||
return CalendarHeaderView.ClassNameTodayButton;
|
||||
};
|
||||
|
||||
@ -3748,13 +3560,10 @@ CalendarHeaderView.prototype.onNavigationButtonClick = function(sender) {
|
||||
*/
|
||||
CalendarHeaderView.prototype.setDisabled = function(disabled) {
|
||||
this.disabled = disabled;
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
this._previousMonthButton.element.style.visibility =
|
||||
this.disabled ? 'hidden' : 'visible';
|
||||
this._nextMonthButton.element.style.visibility =
|
||||
this.disabled ? 'hidden' : 'visible';
|
||||
}
|
||||
|
||||
this.monthPopupButton.element.disabled = this.disabled;
|
||||
this._previousMonthButton.setDisabled(
|
||||
this.disabled ||
|
||||
@ -3797,20 +3606,12 @@ function DayCell() {
|
||||
|
||||
DayCell.prototype = Object.create(ListCell.prototype);
|
||||
|
||||
DayCell._Width = 34;
|
||||
DayCell._WidthRefresh = 28;
|
||||
DayCell._Width = 28;
|
||||
DayCell.GetWidth = function() {
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
return DayCell._WidthRefresh;
|
||||
}
|
||||
return DayCell._Width;
|
||||
};
|
||||
DayCell._Height = hasInaccuratePointingDevice() ? 34 : 20;
|
||||
DayCell._HeightRefresh = 28;
|
||||
DayCell._Height = 28;
|
||||
DayCell.GetHeight = function() {
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
return DayCell._HeightRefresh;
|
||||
}
|
||||
return DayCell._Height;
|
||||
};
|
||||
DayCell.PaddingSize = 1;
|
||||
@ -3918,11 +3719,7 @@ WeekNumberCell.prototype = Object.create(ListCell.prototype);
|
||||
|
||||
WeekNumberCell.Width = 48;
|
||||
WeekNumberCell._Height = DayCell._Height;
|
||||
WeekNumberCell._HeightRefresh = DayCell._HeightRefresh;
|
||||
WeekNumberCell.GetHeight = function() {
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
return WeekNumberCell._HeightRefresh;
|
||||
}
|
||||
return WeekNumberCell._Height;
|
||||
};
|
||||
WeekNumberCell.SeparatorWidth = 1;
|
||||
@ -4018,12 +3815,8 @@ function CalendarTableHeaderView(hasWeekNumberColumn) {
|
||||
|
||||
CalendarTableHeaderView.prototype = Object.create(View.prototype);
|
||||
|
||||
CalendarTableHeaderView._Height = 25;
|
||||
CalendarTableHeaderView._HeightRefresh = 29;
|
||||
CalendarTableHeaderView._Height = 29;
|
||||
CalendarTableHeaderView.GetHeight = function() {
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
return CalendarTableHeaderView._HeightRefresh;
|
||||
}
|
||||
return CalendarTableHeaderView._Height;
|
||||
};
|
||||
|
||||
@ -4056,11 +3849,7 @@ function CalendarRowCell() {
|
||||
CalendarRowCell.prototype = Object.create(ListCell.prototype);
|
||||
|
||||
CalendarRowCell._Height = DayCell._Height;
|
||||
CalendarRowCell._HeightRefresh = DayCell._HeightRefresh;
|
||||
CalendarRowCell.GetHeight = function() {
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
return CalendarRowCell._HeightRefresh;
|
||||
}
|
||||
return CalendarRowCell._Height;
|
||||
};
|
||||
CalendarRowCell.ClassNameCalendarRowCell = 'calendar-row-cell';
|
||||
@ -4138,7 +3927,6 @@ function CalendarTableView(calendarPicker) {
|
||||
var headerView = new CalendarTableHeaderView(this.hasWeekNumberColumn);
|
||||
headerView.attachTo(this, this.scrollView);
|
||||
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
/**
|
||||
* @type {!CalendarNavigationButton}
|
||||
* @const
|
||||
@ -4160,8 +3948,6 @@ function CalendarTableView(calendarPicker) {
|
||||
this.calendarPicker.config.maximum));
|
||||
}
|
||||
todayButton.element.setAttribute('aria-label', global.params.todayLabel);
|
||||
}
|
||||
|
||||
|
||||
if (this.hasWeekNumberColumn) {
|
||||
this.setWidth(DayCell.GetWidth() * DaysPerWeek + WeekNumberCell.Width);
|
||||
@ -4181,10 +3967,6 @@ function CalendarTableView(calendarPicker) {
|
||||
this._ignoreMouseOutUntillNextMouseOver = false;
|
||||
|
||||
this.element.addEventListener('click', this.onClick, false);
|
||||
if (!global.params.isFormControlsRefreshEnabled) {
|
||||
this.element.addEventListener('mouseover', this.onMouseOver, false);
|
||||
this.element.addEventListener('mouseout', this.onMouseOut, false);
|
||||
}
|
||||
|
||||
// You shouldn't be able to use the mouse wheel to scroll.
|
||||
this.scrollView.element.removeEventListener(
|
||||
@ -4196,20 +3978,12 @@ function CalendarTableView(calendarPicker) {
|
||||
|
||||
CalendarTableView.prototype = Object.create(ListView.prototype);
|
||||
|
||||
CalendarTableView._BorderWidth = 1;
|
||||
CalendarTableView._BorderWidthRefresh = 0;
|
||||
CalendarTableView._BorderWidth = 0;
|
||||
CalendarTableView.GetBorderWidth = function() {
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
return CalendarTableView._BorderWidthRefresh;
|
||||
}
|
||||
return CalendarTableView._BorderWidth;
|
||||
};
|
||||
CalendarTableView._TodayButtonHeight = 0;
|
||||
CalendarTableView._TodayButtonHeightRefresh = 28;
|
||||
CalendarTableView._TodayButtonHeight = 28;
|
||||
CalendarTableView.GetTodayButtonHeight = function() {
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
return CalendarTableView._TodayButtonHeightRefresh;
|
||||
}
|
||||
return CalendarTableView._TodayButtonHeight;
|
||||
};
|
||||
CalendarTableView.ClassNameCalendarTableView = 'calendar-table-view';
|
||||
@ -4256,43 +4030,6 @@ CalendarTableView.prototype.onTodayButtonClick = function(sender) {
|
||||
this.calendarPicker.selectRangeContainingDay(Day.createFromToday());
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Event} event
|
||||
*/
|
||||
CalendarTableView.prototype.onMouseOver = function(event) {
|
||||
if (this.hasWeekNumberColumn) {
|
||||
var weekNumberCellElement = enclosingNodeOrSelfWithClass(
|
||||
event.target, WeekNumberCell.ClassNameWeekNumberCell);
|
||||
if (weekNumberCellElement) {
|
||||
var weekNumberCell = weekNumberCellElement.$view;
|
||||
this.calendarPicker.highlightRangeContainingDay(
|
||||
weekNumberCell.week.firstDay());
|
||||
this._ignoreMouseOutUntillNextMouseOver = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
var dayCellElement =
|
||||
enclosingNodeOrSelfWithClass(event.target, DayCell.ClassNameDayCell);
|
||||
if (!dayCellElement)
|
||||
return;
|
||||
var dayCell = dayCellElement.$view;
|
||||
this.calendarPicker.highlightRangeContainingDay(dayCell.day);
|
||||
this._ignoreMouseOutUntillNextMouseOver = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Event} event
|
||||
*/
|
||||
CalendarTableView.prototype.onMouseOut = function(event) {
|
||||
if (this._ignoreMouseOutUntillNextMouseOver)
|
||||
return;
|
||||
var dayCellElement =
|
||||
enclosingNodeOrSelfWithClass(event.target, DayCell.ClassNameDayCell);
|
||||
if (!dayCellElement) {
|
||||
this.calendarPicker.highlightRangeContainingDay(null);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {!number} row
|
||||
* @return {!CalendarRowCell}
|
||||
@ -4320,9 +4057,7 @@ CalendarTableView.prototype.setHeight = function(height) {
|
||||
height - CalendarTableHeaderView.GetHeight() -
|
||||
CalendarTableView.GetBorderWidth() * 2 -
|
||||
CalendarTableView.GetTodayButtonHeight());
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
this.element.style.height = height + 'px';
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@ -4398,22 +4133,9 @@ CalendarTableView.prototype.updateCells = function() {
|
||||
dayCell.setIsToday(Day.createFromToday().equals(day));
|
||||
var isSelected = (day >= firstDayInSelection && day <= lastDayInSelection);
|
||||
dayCell.setSelected(isSelected);
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
if (isSelected && firstDayInSelection == lastDayInSelection) {
|
||||
activeCell = dayCell;
|
||||
}
|
||||
} else {
|
||||
var isHighlighted =
|
||||
day >= firstDayInHighlight && day <= lastDayInHighlight;
|
||||
dayCell.setHighlighted(isHighlighted);
|
||||
if (isHighlighted) {
|
||||
if (firstDayInHighlight == lastDayInHighlight)
|
||||
activeCell = dayCell;
|
||||
else if (
|
||||
this.calendarPicker.type == 'month' && day == firstDayInHighlight)
|
||||
activeCell = dayCell;
|
||||
}
|
||||
}
|
||||
dayCell.setIsInCurrentMonth(
|
||||
day >= firstDayInCurrentMonth && day <= lastDayInCurrentMonth);
|
||||
dayCell.setDisabled(!this.calendarPicker.isValidDay(day));
|
||||
@ -4424,16 +4146,9 @@ CalendarTableView.prototype.updateCells = function() {
|
||||
var week = weekNumberCell.week;
|
||||
var isSelected = (selection && selection.equals(week));
|
||||
weekNumberCell.setSelected(isSelected);
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
if (isSelected) {
|
||||
activeCell = weekNumberCell;
|
||||
}
|
||||
} else {
|
||||
var isWeekHighlighted = highlight && highlight.equals(week);
|
||||
weekNumberCell.setHighlighted(isWeekHighlighted);
|
||||
if (isWeekHighlighted)
|
||||
activeCell = weekNumberCell;
|
||||
}
|
||||
weekNumberCell.setDisabled(!this.calendarPicker.isValid(week));
|
||||
}
|
||||
}
|
||||
@ -4512,7 +4227,7 @@ function CalendarPicker(type, config) {
|
||||
|
||||
this._setValidDateConfig(config);
|
||||
|
||||
if (global.params.isFormControlsRefreshEnabled && this.type === 'week') {
|
||||
if (this.type === 'week') {
|
||||
this.element.classList.add(CalendarPicker.ClassNameWeekPicker);
|
||||
}
|
||||
|
||||
@ -4565,20 +4280,8 @@ function CalendarPicker(type, config) {
|
||||
*/
|
||||
this._selection = null;
|
||||
|
||||
/**
|
||||
* @type {?DateType}
|
||||
* @protected
|
||||
*/
|
||||
if (!global.params.isFormControlsRefreshEnabled) {
|
||||
this._highlight = null;
|
||||
}
|
||||
|
||||
this.calendarTableView.element.addEventListener(
|
||||
'keydown',
|
||||
global.params.isFormControlsRefreshEnabled ?
|
||||
this.onCalendarTableKeyDownRefresh :
|
||||
this.onCalendarTableKeyDown,
|
||||
false);
|
||||
'keydown', this.onCalendarTableKeyDown, false);
|
||||
|
||||
document.body.addEventListener('click', this.onBodyClick, false);
|
||||
document.body.addEventListener('keydown', this.onBodyKeyDown, false);
|
||||
@ -4600,25 +4303,19 @@ function CalendarPicker(type, config) {
|
||||
Month.createFromDay(initialSelection.middleDay()),
|
||||
CalendarPicker.NavigationBehavior.None);
|
||||
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
this._hadValidValueWhenOpened = this.isValid(initialSelection);
|
||||
this.setSelection(this.getNearestValidRange(
|
||||
initialSelection, /*lookForwardFirst*/ true));
|
||||
} else {
|
||||
this.setSelection(initialSelection);
|
||||
}
|
||||
this.setSelection(
|
||||
this.getNearestValidRange(initialSelection, /*lookForwardFirst*/ true));
|
||||
} else {
|
||||
this.setCurrentMonth(
|
||||
Month.createFromToday(), CalendarPicker.NavigationBehavior.None);
|
||||
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
// Ensure that the next date closest to today is selected to start with so that
|
||||
// the user can simply submit the popup to choose it.
|
||||
this.setSelection(this.getValidRangeNearestToDay(
|
||||
this._dateTypeConstructor.createFromToday(),
|
||||
/*lookForwardFirst*/ true));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {?DateType}
|
||||
@ -4637,7 +4334,7 @@ CalendarPicker.ClassNameWeekPicker = 'week-picker';
|
||||
CalendarPicker.ClassNamePreparing = 'preparing';
|
||||
CalendarPicker.EventTypeCurrentMonthChanged = 'currentMonthChanged';
|
||||
CalendarPicker.commitDelayMs = 100;
|
||||
CalendarPicker.VisibleRowsRefresh = 6;
|
||||
CalendarPicker.VisibleRows = 6;
|
||||
|
||||
/**
|
||||
* @param {!Event} event
|
||||
@ -4657,12 +4354,8 @@ CalendarPicker.prototype.resetToInitialValue = function() {
|
||||
CalendarPicker.prototype.onYearListViewDidHide = function(sender) {
|
||||
this.monthPopupView.hide();
|
||||
this.calendarHeaderView.setDisabled(false);
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
this.calendarTableView.element.style.visibility = 'visible';
|
||||
this.calendarTableView.element.focus();
|
||||
} else {
|
||||
this.adjustHeight();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@ -4673,10 +4366,8 @@ CalendarPicker.prototype.onYearListViewDidSelectMonth = function(
|
||||
sender, month) {
|
||||
this.setCurrentMonth(month, CalendarPicker.NavigationBehavior.None);
|
||||
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
this.ensureSelectionIsWithinCurrentMonth();
|
||||
this.onYearListViewDidHide();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@ -4708,11 +4399,7 @@ CalendarPicker.prototype.onMonthPopupButtonClick = function(sender) {
|
||||
clientRect.height);
|
||||
this.monthPopupView.show(this.currentMonth(), calendarTableRect);
|
||||
this.calendarHeaderView.setDisabled(true);
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
this.calendarTableView.element.style.visibility = 'hidden';
|
||||
} else {
|
||||
this.adjustHeight();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@ -4758,19 +4445,14 @@ CalendarPicker.prototype.adjustHeight = function() {
|
||||
var rowForLastDayInMonth =
|
||||
this.calendarTableView.columnAndRowForDay(this._currentMonth.lastDay())
|
||||
.row;
|
||||
var numberOfRows = global.params.isFormControlsRefreshEnabled ?
|
||||
CalendarPicker.VisibleRowsRefresh :
|
||||
rowForLastDayInMonth - rowForFirstDayInMonth + 1;
|
||||
var numberOfRows = CalendarPicker.VisibleRows;
|
||||
var calendarTableViewHeight = CalendarTableHeaderView.GetHeight() +
|
||||
numberOfRows * DayCell.GetHeight() +
|
||||
CalendarTableView.GetBorderWidth() * 2 +
|
||||
CalendarTableView.GetTodayButtonHeight();
|
||||
var height = (this.monthPopupView.isVisible &&
|
||||
!global.params.isFormControlsRefreshEnabled ?
|
||||
YearListView.GetHeight() :
|
||||
calendarTableViewHeight) +
|
||||
CalendarHeaderView.Height + CalendarHeaderView.BottomMargin +
|
||||
CalendarPicker.Padding * 2 + CalendarPicker.BorderWidth * 2;
|
||||
var height = calendarTableViewHeight + CalendarHeaderView.Height +
|
||||
CalendarHeaderView.BottomMargin + CalendarPicker.Padding * 2 +
|
||||
CalendarPicker.BorderWidth * 2;
|
||||
this.setHeight(height);
|
||||
};
|
||||
|
||||
@ -4803,12 +4485,10 @@ CalendarPicker.prototype.lastVisibleDay = function() {
|
||||
var lastVisibleRow =
|
||||
this.calendarTableView.columnAndRowForDay(this.currentMonth().lastDay())
|
||||
.row;
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
lastVisibleRow = this.calendarTableView
|
||||
.columnAndRowForDay(this.currentMonth().firstDay())
|
||||
lastVisibleRow =
|
||||
this.calendarTableView.columnAndRowForDay(this.currentMonth().firstDay())
|
||||
.row +
|
||||
CalendarPicker.VisibleRowsRefresh - 1;
|
||||
}
|
||||
CalendarPicker.VisibleRows - 1;
|
||||
var lastVisibleDay =
|
||||
this.calendarTableView.dayAtColumnAndRow(DaysPerWeek - 1, lastVisibleRow);
|
||||
if (!lastVisibleDay)
|
||||
@ -4843,9 +4523,6 @@ CalendarPicker.prototype.setSelection = function(dayOrWeekOrMonth) {
|
||||
return;
|
||||
if (this._selection && !dayOrWeekOrMonth) {
|
||||
this._selection = null;
|
||||
if (!global.params.isFormControlsRefreshEnabled) {
|
||||
this._setHighlight(null);
|
||||
}
|
||||
return;
|
||||
}
|
||||
var firstDayInSelection = dayOrWeekOrMonth.firstDay();
|
||||
@ -4879,9 +4556,6 @@ CalendarPicker.prototype.setSelection = function(dayOrWeekOrMonth) {
|
||||
candidateCurrentMonth,
|
||||
CalendarPicker.NavigationBehavior.WithAnimation);
|
||||
}
|
||||
if (!global.params.isFormControlsRefreshEnabled) {
|
||||
this._setHighlight(dayOrWeekOrMonth);
|
||||
}
|
||||
if (!this.isValid(dayOrWeekOrMonth))
|
||||
return;
|
||||
this._selection = dayOrWeekOrMonth;
|
||||
@ -4905,8 +4579,7 @@ CalendarPicker.prototype.setSelectionAndCommit = function(dayOrWeekOrMonth) {
|
||||
this.element.offsetLeft;
|
||||
|
||||
// CalendarPicker doesn't handle the submission when used for datetime-local.
|
||||
if (global.params.isFormControlsRefreshEnabled &&
|
||||
this.type == 'datetime-local')
|
||||
if (this.type == 'datetime-local')
|
||||
return;
|
||||
|
||||
var value = this._selection.toString();
|
||||
@ -5039,11 +4712,11 @@ CalendarPicker.prototype._moveHighlight = function(dateRange) {
|
||||
/**
|
||||
* @param {?Event} event
|
||||
*/
|
||||
CalendarPicker.prototype.onCalendarTableKeyDownRefresh = function(event) {
|
||||
CalendarPicker.prototype.onCalendarTableKeyDown = function(event) {
|
||||
var key = event.key;
|
||||
var offset = 0;
|
||||
|
||||
if (!event.target.matches('.today-button-refresh') && this._selection) {
|
||||
if (!event.target.matches('.today-button') && this._selection) {
|
||||
switch (key) {
|
||||
case 'PageUp':
|
||||
var previousMonth = this.currentMonth().previous();
|
||||
@ -5119,62 +4792,6 @@ CalendarPicker.prototype.onCalendarTableKeyDownRefresh = function(event) {
|
||||
// during initialization. In this case there's nothing to do.
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Event} event
|
||||
*/
|
||||
CalendarPicker.prototype.onCalendarTableKeyDown = function(event) {
|
||||
var key = event.key;
|
||||
var eventHandled = false;
|
||||
|
||||
if (key == 't') {
|
||||
this.selectRangeContainingDay(Day.createFromToday());
|
||||
eventHandled = true;
|
||||
} else if (key == 'PageUp') {
|
||||
var previousMonth = this.currentMonth().previous();
|
||||
if (previousMonth && previousMonth >= this.config.minimumValue) {
|
||||
this.setCurrentMonth(
|
||||
previousMonth, CalendarPicker.NavigationBehavior.WithAnimation);
|
||||
eventHandled = true;
|
||||
}
|
||||
} else if (key == 'PageDown') {
|
||||
var nextMonth = this.currentMonth().next();
|
||||
if (nextMonth && nextMonth >= this.config.minimumValue) {
|
||||
this.setCurrentMonth(
|
||||
nextMonth, CalendarPicker.NavigationBehavior.WithAnimation);
|
||||
eventHandled = true;
|
||||
}
|
||||
} else if (this._highlight) {
|
||||
var upOrDownArrowStepSize =
|
||||
this.type === 'date' || this.type === 'datetime-local' ? DaysPerWeek :
|
||||
1;
|
||||
if (global.params.isLocaleRTL ? key == 'ArrowRight' : key == 'ArrowLeft') {
|
||||
eventHandled = this._moveHighlight(this._highlight.previous());
|
||||
} else if (key == 'ArrowUp') {
|
||||
eventHandled =
|
||||
this._moveHighlight(this._highlight.previous(upOrDownArrowStepSize));
|
||||
} else if (
|
||||
global.params.isLocaleRTL ? key == 'ArrowLeft' : key == 'ArrowRight') {
|
||||
eventHandled = this._moveHighlight(this._highlight.next());
|
||||
} else if (key == 'ArrowDown') {
|
||||
eventHandled =
|
||||
this._moveHighlight(this._highlight.next(upOrDownArrowStepSize));
|
||||
} else if (key == 'Enter') {
|
||||
this.setSelectionAndCommit(this._highlight);
|
||||
}
|
||||
} else if (
|
||||
key == 'ArrowLeft' || key == 'ArrowUp' || key == 'ArrowRight' ||
|
||||
key == 'ArrowDown') {
|
||||
// Highlight range near the middle.
|
||||
this.highlightRangeContainingDay(this.currentMonth().middleDay());
|
||||
eventHandled = true;
|
||||
}
|
||||
|
||||
if (eventHandled) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {!number} Width in pixels.
|
||||
*/
|
||||
@ -5210,10 +4827,9 @@ CalendarPicker.prototype.setHeight = function(height) {
|
||||
* @param {?Event} event
|
||||
*/
|
||||
CalendarPicker.prototype.onBodyClick = function(event) {
|
||||
if (global.params.isFormControlsRefreshEnabled &&
|
||||
this.type !== 'datetime-local') {
|
||||
if (this.type !== 'datetime-local') {
|
||||
if (event.target.matches(
|
||||
'.calendar-navigation-button, .navigation-button-icon-refresh, .month-button')) {
|
||||
'.calendar-navigation-button, .navigation-button-icon, .month-button')) {
|
||||
window.pagePopupController.setValue(this.getSelectedValue());
|
||||
}
|
||||
}
|
||||
@ -5225,13 +4841,11 @@ CalendarPicker.prototype.onBodyClick = function(event) {
|
||||
CalendarPicker.prototype.onBodyKeyDown = function(event) {
|
||||
var key = event.key;
|
||||
var eventHandled = false;
|
||||
var offset = 0;
|
||||
switch (key) {
|
||||
case 'Escape':
|
||||
// The datetime-local control handles submission/cancellation at
|
||||
// the top level, so if we're in a datetime-local let event bubble
|
||||
// up instead of handling it here.
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
if (this.type !== 'datetime-local') {
|
||||
if (!this._selection ||
|
||||
(this._selection.equals(this._initialSelection))) {
|
||||
@ -5244,10 +4858,6 @@ CalendarPicker.prototype.onBodyKeyDown = function(event) {
|
||||
'');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
window.pagePopupController.closePopup();
|
||||
eventHandled = true;
|
||||
}
|
||||
break;
|
||||
case 'ArrowUp':
|
||||
case 'ArrowDown':
|
||||
@ -5257,8 +4867,7 @@ CalendarPicker.prototype.onBodyKeyDown = function(event) {
|
||||
case 'PageDown':
|
||||
case 'Home':
|
||||
case 'End':
|
||||
if (global.params.isFormControlsRefreshEnabled &&
|
||||
this.type !== 'datetime-local' &&
|
||||
if (this.type !== 'datetime-local' &&
|
||||
event.target.matches('.calendar-table-view') && this._selection) {
|
||||
window.pagePopupController.setValue(this.getSelectedValue());
|
||||
}
|
||||
@ -5267,8 +4876,7 @@ CalendarPicker.prototype.onBodyKeyDown = function(event) {
|
||||
// Submit the popup for an Enter keypress except when the user is
|
||||
// hitting Enter to activate the month switcher button, Today button,
|
||||
// or previous/next month arrows.
|
||||
if (global.params.isFormControlsRefreshEnabled &&
|
||||
this.type !== 'datetime-local') {
|
||||
if (this.type !== 'datetime-local') {
|
||||
if (!event.target.matches(
|
||||
'.calendar-navigation-button, .month-popup-button, .year-list-view')) {
|
||||
if (this._selection) {
|
||||
@ -5289,38 +4897,6 @@ CalendarPicker.prototype.onBodyKeyDown = function(event) {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'm':
|
||||
case 'M':
|
||||
offset = offset || 1;
|
||||
// Fall-through.
|
||||
case 'y':
|
||||
case 'Y':
|
||||
offset = offset || MonthsPerYear;
|
||||
// Fall-through.
|
||||
case 'd':
|
||||
case 'D':
|
||||
if (!global.params.isFormControlsRefreshEnabled) {
|
||||
offset = offset || MonthsPerYear * 10;
|
||||
var oldFirstVisibleRow =
|
||||
this.calendarTableView
|
||||
.columnAndRowForDay(this.currentMonth().firstDay())
|
||||
.row;
|
||||
this.setCurrentMonth(
|
||||
event.shiftKey ? this.currentMonth().previous(offset) :
|
||||
this.currentMonth().next(offset),
|
||||
CalendarPicker.NavigationBehavior.WithAnimation);
|
||||
var newFirstVisibleRow =
|
||||
this.calendarTableView
|
||||
.columnAndRowForDay(this.currentMonth().firstDay())
|
||||
.row;
|
||||
if (this._highlight) {
|
||||
var highlightMiddleDay = this._highlight.middleDay();
|
||||
this.highlightRangeContainingDay(highlightMiddleDay.next(
|
||||
(newFirstVisibleRow - oldFirstVisibleRow) * DaysPerWeek));
|
||||
}
|
||||
eventHandled = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (eventHandled) {
|
||||
event.stopPropagation();
|
||||
|
@ -165,7 +165,7 @@ body {
|
||||
color: rgba(16, 16, 16, 0.3);
|
||||
}
|
||||
|
||||
.today-button-refresh {
|
||||
.today-button {
|
||||
border: 1px solid transparent;
|
||||
bottom: 12px;
|
||||
color: #0078D4;
|
||||
@ -177,11 +177,11 @@ body {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.today-button-refresh:hover {
|
||||
.today-button:hover {
|
||||
background-color: rgba(0, 117, 255, 0.3);
|
||||
}
|
||||
|
||||
.today-button-refresh:disabled {
|
||||
.today-button:disabled {
|
||||
background-color: #FFFFFF;
|
||||
color: rgba(16, 16, 16, 0.3);
|
||||
}
|
||||
@ -360,18 +360,18 @@ body {
|
||||
color: GrayText;
|
||||
}
|
||||
|
||||
.today-button-refresh {
|
||||
.today-button {
|
||||
background-color: Window;
|
||||
color: LinkText;
|
||||
forced-color-adjust: none;
|
||||
}
|
||||
|
||||
.today-button-refresh:hover {
|
||||
.today-button:hover {
|
||||
background-color: Window;
|
||||
border-color: Highlight;
|
||||
}
|
||||
|
||||
.today-button-refresh:disabled {
|
||||
.today-button:disabled {
|
||||
background-color: Window;
|
||||
border-color: transparent;
|
||||
color: GrayText;
|
||||
@ -471,16 +471,16 @@ body {
|
||||
color: rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
.today-button-refresh {
|
||||
.today-button {
|
||||
color: #99C8FF;
|
||||
}
|
||||
|
||||
.today-button-refresh:hover {
|
||||
.today-button:hover {
|
||||
color: #D1E6FF;
|
||||
background-color: #545454;
|
||||
}
|
||||
|
||||
.today-button-refresh:disabled {
|
||||
.today-button:disabled {
|
||||
color: rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
|
@ -25,10 +25,11 @@
|
||||
|
||||
body {
|
||||
--color-swatch-border-width: 1px;
|
||||
--color-swatch-margin: 1px;
|
||||
--color-swatch-height: 20px;
|
||||
--color-swatch-padding: 0;
|
||||
--color-swatch-width: 20px;
|
||||
--color-swatch-margin: 3px;
|
||||
--color-swatch-height: 18px;
|
||||
--color-swatch-width: 18px;
|
||||
--scrollbar-width: 4px;
|
||||
-webkit-user-select: none;
|
||||
background-color: white;
|
||||
font: -webkit-small-control;
|
||||
@ -36,23 +37,9 @@ body {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
body.controls-refresh {
|
||||
--color-swatch-margin: 3px;
|
||||
--color-swatch-height: 18px;
|
||||
--color-swatch-width: 18px;
|
||||
--scrollbar-width: 4px;
|
||||
}
|
||||
|
||||
.color-suggestion-picker-main {
|
||||
background-color: white;
|
||||
border: solid 1px #8899aa;
|
||||
box-shadow: inset 2px 2px 2px white,
|
||||
inset -2px -2px 1px rgba(0,0,0,0.1);
|
||||
padding: 6px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.controls-refresh .color-suggestion-picker-main {
|
||||
border: 1px solid #bfbfbf;
|
||||
box-shadow: none;
|
||||
padding: 8px 8px 4px 8px;
|
||||
@ -64,19 +51,15 @@ body.controls-refresh {
|
||||
height: var(--color-swatch-height);
|
||||
margin: var(--color-swatch-margin);
|
||||
padding: var(--color-swatch-padding);
|
||||
border: var(--color-swatch-border-width) solid #e0e0e0;
|
||||
border-radius: 0;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
.controls-refresh .color-swatch {
|
||||
border: var(--color-swatch-border-width) solid rgba(0, 0, 0, 0.19);
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.color-swatch:focus {
|
||||
border: var(--color-swatch-border-width) solid #000000;
|
||||
outline: none;
|
||||
outline: solid 2px -webkit-focus-ring-color;
|
||||
outline-offset: -2px;
|
||||
}
|
||||
|
||||
.color-swatch-container {
|
||||
@ -86,17 +69,14 @@ body.controls-refresh {
|
||||
display: flex;
|
||||
flex-flow: row wrap;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.controls-refresh .color-swatch-container {
|
||||
margin: 4px;
|
||||
}
|
||||
|
||||
.controls-refresh .color-swatch-container::-webkit-scrollbar {
|
||||
.color-swatch-container::-webkit-scrollbar {
|
||||
width: var(--scrollbar-width);
|
||||
}
|
||||
|
||||
.controls-refresh .color-swatch-container::-webkit-scrollbar-thumb {
|
||||
.color-swatch-container::-webkit-scrollbar-thumb {
|
||||
background-color: #cecece;
|
||||
border-radius: 2px;
|
||||
height: 47px;
|
||||
@ -104,17 +84,8 @@ body.controls-refresh {
|
||||
width: 4px;
|
||||
}
|
||||
|
||||
.controls-refresh .color-swatch:focus {
|
||||
outline: solid 2px -webkit-focus-ring-color;
|
||||
outline-offset: -2px;
|
||||
}
|
||||
|
||||
.other-color {
|
||||
width: 100%;
|
||||
margin: 4px 0 0 0;
|
||||
}
|
||||
|
||||
.controls-refresh .other-color {
|
||||
background-color: #ffffff;
|
||||
border-color: transparent;
|
||||
border-radius: 2px;
|
||||
@ -125,61 +96,61 @@ body.controls-refresh {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.controls-refresh .other-color:hover {
|
||||
.other-color:hover {
|
||||
background-color: #f3f3f3;
|
||||
}
|
||||
|
||||
@media (forced-colors: active) {
|
||||
.controls-refresh .color-suggestion-picker-main {
|
||||
.color-suggestion-picker-main {
|
||||
border: 1px solid WindowText;
|
||||
}
|
||||
|
||||
.controls-refresh .color-swatch {
|
||||
.color-swatch {
|
||||
forced-color-adjust: none;
|
||||
border-color: WindowText;
|
||||
}
|
||||
|
||||
.controls-refresh .color-swatch:focus {
|
||||
.color-swatch:focus {
|
||||
outline-color: Highlight;
|
||||
}
|
||||
|
||||
.controls-refresh .color-swatch-container {
|
||||
.color-swatch-container {
|
||||
forced-color-adjust: none;
|
||||
}
|
||||
|
||||
.controls-refresh .color-swatch-container::-webkit-scrollbar-thumb {
|
||||
.color-swatch-container::-webkit-scrollbar-thumb {
|
||||
background-color: WindowText;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.controls-refresh .color-suggestion-picker-main {
|
||||
.color-suggestion-picker-main {
|
||||
background: #3B3B3B;
|
||||
color: #FFFFFF;
|
||||
border: 1px solid #858585;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.controls-refresh .color-swatch {
|
||||
.color-swatch {
|
||||
border-color: #858585;
|
||||
}
|
||||
|
||||
.controls-refresh .color-swatch:focus {
|
||||
.color-swatch:focus {
|
||||
outline-color: Highlight;
|
||||
}
|
||||
|
||||
.controls-refresh .other-color,
|
||||
.controls-refresh .other-color:hover {
|
||||
.other-color,
|
||||
.other-color:hover {
|
||||
background: #3B3B3B;
|
||||
color: #FFFFFF;
|
||||
border: 1px solid #858585;
|
||||
}
|
||||
|
||||
.controls-refresh .other-color:hover{
|
||||
.other-color:hover{
|
||||
border: 1px solid #ACACAC;
|
||||
}
|
||||
|
||||
.controls-refresh .color-swatch-container::-webkit-scrollbar-thumb {
|
||||
.color-swatch-container::-webkit-scrollbar-thumb {
|
||||
background-color: WindowText;
|
||||
}
|
||||
}
|
@ -129,15 +129,13 @@ Object.defineProperty(ColorSuggestionPicker, 'SwatchesPerRow', {
|
||||
|
||||
Object.defineProperty(ColorSuggestionPicker, 'SwatchesMaxRow', {
|
||||
get: function() {
|
||||
return global.params.isFormControlsRefreshEnabled ? 3 : 4;
|
||||
return 3;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(ColorSuggestionPicker, 'ScrollbarWidth', {
|
||||
get: function() {
|
||||
return !global.params.isFormControlsRefreshEnabled ?
|
||||
getScrollbarWidth() :
|
||||
Number(window.getComputedStyle(document.body)
|
||||
return Number(window.getComputedStyle(document.body)
|
||||
.getPropertyValue('--scrollbar-width')
|
||||
.replace('px', ''));
|
||||
}
|
||||
@ -178,7 +176,6 @@ ColorSuggestionPicker.prototype._layout = function() {
|
||||
};
|
||||
|
||||
ColorSuggestionPicker.prototype._onOtherButtonClick = function() {
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
var main = $('main');
|
||||
main.innerHTML = '';
|
||||
main.classList.remove('color-suggestion-picker-main');
|
||||
@ -188,9 +185,6 @@ ColorSuggestionPicker.prototype._onOtherButtonClick = function() {
|
||||
var newBody = oldBody.cloneNode(true);
|
||||
oldBody.parentElement.replaceChild(newBody, oldBody);
|
||||
initializeColorPicker();
|
||||
} else {
|
||||
this.chooseOtherColor();
|
||||
}
|
||||
};
|
||||
|
||||
ColorSuggestionPicker.prototype.selectColorAtIndex = function(index) {
|
||||
|
@ -40,9 +40,6 @@ function initialize(args) {
|
||||
main.innerHTML = '';
|
||||
var errorString;
|
||||
if (global.params.shouldShowColorSuggestionPicker) {
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
document.body.classList.add('controls-refresh');
|
||||
}
|
||||
main.classList.add('color-suggestion-picker-main');
|
||||
if (global.params.isBorderTransparent) {
|
||||
main.style.borderColor = 'transparent';
|
||||
|
@ -99,7 +99,7 @@ class DateTimeLocalPicker extends HTMLElement {
|
||||
|
||||
onClick_ = (event) => {
|
||||
if (event.target.matches(
|
||||
'.day-cell, .time-cell, .today-button-refresh, .calendar-navigation-button, .year-list-view, .calendar-navigation-button, .navigation-button-icon-refresh, .month-button') &&
|
||||
'.day-cell, .time-cell, .today-button, .calendar-navigation-button, .year-list-view, .calendar-navigation-button, .navigation-button-icon, .month-button') &&
|
||||
this.hasSelectedDate) {
|
||||
window.pagePopupController.setValue(this.selectedValue);
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
select {
|
||||
display: block;
|
||||
overflow-y: auto;
|
||||
border-radius: 0px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
select hr {
|
||||
@ -16,8 +18,3 @@ option, optgroup {
|
||||
.wrap option {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.controls-refresh select {
|
||||
border-radius: 0px;
|
||||
outline: none;
|
||||
}
|
||||
|
@ -21,9 +21,6 @@ function initialize(args) {
|
||||
global.params = args;
|
||||
var main = $('main');
|
||||
main.innerHTML = '';
|
||||
if (global.params.isFormControlsRefreshEnabled) {
|
||||
document.body.classList.add('controls-refresh');
|
||||
}
|
||||
global.picker = new ListPicker(main, args);
|
||||
}
|
||||
|
||||
|
@ -170,5 +170,5 @@ MonthPicker.YearWidth = 194;
|
||||
MonthPicker.YearHeight = 128;
|
||||
MonthPicker.YearPadding = 12;
|
||||
MonthPicker.Height = 182;
|
||||
MonthPicker.ClassNameTodayButton = 'today-button-refresh';
|
||||
MonthPicker.ClassNameTodayButton = 'today-button';
|
||||
window.customElements.define('month-picker', MonthPicker);
|
||||
|
@ -1,71 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Google Inc. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
*/
|
||||
|
||||
input[type='button'],
|
||||
button {
|
||||
-webkit-appearance: none;
|
||||
-webkit-user-select: none;
|
||||
background-image: linear-gradient(#ededed, #ededed 38%, #dedede);
|
||||
border: 1px solid rgba(0, 0, 0, 0.25);
|
||||
border-radius: 2px;
|
||||
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08),
|
||||
inset 0 1px 2px rgba(255, 255, 255, 0.75);
|
||||
color: #444;
|
||||
font: inherit;
|
||||
text-shadow: 0 1px 0 rgb(240, 240, 240);
|
||||
min-height: 2em;
|
||||
min-width: 4em;
|
||||
padding-inline-end: 10px;
|
||||
padding-inline-start: 10px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
:enabled:hover:-webkit-any(button, input[type='button']) {
|
||||
background-image: linear-gradient(#f0f0f0, #f0f0f0 38%, #e0e0e0);
|
||||
border-color: rgba(0, 0, 0, 0.3);
|
||||
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12), inset 0 1px 2px rgba(255, 255, 255, 0.95);
|
||||
color: black;
|
||||
}
|
||||
|
||||
:enabled:active:-webkit-any(button, input[type='button']) {
|
||||
background-image: linear-gradient(#e7e7e7, #e7e7e7 38%, #d7d7d7);
|
||||
box-shadow: none;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
:disabled:-webkit-any(button, input[type='button']) {
|
||||
background-image: linear-gradient(#f1f1f1, #f1f1f1 38%, #e6e6e6);
|
||||
border-color: rgba(80, 80, 80, 0.2);
|
||||
box-shadow: 0 1px 0 rgba(80, 80, 80, 0.08), inset 0 1px 2px rgba(255, 255, 255, 0.75);
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
:enabled:focus:-webkit-any(button, input[type='button']) {
|
||||
transition: border-color 200ms;
|
||||
/* We use border color because it follows the border radius (unlike outline).
|
||||
* This is particularly noticeable on mac. */
|
||||
border-color: rgb(77, 144, 254);
|
||||
outline: none;
|
||||
}
|
@ -331,7 +331,6 @@ Picker.prototype = Object.create(EventEmitter.prototype);
|
||||
Picker.Actions = {
|
||||
SetValue: 0,
|
||||
Cancel: -1,
|
||||
ChooseOtherColor: -2
|
||||
};
|
||||
|
||||
/**
|
||||
@ -346,11 +345,6 @@ Picker.prototype.handleCancel = function() {
|
||||
window.pagePopupController.closePopup();
|
||||
};
|
||||
|
||||
Picker.prototype.chooseOtherColor = function() {
|
||||
window.pagePopupController.setValueAndClosePopup(
|
||||
Picker.Actions.ChooseOtherColor, '');
|
||||
};
|
||||
|
||||
Picker.prototype.cleanup = function() {};
|
||||
|
||||
window.addEventListener('keyup', function(event) {
|
||||
|
@ -1,23 +1,28 @@
|
||||
.suggestion-list {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font: -webkit-small-control;
|
||||
border: 1px solid #7f9db9;
|
||||
border: 1px solid #bfbfbf;
|
||||
background-color: white;
|
||||
overflow: hidden;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
|
||||
.suggestion-list-entry {
|
||||
white-space: nowrap;
|
||||
height: 1.73em;
|
||||
line-height: 1.73em;
|
||||
-webkit-select: none;
|
||||
cursor: default;
|
||||
border-radius: 2px;
|
||||
font-size: 14px;
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
}
|
||||
|
||||
.suggestion-list-entry:focus {
|
||||
outline: none;
|
||||
background-color: #E5E5E5 !important;
|
||||
outline: solid 2px -webkit-focus-ring-color;
|
||||
outline-offset: -2px;
|
||||
}
|
||||
|
||||
.suggestion-list-entry .content {
|
||||
@ -26,9 +31,9 @@
|
||||
|
||||
.suggestion-list-entry .label {
|
||||
text-align: right;
|
||||
color: #737373;
|
||||
float: right;
|
||||
padding: 0 4px 0 20px;
|
||||
color: rgba(16, 16, 16, 0.6) !important;
|
||||
}
|
||||
|
||||
.rtl .suggestion-list-entry .label {
|
||||
@ -39,6 +44,7 @@
|
||||
.suggestion-list-entry .title {
|
||||
direction: ltr;
|
||||
display: inline-block;
|
||||
color: #101010;
|
||||
}
|
||||
|
||||
.locale-rtl .suggestion-list-entry .title {
|
||||
@ -55,45 +61,19 @@
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.controls-refresh .suggestion-list {
|
||||
border-color: #bfbfbf;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.controls-refresh .suggestion-list-entry {
|
||||
border-radius: 2px;
|
||||
font-size: 14px;
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
}
|
||||
|
||||
.controls-refresh .suggestion-list-entry:focus {
|
||||
background-color: #E5E5E5;
|
||||
outline: solid 2px -webkit-focus-ring-color;
|
||||
outline-offset: -2px;
|
||||
}
|
||||
|
||||
.controls-refresh .suggestion-list-entry .title {
|
||||
color: #101010;
|
||||
}
|
||||
|
||||
.controls-refresh .suggestion-list-entry .label {
|
||||
color: rgba(16, 16, 16, 0.6) !important;
|
||||
}
|
||||
|
||||
@media (forced-colors: active) {
|
||||
.controls-refresh .suggestion-list-entry:focus {
|
||||
.suggestion-list-entry:focus {
|
||||
background-color: Highlight !important;
|
||||
forced-color-adjust: none;
|
||||
}
|
||||
|
||||
.controls-refresh .suggestion-list-entry:focus .label,
|
||||
.controls-refresh .suggestion-list-entry:focus .title {
|
||||
.suggestion-list-entry:focus .label,
|
||||
.suggestion-list-entry:focus .title {
|
||||
color: HighlightText !important;
|
||||
}
|
||||
|
||||
.controls-refresh .suggestion-list-entry .label,
|
||||
.controls-refresh .suggestion-list-entry .title {
|
||||
.suggestion-list-entry .label,
|
||||
.suggestion-list-entry .title {
|
||||
color: WindowText !important;
|
||||
}
|
||||
}
|
||||
|
@ -211,12 +211,6 @@ SuggestionPicker.prototype._layout = function() {
|
||||
this._config.suggestionLabels[i], this._config.suggestionValues[i]));
|
||||
}
|
||||
if (this._config.showOtherDateEntry) {
|
||||
// Add separator
|
||||
if (!global.params.isFormControlsRefreshEnabled) {
|
||||
var separator = createElement('div', 'separator');
|
||||
this._containerElement.appendChild(separator);
|
||||
}
|
||||
|
||||
// Add "Other..." entry
|
||||
var otherEntry = this._createActionEntryElement(
|
||||
this._config.otherDateLabel,
|
||||
|
@ -357,8 +357,6 @@ bool MenuListSelectType::PopupIsVisible() const {
|
||||
|
||||
void MenuListSelectType::SetPopupIsVisible(bool popup_is_visible) {
|
||||
popup_is_visible_ = popup_is_visible;
|
||||
if (!::features::IsFormControlsRefreshEnabled())
|
||||
return;
|
||||
if (auto* layout_object = select_->GetLayoutObject()) {
|
||||
// Invalidate paint to ensure that the focus ring is updated.
|
||||
layout_object->SetShouldDoFullPaintInvalidation();
|
||||
|
@ -63,14 +63,12 @@ void SliderThumbElement::SetPositionFromValue() {
|
||||
if (GetLayoutObject()) {
|
||||
GetLayoutObject()->SetNeedsLayoutAndFullPaintInvalidation(
|
||||
layout_invalidation_reason::kSliderValueChanged);
|
||||
if (features::IsFormControlsRefreshEnabled()) {
|
||||
HTMLInputElement* input(HostInput());
|
||||
if (input && input->GetLayoutObject()) {
|
||||
// the slider track selected value needs to be updated.
|
||||
input->GetLayoutObject()->SetShouldDoFullPaintInvalidation();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LayoutObject* SliderThumbElement::CreateLayoutObject(const ComputedStyle& style,
|
||||
|
@ -24,27 +24,11 @@ TEST_F(LayoutTextControlSingleLineTest, VisualOverflowCleared) {
|
||||
<input id=input type="text"></input.
|
||||
)HTML");
|
||||
auto* input = To<LayoutBox>(GetLayoutObjectByElementId("input"));
|
||||
if (::features::IsFormControlsRefreshEnabled()) {
|
||||
EXPECT_EQ(LayoutRect(-3, -3, 74, 72), input->SelfVisualOverflowRect());
|
||||
} else {
|
||||
#if defined(OS_MAC)
|
||||
EXPECT_EQ(LayoutRect(-3, -3, 72, 72), input->SelfVisualOverflowRect());
|
||||
#else
|
||||
EXPECT_EQ(LayoutRect(-3, -3, 70, 72), input->SelfVisualOverflowRect());
|
||||
#endif
|
||||
}
|
||||
To<Element>(input->GetNode())
|
||||
->setAttribute(html_names::kStyleAttr, "box-shadow: initial");
|
||||
UpdateAllLifecyclePhasesForTest();
|
||||
if (::features::IsFormControlsRefreshEnabled()) {
|
||||
EXPECT_EQ(LayoutRect(0, 0, 58, 56), input->SelfVisualOverflowRect());
|
||||
} else {
|
||||
#if defined(OS_MAC)
|
||||
EXPECT_EQ(LayoutRect(0, 0, 56, 56), input->SelfVisualOverflowRect());
|
||||
#else
|
||||
EXPECT_EQ(LayoutRect(0, 0, 54, 56), input->SelfVisualOverflowRect());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
@ -743,8 +743,7 @@ String LayoutTheme::DisplayNameForFile(const File& file) const {
|
||||
|
||||
bool LayoutTheme::SupportsCalendarPicker(const AtomicString& type) const {
|
||||
DCHECK(RuntimeEnabledFeatures::InputMultipleFieldsUIEnabled());
|
||||
if (features::IsFormControlsRefreshEnabled() &&
|
||||
type == input_type_names::kTime)
|
||||
if (type == input_type_names::kTime)
|
||||
return true;
|
||||
|
||||
return type == input_type_names::kDate ||
|
||||
|
@ -19,19 +19,6 @@ LayoutTheme& LayoutTheme::NativeTheme() {
|
||||
|
||||
LayoutThemeAndroid::~LayoutThemeAndroid() {}
|
||||
|
||||
String LayoutThemeAndroid::ExtraDefaultStyleSheet() {
|
||||
String extra_sheet = LayoutThemeMobile::ExtraDefaultStyleSheet();
|
||||
if (features::IsFormControlsRefreshEnabled())
|
||||
return extra_sheet;
|
||||
|
||||
// "32px" comes from
|
||||
// 2 * -LayoutThemeDefault::SliderTickOffsetFromTrackCenter().
|
||||
return extra_sheet + R"CSS(
|
||||
input[type="range" i]:-internal-has-datalist::-webkit-slider-container {
|
||||
min-block-size: 32px;
|
||||
})CSS";
|
||||
}
|
||||
|
||||
Color LayoutThemeAndroid::PlatformActiveSelectionBackgroundColor(
|
||||
mojom::blink::ColorScheme color_scheme) const {
|
||||
return color_scheme == mojom::blink::ColorScheme::kDark
|
||||
|
@ -13,7 +13,6 @@ class LayoutThemeAndroid final : public LayoutThemeMobile {
|
||||
public:
|
||||
static scoped_refptr<LayoutTheme> Create();
|
||||
bool DelegatesMenuListRendering() const override { return true; }
|
||||
String ExtraDefaultStyleSheet() override;
|
||||
Color PlatformActiveSelectionBackgroundColor(
|
||||
mojom::blink::ColorScheme color_scheme) const override;
|
||||
Color PlatformActiveSelectionForegroundColor(
|
||||
|
@ -66,10 +66,7 @@ String LayoutThemeDefault::ExtraDefaultStyleSheet() {
|
||||
String windows_style_sheet =
|
||||
UncompressResourceAsASCIIString(IDR_UASTYLE_THEME_WIN_CSS);
|
||||
String controls_refresh_style_sheet =
|
||||
features::IsFormControlsRefreshEnabled()
|
||||
? UncompressResourceAsASCIIString(
|
||||
IDR_UASTYLE_THEME_CONTROLS_REFRESH_CSS)
|
||||
: String();
|
||||
UncompressResourceAsASCIIString(IDR_UASTYLE_THEME_CONTROLS_REFRESH_CSS);
|
||||
StringBuilder builder;
|
||||
builder.ReserveCapacity(
|
||||
extra_style_sheet.length() + multiple_fields_style_sheet.length() +
|
||||
@ -108,19 +105,13 @@ Color LayoutThemeDefault::PlatformInactiveSelectionForegroundColor(
|
||||
IntSize LayoutThemeDefault::SliderTickSize() const {
|
||||
// The value should be synchronized with a -webkit-slider-container rule in
|
||||
// html.css.
|
||||
if (features::IsFormControlsRefreshEnabled())
|
||||
return IntSize(1, 4);
|
||||
else
|
||||
return IntSize(1, 6);
|
||||
}
|
||||
|
||||
int LayoutThemeDefault::SliderTickOffsetFromTrackCenter() const {
|
||||
// The value should be synchronized with a -webkit-slider-container rule in
|
||||
// html.css and LayoutThemeAndroid::ExtraDefaultStyleSheet().
|
||||
if (features::IsFormControlsRefreshEnabled())
|
||||
return 7;
|
||||
else
|
||||
return -16;
|
||||
}
|
||||
|
||||
void LayoutThemeDefault::AdjustSliderThumbSize(ComputedStyle& style) const {
|
||||
|
@ -150,7 +150,6 @@ bool LayoutThemeMac::UsesTestModeFocusRingColor() const {
|
||||
}
|
||||
|
||||
LayoutTheme& LayoutTheme::NativeTheme() {
|
||||
DCHECK(features::IsFormControlsRefreshEnabled());
|
||||
DEFINE_STATIC_REF(LayoutTheme, layout_theme, (LayoutThemeMac::Create()));
|
||||
return *layout_theme;
|
||||
}
|
||||
|
@ -19,14 +19,11 @@
|
||||
#include "third_party/blink/renderer/core/testing/color_scheme_helper.h"
|
||||
#include "third_party/blink/renderer/core/testing/page_test_base.h"
|
||||
#include "third_party/blink/renderer/platform/graphics/color.h"
|
||||
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
|
||||
|
||||
namespace blink {
|
||||
|
||||
class LayoutThemeTest : public PageTestBase,
|
||||
private ScopedCSSColorSchemeUARenderingForTest {
|
||||
class LayoutThemeTest : public PageTestBase {
|
||||
protected:
|
||||
LayoutThemeTest() : ScopedCSSColorSchemeUARenderingForTest(true) {}
|
||||
void SetHtmlInnerHTML(const char* html_content);
|
||||
};
|
||||
|
||||
|
@ -2950,7 +2950,6 @@ INSTANTIATE_TEST_SUITE_P(NonOverlay,
|
||||
|
||||
TEST_P(ScrollbarColorSchemeTest, MAYBE_ThemeEnginePaint) {
|
||||
ScopedTestingPlatformSupport<ScrollbarTestingPlatformSupport> platform;
|
||||
ScopedCSSColorSchemeUARenderingForTest color_scheme_ua_scope(true);
|
||||
|
||||
WebView().MainFrameViewWidget()->Resize(gfx::Size(800, 600));
|
||||
SimRequest request("https://example.com/test.html", "text/html");
|
||||
|
@ -516,9 +516,7 @@ void DrawSolidBoxSide(GraphicsContext& graphics_context,
|
||||
float GetFocusRingBorderRadius(const ComputedStyle& style) {
|
||||
// Default style is border-radius equal to outline width.
|
||||
float border_radius = style.GetOutlineStrokeWidthForFocusRing();
|
||||
|
||||
if (::features::IsFormControlsRefreshEnabled() && !style.HasAuthorBorder() &&
|
||||
style.HasEffectiveAppearance()) {
|
||||
if (!style.HasAuthorBorder() && style.HasEffectiveAppearance()) {
|
||||
// For the elements that have not been styled and that have an appearance,
|
||||
// the focus ring should use the same border radius as the one used for
|
||||
// drawing the element.
|
||||
|
@ -2799,9 +2799,7 @@ Scrollbar* PaintLayerScrollableArea::ScrollbarManager::CreateScrollbar(
|
||||
ScrollableArea(), orientation, To<Element>(style_source.GetNode()));
|
||||
} else {
|
||||
Element* style_source_element = nullptr;
|
||||
if (::features::IsFormControlsRefreshEnabled()) {
|
||||
style_source_element = DynamicTo<Element>(style_source.GetNode());
|
||||
}
|
||||
scrollbar = MakeGarbageCollected<Scrollbar>(ScrollableArea(), orientation,
|
||||
style_source_element);
|
||||
}
|
||||
|
@ -171,15 +171,9 @@ bool ThemePainter::Paint(const LayoutObject& o,
|
||||
case kMenulistButtonPart:
|
||||
return true;
|
||||
case kTextFieldPart:
|
||||
if (!features::IsFormControlsRefreshEnabled()) {
|
||||
return true;
|
||||
}
|
||||
CountAppearanceTextFieldPart(element);
|
||||
return PaintTextField(element, style, paint_info, r);
|
||||
case kTextAreaPart:
|
||||
if (!features::IsFormControlsRefreshEnabled()) {
|
||||
return true;
|
||||
}
|
||||
COUNT_APPEARANCE(doc, TextArea);
|
||||
return PaintTextArea(element, style, paint_info, r);
|
||||
case kSearchFieldPart: {
|
||||
@ -211,17 +205,8 @@ bool ThemePainter::PaintBorderOnly(const Node* node,
|
||||
// Call the appropriate paint method based off the appearance value.
|
||||
switch (style.EffectiveAppearance()) {
|
||||
case kTextFieldPart:
|
||||
if (features::IsFormControlsRefreshEnabled()) {
|
||||
return false;
|
||||
}
|
||||
CountAppearanceTextFieldPart(element);
|
||||
return PaintTextField(element, style, paint_info, r);
|
||||
case kTextAreaPart:
|
||||
if (features::IsFormControlsRefreshEnabled()) {
|
||||
return false;
|
||||
}
|
||||
COUNT_APPEARANCE(element.GetDocument(), TextArea);
|
||||
return PaintTextArea(element, style, paint_info, r);
|
||||
case kMenulistButtonPart:
|
||||
case kSearchFieldPart:
|
||||
case kListboxPart:
|
||||
|
@ -209,9 +209,7 @@ bool ThemePainterDefault::PaintRadio(const Element& element,
|
||||
extra_params.button.zoom = zoom_level;
|
||||
GraphicsContextStateSaver state_saver(paint_info.context, false);
|
||||
IntRect unzoomed_rect =
|
||||
features::IsFormControlsRefreshEnabled()
|
||||
? ApplyZoomToRect(rect, paint_info, state_saver, zoom_level)
|
||||
: rect;
|
||||
ApplyZoomToRect(rect, paint_info, state_saver, zoom_level);
|
||||
|
||||
Platform::Current()->ThemeEngine()->Paint(
|
||||
canvas, WebThemeEngine::kPartRadio, GetWebThemeState(element),
|
||||
@ -353,8 +351,7 @@ void ThemePainterDefault::SetupMenuListArrow(
|
||||
theme_.ClampedMenuListArrowPaddingSize(document.GetFrame(), style);
|
||||
float arrow_scale_factor = arrow_box_width / theme_.MenuListArrowWidthInDIP();
|
||||
// TODO(tkent): This should be 7.0 to match scroll bar buttons.
|
||||
float arrow_size = (features::IsFormControlsRefreshEnabled() ? 8.0 : 6.0) *
|
||||
arrow_scale_factor;
|
||||
float arrow_size = 8.0 * arrow_scale_factor;
|
||||
// Put the arrow at the center of paddingForArrow area.
|
||||
// |arrowX| is the left position for Aura theme engine.
|
||||
extra_params.menu_list.arrow_x =
|
||||
@ -383,14 +380,6 @@ bool ThemePainterDefault::PaintSliderTrack(const Element& element,
|
||||
extra_params.slider.zoom = zoom_level;
|
||||
GraphicsContextStateSaver state_saver(i.context, false);
|
||||
IntRect unzoomed_rect = rect;
|
||||
if (zoom_level != 1 && !features::IsFormControlsRefreshEnabled()) {
|
||||
state_saver.Save();
|
||||
unzoomed_rect.SetWidth(unzoomed_rect.Width() / zoom_level);
|
||||
unzoomed_rect.SetHeight(unzoomed_rect.Height() / zoom_level);
|
||||
i.context.Translate(unzoomed_rect.X(), unzoomed_rect.Y());
|
||||
i.context.Scale(zoom_level, zoom_level);
|
||||
i.context.Translate(-unzoomed_rect.X(), -unzoomed_rect.Y());
|
||||
}
|
||||
|
||||
auto* input = DynamicTo<HTMLInputElement>(element);
|
||||
extra_params.slider.thumb_x = 0;
|
||||
@ -405,23 +394,12 @@ bool ThemePainterDefault::PaintSliderTrack(const Element& element,
|
||||
LayoutBox* input_box = input->GetLayoutBox();
|
||||
if (thumb) {
|
||||
IntRect thumb_rect = PixelSnappedIntRect(thumb->FrameRect());
|
||||
if (features::IsFormControlsRefreshEnabled()) {
|
||||
extra_params.slider.thumb_x = thumb_rect.X() +
|
||||
input_box->PaddingLeft().ToInt() +
|
||||
input_box->BorderLeft().ToInt();
|
||||
extra_params.slider.thumb_y = thumb_rect.Y() +
|
||||
input_box->PaddingTop().ToInt() +
|
||||
input_box->BorderTop().ToInt();
|
||||
} else {
|
||||
extra_params.slider.thumb_x =
|
||||
(thumb_rect.X() + input_box->PaddingLeft().ToInt() +
|
||||
input_box->BorderLeft().ToInt()) /
|
||||
zoom_level;
|
||||
extra_params.slider.thumb_y =
|
||||
(thumb_rect.Y() + input_box->PaddingTop().ToInt() +
|
||||
input_box->BorderTop().ToInt()) /
|
||||
zoom_level;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -446,14 +424,6 @@ bool ThemePainterDefault::PaintSliderThumb(const Element& element,
|
||||
extra_params.slider.zoom = zoom_level;
|
||||
GraphicsContextStateSaver state_saver(paint_info.context, false);
|
||||
IntRect unzoomed_rect = rect;
|
||||
if (zoom_level != 1 && !features::IsFormControlsRefreshEnabled()) {
|
||||
state_saver.Save();
|
||||
unzoomed_rect.SetWidth(unzoomed_rect.Width() / zoom_level);
|
||||
unzoomed_rect.SetHeight(unzoomed_rect.Height() / zoom_level);
|
||||
paint_info.context.Translate(unzoomed_rect.X(), unzoomed_rect.Y());
|
||||
paint_info.context.Scale(zoom_level, zoom_level);
|
||||
paint_info.context.Translate(-unzoomed_rect.X(), -unzoomed_rect.Y());
|
||||
}
|
||||
|
||||
// The element passed in is inside the user agent shadowdom of the input
|
||||
// element, so we have to access the parent input element in order to get the
|
||||
|
@ -815,16 +815,14 @@ float Scrollbar::ScaleFromDIP() const {
|
||||
}
|
||||
|
||||
float Scrollbar::EffectiveZoom() const {
|
||||
if (::features::IsFormControlsRefreshEnabled() && style_source_ &&
|
||||
style_source_->GetLayoutObject()) {
|
||||
if (style_source_ && style_source_->GetLayoutObject()) {
|
||||
return style_source_->GetLayoutObject()->Style()->EffectiveZoom();
|
||||
}
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
bool Scrollbar::ContainerIsRightToLeft() const {
|
||||
if (::features::IsFormControlsRefreshEnabled() && style_source_ &&
|
||||
style_source_->GetLayoutObject()) {
|
||||
if (style_source_ && style_source_->GetLayoutObject()) {
|
||||
TextDirection dir = style_source_->GetLayoutObject()->Style()->Direction();
|
||||
return IsRtl(dir);
|
||||
}
|
||||
|
@ -2224,7 +2224,7 @@ int ComputedStyle::OutlineOutsetExtent() const {
|
||||
}
|
||||
|
||||
float ComputedStyle::GetOutlineStrokeWidthForFocusRing() const {
|
||||
if (::features::IsFormControlsRefreshEnabled() && OutlineStyleIsAuto()) {
|
||||
if (OutlineStyleIsAuto()) {
|
||||
return std::max(EffectiveZoom(), 3.f);
|
||||
}
|
||||
|
||||
|
@ -2602,9 +2602,7 @@ class ComputedStyle : public ComputedStyleBase,
|
||||
}
|
||||
|
||||
mojom::blink::ColorScheme UsedColorScheme() const {
|
||||
return RuntimeEnabledFeatures::CSSColorSchemeUARenderingEnabled()
|
||||
? ComputedColorScheme()
|
||||
: mojom::blink::ColorScheme::kLight;
|
||||
return ComputedColorScheme();
|
||||
}
|
||||
|
||||
mojom::blink::ColorScheme UsedColorSchemeForInitialColors() const {
|
||||
|
@ -91,30 +91,11 @@ TEST_F(ComputedStyleTest, ClipPathEqual) {
|
||||
|
||||
TEST_F(ComputedStyleTest, FocusRingWidth) {
|
||||
scoped_refptr<ComputedStyle> style = CreateComputedStyle();
|
||||
if (::features::IsFormControlsRefreshEnabled()) {
|
||||
style->SetOutlineStyleIsAuto(static_cast<bool>(OutlineIsAuto::kOn));
|
||||
EXPECT_EQ(3, style->GetOutlineStrokeWidthForFocusRing());
|
||||
style->SetEffectiveZoom(3.5);
|
||||
style->SetOutlineWidth(4);
|
||||
EXPECT_EQ(3.5, style->GetOutlineStrokeWidthForFocusRing());
|
||||
} else {
|
||||
style->SetEffectiveZoom(3.5);
|
||||
style->SetOutlineStyle(EBorderStyle::kSolid);
|
||||
#if defined(OS_MAC)
|
||||
EXPECT_EQ(3, style->GetOutlineStrokeWidthForFocusRing());
|
||||
#else
|
||||
style->SetOutlineStyleIsAuto(static_cast<bool>(OutlineIsAuto::kOn));
|
||||
static uint16_t outline_width = 4;
|
||||
style->SetOutlineWidth(outline_width);
|
||||
|
||||
double expected_width = 3.5;
|
||||
EXPECT_EQ(expected_width, style->GetOutlineStrokeWidthForFocusRing());
|
||||
|
||||
expected_width = 1.0;
|
||||
style->SetEffectiveZoom(0.5);
|
||||
EXPECT_EQ(expected_width, style->GetOutlineStrokeWidthForFocusRing());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(ComputedStyleTest, FocusRingOutset) {
|
||||
@ -122,15 +103,7 @@ TEST_F(ComputedStyleTest, FocusRingOutset) {
|
||||
style->SetOutlineStyle(EBorderStyle::kSolid);
|
||||
style->SetOutlineStyleIsAuto(static_cast<bool>(OutlineIsAuto::kOn));
|
||||
style->SetEffectiveZoom(4.75);
|
||||
if (::features::IsFormControlsRefreshEnabled()) {
|
||||
EXPECT_EQ(4, style->OutlineOutsetExtent());
|
||||
} else {
|
||||
#if defined(OS_MAC)
|
||||
EXPECT_EQ(4, style->OutlineOutsetExtent());
|
||||
#else
|
||||
EXPECT_EQ(3, style->OutlineOutsetExtent());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(ComputedStyleTest, SVGStackingContext) {
|
||||
@ -679,8 +652,6 @@ TEST_F(ComputedStyleTest, CustomPropertiesInheritance_StyleRecalc) {
|
||||
}
|
||||
|
||||
TEST_F(ComputedStyleTest, ApplyColorSchemeLightOnDark) {
|
||||
ScopedCSSColorSchemeUARenderingForTest scoped_ua_enabled(true);
|
||||
|
||||
std::unique_ptr<DummyPageHolder> dummy_page_holder =
|
||||
std::make_unique<DummyPageHolder>(IntSize(0, 0), nullptr);
|
||||
Document& document = dummy_page_holder->GetDocument();
|
||||
@ -714,8 +685,6 @@ TEST_F(ComputedStyleTest, ApplyColorSchemeLightOnDark) {
|
||||
TEST_F(ComputedStyleTest, ApplyInternalLightDarkColor) {
|
||||
using css_test_helpers::ParseDeclarationBlock;
|
||||
|
||||
ScopedCSSColorSchemeUARenderingForTest scoped_ua_enabled(true);
|
||||
|
||||
std::unique_ptr<DummyPageHolder> dummy_page_holder =
|
||||
std::make_unique<DummyPageHolder>(IntSize(0, 0), nullptr);
|
||||
Document& document = dummy_page_holder->GetDocument();
|
||||
@ -758,8 +727,6 @@ TEST_F(ComputedStyleTest, ApplyInternalLightDarkColor) {
|
||||
TEST_F(ComputedStyleTest, ApplyInternalLightDarkBackgroundImage) {
|
||||
using css_test_helpers::ParseDeclarationBlock;
|
||||
|
||||
ScopedCSSColorSchemeUARenderingForTest scoped_ua_enabled(true);
|
||||
|
||||
std::unique_ptr<DummyPageHolder> dummy_page_holder =
|
||||
std::make_unique<DummyPageHolder>(IntSize(0, 0), nullptr);
|
||||
Document& document = dummy_page_holder->GetDocument();
|
||||
|
@ -711,10 +711,6 @@ unsigned Internals::workerThreadCount() const {
|
||||
return WorkerThread::WorkerThreadCount();
|
||||
}
|
||||
|
||||
bool Internals::isFormControlsRefreshEnabled() const {
|
||||
return ::features::IsFormControlsRefreshEnabled();
|
||||
}
|
||||
|
||||
GCObservation* Internals::observeGC(ScriptValue script_value) {
|
||||
v8::Local<v8::Value> observed_value = script_value.V8Value();
|
||||
DCHECK(!observed_value.IsEmpty());
|
||||
|
@ -333,8 +333,6 @@ class Internals final : public ScriptWrappable {
|
||||
InternalRuntimeFlags* runtimeFlags() const;
|
||||
unsigned workerThreadCount() const;
|
||||
|
||||
bool isFormControlsRefreshEnabled() const;
|
||||
|
||||
String resolveModuleSpecifier(const String& specifier,
|
||||
const String& base_url_string,
|
||||
Document*,
|
||||
|
@ -185,7 +185,6 @@
|
||||
readonly attribute InternalSettings settings;
|
||||
readonly attribute InternalRuntimeFlags runtimeFlags;
|
||||
readonly attribute unsigned long workerThreadCount;
|
||||
readonly attribute boolean isFormControlsRefreshEnabled;
|
||||
|
||||
// Flag for layerTreeAsText. The value must be kept in sync with the value
|
||||
// of LayerTreeFlags in layers_as_json.h.
|
||||
|
@ -678,10 +678,6 @@ void WebRuntimeFeatures::EnableTargetBlankImpliesNoOpener(bool enable) {
|
||||
RuntimeEnabledFeatures::SetTargetBlankImpliesNoOpenerEnabled(enable);
|
||||
}
|
||||
|
||||
void WebRuntimeFeatures::EnableCSSColorSchemeUARendering(bool enable) {
|
||||
RuntimeEnabledFeatures::SetCSSColorSchemeUARenderingEnabled(enable);
|
||||
}
|
||||
|
||||
void WebRuntimeFeatures::EnableDocumentTransition(bool enable) {
|
||||
RuntimeEnabledFeatures::SetDocumentTransitionEnabled(enable);
|
||||
}
|
||||
|
@ -329,32 +329,11 @@ void GraphicsContext::CompositeRecord(sk_sp<PaintRecord> record,
|
||||
canvas_->restore();
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
int AdjustedFocusRingOffset(int offset) {
|
||||
// For FormControlsRefresh we just use the value of outline-offset so we don't
|
||||
// need to call this method.
|
||||
DCHECK(!::features::IsFormControlsRefreshEnabled());
|
||||
|
||||
#if defined(OS_MAC)
|
||||
return offset + 2;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int GraphicsContext::FocusRingOutsetExtent(int offset, int width) {
|
||||
// Unlike normal outlines (whole width is outside of the offset), focus
|
||||
// rings can be drawn with the center of the path aligned with the offset, so
|
||||
// only half of the width is outside of the offset.
|
||||
if (::features::IsFormControlsRefreshEnabled()) {
|
||||
// For FormControlsRefresh 2/3 of the width is outside of the offset.
|
||||
// only 2/3 of the width is outside of the offset.
|
||||
return offset + std::ceil(width / 3.f) * 2;
|
||||
}
|
||||
|
||||
return AdjustedFocusRingOffset(offset) + (width + 1) / 2;
|
||||
}
|
||||
|
||||
void GraphicsContext::DrawFocusRingPath(const SkPath& path,
|
||||
@ -398,10 +377,6 @@ void GraphicsContext::DrawFocusRingInternal(const Vector<IntRect>& rects,
|
||||
return;
|
||||
|
||||
SkRegion focus_ring_region;
|
||||
if (!::features::IsFormControlsRefreshEnabled()) {
|
||||
// For FormControlsRefresh we don't need to adjust the offset.
|
||||
offset = AdjustedFocusRingOffset(offset);
|
||||
}
|
||||
for (unsigned i = 0; i < rect_count; i++) {
|
||||
SkIRect r = rects[i];
|
||||
if (r.isEmpty())
|
||||
@ -436,7 +411,6 @@ void GraphicsContext::DrawFocusRing(const Vector<IntRect>& rects,
|
||||
const Color& inner_color =
|
||||
color_scheme == mojom::blink::ColorScheme::kDark ? SK_ColorWHITE : color;
|
||||
#endif
|
||||
if (::features::IsFormControlsRefreshEnabled()) {
|
||||
// The focus ring is made of two borders which have a 2:1 ratio.
|
||||
const float first_border_width = (width / 3) * 2;
|
||||
const float second_border_width = width - first_border_width;
|
||||
@ -452,13 +426,10 @@ void GraphicsContext::DrawFocusRing(const Vector<IntRect>& rects,
|
||||
// The outer ring is drawn first, and we overdraw to ensure no gaps or AA
|
||||
// artifacts.
|
||||
DrawFocusRingInternal(rects, first_border_width,
|
||||
offset + std::ceil(second_border_width),
|
||||
border_radius, outer_color);
|
||||
offset + std::ceil(second_border_width), border_radius,
|
||||
outer_color);
|
||||
DrawFocusRingInternal(rects, first_border_width, offset, border_radius,
|
||||
inner_color);
|
||||
} else {
|
||||
DrawFocusRingInternal(rects, width, offset, border_radius, inner_color);
|
||||
}
|
||||
}
|
||||
|
||||
static void EnforceDotsAtEndpoints(GraphicsContext& context,
|
||||
|
@ -420,26 +420,7 @@ void DrawPlatformFocusRing(const PrimitiveType& primitive,
|
||||
flags.setColor(color);
|
||||
flags.setStrokeWidth(width);
|
||||
|
||||
if (::features::IsFormControlsRefreshEnabled()) {
|
||||
DrawFocusRingPrimitive(primitive, canvas, flags, border_radius);
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(OS_MAC)
|
||||
flags.setAlpha(64);
|
||||
const float corner_radius = (width - 1) * 0.5f;
|
||||
#else
|
||||
const float corner_radius = width;
|
||||
#endif
|
||||
|
||||
DrawFocusRingPrimitive(primitive, canvas, flags, corner_radius);
|
||||
|
||||
#if defined(OS_MAC)
|
||||
// Inner part
|
||||
flags.setAlpha(128);
|
||||
flags.setStrokeWidth(flags.getStrokeWidth() * 0.5f);
|
||||
DrawFocusRingPrimitive(primitive, canvas, flags, corner_radius);
|
||||
#endif
|
||||
}
|
||||
|
||||
template void PLATFORM_EXPORT
|
||||
|
@ -502,15 +502,6 @@
|
||||
name: "CSSCaseSensitiveSelector",
|
||||
status: "test",
|
||||
},
|
||||
{
|
||||
// When the color-scheme is supported via the CSS color-scheme property
|
||||
// (CSSColorScheme) or the meta tag (MetaColorScheme), the only UA
|
||||
// rendering change is for the canvas background and the :root element
|
||||
// color property. Enabling this runtime flag will enable dark UA
|
||||
// rendering for form controls, scrollbars, etc.
|
||||
name: "CSSColorSchemeUARendering",
|
||||
status: "stable",
|
||||
},
|
||||
{
|
||||
name: "CSSColorTypedOM",
|
||||
status: "experimental",
|
||||
|
@ -249,13 +249,8 @@ void LocaleICU::InitializeCalendar() {
|
||||
UCAL_FIRST_DAY_OF_WEEK) -
|
||||
UCAL_SUNDAY;
|
||||
|
||||
if (features::IsFormControlsRefreshEnabled()) {
|
||||
week_day_short_labels_ = CreateLabelVector(
|
||||
short_date_format_, UDAT_NARROW_WEEKDAYS, UCAL_SUNDAY, 7);
|
||||
} else {
|
||||
week_day_short_labels_ = CreateLabelVector(
|
||||
short_date_format_, UDAT_SHORT_WEEKDAYS, UCAL_SUNDAY, 7);
|
||||
}
|
||||
if (!week_day_short_labels_)
|
||||
week_day_short_labels_ = CreateFallbackWeekDayShortLabels();
|
||||
}
|
||||
|
@ -137,9 +137,7 @@ const Vector<String>& LocaleMac::WeekDayShortLabels() {
|
||||
if (!week_day_short_labels_.IsEmpty())
|
||||
return week_day_short_labels_;
|
||||
week_day_short_labels_.ReserveCapacity(7);
|
||||
NSArray* array = features::IsFormControlsRefreshEnabled()
|
||||
? [ShortDateFormatter() veryShortWeekdaySymbols]
|
||||
: [ShortDateFormatter() shortWeekdaySymbols];
|
||||
NSArray* array = [ShortDateFormatter() veryShortWeekdaySymbols];
|
||||
if ([array count] == 7) {
|
||||
for (unsigned i = 0; i < 7; ++i)
|
||||
week_day_short_labels_.push_back(String(array[i]));
|
||||
|
@ -293,24 +293,14 @@ void LocaleWin::EnsureMonthLabels() {
|
||||
void LocaleWin::EnsureWeekDayShortLabels() {
|
||||
if (!week_day_short_labels_.IsEmpty())
|
||||
return;
|
||||
const LCTYPE kTypes[7] = {LOCALE_SABBREVDAYNAME7, // Sunday
|
||||
LOCALE_SABBREVDAYNAME1, // Monday
|
||||
LOCALE_SABBREVDAYNAME2, LOCALE_SABBREVDAYNAME3,
|
||||
LOCALE_SABBREVDAYNAME4, LOCALE_SABBREVDAYNAME5,
|
||||
LOCALE_SABBREVDAYNAME6};
|
||||
const LCTYPE kTypesRefresh[7] = {
|
||||
LOCALE_SSHORTESTDAYNAME7, // Sunday
|
||||
const LCTYPE kTypes[7] = {LOCALE_SSHORTESTDAYNAME7, // Sunday
|
||||
LOCALE_SSHORTESTDAYNAME1, // Monday
|
||||
LOCALE_SSHORTESTDAYNAME2, LOCALE_SSHORTESTDAYNAME3,
|
||||
LOCALE_SSHORTESTDAYNAME4, LOCALE_SSHORTESTDAYNAME5,
|
||||
LOCALE_SSHORTESTDAYNAME6};
|
||||
week_day_short_labels_.ReserveCapacity(base::size(kTypes));
|
||||
for (unsigned i = 0; i < base::size(kTypes); ++i) {
|
||||
if (features::IsFormControlsRefreshEnabled()) {
|
||||
week_day_short_labels_.push_back(GetLocaleInfoString(kTypesRefresh[i]));
|
||||
} else {
|
||||
week_day_short_labels_.push_back(GetLocaleInfoString(kTypes[i]));
|
||||
}
|
||||
if (week_day_short_labels_.back().IsEmpty()) {
|
||||
week_day_short_labels_.Shrink(0);
|
||||
week_day_short_labels_.ReserveCapacity(base::size(WTF::kWeekdayName));
|
||||
|
@ -189,7 +189,6 @@ TEST_F(LocaleWinTest, monthLabels) {
|
||||
}
|
||||
|
||||
TEST_F(LocaleWinTest, weekDayShortLabels) {
|
||||
if (features::IsFormControlsRefreshEnabled()) {
|
||||
EXPECT_EQ("Su", WeekDayShortLabel(kEnglishUS, kSunday));
|
||||
EXPECT_EQ("We", WeekDayShortLabel(kEnglishUS, kWednesday));
|
||||
EXPECT_EQ("Sa", WeekDayShortLabel(kEnglishUS, kSaturday));
|
||||
@ -197,15 +196,6 @@ TEST_F(LocaleWinTest, weekDayShortLabels) {
|
||||
EXPECT_EQ("di", WeekDayShortLabel(kFrenchFR, kSunday));
|
||||
EXPECT_EQ("me", WeekDayShortLabel(kFrenchFR, kWednesday));
|
||||
EXPECT_EQ("sa", WeekDayShortLabel(kFrenchFR, kSaturday));
|
||||
} else {
|
||||
EXPECT_EQ("Sun", WeekDayShortLabel(kEnglishUS, kSunday));
|
||||
EXPECT_EQ("Wed", WeekDayShortLabel(kEnglishUS, kWednesday));
|
||||
EXPECT_EQ("Sat", WeekDayShortLabel(kEnglishUS, kSaturday));
|
||||
|
||||
EXPECT_EQ("dim.", WeekDayShortLabel(kFrenchFR, kSunday));
|
||||
EXPECT_EQ("mer.", WeekDayShortLabel(kFrenchFR, kWednesday));
|
||||
EXPECT_EQ("sam.", WeekDayShortLabel(kFrenchFR, kSaturday));
|
||||
}
|
||||
EXPECT_EQ("\xE6\x97\xA5", WeekDayShortLabel(kJapaneseJP, kSunday).Utf8());
|
||||
EXPECT_EQ("\xE6\xB0\xB4", WeekDayShortLabel(kJapaneseJP, kWednesday).Utf8());
|
||||
EXPECT_EQ("\xE5\x9C\x9F", WeekDayShortLabel(kJapaneseJP, kSaturday).Utf8());
|
||||
|
@ -724,7 +724,7 @@ crbug.com/6606 external/wpt/mathml/* [ Skip ]
|
||||
|
||||
crbug.com/1034944 webexposed/global-interface-listing.html [ Skip ]
|
||||
|
||||
# TODO(iopopesc) these need to be rebaselined for FormControlsRefresh focus ring.
|
||||
# TODO(iopopesc) these need to be rebaselined for focus ring changes.
|
||||
crbug.com/1035582 fast/css/focus-ring-detached.html [ Failure ]
|
||||
crbug.com/1035582 fast/events/sequential-focus-navigation-starting-point.html [ Skip ]
|
||||
crbug.com/1035582 fast/inline/continuation-outlines-with-layers.html [ Failure ]
|
||||
|
4
third_party/blink/web_tests/TestExpectations
vendored
4
third_party/blink/web_tests/TestExpectations
vendored
@ -1361,7 +1361,7 @@ crbug.com/1133390 virtual/css-calc-infinity-and-nan/external/wpt/css/css-values/
|
||||
# ====== Style team owned tests to here ======
|
||||
|
||||
|
||||
# Bug in FormControlsRefresh <select multiple> tap behavior:
|
||||
# Bug in <select multiple> tap behavior:
|
||||
crbug.com/1045672 fast/forms/select/listbox-tap.html [ Failure ]
|
||||
|
||||
### sheriff 2019-07-16
|
||||
@ -1418,8 +1418,6 @@ crbug.com/520194 http/tests/xmlhttprequest/timeout/xmlhttprequest-timeout-worker
|
||||
|
||||
crbug.com/892032 fast/events/wheel/wheel-latched-scroll-node-removed.html [ Pass Failure ]
|
||||
|
||||
|
||||
# Tests that fail when FormControlsRefresh is enabled:
|
||||
crbug.com/1051136 fast/forms/select/listbox-overlay-scrollbar.html [ Failure ]
|
||||
|
||||
# These performance-sensitive user-timing tests are flaky in debug on all platforms, and flaky on all configurations of windows.
|
||||
|
@ -655,7 +655,7 @@
|
||||
{
|
||||
"prefix": "system-color-compute",
|
||||
"bases": ["external/wpt/css/css-color"],
|
||||
"args": ["--enable-blink-features=CSSColorScheme,CSSColorSchemeUARendering,CSSSystemColorComputeToSelf"]
|
||||
"args": ["--enable-blink-features=CSSColorScheme,CSSSystemColorComputeToSelf"]
|
||||
},
|
||||
{
|
||||
"prefix": "dark-color-scheme",
|
||||
@ -663,7 +663,7 @@
|
||||
"fast/forms/color-scheme",
|
||||
"http/tests/eye-dropper"],
|
||||
"args": ["--force-dark-mode",
|
||||
"--enable-blink-features=CSSColorScheme,CSSColorSchemeUARendering",
|
||||
"--enable-blink-features=CSSColorScheme",
|
||||
"--enable-features=EyeDropper"]
|
||||
},
|
||||
{
|
||||
|
@ -17,11 +17,7 @@ let t = async_test('Test year list view size');
|
||||
function test1() {
|
||||
var dateViewHeight = popupWindow.global.picker.height();
|
||||
clickMonthPopupButton();
|
||||
if (popupWindow.global.params.isFormControlsRefreshEnabled) {
|
||||
assert_equals(dateViewHeight, popupWindow.global.picker.height());
|
||||
} else {
|
||||
assert_not_equals(dateViewHeight, popupWindow.global.picker.height());
|
||||
}
|
||||
}
|
||||
|
||||
t.step(() => {
|
||||
|
4
third_party/blink/web_tests/fast/forms/calendar-picker/resources/calendar-picker-common.js
vendored
4
third_party/blink/web_tests/fast/forms/calendar-picker/resources/calendar-picker-common.js
vendored
@ -173,7 +173,7 @@ function skipAnimationAndGetPositionOfTodayButton() {
|
||||
popupWindow.global.picker.datePicker.calendarTableView :
|
||||
popupWindow.global.picker.calendarTableView;
|
||||
var buttonElement =
|
||||
calendarTableView.element.querySelector('.today-button-refresh');
|
||||
calendarTableView.element.querySelector('.today-button');
|
||||
var offset = cumulativeOffset(buttonElement);
|
||||
return {
|
||||
x: offset[0] + buttonElement.offsetWidth / 2,
|
||||
@ -195,7 +195,7 @@ function clickTodayButton() {
|
||||
function skipAnimationAndGetPositionOfThisMonthButton() {
|
||||
skipAnimation();
|
||||
const button =
|
||||
popupWindow.global.picker.querySelector('.today-button-refresh');
|
||||
popupWindow.global.picker.querySelector('.today-button');
|
||||
var offset = cumulativeOffset(button);
|
||||
return {
|
||||
x: offset[0] + button.offsetWidth / 2,
|
||||
|
@ -9,9 +9,7 @@ testRunner.waitUntilDone();
|
||||
<input type=month id=month value="2018-08">
|
||||
<script>
|
||||
openPickerAppearanceOnly(document.getElementById('month'), function() {
|
||||
if (popupWindow.global.params.isFormControlsRefreshEnabled) {
|
||||
hoverOverMonthButtonForMonthPicker(2018, 5);
|
||||
}
|
||||
testRunner.notifyDone()
|
||||
});
|
||||
</script>
|
||||
|
5
third_party/blink/web_tests/http/tests/forms/resources/date-picker-keyboard-cross-domain-iframe.html
vendored
5
third_party/blink/web_tests/http/tests/forms/resources/date-picker-keyboard-cross-domain-iframe.html
vendored
@ -6,12 +6,7 @@
|
||||
|
||||
input_date.focus();
|
||||
|
||||
if (internals.isFormControlsRefreshEnabled) {
|
||||
eventSender.keyDown(" ");
|
||||
} else {
|
||||
// Old picker needs Alt+ArrowDown
|
||||
eventSender.keyDown("ArrowDown", ["altKey"]);
|
||||
}
|
||||
|
||||
// Advance date to the next day
|
||||
eventSender.keyDown("ArrowRight");
|
||||
|
@ -1,5 +1,5 @@
|
||||
This suite runs the tests with
|
||||
|
||||
--enable-blink-features=CSSColorScheme,CSSColorSchemeUARendering,CSSSystemColorComputeToSelf
|
||||
--enable-blink-features=CSSColorScheme,CSSSystemColorComputeToSelf
|
||||
|
||||
in order to enable the color-scheme property and make system color keywords compute to themselves.
|
||||
|
@ -219,26 +219,7 @@ const base::Feature kEyeDropper {
|
||||
};
|
||||
|
||||
bool IsEyeDropperEnabled() {
|
||||
return IsFormControlsRefreshEnabled() &&
|
||||
base::FeatureList::IsEnabled(features::kEyeDropper);
|
||||
}
|
||||
|
||||
const base::Feature kCSSColorSchemeUARendering = {
|
||||
"CSSColorSchemeUARendering", base::FEATURE_ENABLED_BY_DEFAULT};
|
||||
|
||||
bool IsCSSColorSchemeUARenderingEnabled() {
|
||||
static const bool css_color_scheme_ua_rendering_enabled =
|
||||
base::FeatureList::IsEnabled(features::kCSSColorSchemeUARendering);
|
||||
return css_color_scheme_ua_rendering_enabled;
|
||||
}
|
||||
|
||||
const base::Feature kFormControlsRefresh = {"FormControlsRefresh",
|
||||
base::FEATURE_ENABLED_BY_DEFAULT};
|
||||
|
||||
bool IsFormControlsRefreshEnabled() {
|
||||
static const bool form_controls_refresh_enabled =
|
||||
base::FeatureList::IsEnabled(features::kFormControlsRefresh);
|
||||
return form_controls_refresh_enabled;
|
||||
return base::FeatureList::IsEnabled(features::kEyeDropper);
|
||||
}
|
||||
|
||||
// Enable the common select popup.
|
||||
|
@ -88,16 +88,6 @@ COMPONENT_EXPORT(UI_BASE_FEATURES) bool IsForcedColorsEnabled();
|
||||
COMPONENT_EXPORT(UI_BASE_FEATURES) extern const base::Feature kEyeDropper;
|
||||
COMPONENT_EXPORT(UI_BASE_FEATURES) bool IsEyeDropperEnabled();
|
||||
|
||||
// Used to enable form controls and scrollbar dark mode rendering.
|
||||
COMPONENT_EXPORT(UI_BASE_FEATURES)
|
||||
extern const base::Feature kCSSColorSchemeUARendering;
|
||||
COMPONENT_EXPORT(UI_BASE_FEATURES) bool IsCSSColorSchemeUARenderingEnabled();
|
||||
|
||||
// Used to enable the new controls UI.
|
||||
COMPONENT_EXPORT(UI_BASE_FEATURES)
|
||||
extern const base::Feature kFormControlsRefresh;
|
||||
COMPONENT_EXPORT(UI_BASE_FEATURES) bool IsFormControlsRefreshEnabled();
|
||||
|
||||
// Used to enable the common select popup.
|
||||
COMPONENT_EXPORT(UI_BASE_FEATURES)
|
||||
extern const base::Feature kUseCommonSelectPopup;
|
||||
|
@ -103,7 +103,6 @@ NativeThemeAura* NativeThemeAura::web_instance() {
|
||||
|
||||
SkColor NativeThemeAura::FocusRingColorForBaseColor(SkColor base_color) const {
|
||||
#if defined(OS_APPLE)
|
||||
DCHECK(features::IsFormControlsRefreshEnabled());
|
||||
// On Mac OSX, the system Accent Color setting is darkened a bit
|
||||
// for better contrast.
|
||||
return SkColorSetA(base_color, 166);
|
||||
@ -184,12 +183,6 @@ void NativeThemeAura::PaintArrowButton(
|
||||
cc::PaintFlags flags;
|
||||
flags.setColor(bg_color);
|
||||
|
||||
if (!features::IsFormControlsRefreshEnabled()) {
|
||||
canvas->drawIRect(gfx::RectToSkIRect(rect), flags);
|
||||
|
||||
return PaintArrow(canvas, rect, direction, arrow_color);
|
||||
}
|
||||
|
||||
SkScalar upper_left_radius = 0;
|
||||
SkScalar lower_left_radius = 0;
|
||||
SkScalar upper_right_radius = 0;
|
||||
|
@ -37,10 +37,6 @@ namespace {
|
||||
const int kCheckboxAndRadioWidth = 13;
|
||||
const int kCheckboxAndRadioHeight = 13;
|
||||
|
||||
// These sizes match the sizes in Chromium Win.
|
||||
const int kSliderThumbWidth = 11;
|
||||
const int kSliderThumbHeight = 21;
|
||||
|
||||
// Color constant pairs for light/default and dark color-schemes below.
|
||||
constexpr SkColor kThumbActiveColor[2] = {SkColorSetRGB(0xF4, 0xF4, 0xF4),
|
||||
gfx::kPlaceholderColor};
|
||||
@ -48,69 +44,12 @@ constexpr SkColor kThumbInactiveColor[2] = {SkColorSetRGB(0xEA, 0xEA, 0xEA),
|
||||
SK_ColorWHITE};
|
||||
constexpr SkColor kTrackColor[2] = {SkColorSetRGB(0xD3, 0xD3, 0xD3),
|
||||
gfx::kPlaceholderColor};
|
||||
constexpr SkColor kSliderTrackBackgroundColor[2] = {
|
||||
SkColorSetRGB(0xE3, 0xDD, 0xD8), SkColorSetRGB(0x44, 0x44, 0x44)};
|
||||
constexpr SkColor kSliderThumbBrightColor[2] = {
|
||||
SkColorSetRGB(0xF4, 0xF2, 0xEF), SkColorSetRGB(0xD0, 0xD0, 0xD0)};
|
||||
constexpr SkColor kSliderThumbShadedColor[2] = {
|
||||
SkColorSetRGB(0xEA, 0xE5, 0xE0), SkColorSetRGB(0xC4, 0xC4, 0xC4)};
|
||||
constexpr SkColor kSliderThumbHoveredBrightColor[2] = {
|
||||
SK_ColorWHITE, SkColorSetRGB(0xDD, 0xDD, 0xDD)};
|
||||
constexpr SkColor kSliderThumbHoveredShadedColor[2] = {
|
||||
SkColorSetRGB(0xF4, 0xF2, 0xEF), SkColorSetRGB(0xD0, 0xD0, 0xD0)};
|
||||
constexpr SkColor kSliderThumbBorder[2] = {SkColorSetRGB(0x9D, 0x96, 0x8E),
|
||||
SkColorSetRGB(0x63, 0x6C, 0x72)};
|
||||
constexpr SkColor kTextBorderColor[2] = {SkColorSetRGB(0xA9, 0xA9, 0xA9),
|
||||
SkColorSetRGB(0x60, 0x60, 0x60)};
|
||||
constexpr SkColor kProgressBorderColor[2] = {SkColorSetRGB(0xA9, 0xA9, 0xA9),
|
||||
SkColorSetRGB(0x60, 0x60, 0x60)};
|
||||
constexpr SkColor kProgressTickColor[2] = {SkColorSetRGB(0xED, 0xED, 0xED),
|
||||
SkColorSetRGB(0x20, 0x20, 0x20)};
|
||||
constexpr SkColor kProgressValueColor[2] = {gfx::kGoogleBlue300,
|
||||
gfx::kGoogleBlue700};
|
||||
// We are currently only painting kMenuPopupBackground with the kDefault
|
||||
// scheme. If that changes, we need to replace gfx::kPlaceholderColor with an
|
||||
// appropriate dark scheme color. See the DCHECK in PaintMenuPopupBackground().
|
||||
constexpr SkColor kMenuPopupBackgroundColor[2] = {SkColorSetRGB(210, 225, 246),
|
||||
gfx::kPlaceholderColor};
|
||||
constexpr SkColor kCheckboxTinyColor[2] = {SK_ColorGRAY, SK_ColorDKGRAY};
|
||||
constexpr SkColor kCheckboxShadowColor[2] = {SkColorSetA(SK_ColorBLACK, 0x15),
|
||||
SkColorSetA(SK_ColorWHITE, 0x15)};
|
||||
constexpr SkColor kCheckboxShadowHoveredColor[2] = {
|
||||
SkColorSetA(SK_ColorBLACK, 0x1F), SkColorSetA(SK_ColorWHITE, 0x1F)};
|
||||
constexpr SkColor kCheckboxShadowDisabledColor[2] = {
|
||||
SK_ColorTRANSPARENT, SkColorSetA(SK_ColorWHITE, 0x1F)};
|
||||
constexpr SkColor kCheckboxGradientStartColor[2] = {
|
||||
SkColorSetRGB(0xED, 0xED, 0xED), SkColorSetRGB(0x13, 0x13, 0x13)};
|
||||
constexpr SkColor kCheckboxGradientEndColor[2] = {
|
||||
SkColorSetRGB(0xDE, 0xDE, 0xDE), SkColorSetRGB(0x20, 0x20, 0x20)};
|
||||
constexpr U8CPU kCheckboxDisabledGradientAlpha = 0x80;
|
||||
constexpr SkColor kCheckboxPressedGradientStartColor[2] = {
|
||||
SkColorSetRGB(0xE7, 0xE7, 0xE7), SkColorSetRGB(0x19, 0x19, 0x19)};
|
||||
constexpr SkColor kCheckboxPressedGradientEndColor[2] = {
|
||||
SkColorSetRGB(0xD7, 0xD7, 0xD7), SkColorSetRGB(0x27, 0x27, 0x27)};
|
||||
const SkColor kCheckboxHoveredGradientStartColor[2] = {
|
||||
SkColorSetRGB(0xF0, 0xF0, 0xF0), SkColorSetRGB(0x16, 0x16, 0x16)};
|
||||
const SkColor kCheckboxHoveredGradientEndColor[2] = {
|
||||
SkColorSetRGB(0xE0, 0xE0, 0xE0), SkColorSetRGB(0x20, 0x20, 0x20)};
|
||||
constexpr SkColor kCheckboxBorderColor[2] = {SkColorSetA(SK_ColorBLACK, 0x40),
|
||||
SkColorSetA(SK_ColorWHITE, 0x40)};
|
||||
constexpr SkColor kCheckboxBorderHoveredColor[2] = {
|
||||
SkColorSetA(SK_ColorBLACK, 0x4D), SkColorSetA(SK_ColorWHITE, 0x4D)};
|
||||
constexpr SkColor kCheckboxBorderDisabledColor[2] = {
|
||||
SkColorSetA(SK_ColorBLACK, 0x20), SkColorSetA(SK_ColorWHITE, 0x20)};
|
||||
constexpr SkColor kCheckboxStrokeColor[2] = {SkColorSetA(SK_ColorBLACK, 0xB3),
|
||||
SkColorSetA(SK_ColorWHITE, 0xB3)};
|
||||
constexpr SkColor kCheckboxStrokeDisabledColor[2] = {
|
||||
SkColorSetA(SK_ColorBLACK, 0x59), SkColorSetA(SK_ColorWHITE, 0x59)};
|
||||
constexpr SkColor kRadioDotColor[2] = {SkColorSetRGB(0x66, 0x66, 0x66),
|
||||
SkColorSetRGB(0xDD, 0xDD, 0xDD)};
|
||||
constexpr SkColor kRadioDotDisabledColor[2] = {
|
||||
SkColorSetARGB(0x80, 0x66, 0x66, 0x66),
|
||||
SkColorSetARGB(0x80, 0xDD, 0xDD, 0xDD)};
|
||||
constexpr SkColor kArrowDisabledColor[2] = {SK_ColorBLACK, SK_ColorWHITE};
|
||||
constexpr SkColor kButtonBorderColor[2] = {SK_ColorBLACK, SK_ColorWHITE};
|
||||
constexpr SkColor kProgressBackgroundColor[2] = {SK_ColorWHITE, SK_ColorBLACK};
|
||||
|
||||
// The "dash" is 8x2 px by default (the checkbox is 13x13 px).
|
||||
const SkScalar kIndeterminateInsetWidthRatio = (13 - 8) / 2.0f / 13;
|
||||
@ -130,19 +69,6 @@ SkColor GetColor(const SkColor colors[2],
|
||||
return colors[color_scheme == ui::NativeTheme::ColorScheme::kDark ? 1 : 0];
|
||||
}
|
||||
|
||||
// Get lightness adjusted color.
|
||||
SkColor BrightenColor(const color_utils::HSL& hsl, SkAlpha alpha,
|
||||
double lightness_amount) {
|
||||
color_utils::HSL adjusted = hsl;
|
||||
adjusted.l += lightness_amount;
|
||||
if (adjusted.l > 1.0)
|
||||
adjusted.l = 1.0;
|
||||
if (adjusted.l < 0.0)
|
||||
adjusted.l = 0.0;
|
||||
|
||||
return color_utils::HSLToSkColor(adjusted, alpha);
|
||||
}
|
||||
|
||||
// This returns a color scheme which provides enough contrast with the custom
|
||||
// accent-color to make it easy to see.
|
||||
// TODO(crbug.com/1092093): Use separate hard coded colors instead of deferring
|
||||
@ -205,9 +131,7 @@ gfx::Size NativeThemeBase::GetPartSize(Part part,
|
||||
return gfx::Size(); // No default size.
|
||||
case kSliderThumb:
|
||||
// These sizes match the sizes in Chromium Win.
|
||||
if (features::IsFormControlsRefreshEnabled())
|
||||
return gfx::Size(kSliderThumbSize, kSliderThumbSize);
|
||||
return gfx::Size(kSliderThumbWidth, kSliderThumbHeight);
|
||||
case kTabPanelBackground:
|
||||
NOTIMPLEMENTED();
|
||||
break;
|
||||
@ -228,11 +152,6 @@ gfx::Size NativeThemeBase::GetPartSize(Part part,
|
||||
float NativeThemeBase::GetBorderRadiusForPart(Part part,
|
||||
float width,
|
||||
float height) const {
|
||||
if (!features::IsFormControlsRefreshEnabled()) {
|
||||
NOTREACHED() << "GetBorderRadiusForPart only supports FormControlsRefresh.";
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (part) {
|
||||
case kCheckbox:
|
||||
return 2.f;
|
||||
@ -630,15 +549,14 @@ void NativeThemeBase::PaintCheckbox(
|
||||
const ButtonExtraParams& button,
|
||||
ColorScheme color_scheme,
|
||||
const absl::optional<SkColor>& accent_color) const {
|
||||
if (features::IsFormControlsRefreshEnabled()) {
|
||||
color_scheme = ColorSchemeForAccentColor(accent_color, color_scheme);
|
||||
|
||||
const float border_radius =
|
||||
GetBorderRadiusForPart(kCheckbox, rect.width(), rect.height());
|
||||
|
||||
SkRect skrect =
|
||||
PaintCheckboxRadioCommon(canvas, state, rect, button, true,
|
||||
border_radius, color_scheme, accent_color);
|
||||
PaintCheckboxRadioCommon(canvas, state, rect, button, true, border_radius,
|
||||
color_scheme, accent_color);
|
||||
|
||||
if (!skrect.isEmpty()) {
|
||||
cc::PaintFlags flags;
|
||||
@ -651,8 +569,7 @@ void NativeThemeBase::PaintCheckbox(
|
||||
skrect.makeInset(skrect.width() * kIndeterminateInsetWidthRatio,
|
||||
skrect.height() * kIndeterminateInsetHeightRatio);
|
||||
flags.setStyle(cc::PaintFlags::kFill_Style);
|
||||
canvas->drawRoundRect(indeterminate, border_radius, border_radius,
|
||||
flags);
|
||||
canvas->drawRoundRect(indeterminate, border_radius, border_radius, flags);
|
||||
} else if (button.checked) {
|
||||
// Draw the accent background.
|
||||
flags.setStyle(cc::PaintFlags::kFill_Style);
|
||||
@ -677,38 +594,6 @@ void NativeThemeBase::PaintCheckbox(
|
||||
canvas->drawPath(check, flags);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
SkRect skrect =
|
||||
PaintCheckboxRadioCommon(canvas, state, rect, button, true,
|
||||
SkIntToScalar(2), color_scheme, accent_color);
|
||||
if (!skrect.isEmpty()) {
|
||||
// Draw the checkmark / dash.
|
||||
cc::PaintFlags flags;
|
||||
flags.setAntiAlias(true);
|
||||
flags.setStyle(cc::PaintFlags::kStroke_Style);
|
||||
flags.setColor(GetColor(state == kDisabled ? kCheckboxStrokeDisabledColor
|
||||
: kCheckboxStrokeColor,
|
||||
color_scheme));
|
||||
if (button.indeterminate) {
|
||||
SkPath dash;
|
||||
dash.moveTo(skrect.x() + skrect.width() * 0.16,
|
||||
(skrect.y() + skrect.bottom()) / 2);
|
||||
dash.rLineTo(skrect.width() * 0.68, 0);
|
||||
flags.setStrokeWidth(SkFloatToScalar(skrect.height() * 0.2));
|
||||
canvas->drawPath(dash, flags);
|
||||
} else if (button.checked) {
|
||||
SkPath check;
|
||||
check.moveTo(skrect.x() + skrect.width() * 0.2,
|
||||
skrect.y() + skrect.height() * 0.5);
|
||||
check.rLineTo(skrect.width() * 0.2, skrect.height() * 0.2);
|
||||
flags.setStrokeWidth(SkFloatToScalar(skrect.height() * 0.23));
|
||||
check.lineTo(skrect.right() - skrect.width() * 0.2,
|
||||
skrect.y() + skrect.height() * 0.2);
|
||||
canvas->drawPath(check, flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Draws the common elements of checkboxes and radio buttons.
|
||||
@ -723,7 +608,6 @@ SkRect NativeThemeBase::PaintCheckboxRadioCommon(
|
||||
const SkScalar border_radius,
|
||||
ColorScheme color_scheme,
|
||||
const absl::optional<SkColor>& accent_color) const {
|
||||
if (features::IsFormControlsRefreshEnabled()) {
|
||||
color_scheme = ColorSchemeForAccentColor(accent_color, color_scheme);
|
||||
|
||||
SkRect skrect = gfx::RectToSkRect(rect);
|
||||
@ -790,97 +674,8 @@ SkRect NativeThemeBase::PaintCheckboxRadioCommon(
|
||||
flags.setStrokeWidth(kBorderWidth);
|
||||
canvas->drawRoundRect(border_rect, border_radius, border_radius, flags);
|
||||
}
|
||||
|
||||
// Return the rectangle for drawing any additional decorations.
|
||||
return skrect;
|
||||
}
|
||||
|
||||
SkRect skrect = gfx::RectToSkRect(rect);
|
||||
|
||||
// Use the largest square that fits inside the provided rectangle.
|
||||
// No other browser seems to support non-square widget, so accidentally
|
||||
// having non-square sizes is common (eg. amazon and webkit dev tools).
|
||||
if (skrect.width() != skrect.height()) {
|
||||
SkScalar size = std::min(skrect.width(), skrect.height());
|
||||
skrect.inset((skrect.width() - size) / 2, (skrect.height() - size) / 2);
|
||||
}
|
||||
|
||||
// If the rectangle is too small then paint only a rectangle. We don't want
|
||||
// to have to worry about '- 1' and '+ 1' calculations below having overflow
|
||||
// or underflow.
|
||||
if (skrect.width() <= 2) {
|
||||
cc::PaintFlags flags;
|
||||
flags.setColor(GetColor(kCheckboxTinyColor, color_scheme));
|
||||
flags.setStyle(cc::PaintFlags::kFill_Style);
|
||||
canvas->drawRect(skrect, flags);
|
||||
// Too small to draw anything more.
|
||||
return SkRect::MakeEmpty();
|
||||
}
|
||||
|
||||
// Make room for padding/drop shadow.
|
||||
AdjustCheckboxRadioRectForPadding(&skrect);
|
||||
|
||||
// Draw the drop shadow below the widget.
|
||||
if (state != kPressed) {
|
||||
cc::PaintFlags flags;
|
||||
flags.setAntiAlias(true);
|
||||
SkRect shadow_rect = skrect;
|
||||
shadow_rect.offset(0, 1);
|
||||
if (state == kDisabled)
|
||||
flags.setColor(GetColor(kCheckboxShadowDisabledColor, color_scheme));
|
||||
else if (state == kHovered)
|
||||
flags.setColor(GetColor(kCheckboxShadowHoveredColor, color_scheme));
|
||||
else
|
||||
flags.setColor(GetColor(kCheckboxShadowColor, color_scheme));
|
||||
flags.setStyle(cc::PaintFlags::kFill_Style);
|
||||
canvas->drawRoundRect(shadow_rect, border_radius, border_radius, flags);
|
||||
}
|
||||
|
||||
// Draw the gradient-filled rectangle
|
||||
SkPoint gradient_bounds[3];
|
||||
gradient_bounds[0].set(skrect.x(), skrect.y());
|
||||
gradient_bounds[1].set(skrect.x(), skrect.y() + skrect.height() * 0.38);
|
||||
gradient_bounds[2].set(skrect.x(), skrect.bottom());
|
||||
SkColor start_color;
|
||||
SkColor end_color;
|
||||
if (state == kPressed) {
|
||||
start_color = GetColor(kCheckboxPressedGradientStartColor, color_scheme);
|
||||
end_color = GetColor(kCheckboxPressedGradientEndColor, color_scheme);
|
||||
} else if (state == kHovered) {
|
||||
start_color = GetColor(kCheckboxHoveredGradientStartColor, color_scheme);
|
||||
end_color = GetColor(kCheckboxHoveredGradientEndColor, color_scheme);
|
||||
} else /* kNormal or kDisabled */ {
|
||||
start_color = GetColor(kCheckboxGradientStartColor, color_scheme);
|
||||
end_color = GetColor(kCheckboxGradientEndColor, color_scheme);
|
||||
if (state == kDisabled) {
|
||||
start_color = SkColorSetA(start_color, kCheckboxDisabledGradientAlpha);
|
||||
end_color = SkColorSetA(end_color, kCheckboxDisabledGradientAlpha);
|
||||
}
|
||||
}
|
||||
SkColor colors[3] = {start_color, start_color, end_color};
|
||||
cc::PaintFlags flags;
|
||||
flags.setAntiAlias(true);
|
||||
flags.setShader(cc::PaintShader::MakeLinearGradient(
|
||||
gradient_bounds, colors, nullptr, 3, SkTileMode::kClamp));
|
||||
flags.setStyle(cc::PaintFlags::kFill_Style);
|
||||
canvas->drawRoundRect(skrect, border_radius, border_radius, flags);
|
||||
flags.setShader(nullptr);
|
||||
|
||||
// Draw the border.
|
||||
if (state == kHovered)
|
||||
flags.setColor(GetColor(kCheckboxBorderHoveredColor, color_scheme));
|
||||
else if (state == kDisabled)
|
||||
flags.setColor(GetColor(kCheckboxBorderDisabledColor, color_scheme));
|
||||
else
|
||||
flags.setColor(GetColor(kCheckboxBorderColor, color_scheme));
|
||||
flags.setStyle(cc::PaintFlags::kStroke_Style);
|
||||
flags.setStrokeWidth(SkIntToScalar(1));
|
||||
skrect.inset(SkFloatToScalar(.5f), SkFloatToScalar(.5f));
|
||||
canvas->drawRoundRect(skrect, border_radius, border_radius, flags);
|
||||
|
||||
// Return the rectangle excluding the drop shadow for drawing any additional
|
||||
// decorations.
|
||||
return skrect;
|
||||
}
|
||||
|
||||
void NativeThemeBase::PaintRadio(
|
||||
@ -890,7 +685,6 @@ void NativeThemeBase::PaintRadio(
|
||||
const ButtonExtraParams& button,
|
||||
ColorScheme color_scheme,
|
||||
const absl::optional<SkColor>& accent_color) const {
|
||||
if (features::IsFormControlsRefreshEnabled()) {
|
||||
color_scheme = ColorSchemeForAccentColor(accent_color, color_scheme);
|
||||
|
||||
// Most of a radio button is the same as a checkbox, except the the rounded
|
||||
@ -916,28 +710,6 @@ void NativeThemeBase::PaintRadio(
|
||||
// with the border in PaintCheckboxRadioNewCommon.
|
||||
canvas->drawRoundRect(skrect, border_radius, border_radius, flags);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Most of a radio button is the same as a checkbox, except the the rounded
|
||||
// square is a circle (i.e. border radius >= 100%).
|
||||
const SkScalar radius = SkFloatToScalar(
|
||||
static_cast<float>(std::max(rect.width(), rect.height())) / 2);
|
||||
SkRect skrect = PaintCheckboxRadioCommon(canvas, state, rect, button, false,
|
||||
radius, color_scheme, accent_color);
|
||||
if (!skrect.isEmpty() && button.checked) {
|
||||
// Draw the dot.
|
||||
cc::PaintFlags flags;
|
||||
flags.setAntiAlias(true);
|
||||
flags.setStyle(cc::PaintFlags::kFill_Style);
|
||||
flags.setColor(
|
||||
GetColor(state == kDisabled ? kRadioDotDisabledColor : kRadioDotColor,
|
||||
color_scheme));
|
||||
skrect.inset(skrect.width() * 0.25, skrect.height() * 0.25);
|
||||
// Use drawRoundedRect instead of drawOval to be completely consistent
|
||||
// with the border in PaintCheckboxRadioNewCommon.
|
||||
canvas->drawRoundRect(skrect, radius, radius, flags);
|
||||
}
|
||||
}
|
||||
|
||||
void NativeThemeBase::PaintButton(cc::PaintCanvas* canvas,
|
||||
@ -945,7 +717,6 @@ void NativeThemeBase::PaintButton(cc::PaintCanvas* canvas,
|
||||
const gfx::Rect& rect,
|
||||
const ButtonExtraParams& button,
|
||||
ColorScheme color_scheme) const {
|
||||
if (features::IsFormControlsRefreshEnabled()) {
|
||||
cc::PaintFlags flags;
|
||||
SkRect skrect = gfx::RectToSkRect(rect);
|
||||
float border_width = AdjustBorderWidthByZoom(kBorderWidth, button.zoom);
|
||||
@ -975,56 +746,6 @@ void NativeThemeBase::PaintButton(cc::PaintCanvas* canvas,
|
||||
flags.setColor(ButtonBorderColorForState(state, color_scheme));
|
||||
canvas->drawRoundRect(skrect, border_radius, border_radius, flags);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
cc::PaintFlags flags;
|
||||
SkRect skrect = gfx::RectToSkRect(rect);
|
||||
SkColor base_color = button.background_color;
|
||||
|
||||
color_utils::HSL base_hsl;
|
||||
color_utils::SkColorToHSL(base_color, &base_hsl);
|
||||
|
||||
// Our standard gradient is from 0xDD to 0xF8. This is the amount of
|
||||
// increased luminance between those values.
|
||||
SkColor light_color(BrightenColor(base_hsl, SkColorGetA(base_color), 0.105));
|
||||
|
||||
// If the button is too small, fallback to drawing a single, solid color
|
||||
if (rect.width() < 5 || rect.height() < 5) {
|
||||
flags.setColor(base_color);
|
||||
canvas->drawRect(skrect, flags);
|
||||
return;
|
||||
}
|
||||
|
||||
flags.setColor(GetColor(kButtonBorderColor, color_scheme));
|
||||
SkPoint gradient_bounds[2] = {
|
||||
gfx::PointToSkPoint(rect.origin()),
|
||||
gfx::PointToSkPoint(rect.bottom_left() - gfx::Vector2d(0, 1))
|
||||
};
|
||||
if (state == kPressed)
|
||||
std::swap(gradient_bounds[0], gradient_bounds[1]);
|
||||
SkColor colors[2] = { light_color, base_color };
|
||||
|
||||
flags.setStyle(cc::PaintFlags::kFill_Style);
|
||||
flags.setAntiAlias(true);
|
||||
flags.setShader(cc::PaintShader::MakeLinearGradient(
|
||||
gradient_bounds, colors, nullptr, 2, SkTileMode::kClamp));
|
||||
|
||||
canvas->drawRoundRect(skrect, SkIntToScalar(1), SkIntToScalar(1), flags);
|
||||
flags.setShader(nullptr);
|
||||
|
||||
if (button.has_border) {
|
||||
int border_alpha = state == kHovered ? 0x80 : 0x55;
|
||||
if (button.is_focused) {
|
||||
border_alpha = 0xFF;
|
||||
flags.setColor(GetSystemColor(kColorId_FocusedBorderColor, color_scheme));
|
||||
}
|
||||
flags.setStyle(cc::PaintFlags::kStroke_Style);
|
||||
flags.setStrokeWidth(SkIntToScalar(1));
|
||||
flags.setAlpha(border_alpha);
|
||||
skrect.inset(SkFloatToScalar(.5f), SkFloatToScalar(.5f));
|
||||
canvas->drawRoundRect(skrect, SkIntToScalar(1), SkIntToScalar(1), flags);
|
||||
}
|
||||
}
|
||||
|
||||
void NativeThemeBase::PaintTextField(cc::PaintCanvas* canvas,
|
||||
@ -1032,7 +753,6 @@ void NativeThemeBase::PaintTextField(cc::PaintCanvas* canvas,
|
||||
const gfx::Rect& rect,
|
||||
const TextFieldExtraParams& text,
|
||||
ColorScheme color_scheme) const {
|
||||
if (features::IsFormControlsRefreshEnabled()) {
|
||||
SkRect bounds = gfx::RectToSkRect(rect);
|
||||
const SkScalar border_radius =
|
||||
GetBorderRadiusForPart(kTextField, rect.width(), rect.height());
|
||||
@ -1062,24 +782,6 @@ void NativeThemeBase::PaintTextField(cc::PaintCanvas* canvas,
|
||||
stroke_flags.setStrokeWidth(border_width);
|
||||
canvas->drawRoundRect(bounds, border_radius, border_radius, stroke_flags);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
SkRect bounds;
|
||||
bounds.setLTRB(rect.x(), rect.y(), rect.right() - 1, rect.bottom() - 1);
|
||||
|
||||
cc::PaintFlags fill_flags;
|
||||
fill_flags.setStyle(cc::PaintFlags::kFill_Style);
|
||||
fill_flags.setColor(text.background_color);
|
||||
canvas->drawRect(bounds, fill_flags);
|
||||
|
||||
// Text INPUT, listbox SELECT, and TEXTAREA have consistent borders.
|
||||
// border: 1px solid #a9a9a9
|
||||
cc::PaintFlags stroke_flags;
|
||||
stroke_flags.setStyle(cc::PaintFlags::kStroke_Style);
|
||||
stroke_flags.setColor(GetColor(kTextBorderColor, color_scheme));
|
||||
canvas->drawRect(bounds, stroke_flags);
|
||||
}
|
||||
|
||||
void NativeThemeBase::PaintMenuList(cc::PaintCanvas* canvas,
|
||||
@ -1087,13 +789,12 @@ void NativeThemeBase::PaintMenuList(cc::PaintCanvas* canvas,
|
||||
const gfx::Rect& rect,
|
||||
const MenuListExtraParams& menu_list,
|
||||
ColorScheme color_scheme) const {
|
||||
if (features::IsFormControlsRefreshEnabled()) {
|
||||
// If a border radius is specified paint the background and the border of
|
||||
// the menulist, otherwise let the non-theming code paint the background
|
||||
// and the border of the control. The arrow (menulist button) is always
|
||||
// painted by the theming code.
|
||||
if (!menu_list.has_border_radius) {
|
||||
TextFieldExtraParams text_field = {0};
|
||||
TextFieldExtraParams text_field = {false};
|
||||
text_field.background_color = menu_list.background_color;
|
||||
text_field.has_border = menu_list.has_border;
|
||||
text_field.zoom = menu_list.zoom;
|
||||
@ -1131,39 +832,6 @@ void NativeThemeBase::PaintMenuList(cc::PaintCanvas* canvas,
|
||||
path.lineTo(arrow.x() + arrow.width() / 2, arrow.y() + arrow.height());
|
||||
path.lineTo(arrow.x() + arrow.width(), arrow.y());
|
||||
canvas->drawPath(path, flags);
|
||||
return;
|
||||
}
|
||||
|
||||
// If a border radius is specified, we let the WebCore paint the background
|
||||
// and the border of the control.
|
||||
if (!menu_list.has_border_radius) {
|
||||
ButtonExtraParams button = { 0 };
|
||||
button.background_color = menu_list.background_color;
|
||||
button.has_border = menu_list.has_border;
|
||||
PaintButton(canvas, state, rect, button, color_scheme);
|
||||
}
|
||||
|
||||
cc::PaintFlags flags;
|
||||
flags.setColor(menu_list.arrow_color);
|
||||
flags.setAntiAlias(true);
|
||||
flags.setStyle(cc::PaintFlags::kFill_Style);
|
||||
|
||||
int arrow_size = menu_list.arrow_size;
|
||||
gfx::Rect arrow(
|
||||
menu_list.arrow_x,
|
||||
menu_list.arrow_y - (arrow_size / 2),
|
||||
arrow_size,
|
||||
arrow_size);
|
||||
|
||||
// Constrain to the paint rect.
|
||||
arrow.Intersect(rect);
|
||||
|
||||
SkPath path;
|
||||
path.moveTo(arrow.x(), arrow.y());
|
||||
path.lineTo(arrow.right(), arrow.y());
|
||||
path.lineTo(arrow.x() + arrow.width() / 2, arrow.bottom());
|
||||
path.close();
|
||||
canvas->drawPath(path, flags);
|
||||
}
|
||||
|
||||
void NativeThemeBase::PaintMenuPopupBackground(
|
||||
@ -1207,7 +875,6 @@ void NativeThemeBase::PaintSliderTrack(
|
||||
const SliderExtraParams& slider,
|
||||
ColorScheme color_scheme,
|
||||
const absl::optional<SkColor>& accent_color) const {
|
||||
if (features::IsFormControlsRefreshEnabled()) {
|
||||
color_scheme = ColorSchemeForAccentColor(accent_color, color_scheme);
|
||||
|
||||
// Paint the entire slider track.
|
||||
@ -1253,24 +920,6 @@ void NativeThemeBase::PaintSliderTrack(
|
||||
flags.setColor(border_color);
|
||||
track_rect.inset(border_width / 2, border_width / 2);
|
||||
canvas->drawRoundRect(track_rect, border_radius, border_radius, flags);
|
||||
return;
|
||||
}
|
||||
|
||||
const int kMidX = rect.x() + rect.width() / 2;
|
||||
const int kMidY = rect.y() + rect.height() / 2;
|
||||
|
||||
cc::PaintFlags flags;
|
||||
flags.setColor(GetColor(kSliderTrackBackgroundColor, color_scheme));
|
||||
|
||||
SkRect skrect;
|
||||
if (slider.vertical) {
|
||||
skrect.setLTRB(std::max(rect.x(), kMidX - 2), rect.y(),
|
||||
std::min(rect.right(), kMidX + 2), rect.bottom());
|
||||
} else {
|
||||
skrect.setLTRB(rect.x(), std::max(rect.y(), kMidY - 2), rect.right(),
|
||||
std::min(rect.bottom(), kMidY + 2));
|
||||
}
|
||||
canvas->drawRect(skrect, flags);
|
||||
}
|
||||
|
||||
void NativeThemeBase::PaintSliderThumb(
|
||||
@ -1280,7 +929,6 @@ void NativeThemeBase::PaintSliderThumb(
|
||||
const SliderExtraParams& slider,
|
||||
ColorScheme color_scheme,
|
||||
const absl::optional<SkColor>& accent_color) const {
|
||||
if (features::IsFormControlsRefreshEnabled()) {
|
||||
color_scheme = ColorSchemeForAccentColor(accent_color, color_scheme);
|
||||
|
||||
const float radius =
|
||||
@ -1305,45 +953,6 @@ void NativeThemeBase::PaintSliderThumb(
|
||||
}
|
||||
flags.setStyle(cc::PaintFlags::kFill_Style);
|
||||
canvas->drawRoundRect(thumb_rect, radius, radius, flags);
|
||||
return;
|
||||
}
|
||||
|
||||
const bool hovered = (state == kHovered) || slider.in_drag;
|
||||
const int kMidX = rect.x() + rect.width() / 2;
|
||||
const int kMidY = rect.y() + rect.height() / 2;
|
||||
|
||||
cc::PaintFlags flags;
|
||||
flags.setColor(GetColor(
|
||||
hovered ? kSliderThumbHoveredBrightColor : kSliderThumbBrightColor,
|
||||
color_scheme));
|
||||
|
||||
SkIRect skrect;
|
||||
if (slider.vertical)
|
||||
skrect.setLTRB(rect.x(), rect.y(), kMidX + 1, rect.bottom());
|
||||
else
|
||||
skrect.setLTRB(rect.x(), rect.y(), rect.right(), kMidY + 1);
|
||||
|
||||
canvas->drawIRect(skrect, flags);
|
||||
|
||||
flags.setColor(GetColor(
|
||||
hovered ? kSliderThumbHoveredShadedColor : kSliderThumbShadedColor,
|
||||
color_scheme));
|
||||
|
||||
if (slider.vertical)
|
||||
skrect.setLTRB(kMidX + 1, rect.y(), rect.right(), rect.bottom());
|
||||
else
|
||||
skrect.setLTRB(rect.x(), kMidY + 1, rect.right(), rect.bottom());
|
||||
|
||||
canvas->drawIRect(skrect, flags);
|
||||
|
||||
flags.setColor(GetColor(kSliderThumbBorder, color_scheme));
|
||||
DrawBox(canvas, rect, flags);
|
||||
|
||||
if (rect.height() > 10 && rect.width() > 10) {
|
||||
DrawHorizLine(canvas, kMidX - 2, kMidX + 2, kMidY, flags);
|
||||
DrawHorizLine(canvas, kMidX - 2, kMidX + 2, kMidY - 3, flags);
|
||||
DrawHorizLine(canvas, kMidX - 2, kMidX + 2, kMidY + 3, flags);
|
||||
}
|
||||
}
|
||||
|
||||
void NativeThemeBase::PaintInnerSpinButton(
|
||||
@ -1381,7 +990,6 @@ void NativeThemeBase::PaintProgressBar(
|
||||
const ProgressBarExtraParams& progress_bar,
|
||||
ColorScheme color_scheme,
|
||||
const absl::optional<SkColor>& accent_color) const {
|
||||
if (features::IsFormControlsRefreshEnabled()) {
|
||||
DCHECK(!rect.IsEmpty());
|
||||
|
||||
color_scheme = ColorSchemeForAccentColor(accent_color, color_scheme);
|
||||
@ -1426,8 +1034,7 @@ void NativeThemeBase::PaintProgressBar(
|
||||
}
|
||||
|
||||
// Paint the border.
|
||||
float border_width =
|
||||
AdjustBorderWidthByZoom(kBorderWidth, progress_bar.zoom);
|
||||
float border_width = AdjustBorderWidthByZoom(kBorderWidth, progress_bar.zoom);
|
||||
flags.setStyle(cc::PaintFlags::kStroke_Style);
|
||||
flags.setStrokeWidth(border_width);
|
||||
SkColor border_color = GetControlColor(kBorder, color_scheme);
|
||||
@ -1436,44 +1043,6 @@ void NativeThemeBase::PaintProgressBar(
|
||||
flags.setColor(border_color);
|
||||
track_rect.inset(border_width / 2, border_width / 2);
|
||||
canvas->drawRoundRect(track_rect, border_radius, border_radius, flags);
|
||||
return;
|
||||
}
|
||||
|
||||
DCHECK(!rect.IsEmpty());
|
||||
|
||||
canvas->drawColor(GetColor(kProgressBackgroundColor, color_scheme));
|
||||
|
||||
// Draw the tick marks. The spacing between the tick marks is adjusted to
|
||||
// evenly divide into the width.
|
||||
SkPath path;
|
||||
int stroke_width = std::max(1, rect.height() / 18);
|
||||
int tick_width = 16 * stroke_width;
|
||||
int ticks = rect.width() / tick_width + (rect.width() % tick_width ? 1 : 0);
|
||||
SkScalar tick_spacing = SkIntToScalar(rect.width()) / ticks;
|
||||
for (int i = 1; i < ticks; ++i) {
|
||||
path.moveTo(rect.x() + i * tick_spacing, rect.y());
|
||||
path.rLineTo(0, rect.height());
|
||||
}
|
||||
cc::PaintFlags stroke_flags;
|
||||
stroke_flags.setColor(GetColor(kProgressTickColor, color_scheme));
|
||||
stroke_flags.setStyle(cc::PaintFlags::kStroke_Style);
|
||||
stroke_flags.setStrokeWidth(stroke_width);
|
||||
canvas->drawPath(path, stroke_flags);
|
||||
|
||||
// Draw progress.
|
||||
gfx::Rect progress_rect(progress_bar.value_rect_x, progress_bar.value_rect_y,
|
||||
progress_bar.value_rect_width,
|
||||
progress_bar.value_rect_height);
|
||||
cc::PaintFlags progress_flags;
|
||||
progress_flags.setColor(GetColor(kProgressValueColor, color_scheme));
|
||||
progress_flags.setStyle(cc::PaintFlags::kFill_Style);
|
||||
canvas->drawRect(gfx::RectToSkRect(progress_rect), progress_flags);
|
||||
|
||||
// Draw the border.
|
||||
gfx::RectF border_rect(rect);
|
||||
border_rect.Inset(stroke_width / 2.0f, stroke_width / 2.0f);
|
||||
stroke_flags.setColor(GetColor(kProgressBorderColor, color_scheme));
|
||||
canvas->drawRect(gfx::RectFToSkRect(border_rect), stroke_flags);
|
||||
}
|
||||
|
||||
void NativeThemeBase::PaintFrameTopArea(
|
||||
|
@ -109,9 +109,7 @@ namespace ui {
|
||||
|
||||
// static
|
||||
NativeTheme* NativeTheme::GetInstanceForWeb() {
|
||||
if (features::IsFormControlsRefreshEnabled())
|
||||
return NativeThemeAura::web_instance();
|
||||
return NativeThemeMac::instance();
|
||||
}
|
||||
|
||||
// static
|
||||
@ -625,11 +623,7 @@ void NativeThemeMac::InitializeDarkModeStateAndObserver() {
|
||||
}
|
||||
|
||||
void NativeThemeMac::ConfigureWebInstance() {
|
||||
if (!features::IsFormControlsRefreshEnabled())
|
||||
return;
|
||||
|
||||
// For FormControlsRefresh, NativeThemeAura is used as web instance so we need
|
||||
// to initialize its state.
|
||||
// NativeThemeAura is used as web instance so we need to initialize its state.
|
||||
NativeTheme* web_instance = NativeTheme::GetInstanceForWeb();
|
||||
web_instance->set_use_dark_colors(IsDarkMode());
|
||||
web_instance->set_preferred_color_scheme(CalculatePreferredColorScheme());
|
||||
|
@ -110,8 +110,7 @@ class DesktopNativeWidgetTopLevelHandler : public aura::WindowObserver {
|
||||
#if defined(OS_WIN)
|
||||
// For menus, on Windows versions that support drop shadow remove
|
||||
// the standard frame in order to keep just the shadow.
|
||||
if (::features::IsFormControlsRefreshEnabled() &&
|
||||
init_params.type == Widget::InitParams::TYPE_MENU)
|
||||
if (init_params.type == Widget::InitParams::TYPE_MENU)
|
||||
init_params.remove_standard_frame = true;
|
||||
#endif
|
||||
init_params.bounds = bounds;
|
||||
|
@ -109,8 +109,7 @@ void CalculateWindowStylesFromInitParams(
|
||||
break;
|
||||
case Widget::InitParams::TYPE_MENU:
|
||||
*style |= WS_POPUP;
|
||||
if (::features::IsFormControlsRefreshEnabled() &&
|
||||
params.remove_standard_frame) {
|
||||
if (params.remove_standard_frame) {
|
||||
// If the platform doesn't support drop shadow, decorate the Window
|
||||
// with just a border.
|
||||
if (ui::win::IsAeroGlassEnabled())
|
||||
|
Reference in New Issue
Block a user