Commit f60c78db authored by Yulun Wu's avatar Yulun Wu Committed by Commit Bot

Fix issue where cycling search box box state caused incorrect coloring.

ZergoQuerySearchBoxColor should be deprecated and
kSearchBoxBackgroundDefault should not be used outside of the
SearchBoxViewBase constructor.

Bug: 1131223
Change-Id: I1f2497618d3c3bfd0fdb93c6b0f162873a2b2111
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2425623Reviewed-by: default avatarAlex Newcomer <newcomer@chromium.org>
Reviewed-by: default avatarYulun Wu <yulunwu@chromium.org>
Commit-Queue: Yulun Wu <yulunwu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#809866}
parent b51fe1fa
......@@ -336,6 +336,8 @@ void SearchBoxView::UpdateBackground(double progress,
progress, GetBackgroundColorForState(current_state),
GetBackgroundColorForState(target_state));
UpdateBackgroundColor(color);
search_box()->SetTextColor(
AppListColorProvider::Get()->GetSearchBoxTextColor());
}
void SearchBoxView::UpdateLayout(double progress,
......
......@@ -47,10 +47,6 @@ constexpr SkColor kSelectedColor = SkColorSetARGB(15, 0, 0, 0);
constexpr SkColor kSearchTextColor = SkColorSetRGB(0x33, 0x33, 0x33);
// Color of placeholder text in zero query state.
constexpr SkColor kZeroQuerySearchboxColor =
SkColorSetARGB(0x8A, 0x00, 0x00, 0x00);
} // namespace
// A background that paints a solid white rounded rect with a thin grey
......@@ -340,13 +336,10 @@ void SearchBoxViewBase::SetSearchBoxActive(bool active,
is_search_box_active_ = active;
UpdateSearchIcon();
UpdateBackgroundColor(kSearchBoxBackgroundDefault);
search_box_->set_placeholder_text_draw_flags(
active ? (base::i18n::IsRTL() ? gfx::Canvas::TEXT_ALIGN_RIGHT
: gfx::Canvas::TEXT_ALIGN_LEFT)
: gfx::Canvas::TEXT_ALIGN_CENTER);
search_box_->set_placeholder_text_color(active ? kZeroQuerySearchboxColor
: search_box_color_);
search_box_->SetCursorEnabled(active);
if (active) {
......@@ -555,8 +548,6 @@ void SearchBoxViewBase::HandleSearchBoxEvent(ui::LocatedEvent* located_event) {
// TODO(crbug.com/755219): Unify this with SetBackgroundColor.
void SearchBoxViewBase::UpdateBackgroundColor(SkColor color) {
if (is_search_box_active_)
color = kSearchBoxBackgroundDefault;
GetSearchBoxBackground()->SetNativeControlColor(color);
}
......
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