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

Issue 2065003002: Do not SchedulePaint() inside views::Label::OnPaint() (Closed)

Created:
4 years, 6 months ago by tapted
Modified:
4 years, 6 months ago
Reviewers:
sky
CC:
chromium-reviews, tfarina, chrome-apps-syd-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Do not SchedulePaint() inside views::Label::OnPaint() View::SchedulePaint() shouldn't be called inside an OnPaint() method. At best it wastes computation doing a follow-up, redundant paint. On Mac it's causing a weird interaction with transparent backgrounds for strings of particular lengths on retina screens. For performance, MaybeBuildRenderTextLines() is always deferred until a Paint. It calls RecalculateColors() to apply colors to the lines it newly creates, and that schedules a paint. But MaybeBuildRenderTextLines() just needs to apply the colors that have already been calculated. So, to fix, split RecalculateColors() into the color calculation and ApplyTextColors(), which can be called from OnPaint(). BUG=604092 TEST=On a retina-screen Mac with a fresh profile, navigate (e.g. to chrome://version), then press Backspace, The "Press <key> to go back" popup should appear and it should have a consistent, transparent background. Committed: https://crrev.com/2b40c5ca82b21f503cc7cc75ac101f1d2b710fc1 Cr-Commit-Position: refs/heads/master@{#400273}

Patch Set 1 : Feeds through a bool `in_paint` #

Patch Set 2 : Nicer fix (also fix hypothetical GetFocusBounds) #

Patch Set 3 : call super::OnEnabledChanged() #

Total comments: 2

Patch Set 4 : Add a test #

Unified diffs Side-by-side diffs Delta from patch set Stats (+80 lines, -8 lines) Patch
M ui/views/controls/label.h View 1 2 3 1 chunk +4 lines, -0 lines 0 comments Download
M ui/views/controls/label.cc View 1 2 3 4 chunks +8 lines, -3 lines 0 comments Download
M ui/views/controls/label_unittest.cc View 1 2 3 5 chunks +68 lines, -5 lines 0 comments Download

Messages

Total messages: 15 (10 generated)
tapted
Hi sky, please take a look https://codereview.chromium.org/2065003002/diff/40001/ui/views/controls/label.cc File ui/views/controls/label.cc (right): https://codereview.chromium.org/2065003002/diff/40001/ui/views/controls/label.cc#newcode360 ui/views/controls/label.cc:360: MaybeBuildRenderTextLines(); This was ...
4 years, 6 months ago (2016-06-14 11:15:54 UTC) #8
sky
LGTM
4 years, 6 months ago (2016-06-16 15:45:58 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2065003002/60001
4 years, 6 months ago (2016-06-16 21:03:15 UTC) #11
commit-bot: I haz the power
Committed patchset #4 (id:60001)
4 years, 6 months ago (2016-06-16 21:58:12 UTC) #13
commit-bot: I haz the power
4 years, 6 months ago (2016-06-16 22:00:41 UTC) #15
Message was sent while issue was closed.
Patchset 4 (id:??) landed as
https://crrev.com/2b40c5ca82b21f503cc7cc75ac101f1d2b710fc1
Cr-Commit-Position: refs/heads/master@{#400273}

Powered by Google App Engine
This is Rietveld 408576698