Commit 9b4fc16e authored by Aaron Leventhal's avatar Aaron Leventhal Committed by Commit Bot

Table not firing focus events in device chooser

Make sure even if painting returns early, that accessibility focus is
still updated.

Bug: 820351
Change-Id: I4d712742b9677095cdcf19d486945c892b73a11c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1976071
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Reviewed-by: default avatarNektarios Paisios <nektar@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#726581}
parent e830d58a
...@@ -720,7 +720,25 @@ gfx::Point TableView::GetKeyboardContextMenuLocation() { ...@@ -720,7 +720,25 @@ gfx::Point TableView::GetKeyboardContextMenuLocation() {
return screen_loc; return screen_loc;
} }
void TableView::OnFocus() {
SchedulePaintForSelection();
focus_ring_->SchedulePaint();
needs_update_accessibility_focus_ = true;
}
void TableView::OnBlur() {
SchedulePaintForSelection();
focus_ring_->SchedulePaint();
needs_update_accessibility_focus_ = true;
}
void TableView::OnPaint(gfx::Canvas* canvas) { void TableView::OnPaint(gfx::Canvas* canvas) {
OnPaintImpl(canvas);
if (needs_update_accessibility_focus_)
UpdateAccessibilityFocus();
}
void TableView::OnPaintImpl(gfx::Canvas* canvas) {
// Don't invoke View::OnPaint so that we can render our own focus border. // Don't invoke View::OnPaint so that we can render our own focus border.
if (sort_on_paint_) if (sort_on_paint_)
...@@ -815,21 +833,6 @@ void TableView::OnPaint(gfx::Canvas* canvas) { ...@@ -815,21 +833,6 @@ void TableView::OnPaint(gfx::Canvas* canvas) {
grouping_flags); grouping_flags);
i = last + 1; i = last + 1;
} }
if (needs_update_accessibility_focus_)
UpdateAccessibilityFocus();
}
void TableView::OnFocus() {
SchedulePaintForSelection();
focus_ring_->SchedulePaint();
needs_update_accessibility_focus_ = true;
}
void TableView::OnBlur() {
SchedulePaintForSelection();
focus_ring_->SchedulePaint();
needs_update_accessibility_focus_ = true;
} }
int TableView::GetCellMargin() const { int TableView::GetCellMargin() const {
......
...@@ -227,9 +227,9 @@ class VIEWS_EXPORT TableView ...@@ -227,9 +227,9 @@ class VIEWS_EXPORT TableView
protected: protected:
// View overrides: // View overrides:
gfx::Point GetKeyboardContextMenuLocation() override; gfx::Point GetKeyboardContextMenuLocation() override;
void OnPaint(gfx::Canvas* canvas) override;
void OnFocus() override; void OnFocus() override;
void OnBlur() override; void OnBlur() override;
void OnPaint(gfx::Canvas* canvas) override;
private: private:
friend class TableViewTestHelper; friend class TableViewTestHelper;
...@@ -252,6 +252,8 @@ class VIEWS_EXPORT TableView ...@@ -252,6 +252,8 @@ class VIEWS_EXPORT TableView
int max_column = 0; int max_column = 0;
}; };
void OnPaintImpl(gfx::Canvas* canvas);
// Returns the horizontal margin between the bounds of a cell and its // Returns the horizontal margin between the bounds of a cell and its
// contents. // contents.
int GetCellMargin() const; int GetCellMargin() const;
......
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