Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix text color of inactive tabs #12911

Closed
wants to merge 1 commit into from
Closed

Conversation

gurnec
Copy link

@gurnec gurnec commented Apr 6, 2022

This regression, which caused inactive tabs under certain dark/light mode conditions on Windows to have very low contrast, was cause by the Chromium 100 change below. This fix was modelled after 5c145e9.

https://chromium.googlesource.com/chromium/src/+/23a6ae6a05ef9407f56c29cbbbb133463c734099

Remove use of HasCustomColor in TabStrip and use ColorProvider.

Systematized all the ChromeColorIds used for the tab strip.

Bug: 1292176
Change-Id: I9dbed732cd977a184c59e45d53b918774a44799d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3425646
Reviewed-by: Peter Kasting [email protected]
Reviewed-by: Thomas Lukaszewicz [email protected]
Commit-Queue: Allen Bauer [email protected]
Cr-Commit-Position: refs/heads/main@{#967904}

Notes

Setting both kColorTabForegroundInactiveFrameActive and kColorTabForegroundInactiveFrameInactive were required for this to work under all conditions. Setting kColorTabForegroundActiveFrameActive and kColorTabForegroundActiveFrameInactive were apparently not required, so I didn't include them.

I verified in a debugger that MaybeGetDefaultColorForBraveUi() is no longer called after that Chromium change with either of the two IDs that I removed (COLOR_TAB_FOREGROUND_ACTIVE_FRAME_ACTIVE and COLOR_TAB_FOREGROUND_INACTIVE_FRAME_ACTIVE).

I manually tested (the cross product of) all of the following combinations on (only) Windows 10 x64 19044.1586.

Tab state: Active/Inactive
Frame state: Active/Inactive
Window type: Normal/Private/Tor
Mouse state: Hovered/Not
Color mode: Light/Dark
Show accent color on "Title bars and window borders" Windows 10 setting: Enabled/Disabled
"Choose your accent color" Windows 10 setting: Light gray/Dark gray

To reproduce the issue on a non-patched version, enable the Show accent color on "Title bars and window borders" Windows 10 setting, choose a light dark accent color in Windows, and choose Light mode (or choose a dark light accent color and Dark mode), and then view an inactive tab.

Full disclosure: I have zero experience w/the Chromium source, so I very well could have missed something.

Resolves brave/brave-browser#22027

Submitter Checklist:

  • I confirm that no security/privacy review is needed, or that I have requested one
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally: npm run test -- brave_browser_tests, npm run test -- brave_unit_tests, npm run lint, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

Fixes brave/brave-browser#22027

This regression, which caused inactive tabs under certain dark/light
mode conditions on Windows to have very low contrast, was cause by
the Chromium 100 change below. This fix was modelled after 5c145e9.

https://chromium.googlesource.com/chromium/src/+/23a6ae6a05ef9407f56c29cbbbb133463c734099

Remove use of HasCustomColor in TabStrip and use ColorProvider.

Systematized all the ChromeColorIds used for the tab strip.

Bug: 1292176
Change-Id: I9dbed732cd977a184c59e45d53b918774a44799d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3425646
Reviewed-by: Peter Kasting <[email protected]>
Reviewed-by: Thomas Lukaszewicz <[email protected]>
Commit-Queue: Allen Bauer <[email protected]>
Cr-Commit-Position: refs/heads/main@{#967904}
@gurnec gurnec requested review from simonhong and a team as code owners April 6, 2022 13:05
@simonhong
Copy link
Member

@gurnec Huge thanks for trying to fix!
I saw your PR and it'll work. 👍🏼
However, we decided to prevent accent color affect frame colors instead of handling each color ids individually
by #12946
Thanks again for your contribution!

@gurnec
Copy link
Author

gurnec commented Apr 8, 2022

@simonhong I like your solution better, thanks for fixing this the right way!

@gurnec gurnec closed this Apr 8, 2022
@simonhong
Copy link
Member

@gurnec and Please understand pushing w/o discussing with you.
As this issue was marked as P2, I decided to fix quickly.
Hope we can see again in brave community and we always welcome your PR :)

@gurnec
Copy link
Author

gurnec commented Apr 8, 2022

@simonhong Fully understand, and I took no offense (sorry if it seemed otherwise in my response). And thanks for the welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(Windows only) Text in tab bar is sometimes unreadable depending on brave colors and windows accent color
2 participants