Commit caa76e71 authored by Kevin Bailey's avatar Kevin Bailey Committed by Commit Bot

[omnibox] Fix tab switch button pressed coloring

Restores (dark) pressed color to tab switch button, which was
unintentionally removed in prior CL. Also creates an ink
drop mask for the tab switch button, due to discovering that ink drop
was extending beyond border. (A more general solution is being
worked on.)

Bug: 780835
Change-Id: Id96f4c1695b0f0dceed1e122b55f0f029f813fa0
Reviewed-on: https://chromium-review.googlesource.com/1103140
Commit-Queue: Kevin Bailey <krb@chromium.org>
Reviewed-by: default avatarJustin Donnelly <jdonnelly@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568479}
parent e139e638
......@@ -17,6 +17,7 @@
#include "ui/gfx/color_palette.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/views/animation/ink_drop_mask.h"
bool OmniboxTabSwitchButton::calculated_widths_ = false;
size_t OmniboxTabSwitchButton::icon_only_width_;
......@@ -75,6 +76,12 @@ void OmniboxTabSwitchButton::OnBoundsChanged(const gfx::Rect& previous_bounds) {
focus_ring()->SetPath(GetFocusRingPath());
}
std::unique_ptr<views::InkDropMask> OmniboxTabSwitchButton::CreateInkDropMask()
const {
return std::make_unique<views::RoundRectInkDropMask>(
size(), gfx::Insets(), CalculatePreferredSize().height() / 2.f);
}
void OmniboxTabSwitchButton::AnimationProgressed(
const gfx::Animation* animation) {
if (animation != animation_.get()) {
......@@ -159,9 +166,10 @@ SkColor OmniboxTabSwitchButton::GetBackgroundColor() const {
}
void OmniboxTabSwitchButton::SetPressed() {
SetBgColorOverride(GetOmniboxColor(OmniboxPart::RESULTS_BACKGROUND,
result_view_->GetTint(),
OmniboxPartState::NORMAL));
SetBgColorOverride(color_utils::AlphaBlend(
GetOmniboxColor(OmniboxPart::RESULTS_BACKGROUND, result_view_->GetTint(),
OmniboxPartState::SELECTED),
SK_ColorBLACK, 0.8 * 255));
}
size_t OmniboxTabSwitchButton::CalculateGoalWidth(size_t parent_width,
......
......@@ -25,6 +25,9 @@ class OmniboxTabSwitchButton : public views::MdTextButton {
gfx::Size CalculatePreferredSize() const override;
void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
// views::InkDropHostView
std::unique_ptr<views::InkDropMask> CreateInkDropMask() const override;
// views::Button
void AnimationProgressed(const gfx::Animation* animation) override;
void StateChanged(ButtonState old_state) override;
......
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