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

Issue 734923003: Fixed StyledLabel size caching (Closed)

Created:
6 years, 1 month ago by edjomin
Modified:
6 years ago
Reviewers:
sadrul, sky
CC:
chromium-reviews, tfarina
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Fixed StyledLabel size caching StyledLabel size caching was not really working due to width check did not take control insets into account. So any call to GetHeightForWidth or Layout caused full layout recalculation. When view with StyledLabel is created CalculateAndDoLayout that does all layouting job is called for five or six times with same arguments. And each call caused StyledLabel reset and controls removal R=sky@chromium.org Committed: https://crrev.com/1736bcf4e918f13c78ade1d446c7222c720d4d6a Cr-Commit-Position: refs/heads/master@{#308770} Committed: https://crrev.com/89945ce39a4f2efda1800ae53f4b357723586580 Cr-Commit-Position: refs/heads/master@{#309172}

Patch Set 1 #

Total comments: 5

Patch Set 2 : modified StyledLabel caching according to review comments #

Total comments: 4

Patch Set 3 : code review changes #

Total comments: 5

Patch Set 4 : code review changes #

Total comments: 11

Patch Set 5 : codereview changes #

Patch Set 6 : codereview changes #

Total comments: 4

Patch Set 7 : codereview changes #

Patch Set 8 : fix compilation on linux #

Patch Set 9 : fix memory error #

Unified diffs Side-by-side diffs Delta from patch set Stats (+69 lines, -9 lines) Patch
M ui/views/controls/styled_label.h View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M ui/views/controls/styled_label.cc View 1 2 3 4 5 6 7 8 4 chunks +24 lines, -9 lines 0 comments Download
M ui/views/controls/styled_label_unittest.cc View 1 2 3 4 5 6 1 chunk +44 lines, -0 lines 0 comments Download

Messages

Total messages: 35 (5 generated)
edjomin
6 years, 1 month ago (2014-11-18 09:02:04 UTC) #1
sky
https://codereview.chromium.org/734923003/diff/1/ui/views/controls/styled_label.cc File ui/views/controls/styled_label.cc (right): https://codereview.chromium.org/734923003/diff/1/ui/views/controls/styled_label.cc#newcode145 ui/views/controls/styled_label.cc:145: calculated_size_ = gfx::Size(); // force layout recalculation This comment ...
6 years, 1 month ago (2014-11-18 18:30:03 UTC) #3
edjomin
https://codereview.chromium.org/734923003/diff/1/ui/views/controls/styled_label.cc File ui/views/controls/styled_label.cc (right): https://codereview.chromium.org/734923003/diff/1/ui/views/controls/styled_label.cc#newcode145 ui/views/controls/styled_label.cc:145: calculated_size_ = gfx::Size(); // force layout recalculation On 2014/11/18 ...
6 years, 1 month ago (2014-11-19 17:04:00 UTC) #4
sky
https://codereview.chromium.org/734923003/diff/1/ui/views/controls/styled_label.cc File ui/views/controls/styled_label.cc (right): https://codereview.chromium.org/734923003/diff/1/ui/views/controls/styled_label.cc#newcode177 ui/views/controls/styled_label.cc:177: return const_cast<StyledLabel*>(this)->CalculateAndDoLayout(w, true).height(); On 2014/11/19 17:04:00, edjomin wrote: > ...
6 years, 1 month ago (2014-11-19 19:05:51 UTC) #5
edjomin
Please take another look
6 years ago (2014-12-10 14:09:01 UTC) #6
sky
https://codereview.chromium.org/734923003/diff/20001/ui/views/controls/styled_label.cc File ui/views/controls/styled_label.cc (right): https://codereview.chromium.org/734923003/diff/20001/ui/views/controls/styled_label.cc#newcode144 ui/views/controls/styled_label.cc:144: displayed_on_background_color_ = color; Early out if color == displayed_on_background_color_. ...
6 years ago (2014-12-10 17:02:54 UTC) #7
edjomin
Cahnged code according to your comments, please take a look https://codereview.chromium.org/734923003/diff/20001/ui/views/controls/styled_label.cc File ui/views/controls/styled_label.cc (right): https://codereview.chromium.org/734923003/diff/20001/ui/views/controls/styled_label.cc#newcode144 ...
6 years ago (2014-12-11 10:50:54 UTC) #8
sky
https://codereview.chromium.org/734923003/diff/40001/ui/views/controls/styled_label.cc File ui/views/controls/styled_label.cc (right): https://codereview.chromium.org/734923003/diff/40001/ui/views/controls/styled_label.cc#newcode151 ui/views/controls/styled_label.cc:151: static_cast<Label*>(child_at(i))-> DCHECK the class name of the child is ...
6 years ago (2014-12-11 15:48:54 UTC) #9
edjomin
Please take another look https://codereview.chromium.org/734923003/diff/40001/ui/views/controls/styled_label.cc File ui/views/controls/styled_label.cc (right): https://codereview.chromium.org/734923003/diff/40001/ui/views/controls/styled_label.cc#newcode151 ui/views/controls/styled_label.cc:151: static_cast<Label*>(child_at(i))-> On 2014/12/11 15:48:54, sky ...
6 years ago (2014-12-12 08:58:23 UTC) #10
sky
https://codereview.chromium.org/734923003/diff/60001/ui/views/controls/styled_label.cc File ui/views/controls/styled_label.cc (right): https://codereview.chromium.org/734923003/diff/60001/ui/views/controls/styled_label.cc#newcode151 ui/views/controls/styled_label.cc:151: DCHECK(!strcmp(child_at(i)->GetClassName(), Label::kViewClassName) || Use == for comparison. https://codereview.chromium.org/734923003/diff/60001/ui/views/controls/styled_label.h File ...
6 years ago (2014-12-12 16:01:11 UTC) #11
tfarina
https://codereview.chromium.org/734923003/diff/60001/ui/views/controls/styled_label.cc File ui/views/controls/styled_label.cc (right): https://codereview.chromium.org/734923003/diff/60001/ui/views/controls/styled_label.cc#newcode151 ui/views/controls/styled_label.cc:151: DCHECK(!strcmp(child_at(i)->GetClassName(), Label::kViewClassName) || On 2014/12/12 16:01:10, sky wrote: > ...
6 years ago (2014-12-12 16:05:08 UTC) #12
sky
https://codereview.chromium.org/734923003/diff/60001/ui/views/controls/styled_label.cc File ui/views/controls/styled_label.cc (right): https://codereview.chromium.org/734923003/diff/60001/ui/views/controls/styled_label.cc#newcode151 ui/views/controls/styled_label.cc:151: DCHECK(!strcmp(child_at(i)->GetClassName(), Label::kViewClassName) || On 2014/12/12 16:05:07, tfarina wrote: > ...
6 years ago (2014-12-12 16:21:17 UTC) #13
tfarina
https://codereview.chromium.org/734923003/diff/60001/ui/views/controls/styled_label.cc File ui/views/controls/styled_label.cc (right): https://codereview.chromium.org/734923003/diff/60001/ui/views/controls/styled_label.cc#newcode151 ui/views/controls/styled_label.cc:151: DCHECK(!strcmp(child_at(i)->GetClassName(), Label::kViewClassName) || On 2014/12/12 16:21:17, sky wrote: > ...
6 years ago (2014-12-12 16:50:48 UTC) #14
sadrul
https://codereview.chromium.org/734923003/diff/60001/ui/views/controls/styled_label.cc File ui/views/controls/styled_label.cc (right): https://codereview.chromium.org/734923003/diff/60001/ui/views/controls/styled_label.cc#newcode151 ui/views/controls/styled_label.cc:151: DCHECK(!strcmp(child_at(i)->GetClassName(), Label::kViewClassName) || On 2014/12/12 16:50:48, tfarina wrote: > ...
6 years ago (2014-12-12 17:19:32 UTC) #15
edjomin
https://codereview.chromium.org/734923003/diff/60001/ui/views/controls/styled_label.cc File ui/views/controls/styled_label.cc (right): https://codereview.chromium.org/734923003/diff/60001/ui/views/controls/styled_label.cc#newcode151 ui/views/controls/styled_label.cc:151: DCHECK(!strcmp(child_at(i)->GetClassName(), Label::kViewClassName) || On 2014/12/12 16:01:10, sky wrote: > ...
6 years ago (2014-12-15 07:37:21 UTC) #16
sky
https://codereview.chromium.org/734923003/diff/60001/ui/views/controls/styled_label.h File ui/views/controls/styled_label.h (right): https://codereview.chromium.org/734923003/diff/60001/ui/views/controls/styled_label.h#newcode150 ui/views/controls/styled_label.h:150: int layout_built_for_width_; On 2014/12/12 16:01:10, sky wrote: > This ...
6 years ago (2014-12-15 17:03:07 UTC) #17
edjomin
Please take another look https://codereview.chromium.org/734923003/diff/60001/ui/views/controls/styled_label.h File ui/views/controls/styled_label.h (right): https://codereview.chromium.org/734923003/diff/60001/ui/views/controls/styled_label.h#newcode150 ui/views/controls/styled_label.h:150: int layout_built_for_width_; On 2014/12/15 17:03:07, ...
6 years ago (2014-12-16 08:51:52 UTC) #18
sky
https://codereview.chromium.org/734923003/diff/100001/ui/views/controls/styled_label_unittest.cc File ui/views/controls/styled_label_unittest.cc (right): https://codereview.chromium.org/734923003/diff/100001/ui/views/controls/styled_label_unittest.cc#newcode437 ui/views/controls/styled_label_unittest.cc:437: EXPECT_GT(precalculated_height, 0); For testing assertions you always want expected, ...
6 years ago (2014-12-16 16:24:51 UTC) #19
edjomin
https://codereview.chromium.org/734923003/diff/100001/ui/views/controls/styled_label_unittest.cc File ui/views/controls/styled_label_unittest.cc (right): https://codereview.chromium.org/734923003/diff/100001/ui/views/controls/styled_label_unittest.cc#newcode437 ui/views/controls/styled_label_unittest.cc:437: EXPECT_GT(precalculated_height, 0); On 2014/12/16 16:24:51, sky wrote: > For ...
6 years ago (2014-12-16 17:11:20 UTC) #20
sky
LGTM
6 years ago (2014-12-16 17:34:05 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/734923003/120001
6 years ago (2014-12-17 08:31:15 UTC) #23
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_gn_rel on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_gn_rel/builds/43784)
6 years ago (2014-12-17 08:40:42 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/734923003/140001
6 years ago (2014-12-17 09:10:32 UTC) #27
commit-bot: I haz the power
Committed patchset #8 (id:140001)
6 years ago (2014-12-17 10:10:10 UTC) #28
commit-bot: I haz the power
Patchset 8 (id:??) landed as https://crrev.com/1736bcf4e918f13c78ade1d446c7222c720d4d6a Cr-Commit-Position: refs/heads/master@{#308770}
6 years ago (2014-12-17 10:19:09 UTC) #29
edjomin
Commit for this issue was reverted due to uninitialized memory bug. (https://codereview.chromium.org/808853006) I've fixed it. ...
6 years ago (2014-12-18 10:22:31 UTC) #30
sky
LGTM
6 years ago (2014-12-18 20:13:16 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/734923003/160001
6 years ago (2014-12-19 08:21:09 UTC) #33
commit-bot: I haz the power
Committed patchset #9 (id:160001)
6 years ago (2014-12-19 09:11:57 UTC) #34
commit-bot: I haz the power
6 years ago (2014-12-19 09:12:48 UTC) #35
Message was sent while issue was closed.
Patchset 9 (id:??) landed as
https://crrev.com/89945ce39a4f2efda1800ae53f4b357723586580
Cr-Commit-Position: refs/heads/master@{#309172}

Powered by Google App Engine
This is Rietveld 408576698