Commit 05c382ec authored by Leonard Grey's avatar Leonard Grey Committed by Commit Bot

Views: only install focus ring once in page action view

Bug: 850128
Change-Id: Ifc009ffebaddac9037b7e72175ba571f980ff83a
Reviewed-on: https://chromium-review.googlesource.com/1124759
Commit-Queue: Leonard Grey <lgrey@chromium.org>
Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572241}
parent 0cce2a24
...@@ -44,6 +44,8 @@ PageActionIconView::PageActionIconView(CommandUpdater* command_updater, ...@@ -44,6 +44,8 @@ PageActionIconView::PageActionIconView(CommandUpdater* command_updater,
command_id_(command_id), command_id_(command_id),
active_(false), active_(false),
suppress_mouse_released_action_(false) { suppress_mouse_released_action_(false) {
if (views::PlatformStyle::kPreferFocusRings)
focus_ring_ = views::FocusRing::Install(this);
SetBorder(views::CreateEmptyBorder( SetBorder(views::CreateEmptyBorder(
GetLayoutInsets(LOCATION_BAR_ICON_INTERIOR_PADDING))); GetLayoutInsets(LOCATION_BAR_ICON_INTERIOR_PADDING)));
if (ui::MaterialDesignController::IsNewerMaterialUi()) { if (ui::MaterialDesignController::IsNewerMaterialUi()) {
...@@ -113,8 +115,8 @@ gfx::Size PageActionIconView::CalculatePreferredSize() const { ...@@ -113,8 +115,8 @@ gfx::Size PageActionIconView::CalculatePreferredSize() const {
void PageActionIconView::Layout() { void PageActionIconView::Layout() {
image_->SetBoundsRect(GetContentsBounds()); image_->SetBoundsRect(GetContentsBounds());
if (views::PlatformStyle::kPreferFocusRings) { if (focus_ring_) {
focus_ring_ = views::FocusRing::Install(this); focus_ring_->Layout();
if (LocationBarView::IsRounded()) { if (LocationBarView::IsRounded()) {
SkPath path; SkPath path;
path.addOval(gfx::RectToSkRect(GetLocalBounds())); path.addOval(gfx::RectToSkRect(GetLocalBounds()));
......
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