Commit 80f0a769 authored by Wei Li's avatar Wei Li Committed by Commit Bot

Remove custom layout from ComboBox

The custom layout used by ComboxBox simply calls the parent's layout
function and set up the arrow button's bounds. The latter can be
replaced in OnBoundsChanged(). After that move, the custom layout is no
longer needed.

BUG=1005568

Change-Id: Ib3ea796fbaa6bf626ad5d07e00d6db8c2fbc31b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1890976Reviewed-by: default avatarAllen Bauer <kylixrd@chromium.org>
Commit-Queue: Wei Li <weili@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711366}
parent 20754851
......@@ -307,11 +307,6 @@ void Combobox::SetInvalid(bool invalid) {
OnPropertyChanged(&selected_index_, kPropertyEffectsPaint);
}
void Combobox::Layout() {
View::Layout();
arrow_button_->SetBounds(0, 0, width(), height());
}
void Combobox::OnThemeChanged() {
SetBackground(
CreateBackgroundFromPainter(Painter::CreateSolidRoundRectPainter(
......@@ -359,6 +354,10 @@ gfx::Size Combobox::CalculatePreferredSize() const {
return gfx::Size(total_width, content_size_.height() + insets.height());
}
void Combobox::OnBoundsChanged(const gfx::Rect& previous_bounds) {
arrow_button_->SetBounds(0, 0, width(), height());
}
bool Combobox::SkipDefaultKeyEventProcessing(const ui::KeyEvent& e) {
// Escape should close the drop down list when it is active, not host UI.
if (e.key_code() != ui::VKEY_ESCAPE ||
......
......@@ -84,6 +84,7 @@ class VIEWS_EXPORT Combobox : public View,
// Overridden from View:
gfx::Size CalculatePreferredSize() const override;
void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& e) override;
bool OnKeyPressed(const ui::KeyEvent& e) override;
void OnPaint(gfx::Canvas* canvas) override;
......@@ -91,7 +92,6 @@ class VIEWS_EXPORT Combobox : public View,
void OnBlur() override;
void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
bool HandleAccessibleAction(const ui::AXActionData& action_data) override;
void Layout() override;
void OnThemeChanged() override;
// Overridden from PrefixDelegate:
......
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