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

Issue 2430493002: [Mac] Fix rough-looking profile picker text, especially with a dark theme. (Closed)

Created:
4 years, 2 months ago by Sidney San Martín
Modified:
3 years, 11 months ago
CC:
chromium-reviews, mac-reviews_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[Mac] Fix rough-looking profile picker text, especially with a dark theme. Issue 593835 shows the AvatarButton's text having jagged, rainbow tinted edges. It turns out that the text cell gets a hint about anti-aliasing from the NSVisualEffect view below it, but the hint is wrong because the NSVisualEffectView is itself below the theme background. This only happens when the NSVisualEffectView's blendingMode is set to NSVisualEffectBlendingModeBehindWindow (which makes the content behind the window show through with a blur effect). To create the effect, the view cuts a hole in the window and generates a mask which the window server uses to render a translucent material behind the window. Because the translucent parts of the window are invisible to the app, the text can't render itself with correct subpixel anti-aliasing, which needs information about the background. To help, NSVisualEffectView implements two undocumented methods: `-shouldSetFontSmoothingBackgroundColor` and `-_backgroundColorForFontSmoothing`. It provides the base color of the translucent material, and for the purpose of antialiasing the text cell pretends that it's over an opaque background of that color. Because the translucency effect is subtle, it's not obvious that the antialiasing is done with a fixed color. NSView implements these methods to first search its immediate subviews and return the first YES/non-nil answer, or return NO/nil if `self.opaque == YES`, then tail call the same method on its superview. A quirk of this strategy is that, to provide a background color to a text view, an NSVisualEffectView must be either a superview or an immediate subview of a superview. So, the AvatarButton's text does get a background color hint with the current hierarchy: - NSThemeFrame |- NSVisualEffectView | |- TabStripBackgroundView |- FullSizeContentView |- AvatarButton …but, if the NSVisualEffectView were wrapped in another view, it doesn't (because each step of the search just looks at immediate subviews): - NSThemeFrame |- NSView | |- NSVisualEffectView | | |- TabStripBackgroundView |- FullSizeContentView |- AvatarButton Anyway, back on topic, our issue is that the text cell accepts the hinted background color, which is never right since Chrome always draws a tint over the visual effect view, and in some cases the hint is drastically wrong. Ideally, we'd provide a fake background for the text to perform subpixel anti-aliasing against, but it's unclear how to do that. For now, the simplest solution is to wrap it in another view. This CL sucks all of the tab strip background drawing into TabStripBackgroundView, and makes it so that other views don't need to know about the NSVisualEffectView at all. It also only creates the NSVisualEffectView when it's used, and gets rid of it when it's not used (like in full screen, or when a theme is installed). BUG=593835 Review-Url: https://codereview.chromium.org/2430493002 Cr-Commit-Position: refs/heads/master@{#443707} Committed: https://chromium.googlesource.com/chromium/src/+/a5fd3c415f3cc4f8813ba9772d838bee41040ae8

Patch Set 1 #

Patch Set 2 : Rebase/refactor/finish #

Patch Set 3 : Add a missing header to a test. #

Patch Set 4 : Roll back a change that broke tests and shouldn't have been in this CL anyway :) #

Patch Set 5 : Replace a now-invalid test with a better one. #

Patch Set 6 : Add theme tests #

Total comments: 43

Patch Set 7 : Address a round of comments. #

Total comments: 14

Patch Set 8 : Address second round of comments. #

Patch Set 9 : Scopify! #

Unified diffs Side-by-side diffs Delta from patch set Stats (+290 lines, -371 lines) Patch
M base/mac/sdk_forward_declarations.h View 1 2 3 4 5 6 3 chunks +0 lines, -12 lines 0 comments Download
M chrome/browser/ui/cocoa/browser_window_controller_private.mm View 1 2 chunks +0 lines, -4 lines 0 comments Download
M chrome/browser/ui/cocoa/browser_window_controller_unittest.mm View 1 2 3 4 1 chunk +0 lines, -19 lines 0 comments Download
M chrome/browser/ui/cocoa/browser_window_fullscreen_transition.mm View 1 3 chunks +2 lines, -38 lines 0 comments Download
M chrome/browser/ui/cocoa/floating_bar_backing_view.h View 1 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/cocoa/floating_bar_backing_view.mm View 1 2 chunks +0 lines, -28 lines 0 comments Download
M chrome/browser/ui/cocoa/tabs/tab_strip_background_view.h View 1 2 3 4 5 6 1 chunk +4 lines, -4 lines 0 comments Download
M chrome/browser/ui/cocoa/tabs/tab_strip_background_view.mm View 1 2 3 4 5 6 7 2 chunks +164 lines, -19 lines 0 comments Download
A chrome/browser/ui/cocoa/tabs/tab_strip_background_view_unittest.mm View 1 2 3 4 5 6 7 8 1 chunk +92 lines, -0 lines 0 comments Download
M chrome/browser/ui/cocoa/tabs/tab_strip_controller.h View 1 1 chunk +0 lines, -4 lines 0 comments Download
M chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm View 1 1 chunk +0 lines, -4 lines 0 comments Download
M chrome/browser/ui/cocoa/tabs/tab_strip_view.h View 1 2 chunks +1 line, -14 lines 0 comments Download
M chrome/browser/ui/cocoa/tabs/tab_strip_view.mm View 1 4 chunks +1 line, -111 lines 0 comments Download
M chrome/browser/ui/cocoa/tabs/tab_window_controller.h View 1 2 3 2 chunks +2 lines, -5 lines 0 comments Download
M chrome/browser/ui/cocoa/tabs/tab_window_controller.mm View 1 2 3 4 5 6 7 7 chunks +21 lines, -107 lines 0 comments Download
M chrome/test/BUILD.gn View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 57 (43 generated)
Sidney San Martín
Beware, the CL description is fairly long, but it mostly just boils down to a ...
3 years, 11 months ago (2017-01-10 23:12:20 UTC) #14
Avi (use Gerrit)
lgtm Looks Sane To Me.
3 years, 11 months ago (2017-01-11 19:03:42 UTC) #25
Robert Sesek
Mostly style comments :-) https://codereview.chromium.org/2430493002/diff/100001/base/mac/sdk_forward_declarations.h File base/mac/sdk_forward_declarations.h (left): https://codereview.chromium.org/2430493002/diff/100001/base/mac/sdk_forward_declarations.h#oldcode79 base/mac/sdk_forward_declarations.h:79: BASE_EXPORT extern NSString* const NSAppearanceNameVibrantDark; ...
3 years, 11 months ago (2017-01-11 19:23:40 UTC) #29
spqchan
The fullscreen changes LGTM I just have some nits https://codereview.chromium.org/2430493002/diff/100001/chrome/browser/ui/cocoa/tabs/tab_strip_background_view.mm File chrome/browser/ui/cocoa/tabs/tab_strip_background_view.mm (right): https://codereview.chromium.org/2430493002/diff/100001/chrome/browser/ui/cocoa/tabs/tab_strip_background_view.mm#newcode24 chrome/browser/ui/cocoa/tabs/tab_strip_background_view.mm:24: ...
3 years, 11 months ago (2017-01-11 19:33:57 UTC) #30
Sidney San Martín
Still working on the other comments. https://codereview.chromium.org/2430493002/diff/100001/base/mac/sdk_forward_declarations.h File base/mac/sdk_forward_declarations.h (left): https://codereview.chromium.org/2430493002/diff/100001/base/mac/sdk_forward_declarations.h#oldcode79 base/mac/sdk_forward_declarations.h:79: BASE_EXPORT extern NSString* ...
3 years, 11 months ago (2017-01-11 22:00:59 UTC) #31
Robert Sesek
https://codereview.chromium.org/2430493002/diff/100001/base/mac/sdk_forward_declarations.h File base/mac/sdk_forward_declarations.h (left): https://codereview.chromium.org/2430493002/diff/100001/base/mac/sdk_forward_declarations.h#oldcode79 base/mac/sdk_forward_declarations.h:79: BASE_EXPORT extern NSString* const NSAppearanceNameVibrantDark; On 2017/01/11 22:00:58, sdy ...
3 years, 11 months ago (2017-01-11 22:09:54 UTC) #32
Sidney San Martín
This should address all comments so far. https://codereview.chromium.org/2430493002/diff/100001/chrome/browser/ui/cocoa/tabs/tab_strip_background_view.h File chrome/browser/ui/cocoa/tabs/tab_strip_background_view.h (right): https://codereview.chromium.org/2430493002/diff/100001/chrome/browser/ui/cocoa/tabs/tab_strip_background_view.h#newcode10 chrome/browser/ui/cocoa/tabs/tab_strip_background_view.h:10: @class TabStripBackgroundView; ...
3 years, 11 months ago (2017-01-13 00:10:08 UTC) #35
Robert Sesek
https://codereview.chromium.org/2430493002/diff/120001/chrome/browser/ui/cocoa/tabs/tab_strip_background_view.mm File chrome/browser/ui/cocoa/tabs/tab_strip_background_view.mm (right): https://codereview.chromium.org/2430493002/diff/120001/chrome/browser/ui/cocoa/tabs/tab_strip_background_view.mm#newcode12 chrome/browser/ui/cocoa/tabs/tab_strip_background_view.mm:12: // TODO: Remove once we no longer support 10.9 ...
3 years, 11 months ago (2017-01-13 19:39:42 UTC) #38
Sidney San Martín
This should address all of these comments except the scoped_nsobject one (see below). https://codereview.chromium.org/2430493002/diff/120001/chrome/browser/ui/cocoa/tabs/tab_strip_background_view.mm File ...
3 years, 11 months ago (2017-01-13 20:05:17 UTC) #44
Robert Sesek
LGTM https://codereview.chromium.org/2430493002/diff/120001/chrome/browser/ui/cocoa/tabs/tab_strip_background_view_unittest.mm File chrome/browser/ui/cocoa/tabs/tab_strip_background_view_unittest.mm (right): https://codereview.chromium.org/2430493002/diff/120001/chrome/browser/ui/cocoa/tabs/tab_strip_background_view_unittest.mm#newcode67 chrome/browser/ui/cocoa/tabs/tab_strip_background_view_unittest.mm:67: [[[TabStripBackgroundViewTestWindow alloc] init] autorelease]; On 2017/01/13 20:05:17, sdy ...
3 years, 11 months ago (2017-01-13 20:12:36 UTC) #46
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/2430493002/180001
3 years, 11 months ago (2017-01-13 20:19:01 UTC) #52
Sidney San Martín
https://codereview.chromium.org/2430493002/diff/120001/chrome/browser/ui/cocoa/tabs/tab_strip_background_view_unittest.mm File chrome/browser/ui/cocoa/tabs/tab_strip_background_view_unittest.mm (right): https://codereview.chromium.org/2430493002/diff/120001/chrome/browser/ui/cocoa/tabs/tab_strip_background_view_unittest.mm#newcode67 chrome/browser/ui/cocoa/tabs/tab_strip_background_view_unittest.mm:67: [[[TabStripBackgroundViewTestWindow alloc] init] autorelease]; On 2017/01/13 20:12:36, Robert Sesek ...
3 years, 11 months ago (2017-01-13 20:30:42 UTC) #53
commit-bot: I haz the power
Committed patchset #9 (id:180001) as https://chromium.googlesource.com/chromium/src/+/a5fd3c415f3cc4f8813ba9772d838bee41040ae8
3 years, 11 months ago (2017-01-13 22:52:02 UTC) #56
pkalinnikov
3 years, 11 months ago (2017-01-17 09:54:40 UTC) #57
Message was sent while issue was closed.
A revert of this CL (patchset #9 id:180001) has been created in
https://codereview.chromium.org/2638873002/ by pkalinnikov@chromium.org.

The reason for reverting is: FullscreenControllerTest.FullscreenOnFileURL from
browser_tests flakes chromium.mac/Mac10.10 Tests builder..

Powered by Google App Engine
This is Rietveld 408576698