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

Issue 2810403002: Views: Don't add insets for views::Link focus rings under MD. (Closed)

Created:
3 years, 8 months ago by tapted
Modified:
3 years, 8 months ago
Reviewers:
sky
CC:
chromium-reviews, tfarina, chrome-apps-syd-reviews_chromium.org, Peter Kasting
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Views: Don't add insets for views::Link focus rings under MD. Insets for dashed focus rings are throwing off the text alignment on dialogs. Currently they are added to any Link and any StyledLabel that contains a Link. Dashed focus rings have already been phased out from most places in Chrome. On a views::Link, they are still needed when the link is permanently underlined since that's the only way to indicate focus. To contain the insanity, this CL makes assumptions (both with and without MD). - only views::Link ever wants a focus ring - not vanilla views::Labels (effectively, a vanilla Label is never focusable). - If a views::Link consumer calls SetUnderline(true) then it wants a focus ring (even under MD). This happens (sometimes) for the BookmarkBarInstructionsView and nothing else. - If SetUnderline is not called it wants the "default" - Nothing overrides Label::GetInsets to add things that are not focus rings (StyledLabel was already making this assumption). - Under MD only, views::StyledLabel consumers never want underlines on links (this is currently the case). - Under Non-MD only, calling SetUnderline(false) removes the underline but does not change the focus style. This allows a lot of the "focus ring" logic to move down into views::Link where it will be easier to delete later. Calculating the bounds stays in views::Label since it inspects Label's private RenderText instances. BUG=711161 Review-Url: https://codereview.chromium.org/2810403002 Cr-Commit-Position: refs/heads/master@{#466211} Committed: https://chromium.googlesource.com/chromium/src/+/480f457f6939eade256dc987fd740452ef5912de

Patch Set 1 #

Patch Set 2 : Self review #

Patch Set 3 : Tests passing #

Total comments: 7

Patch Set 4 : respond to comments #

Patch Set 5 : Update tests, but I need to rebase to add the Harmony one #

Patch Set 6 : rebase #

Patch Set 7 : add harmony test from crrev/2834603002 #

Patch Set 8 : zap width check: concrete_link is not added to a Widget so can differ #

Patch Set 9 : self nits #

Total comments: 2

Patch Set 10 : Add missing // namespace comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+372 lines, -104 lines) Patch
M chrome/browser/ui/views/harmony/layout_provider_unittest.cc View 1 2 3 4 5 6 7 8 9 5 chunks +65 lines, -1 line 0 comments Download
M ui/views/controls/label.h View 1 2 3 4 5 chunks +5 lines, -7 lines 0 comments Download
M ui/views/controls/label.cc View 1 2 3 4 5 6 7 8 9 7 chunks +36 lines, -40 lines 0 comments Download
M ui/views/controls/label_unittest.cc View 1 2 3 4 5 6 7 8 8 chunks +89 lines, -14 lines 0 comments Download
M ui/views/controls/link.h View 1 2 3 2 chunks +23 lines, -2 lines 0 comments Download
M ui/views/controls/link.cc View 1 2 3 4 5 5 chunks +35 lines, -7 lines 0 comments Download
M ui/views/controls/styled_label.cc View 1 2 3 4 5 6 7 8 5 chunks +43 lines, -20 lines 0 comments Download
M ui/views/controls/styled_label_unittest.cc View 1 2 3 4 5 6 7 8 9 10 chunks +76 lines, -13 lines 0 comments Download

Messages

Total messages: 60 (50 generated)
tapted
Hi sky (cc pkasting/estade) I was hoping to get some feedback on this approach. I ...
3 years, 8 months ago (2017-04-19 12:28:45 UTC) #25
Evan Stade
I agree with all the cl bullet point except maybe this one: - If SetUnderline(false) ...
3 years, 8 months ago (2017-04-19 13:29:56 UTC) #27
sky
On 2017/04/19 12:28:45, tapted wrote: > Hi sky (cc pkasting/estade) > > I was hoping ...
3 years, 8 months ago (2017-04-19 17:27:39 UTC) #28
sky
https://codereview.chromium.org/2810403002/diff/40001/ui/views/controls/label.cc File ui/views/controls/label.cc (right): https://codereview.chromium.org/2810403002/diff/40001/ui/views/controls/label.cc#newcode853 ui/views/controls/label.cc:853: rect.Inset(GetInsets() - View::GetInsets()); This is very subtle and worth ...
3 years, 8 months ago (2017-04-19 17:27:46 UTC) #29
tapted
sky, PTAL - I think this is ready for review. On 2017/04/19 17:27:39, sky wrote: ...
3 years, 8 months ago (2017-04-20 11:50:18 UTC) #46
sky
LGTM https://codereview.chromium.org/2810403002/diff/180001/ui/views/controls/label.cc File ui/views/controls/label.cc (right): https://codereview.chromium.org/2810403002/diff/180001/ui/views/controls/label.cc#newcode45 ui/views/controls/label.cc:45: } // namespace
3 years, 8 months ago (2017-04-20 17:38:29 UTC) #47
tapted
https://codereview.chromium.org/2810403002/diff/180001/ui/views/controls/label.cc File ui/views/controls/label.cc (right): https://codereview.chromium.org/2810403002/diff/180001/ui/views/controls/label.cc#newcode45 ui/views/controls/label.cc:45: } On 2017/04/20 17:38:29, sky wrote: > // namespace ...
3 years, 8 months ago (2017-04-21 01:19:10 UTC) #53
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2810403002/200001
3 years, 8 months ago (2017-04-21 01:19:42 UTC) #56
commit-bot: I haz the power
Committed patchset #10 (id:200001) as https://chromium.googlesource.com/chromium/src/+/480f457f6939eade256dc987fd740452ef5912de
3 years, 8 months ago (2017-04-21 01:25:26 UTC) #59
Evan Stade
3 years, 8 months ago (2017-04-21 01:40:01 UTC) #60
Message was sent while issue was closed.
On 2017/04/20 11:50:18, tapted wrote:
> Yup - confirmed this with my brute-force refactoring. So it looks like there's
> exactly one case that will still need focus rings after MD :/
> 

I wonder if a designer could be convinced to turn that link into a button or
something else that's not a link. I think the Show All button on the download
shelf was once a link.

Powered by Google App Engine
This is Rietveld 408576698