Commit 481a9326 authored by Chris Lu's avatar Chris Lu Committed by Commit Bot

[ios] Remove unused viewport adjustment experiments

Code does not use these experiment enums anymore. Only kSmoothScrollingDefault
is used to determine how to adjust the viewport insets.

Bug: 914042
Change-Id: I71c4112d7f2f820a4793d74d0c5a0726513f300a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1812121Reviewed-by: default avatarKurt Horimoto <kkhorimoto@chromium.org>
Commit-Queue: Chris Lu <thegreenfrog@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699980}
parent 4243189a
...@@ -323,11 +323,9 @@ const flags_ui::FeatureEntry kFeatureEntries[] = { ...@@ -323,11 +323,9 @@ const flags_ui::FeatureEntry kFeatureEntries[] = {
flags_ui::kOsIos, flags_ui::kOsIos,
FEATURE_VALUE_TYPE(autofill::features::kAutofillRichMetadataQueries)}, FEATURE_VALUE_TYPE(autofill::features::kAutofillRichMetadataQueries)},
{"fullscreen-viewport-adjustment-experiment", {"fullscreen-viewport-adjustment-experiment",
flag_descriptions::kFullscreenViewportAdjustmentExperimentName, flag_descriptions::kFullscreenSmoothScrollingName,
flag_descriptions::kFullscreenViewportAdjustmentExperimentDescription, flag_descriptions::kFullscreenSmoothScrollingDescription, flags_ui::kOsIos,
flags_ui::kOsIos, FEATURE_VALUE_TYPE(fullscreen::features::kSmoothScrollingDefault)},
MULTI_VALUE_TYPE(
fullscreen::features::kViewportAdjustmentExperimentChoices)},
{"autofill-enforce-min-required-fields-for-heuristics", {"autofill-enforce-min-required-fields-for-heuristics",
flag_descriptions::kAutofillEnforceMinRequiredFieldsForHeuristicsName, flag_descriptions::kAutofillEnforceMinRequiredFieldsForHeuristicsName,
flag_descriptions:: flag_descriptions::
......
...@@ -204,11 +204,10 @@ const char kFindInPageiFrameName[] = "Find in Page in iFrames."; ...@@ -204,11 +204,10 @@ const char kFindInPageiFrameName[] = "Find in Page in iFrames.";
const char kFindInPageiFrameDescription[] = const char kFindInPageiFrameDescription[] =
"When enabled, Find In Page will search in iFrames."; "When enabled, Find In Page will search in iFrames.";
const char kFullscreenViewportAdjustmentExperimentName[] = const char kFullscreenSmoothScrollingName[] = "Fullscreen Smooth Scrolling";
"Fullscreen Viewport Adjustment Mode"; const char kFullscreenSmoothScrollingDescription[] =
const char kFullscreenViewportAdjustmentExperimentDescription[] = "When enabled, the web view's insets are updated for scoll events. If "
"The different ways in which the web view's viewport is updated for scroll " "disabled, the the web view's frame are updated.";
"events. The default option updates the web view's frame.";
const char kIgnoresViewportScaleLimitsName[] = "Ignore Viewport Scale Limits"; const char kIgnoresViewportScaleLimitsName[] = "Ignore Viewport Scale Limits";
const char kIgnoresViewportScaleLimitsDescription[] = const char kIgnoresViewportScaleLimitsDescription[] =
......
...@@ -169,8 +169,8 @@ extern const char kFindInPageiFrameDescription[]; ...@@ -169,8 +169,8 @@ extern const char kFindInPageiFrameDescription[];
// Title and description for the command line switch used to determine the // Title and description for the command line switch used to determine the
// active fullscreen viewport adjustment mode. // active fullscreen viewport adjustment mode.
extern const char kFullscreenViewportAdjustmentExperimentName[]; extern const char kFullscreenSmoothScrollingName[];
extern const char kFullscreenViewportAdjustmentExperimentDescription[]; extern const char kFullscreenSmoothScrollingDescription[];
// Title and description for the flag to ignore viewport scale limits. // Title and description for the flag to ignore viewport scale limits.
extern const char kIgnoresViewportScaleLimitsName[]; extern const char kIgnoresViewportScaleLimitsName[];
......
...@@ -11,37 +11,10 @@ ...@@ -11,37 +11,10 @@
namespace fullscreen { namespace fullscreen {
namespace features { namespace features {
// The name of the command line switch used to control the method by which the
// viewport of the content area is updated by scrolling events.
extern const char kViewportAdjustmentExperimentCommandLineSwitch[];
// The available viewport adjustment experiments. The choices in this array
// correspond with the ViewportAdjustmentExperiment values.
extern const flags_ui::FeatureEntry::Choice
kViewportAdjustmentExperimentChoices[6];
// Feature used by finch config to enable smooth scrolling when the default // Feature used by finch config to enable smooth scrolling when the default
// viewport adjustment experiment is selected via command line switches. // viewport adjustment experiment is selected via command line switches.
extern const base::Feature kSmoothScrollingDefault; extern const base::Feature kSmoothScrollingDefault;
// Enum type describing viewport adjustment experiments.
enum class ViewportAdjustmentExperiment : short {
FRAME = 0, // Adjust the viewport by resizing the entire WKWebView.
CONTENT_INSET, // Adjust the viewport by updating the WKWebView's scroll view
// contentInset.
SAFE_AREA, // Adjust the viewport by updating the safe area of the browser
// container view.
HYBRID, // Translates the web view up and down and updates the viewport using
// safe area insets.
SMOOTH_SCROLLING, // Adjusts the viewport using the smooth scrolling
// workaround.
};
// Convenience method for retrieving the active viewport adjustment experiment
// from the command line. TODO(crbug.com/914042): Remove once the internal
// references are moved to ShouldUseSmoothScrolling().
ViewportAdjustmentExperiment GetActiveViewportExperiment();
// Convenience method for determining when to adjust the viewport by resizing // Convenience method for determining when to adjust the viewport by resizing
// WKWebView or using smooth scrolling. // WKWebView or using smooth scrolling.
bool ShouldUseSmoothScrolling(); bool ShouldUseSmoothScrolling();
......
...@@ -11,59 +11,12 @@ ...@@ -11,59 +11,12 @@
#error "This file requires ARC support." #error "This file requires ARC support."
#endif #endif
namespace {
// The command line values for the content inset and safe area experiment
// choices.
const char kFrameChoiceValue[] = "frame";
const char kContentInsetChoiceValue[] = "content-inset";
const char kSafeAreaChoiceValue[] = "safe-area";
const char kHybridChoiceValue[] = "hybrid";
const char kSmoothScrollingChoiceValue[] = "smooth";
}
namespace fullscreen { namespace fullscreen {
namespace features { namespace features {
const char kViewportAdjustmentExperimentCommandLineSwitch[] =
"fullscreen-viewport-adjustment-experiment";
const flags_ui::FeatureEntry::Choice kViewportAdjustmentExperimentChoices[] = {
{flags_ui::kGenericExperimentChoiceDefault, "", ""},
{"Update Content Inset", kViewportAdjustmentExperimentCommandLineSwitch,
"content-inset"},
{"Update Safe Area", kViewportAdjustmentExperimentCommandLineSwitch,
"safe-area"},
{"Use Hybrid Implementation",
kViewportAdjustmentExperimentCommandLineSwitch, "hybrid"},
{"Use Smooth Scrolling", kViewportAdjustmentExperimentCommandLineSwitch,
"smooth"},
{"Update Frame", kViewportAdjustmentExperimentCommandLineSwitch, "frame"}};
const base::Feature kSmoothScrollingDefault{"FullscreenSmoothScrollingDefault", const base::Feature kSmoothScrollingDefault{"FullscreenSmoothScrollingDefault",
base::FEATURE_ENABLED_BY_DEFAULT}; base::FEATURE_ENABLED_BY_DEFAULT};
ViewportAdjustmentExperiment GetActiveViewportExperiment() {
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(kViewportAdjustmentExperimentCommandLineSwitch)) {
std::string viewport_experiment = command_line->GetSwitchValueASCII(
kViewportAdjustmentExperimentCommandLineSwitch);
if (viewport_experiment == std::string(kContentInsetChoiceValue))
return ViewportAdjustmentExperiment::CONTENT_INSET;
if (viewport_experiment == std::string(kSafeAreaChoiceValue))
return ViewportAdjustmentExperiment::SAFE_AREA;
if (viewport_experiment == std::string(kHybridChoiceValue))
return ViewportAdjustmentExperiment::HYBRID;
if (viewport_experiment == std::string(kSmoothScrollingChoiceValue))
return ViewportAdjustmentExperiment::SMOOTH_SCROLLING;
if (viewport_experiment == std::string(kFrameChoiceValue))
return ViewportAdjustmentExperiment::FRAME;
}
return base::FeatureList::IsEnabled(kSmoothScrollingDefault)
? ViewportAdjustmentExperiment::SMOOTH_SCROLLING
: ViewportAdjustmentExperiment::FRAME;
}
bool ShouldUseSmoothScrolling() { bool ShouldUseSmoothScrolling() {
return base::FeatureList::IsEnabled(kSmoothScrollingDefault); return base::FeatureList::IsEnabled(kSmoothScrollingDefault);
} }
......
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