Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Issue 2380303004: Move MdFocusRing to be a property of FocusManager. (Closed)

Created:
4 years, 2 months ago by Evan Stade
Modified:
4 years, 2 months ago
Reviewers:
sky
CC:
chromium-reviews, tfarina
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Move MdFocusRing to be a property of FocusManager. This allows greater reuse across different Views types, and compared to alternatives like https://codereview.chromium.org/2383243002 it reduces the number of views, layers, and focus change listeners required. BUG=649815

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+99 lines, -74 lines) Patch
M ui/views/controls/button/md_text_button.h View 3 chunks +0 lines, -12 lines 0 comments Download
M ui/views/controls/button/md_text_button.cc View 5 chunks +2 lines, -54 lines 0 comments Download
M ui/views/examples/button_sticker_sheet.cc View 1 chunk +0 lines, -5 lines 0 comments Download
M ui/views/focus/focus_manager.h View 2 chunks +7 lines, -0 lines 0 comments Download
M ui/views/focus/focus_manager.cc View 4 chunks +80 lines, -3 lines 0 comments Download
M ui/views/view.h View 2 chunks +9 lines, -0 lines 0 comments Download
M ui/views/view.cc View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 9 (5 generated)
Evan Stade
wdyt of this approach? You can see the leading alternative in the CL that I ...
4 years, 2 months ago (2016-09-30 21:38:21 UTC) #4
sky
It's not uncommon for views to override layout and expect a specific number of children, ...
4 years, 2 months ago (2016-10-03 16:04:55 UTC) #7
Evan Stade
On 2016/10/03 16:04:55, sky wrote: > It's not uncommon for views to override layout and ...
4 years, 2 months ago (2016-10-03 19:48:38 UTC) #8
sky
4 years, 2 months ago (2016-10-03 21:38:01 UTC) #9
On 2016/10/03 19:48:38, Evan Stade wrote:
> On 2016/10/03 16:04:55, sky wrote:
> > It's not uncommon for views to override layout and expect a specific number
of
> > children, or do processing when a view is added/removed, or the
LayoutManager
> to
> > want to interact with a newly added view. We shouldn't add child Views to
> other
> > Views like this. It breaks too many assumptions.
> 
> yea, that's a good point. But it only happens for the few views that
> specifically opt into this.

I missed the should_use_md_focus_ring(). I would prefer not to add more
functions like that to views, it doesn't scale well. Same comment about baking
functionality into the focusmanager.

I'm ok with the other patch, or alternatively making subclasses explicitly
override OnFocus/OnBlur and create/destroy the focus ring. That pattern forces
users to understand what is happening and doesn't suffer the extra overhead you
mention.

> 
> Did you prefer https://codereview.chromium.org/2383243002 or have another
> suggestion for how to accomplish this?

Powered by Google App Engine
This is Rietveld 408576698