Commit ded01c18 authored by Éric Noyau's avatar Éric Noyau Committed by Commit Bot

Uses a Lift instead of Highlight hover effect on round buttons.

Bug: 1073961
Change-Id: I25528719e13d340b69681941eee4e817b3a2c2ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2165112
Auto-Submit: Eric Noyau <noyau@chromium.org>
Commit-Queue: edchin <edchin@chromium.org>
Reviewed-by: default avataredchin <edchin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#762444}
parent 2e55226c
......@@ -5,6 +5,7 @@
#import "ios/chrome/browser/ui/omnibox/omnibox_view_controller.h"
#include "base/bind.h"
#include "base/feature_list.h"
#include "base/metrics/user_metrics.h"
#include "base/metrics/user_metrics_action.h"
#include "base/strings/sys_string_conversions.h"
......@@ -340,8 +341,12 @@ const CGFloat kClearButtonSize = 28.0f;
^UIPointerStyle*(UIButton* button, UIPointerEffect* proposedEffect,
UIPointerShape* proposedShape) {
CGRect rect = button.frame;
UITargetedPreview* preview =
[[UITargetedPreview alloc] initWithView:button];
UIPointerLiftEffect* effect =
[UIPointerLiftEffect effectWithPreview:preview];
return [UIPointerStyle
styleWithEffect:proposedEffect
styleWithEffect:effect
shape:[UIPointerShape
shapeWithRoundedRect:rect
cornerRadius:rect.size.width / 2]];
......
......@@ -4,9 +4,11 @@
#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_new_tab_button.h"
#include "base/feature_list.h"
#import "ios/chrome/browser/ui/toolbar/buttons/toolbar_configuration.h"
#import "ios/chrome/browser/ui/toolbar/public/features.h"
#import "ios/chrome/browser/ui/toolbar/public/toolbar_constants.h"
#include "ios/chrome/browser/ui/ui_feature_flags.h"
#import "ios/chrome/common/ui/util/constraints_ui_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
......@@ -53,6 +55,28 @@ const CGFloat kSpotlightHeight = 36.0f;
[spotlightView.widthAnchor constraintEqualToConstant:kSpotlightHeight]
.active = YES;
self.spotlightView = spotlightView;
#if defined(__IPHONE_13_4)
if (@available(iOS 13.4, *)) {
if (base::FeatureList::IsEnabled(kPointerSupport)) {
// Customize the pointer highlight tomatch the spotlight view.
self.pointerStyleProvider =
^UIPointerStyle*(UIButton* button, UIPointerEffect* proposedEffect,
UIPointerShape* proposedShape) {
CGRect rect = button.frame;
UITargetedPreview* preview =
[[UITargetedPreview alloc] initWithView:button];
UIPointerLiftEffect* effect =
[UIPointerLiftEffect effectWithPreview:preview];
return [UIPointerStyle
styleWithEffect:effect
shape:[UIPointerShape
shapeWithRoundedRect:rect
cornerRadius:rect.size.width / 2]];
};
}
}
#endif // defined(__IPHONE_13_4)
}
@end
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