Commit 2dbfbc53 authored by Robbie Gibson's avatar Robbie Gibson Committed by Commit Bot

[iOS] Disable Text Zoom on iPad

Text Zoom does not work on iPad because the Javascript property used
to change the content size doesn't work on iPad in iOS 13.

Bug: 1061119
Change-Id: Icc46da8c2a6990388b72312eaa4d4fd5807bd29c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2152812
Commit-Queue: Robbie Gibson <rkgibson@google.com>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#760068}
parent e0e478f1
...@@ -135,6 +135,7 @@ source_set("unit_tests") { ...@@ -135,6 +135,7 @@ source_set("unit_tests") {
"//testing/gmock", "//testing/gmock",
"//testing/gtest", "//testing/gtest",
"//third_party/ocmock", "//third_party/ocmock",
"//ui/base:base",
] ]
configs += [ "//build/config/compiler:enable_arc" ] configs += [ "//build/config/compiler:enable_arc" ]
} }
......
...@@ -853,7 +853,8 @@ PopupMenuToolsItem* CreateTableViewItem(int titleID, ...@@ -853,7 +853,8 @@ PopupMenuToolsItem* CreateTableViewItem(int titleID,
[actionsArray addObject:self.findInPageItem]; [actionsArray addObject:self.findInPageItem];
// Text Zoom // Text Zoom
if (base::FeatureList::IsEnabled(web::kWebPageTextAccessibility)) { if (!IsIPadIdiom() &&
base::FeatureList::IsEnabled(web::kWebPageTextAccessibility)) {
self.textZoomItem = CreateTableViewItem( self.textZoomItem = CreateTableViewItem(
IDS_IOS_TOOLS_MENU_TEXT_ZOOM, PopupMenuActionTextZoom, IDS_IOS_TOOLS_MENU_TEXT_ZOOM, PopupMenuActionTextZoom,
@"popup_menu_text_zoom", kToolsMenuTextZoom); @"popup_menu_text_zoom", kToolsMenuTextZoom);
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include "testing/platform_test.h" #include "testing/platform_test.h"
#import "third_party/ocmock/OCMock/OCMock.h" #import "third_party/ocmock/OCMock/OCMock.h"
#include "third_party/ocmock/gtest_support.h" #include "third_party/ocmock/gtest_support.h"
#include "ui/base/device_form_factor.h"
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support." #error "This file requires ARC support."
...@@ -368,7 +369,11 @@ TEST_F(PopupMenuMediatorTest, TestReadLaterDisabled) { ...@@ -368,7 +369,11 @@ TEST_F(PopupMenuMediatorTest, TestReadLaterDisabled) {
} }
// Tests that the "Text Zoom..." button is disabled on non-HTML pages. // Tests that the "Text Zoom..." button is disabled on non-HTML pages.
TEST_F(PopupMenuMediatorTest, TextTextZoomDisabled) { TEST_F(PopupMenuMediatorTest, TestTextZoomDisabled) {
// This feature is currently disabled on iPad. See crbug.com/1061119.
if (ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_TABLET) {
return;
}
base::test::ScopedFeatureList feature_list; base::test::ScopedFeatureList feature_list;
feature_list.InitAndEnableFeature(web::kWebPageTextAccessibility); feature_list.InitAndEnableFeature(web::kWebPageTextAccessibility);
...@@ -388,3 +393,24 @@ TEST_F(PopupMenuMediatorTest, TextTextZoomDisabled) { ...@@ -388,3 +393,24 @@ TEST_F(PopupMenuMediatorTest, TextTextZoomDisabled) {
web_state_->OnNavigationFinished(&context); web_state_->OnNavigationFinished(&context);
EXPECT_TRUE(HasItem(consumer, kToolsMenuTextZoom, /*enabled=*/NO)); EXPECT_TRUE(HasItem(consumer, kToolsMenuTextZoom, /*enabled=*/NO));
} }
// Tests that this feature is disabled on iPad, no matter the state of the
// Feature flag. See crbug.com/1061119.
TEST_F(PopupMenuMediatorTest, TestTextZoomDisabledIPad) {
if (ui::GetDeviceFormFactor() != ui::DEVICE_FORM_FACTOR_TABLET) {
return;
}
base::test::ScopedFeatureList feature_list;
feature_list.InitAndEnableFeature(web::kWebPageTextAccessibility);
CreateMediator(PopupMenuTypeToolsMenu, /*is_incognito=*/NO,
/*trigger_incognito_hint=*/NO);
mediator_.webStateList = web_state_list_.get();
FakePopupMenuConsumer* consumer = [[FakePopupMenuConsumer alloc] init];
mediator_.popupMenu = consumer;
FontSizeTabHelper::CreateForWebState(web_state_list_->GetWebStateAt(0));
SetUpActiveWebState();
EXPECT_FALSE(HasItem(consumer, kToolsMenuTextZoom, /*enabled=*/YES));
}
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