Commit 246c8db4 authored by Robbie Gibson's avatar Robbie Gibson Committed by Commit Bot

[iOS][Dark Mode] Support dark mode on overscroll actions

Bug: 986804, 987907
Change-Id: Ibf4b7664100f9d318c2110017ea631dc28d66866
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1713536
Commit-Queue: Robbie Gibson <rkgibson@google.com>
Reviewed-by: default avatarKurt Horimoto <kkhorimoto@chromium.org>
Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682247}
parent de65a83d
...@@ -30,6 +30,7 @@ source_set("unit_tests") { ...@@ -30,6 +30,7 @@ source_set("unit_tests") {
"//base/test:test_support", "//base/test:test_support",
"//ios/chrome/browser/browser_state:test_support", "//ios/chrome/browser/browser_state:test_support",
"//ios/chrome/browser/ui/overscroll_actions", "//ios/chrome/browser/ui/overscroll_actions",
"//ios/chrome/common/colors",
"//ios/chrome/test/fakes", "//ios/chrome/test/fakes",
"//ios/web/public", "//ios/web/public",
"//ios/web/public/test", "//ios/web/public/test",
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h"
#import "ios/chrome/browser/ui/overscroll_actions/overscroll_actions_controller.h" #import "ios/chrome/browser/ui/overscroll_actions/overscroll_actions_controller.h"
#import "ios/chrome/browser/ui/overscroll_actions/overscroll_actions_view.h" #import "ios/chrome/browser/ui/overscroll_actions/overscroll_actions_view.h"
#import "ios/chrome/common/colors/incognito_color_util.h"
#import "ios/chrome/common/colors/semantic_color_names.h"
#import "ios/chrome/test/fakes/fake_overscroll_actions_controller_delegate.h" #import "ios/chrome/test/fakes/fake_overscroll_actions_controller_delegate.h"
#import "ios/web/public/test/fakes/test_web_state.h" #import "ios/web/public/test/fakes/test_web_state.h"
#include "ios/web/public/test/test_web_thread_bundle.h" #include "ios/web/public/test/test_web_thread_bundle.h"
...@@ -112,9 +114,7 @@ TEST_F(OverscrollActionsTabHelperTest, MAYBE_TestRegularBrowserStateStyle) { ...@@ -112,9 +114,7 @@ TEST_F(OverscrollActionsTabHelperTest, MAYBE_TestRegularBrowserStateStyle) {
web_state_.SetBrowserState(browser_state_.get()); web_state_.SetBrowserState(browser_state_.get());
overscroll_tab_helper()->SetDelegate(overscroll_delegate_); overscroll_tab_helper()->SetDelegate(overscroll_delegate_);
SimulatePullForRefreshAction(); SimulatePullForRefreshAction();
UIColor* expected_color = UIColor* expected_color = [UIColor colorNamed:kBackgroundColor];
[UIColor colorWithWhite:kActionViewBackgroundColorBrightnessNonIncognito
alpha:1.0];
EXPECT_TRUE(action_view()); EXPECT_TRUE(action_view());
EXPECT_NSEQ(expected_color, action_view().backgroundColor); EXPECT_NSEQ(expected_color, action_view().backgroundColor);
} }
...@@ -135,9 +135,11 @@ TEST_F(OverscrollActionsTabHelperTest, ...@@ -135,9 +135,11 @@ TEST_F(OverscrollActionsTabHelperTest,
browser_state_->GetOffTheRecordChromeBrowserState()); browser_state_->GetOffTheRecordChromeBrowserState());
overscroll_tab_helper()->SetDelegate(overscroll_delegate_); overscroll_tab_helper()->SetDelegate(overscroll_delegate_);
SimulatePullForRefreshAction(); SimulatePullForRefreshAction();
// For iOS 13 and dark mode, the incognito overscroll actions view uses a
// dynamic color.
UIColor* expected_color = UIColor* expected_color =
[UIColor colorWithWhite:kActionViewBackgroundColorBrightnessIncognito color::IncognitoDynamicColor(true, [UIColor colorNamed:kBackgroundColor],
alpha:1.0]; [UIColor colorNamed:kBackgroundDarkColor]);
EXPECT_TRUE(action_view()); EXPECT_TRUE(action_view());
EXPECT_NSEQ(expected_color, action_view().backgroundColor); EXPECT_NSEQ(expected_color, action_view().backgroundColor);
} }
......
...@@ -34,6 +34,7 @@ source_set("overscroll_actions") { ...@@ -34,6 +34,7 @@ source_set("overscroll_actions") {
"//ios/chrome/browser/ui/toolbar/public", "//ios/chrome/browser/ui/toolbar/public",
"//ios/chrome/browser/ui/util", "//ios/chrome/browser/ui/util",
"//ios/chrome/browser/ui/voice", "//ios/chrome/browser/ui/voice",
"//ios/chrome/common/colors",
"//ios/public/provider/chrome/browser", "//ios/public/provider/chrome/browser",
"//ios/public/provider/chrome/browser/ui", "//ios/public/provider/chrome/browser/ui",
"//ios/web/common", "//ios/web/common",
......
...@@ -367,7 +367,7 @@ NSString* const kOverscrollActionsDidEnd = @"OverscrollActionsDidStop"; ...@@ -367,7 +367,7 @@ NSString* const kOverscrollActionsDidEnd = @"OverscrollActionsDidStop";
} }
- (void)setStyle:(OverscrollStyle)style { - (void)setStyle:(OverscrollStyle)style {
[self.overscrollActionView setStyle:style]; self.overscrollActionView.style = style;
} }
#pragma mark - webViewScrollView and UIScrollView delegates implementations #pragma mark - webViewScrollView and UIScrollView delegates implementations
......
...@@ -58,6 +58,8 @@ extern const CGFloat kActionViewBackgroundColorBrightnessIncognito; ...@@ -58,6 +58,8 @@ extern const CGFloat kActionViewBackgroundColorBrightnessIncognito;
@property(nonatomic, strong, readonly) UIView* backgroundView; @property(nonatomic, strong, readonly) UIView* backgroundView;
// Whether cropping is set on the selection circle (true by default). // Whether cropping is set on the selection circle (true by default).
@property(nonatomic, assign) BOOL selectionCroppingEnabled; @property(nonatomic, assign) BOOL selectionCroppingEnabled;
// The current style of the overscroll actions UI.
@property(nonatomic, assign) OverscrollStyle style;
@property(nonatomic, assign) id<OverscrollActionsViewDelegate> delegate; @property(nonatomic, assign) id<OverscrollActionsViewDelegate> delegate;
...@@ -82,9 +84,6 @@ extern const CGFloat kActionViewBackgroundColorBrightnessIncognito; ...@@ -82,9 +84,6 @@ extern const CGFloat kActionViewBackgroundColorBrightnessIncognito;
// action has been selected. // action has been selected.
- (void)displayActionAnimation; - (void)displayActionAnimation;
// Sets the style of the overscroll action UI.
- (void)setStyle:(OverscrollStyle)style;
@end @end
#endif // IOS_CHROME_BROWSER_UI_OVERSCROLL_ACTIONS_OVERSCROLL_ACTIONS_VIEW_H_ #endif // IOS_CHROME_BROWSER_UI_OVERSCROLL_ACTIONS_OVERSCROLL_ACTIONS_VIEW_H_
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