Commit 4da682b0 authored by Kurt Horimoto's avatar Kurt Horimoto Committed by Commit Bot

[iOS] Created flag for contentInset-based fullscreen implementation.

This CL adds a flag that forces the CRWWebViewContentView to always use
the WKScrollView's contentInset rather than resizing the frame for
fullscreen events.

Bug: none
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I70f2d814a15a24a6a0df3874565d8a41325a162a
Reviewed-on: https://chromium-review.googlesource.com/1009163
Commit-Queue: Kurt Horimoto <kkhorimoto@chromium.org>
Reviewed-by: default avatarPeter Lee <pkl@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550085}
parent 748bc4a0
......@@ -125,6 +125,7 @@ source_set("browser") {
"//ios/chrome/browser/ui:feature_flags",
"//ios/chrome/browser/ui/coordinators:chrome_coordinators",
"//ios/chrome/browser/ui/external_search:features",
"//ios/chrome/browser/ui/fullscreen:features",
"//ios/chrome/browser/ui/history:history_base_feature",
"//ios/chrome/browser/ui/main:feature_flags",
"//ios/chrome/browser/ui/omnibox",
......
......@@ -46,6 +46,7 @@
#include "ios/chrome/browser/mailto/features.h"
#include "ios/chrome/browser/ssl/captive_portal_features.h"
#include "ios/chrome/browser/ui/external_search/features.h"
#import "ios/chrome/browser/ui/fullscreen/fullscreen_features.h"
#import "ios/chrome/browser/ui/history/history_base_feature.h"
#include "ios/chrome/browser/ui/main/main_feature_flags.h"
#import "ios/chrome/browser/ui/popup_menu/popup_menu_flags.h"
......@@ -266,6 +267,9 @@ const flags_ui::FeatureEntry kFeatureEntries[] = {
{"ui-refresh-location-bar", flag_descriptions::kUIRefreshLocationBarName,
flag_descriptions::kUIRefreshLocationBarDescription, flags_ui::kOsIos,
FEATURE_VALUE_TYPE(kUIRefreshLocationBar)},
{"fullscreen-content-inset", flag_descriptions::kFullscreenContentInsetName,
flag_descriptions::kFullscreenContentInsetDescription, flags_ui::kOsIos,
FEATURE_VALUE_TYPE(fullscreen::features::kFullscreenContentInset)},
};
// Add all switches from experimental flags to |command_line|.
......
......@@ -62,6 +62,12 @@ const char kFeedbackKitV2WithSSOServiceName[] =
const char kFeedbackKitV2WithSSOServiceDescription[] =
"Send SSOService with configuration for FeedbackKit V2.";
const char kFullscreenContentInsetName[] = "Fullscreen ContentInset";
const char kFullscreenContentInsetDescription[] =
"When enabled, fullscreen will be implemented by adjusting the "
"contentInset of the WKWebView's scroll view rather than adjusting its "
"frame.";
const char kHistoryBatchUpdatesFilterName[] = "History Single Batch Filtering";
const char kHistoryBatchUpdatesFilterDescription[] =
"When enabled History inserts and deletes history items in the same "
......
......@@ -55,6 +55,11 @@ extern const char kFeedbackKitV2Description[];
extern const char kFeedbackKitV2WithSSOServiceName[];
extern const char kFeedbackKitV2WithSSOServiceDescription[];
// Title and description for the flag used to enable fullscreen's contentInset
// based implementation.
extern const char kFullscreenContentInsetName[];
extern const char kFullscreenContentInsetDescription[];
// Title and description for the flag to enable History batch filtering.
extern const char kHistoryBatchUpdatesFilterName[];
extern const char kHistoryBatchUpdatesFilterDescription[];
......
......@@ -29,6 +29,19 @@ source_set("fullscreen") {
]
}
source_set("features") {
sources = [
"fullscreen_features.h",
"fullscreen_features.mm",
]
configs += [ "//build/config/compiler:enable_arc" ]
deps = [
"//base",
]
}
source_set("coordinators") {
sources = [
"chrome_coordinator+fullscreen_disabling.h",
......@@ -70,6 +83,7 @@ source_set("internal") {
configs += [ "//build/config/compiler:enable_arc" ]
deps = [
":features",
":ui",
"//base",
"//components/keyed_service/ios",
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_FEATURES_H_
#define IOS_CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_FEATURES_H_
#include "base/feature_list.h"
namespace fullscreen {
namespace features {
// Used to control whether fullscreen should be implemented by adjusting the
// WKWebView's contentInset rather than its frame.
extern const base::Feature kFullscreenContentInset;
} // namespace features
} // namespace fullscreen
#endif // IOS_CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_FEATURES_H_
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/chrome/browser/ui/fullscreen/fullscreen_features.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace fullscreen {
namespace features {
const base::Feature kFullscreenContentInset{"FullscreenContentInset",
base::FEATURE_DISABLED_BY_DEFAULT};
} // namespace features
} // namespace fullscreen
......@@ -5,6 +5,7 @@
#import "ios/chrome/browser/ui/fullscreen/fullscreen_web_state_observer.h"
#include "base/logging.h"
#import "ios/chrome/browser/ui/fullscreen/fullscreen_features.h"
#import "ios/chrome/browser/ui/fullscreen/fullscreen_model.h"
#import "ios/chrome/browser/ui/fullscreen/fullscreen_web_view_proxy_observer.h"
#import "ios/chrome/browser/ui/fullscreen/scoped_fullscreen_disabler.h"
......@@ -81,7 +82,10 @@ void FullscreenWebStateObserver::DidFinishNavigation(
// - For normal pages, using |contentInset| breaks the layout of fixed-
// position DOM elements, so top padding must be accomplished by updating
// the WKWebView's frame.
bool force_content_inset = base::FeatureList::IsEnabled(
fullscreen::features::kFullscreenContentInset);
web_state->GetWebViewProxy().shouldUseViewContentInset =
force_content_inset ||
web_state->GetContentsMimeType() == "application/pdf";
// Reset the model so that the toolbar is visible for the new page.
model_->ResetForNavigation();
......
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