Commit 8c27018b authored by Ella Ge's avatar Ella Ge Committed by Commit Bot

Revert "[AF] GoogleBlue50 as Autofill's field preview bg color"

This reverts commit 3fbdb522.

Reason for revert: failing on Mac10.10 and Mac10.11

Original change's description:
> [AF] GoogleBlue50 as Autofill's field preview bg color
>
> This basically reverts the experimentation scaffolding introduced by
> crrev.com/1174710, and makes GoogleBlue50 the field preview bg color
> for Autofill and Autocomplete.
>
> Bug: 935991
> Change-Id: Id821f57c5a2954d502ca241e4414fd452cc501ce
> Reviewed-on: https://chromium-review.googlesource.com/c/1489173
> Commit-Queue: Fabio Tirelo <ftirelo@chromium.org>
> Reviewed-by: Kent Tamura <tkent@chromium.org>
> Reviewed-by: Tommy Martino <tmartino@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#636103}

TBR=tkent@chromium.org,tmartino@chromium.org,ftirelo@chromium.org

Change-Id: Id05bd9c4b40aa79130779d4602791678566d9c60
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 935991
Reviewed-on: https://chromium-review.googlesource.com/c/1492437
Commit-Queue: Ella Ge <eirage@chromium.org>
Reviewed-by: default avatarElla Ge <eirage@chromium.org>
Cr-Commit-Position: refs/heads/master@{#636133}
parent 972e093f
...@@ -684,6 +684,49 @@ const FeatureEntry::Choice kForceColorProfileChoices[] = { ...@@ -684,6 +684,49 @@ const FeatureEntry::Choice kForceColorProfileChoices[] = {
switches::kForceDisplayColorProfile, "scrgb-linear"}, switches::kForceDisplayColorProfile, "scrgb-linear"},
}; };
const FeatureEntry::FeatureParam kAutofillPreviewStyleBlackOnBlue050[] = {
{blink::features::kAutofillPreviewStyleExperimentBgColorParameterName,
"#E8F0FE"},
{blink::features::kAutofillPreviewStyleExperimentColorParameterName,
"#000000"},
};
const FeatureEntry::FeatureParam kAutofillPreviewStyleBlackOnBlue100[] = {
{blink::features::kAutofillPreviewStyleExperimentBgColorParameterName,
"#D2E3FC"},
{blink::features::kAutofillPreviewStyleExperimentColorParameterName,
"#000000"},
};
const FeatureEntry::FeatureParam kAutofillPreviewStyleBlue900OnBlue050[] = {
{blink::features::kAutofillPreviewStyleExperimentBgColorParameterName,
"#E8F0FE"},
{blink::features::kAutofillPreviewStyleExperimentColorParameterName,
"#174EA6"},
};
const FeatureEntry::FeatureParam kAutofillPreviewStyleBlackOnGreen050[] = {
{blink::features::kAutofillPreviewStyleExperimentBgColorParameterName,
"#E6F4EA"},
{blink::features::kAutofillPreviewStyleExperimentColorParameterName,
"#000000"},
};
const FeatureEntry::FeatureParam kAutofillPreviewStyleBlackOnYellow050[] = {
{blink::features::kAutofillPreviewStyleExperimentBgColorParameterName,
"#FEF7E0"},
{blink::features::kAutofillPreviewStyleExperimentColorParameterName,
"#000000"},
};
const FeatureEntry::FeatureVariation kAutofillPreviewStyleVariations[] = {
{"(Black on GoogleBlue050)", kAutofillPreviewStyleBlackOnBlue050,
base::size(kAutofillPreviewStyleBlackOnBlue050), nullptr},
{"(Black on GoogleBlue100)", kAutofillPreviewStyleBlackOnBlue100,
base::size(kAutofillPreviewStyleBlackOnBlue100), nullptr},
{"(GoogleBlue900 on GoogleBlue050)", kAutofillPreviewStyleBlue900OnBlue050,
base::size(kAutofillPreviewStyleBlue900OnBlue050), nullptr},
{"(Black on GoogleGreen050)", kAutofillPreviewStyleBlackOnGreen050,
base::size(kAutofillPreviewStyleBlackOnGreen050), nullptr},
{"(Black on GoogleYellow050)", kAutofillPreviewStyleBlackOnYellow050,
base::size(kAutofillPreviewStyleBlackOnYellow050), nullptr}};
const FeatureEntry::Choice kAutoplayPolicyChoices[] = { const FeatureEntry::Choice kAutoplayPolicyChoices[] = {
{flags_ui::kGenericExperimentChoiceDefault, "", ""}, {flags_ui::kGenericExperimentChoiceDefault, "", ""},
{flag_descriptions::kAutoplayPolicyNoUserGestureRequired, {flag_descriptions::kAutoplayPolicyNoUserGestureRequired,
...@@ -3362,6 +3405,14 @@ const FeatureEntry kFeatureEntries[] = { ...@@ -3362,6 +3405,14 @@ const FeatureEntry kFeatureEntries[] = {
flag_descriptions::kAutofillDynamicFormsDescription, kOsAll, flag_descriptions::kAutofillDynamicFormsDescription, kOsAll,
FEATURE_VALUE_TYPE(autofill::features::kAutofillDynamicForms)}, FEATURE_VALUE_TYPE(autofill::features::kAutofillDynamicForms)},
{"autofill-preview-style",
flag_descriptions::kAutofillPreviewStyleExperimentName,
flag_descriptions::kAutofillPreviewStyleExperimentDescription, kOsAll,
FEATURE_WITH_PARAMS_VALUE_TYPE(
blink::features::kAutofillPreviewStyleExperiment,
kAutofillPreviewStyleVariations,
"AutofillPreviewStyle")},
{"autofill-prefilled-fields", {"autofill-prefilled-fields",
flag_descriptions::kAutofillPrefilledFieldsName, flag_descriptions::kAutofillPrefilledFieldsName,
flag_descriptions::kAutofillPrefilledFieldsDescription, kOsAll, flag_descriptions::kAutofillPrefilledFieldsDescription, kOsAll,
......
...@@ -140,6 +140,11 @@ const char kAutofillShowFullDisclosureLabelDescription[] = ...@@ -140,6 +140,11 @@ const char kAutofillShowFullDisclosureLabelDescription[] =
"When enabled, the Autofill dropdown's labels are displayed in the full " "When enabled, the Autofill dropdown's labels are displayed in the full "
"disclosure format."; "disclosure format.";
const char kAutofillPreviewStyleExperimentName[] =
"Autofill Preview Style Experiment";
const char kAutofillPreviewStyleExperimentDescription[] =
"Allows experimentation with the Autofill field preview's style.";
const char kAutofillEnforceMinRequiredFieldsForHeuristicsName[] = const char kAutofillEnforceMinRequiredFieldsForHeuristicsName[] =
"Autofill Enforce Min Required Fields For Heuristics"; "Autofill Enforce Min Required Fields For Heuristics";
const char kAutofillEnforceMinRequiredFieldsForHeuristicsDescription[] = const char kAutofillEnforceMinRequiredFieldsForHeuristicsDescription[] =
......
...@@ -122,6 +122,9 @@ extern const char kAutofillProfileServerValidationDescription[]; ...@@ -122,6 +122,9 @@ extern const char kAutofillProfileServerValidationDescription[];
extern const char kAutofillShowFullDisclosureLabelName[]; extern const char kAutofillShowFullDisclosureLabelName[];
extern const char kAutofillShowFullDisclosureLabelDescription[]; extern const char kAutofillShowFullDisclosureLabelDescription[];
extern const char kAutofillPreviewStyleExperimentName[];
extern const char kAutofillPreviewStyleExperimentDescription[];
extern const char kAutofillRestrictUnownedFieldsToFormlessCheckoutName[]; extern const char kAutofillRestrictUnownedFieldsToFormlessCheckoutName[];
extern const char kAutofillRestrictUnownedFieldsToFormlessCheckoutDescription[]; extern const char kAutofillRestrictUnownedFieldsToFormlessCheckoutDescription[];
......
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
namespace blink { namespace blink {
namespace features { namespace features {
const base::Feature kAutofillPreviewStyleExperiment{
"AutofillPreviewStyleExperiment", base::FEATURE_DISABLED_BY_DEFAULT};
// Enable defer commits a bit to avoid flash. // Enable defer commits a bit to avoid flash.
const base::Feature kAvoidFlashBetweenNavigation{ const base::Feature kAvoidFlashBetweenNavigation{
"AvoidFlashBetweenNavigation", base::FEATURE_DISABLED_BY_DEFAULT}; "AvoidFlashBetweenNavigation", base::FEATURE_DISABLED_BY_DEFAULT};
...@@ -188,6 +191,10 @@ const base::Feature kRestrictDeviceSensorEventsToSecureContexts{ ...@@ -188,6 +191,10 @@ const base::Feature kRestrictDeviceSensorEventsToSecureContexts{
"RestrictDeviceSensorEventsToSecureContexts", "RestrictDeviceSensorEventsToSecureContexts",
base::FEATURE_ENABLED_BY_DEFAULT}; base::FEATURE_ENABLED_BY_DEFAULT};
const char kAutofillPreviewStyleExperimentBgColorParameterName[] = "bg_color";
const char kAutofillPreviewStyleExperimentColorParameterName[] = "color";
const char kMixedContentAutoupgradeModeParamName[] = "mode"; const char kMixedContentAutoupgradeModeParamName[] = "mode";
const char kMixedContentAutoupgradeModeBlockable[] = "blockable"; const char kMixedContentAutoupgradeModeBlockable[] = "blockable";
const char kMixedContentAutoupgradeModeOptionallyBlockable[] = const char kMixedContentAutoupgradeModeOptionallyBlockable[] =
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
namespace blink { namespace blink {
namespace features { namespace features {
BLINK_COMMON_EXPORT extern const base::Feature kAutofillPreviewStyleExperiment;
BLINK_COMMON_EXPORT extern const base::Feature kAvoidFlashBetweenNavigation; BLINK_COMMON_EXPORT extern const base::Feature kAvoidFlashBetweenNavigation;
BLINK_COMMON_EXPORT extern const base::Feature BLINK_COMMON_EXPORT extern const base::Feature
kEagerCacheStorageSetupForServiceWorkers; kEagerCacheStorageSetupForServiceWorkers;
...@@ -56,6 +57,11 @@ BLINK_COMMON_EXPORT extern const base::Feature kForbidSyncXHRInPageDismissal; ...@@ -56,6 +57,11 @@ BLINK_COMMON_EXPORT extern const base::Feature kForbidSyncXHRInPageDismissal;
BLINK_COMMON_EXPORT extern const base::Feature BLINK_COMMON_EXPORT extern const base::Feature
kRestrictDeviceSensorEventsToSecureContexts; kRestrictDeviceSensorEventsToSecureContexts;
BLINK_COMMON_EXPORT extern const char
kAutofillPreviewStyleExperimentBgColorParameterName[];
BLINK_COMMON_EXPORT extern const char
kAutofillPreviewStyleExperimentColorParameterName[];
BLINK_COMMON_EXPORT extern const char kMixedContentAutoupgradeModeParamName[]; BLINK_COMMON_EXPORT extern const char kMixedContentAutoupgradeModeParamName[];
BLINK_COMMON_EXPORT extern const char kMixedContentAutoupgradeModeBlockable[]; BLINK_COMMON_EXPORT extern const char kMixedContentAutoupgradeModeBlockable[];
BLINK_COMMON_EXPORT extern const char BLINK_COMMON_EXPORT extern const char
......
...@@ -556,19 +556,6 @@ input[type="image" i] { ...@@ -556,19 +556,6 @@ input[type="image" i] {
cursor: pointer; cursor: pointer;
} }
/* TODO(crbug.com/880258): Use different styles for
`-internal-autofill-previewed` and `-internal-autofill-selected`. */
input:-internal-autofill-previewed,
input:-internal-autofill-selected,
textarea:-internal-autofill-previewed,
textarea:-internal-autofill-selected,
select:-internal-autofill-previewed,
select:-internal-autofill-selected {
background-color: #E8F0FE !important;
background-image:none !important;
color: #000000 !important;
}
input[type="radio" i], input[type="checkbox" i] { input[type="radio" i], input[type="checkbox" i] {
margin: 3px 0.5ex; margin: 3px 0.5ex;
padding: initial; padding: initial;
......
...@@ -21,6 +21,11 @@ ...@@ -21,6 +21,11 @@
#include "third_party/blink/renderer/core/layout/layout_theme.h" #include "third_party/blink/renderer/core/layout/layout_theme.h"
#include <string>
#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/web_rect.h" #include "third_party/blink/public/platform/web_rect.h"
#include "third_party/blink/public/web/blink.h" #include "third_party/blink/public/web/blink.h"
...@@ -52,6 +57,7 @@ ...@@ -52,6 +57,7 @@
#include "third_party/blink/renderer/platform/file_metadata.h" #include "third_party/blink/renderer/platform/file_metadata.h"
#include "third_party/blink/renderer/platform/fonts/font_selector.h" #include "third_party/blink/renderer/platform/fonts/font_selector.h"
#include "third_party/blink/renderer/platform/fonts/string_truncator.h" #include "third_party/blink/renderer/platform/fonts/string_truncator.h"
#include "third_party/blink/renderer/platform/graphics/color.h"
#include "third_party/blink/renderer/platform/graphics/touch_action.h" #include "third_party/blink/renderer/platform/graphics/touch_action.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/text/platform_locale.h" #include "third_party/blink/renderer/platform/text/platform_locale.h"
...@@ -64,6 +70,36 @@ ...@@ -64,6 +70,36 @@
namespace blink { namespace blink {
namespace {
void GetAutofillPreviewColorsFromFieldTrial(std::string* color,
std::string* background_color) {
constexpr char kAutofillDefaultBackgroundColor[] = "#FAFFBD";
constexpr char kAutofillDefaultColor[] = "#000000";
if (base::FeatureList::IsEnabled(features::kAutofillPreviewStyleExperiment)) {
std::string bg_color_param = base::GetFieldTrialParamValueByFeature(
features::kAutofillPreviewStyleExperiment,
features::kAutofillPreviewStyleExperimentBgColorParameterName);
std::string color_param = base::GetFieldTrialParamValueByFeature(
features::kAutofillPreviewStyleExperiment,
features::kAutofillPreviewStyleExperimentColorParameterName);
if (Color().SetFromString(bg_color_param.c_str()) &&
Color().SetFromString(color_param.c_str())) {
*background_color = bg_color_param;
*color = color_param;
return;
}
}
// Fallback to the default colors if the experiment is not enabled or if a
// color param is invalid.
*background_color = std::string(kAutofillDefaultBackgroundColor);
*color = std::string(kAutofillDefaultColor);
}
} // namespace
// Wrapper function defined in WebKit.h // Wrapper function defined in WebKit.h
void SetMockThemeEnabledForTest(bool value) { void SetMockThemeEnabledForTest(bool value) {
WebTestSupport::SetMockThemeEnabledForTest(value); WebTestSupport::SetMockThemeEnabledForTest(value);
...@@ -263,7 +299,23 @@ void LayoutTheme::AdjustStyle(ComputedStyle& style, Element* e) { ...@@ -263,7 +299,23 @@ void LayoutTheme::AdjustStyle(ComputedStyle& style, Element* e) {
} }
String LayoutTheme::ExtraDefaultStyleSheet() { String LayoutTheme::ExtraDefaultStyleSheet() {
return g_empty_string; std::string color, background_color;
GetAutofillPreviewColorsFromFieldTrial(&color, &background_color);
// TODO(crbug.com/880258): Use different styles for
// `-internal-autofill-previewed` and `-internal-autofill-selected`.
constexpr char const format[] =
"input:-internal-autofill-previewed,"
"input:-internal-autofill-selected,"
"textarea:-internal-autofill-previewed,"
"textarea:-internal-autofill-selected,"
"select:-internal-autofill-previewed,"
"select:-internal-autofill-selected "
"{"
" background-color: %s !important;"
" background-image:none !important;"
" color: %s !important;"
"}";
return String::Format(format, background_color.c_str(), color.c_str());
} }
String LayoutTheme::ExtraQuirksStyleSheet() { String LayoutTheme::ExtraQuirksStyleSheet() {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<style> <style>
select { select {
width: 168px; width: 168px;
padding: 5px; padding: 5px;
font-size: 16px; font-size: 16px;
height: 34px; height: 34px;
background: transparent; background: transparent;
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
if (window.testRunner) if (window.testRunner)
testRunner.setUseMockTheme(false); testRunner.setUseMockTheme(false);
</script> </script>
<p>The background should be blue.</p> <p>The background should be yellow.</p>
<select id = "select"> <select id = "select">
<option>CA</option> <option>CA</option>
<option>TX</option> <option>TX</option>
...@@ -21,6 +21,6 @@ if (window.testRunner) ...@@ -21,6 +21,6 @@ if (window.testRunner)
<script> <script>
var select = document.getElementById('select'); var select = document.getElementById('select');
if (window.internals) if (window.internals)
internals.setAutofilled(select, true); internals.setAutofilled(select, true);
</script> </script>
</body> </body>
...@@ -31621,6 +31621,7 @@ from previous Chrome versions. ...@@ -31621,6 +31621,7 @@ from previous Chrome versions.
<int value="-844537521" label="HttpFormWarning:disabled"/> <int value="-844537521" label="HttpFormWarning:disabled"/>
<int value="-844381918" label="ArcNativeBridgeExperiment:disabled"/> <int value="-844381918" label="ArcNativeBridgeExperiment:disabled"/>
<int value="-842438090" label="enable-md-feedback"/> <int value="-842438090" label="enable-md-feedback"/>
<int value="-841849040" label="AutofillPreviewStyleExperiment:enabled"/>
<int value="-839664591" label="enable-web-authentication-testing-api"/> <int value="-839664591" label="enable-web-authentication-testing-api"/>
<int value="-836123854" label="wallet-service-use-sandbox"/> <int value="-836123854" label="wallet-service-use-sandbox"/>
<int value="-835672415" label="PointerEventV1SpecCapturing:disabled"/> <int value="-835672415" label="PointerEventV1SpecCapturing:disabled"/>
...@@ -32131,6 +32132,7 @@ from previous Chrome versions. ...@@ -32131,6 +32132,7 @@ from previous Chrome versions.
<int value="36422284" <int value="36422284"
label="AutofillSaveCardDialogUnlabeledExpirationDate:enabled"/> label="AutofillSaveCardDialogUnlabeledExpirationDate:enabled"/>
<int value="37024318" label="disable-affiliation-based-matching"/> <int value="37024318" label="disable-affiliation-based-matching"/>
<int value="37045987" label="AutofillPreviewStyleExperiment:disabled"/>
<int value="42098736" label="TranslateAndroidManualTrigger:disabled"/> <int value="42098736" label="TranslateAndroidManualTrigger:disabled"/>
<int value="42844603" label="AndroidSurfaceControl:disabled"/> <int value="42844603" label="AndroidSurfaceControl:disabled"/>
<int value="43951968" label="DesktopPWAsCustomTabUI:enabled"/> <int value="43951968" label="DesktopPWAsCustomTabUI:enabled"/>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment