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

Issue 1082833006: Compute the correct maximum contents width when eliding away the description in (Closed)

Created:
5 years, 8 months ago by Peter Kasting
Modified:
5 years, 8 months ago
Reviewers:
Mark P
CC:
chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Compute the correct maximum contents width when eliding away the description in the omnibox dropdown. In the case where the description space was so small that the entire description was eliminated, the contents space was set to whatever the desired contents size was, which might be larger than the available space. Instead, clamp this correctly to the available space, including space we'd previously reserved for the separator. Also, in some cases, the previous code would allocate more space to contents and/or description than they actually wanted. Because the caller simply used the returned values to elide, this had no functional effect, but it was arguably confusing, and could cause bugs if anyone else calls this function in the future, so this was fixed. Now both will be given space that's at most as large as they request. Another quirk of the old code was that if the available width was less than kMinimumContentsWidth, the assigned contents width would exceed the available width. Again, the caller would ultimately clamp this, but like the above behavior, this was confusing and seemed error-prone, so this was fixed as well. This required some other minor adjustments to ensure that this wouldn't result in returning a negative max width, even if the available width on entry to the function was less than the separator width. BUG=none TEST=none Committed: https://crrev.com/f01e1802853692c9b1e758e7b2a1029d4ccf655e Cr-Commit-Position: refs/heads/master@{#326700}

Patch Set 1 #

Total comments: 2

Patch Set 2 : Fix bug and test #

Unified diffs Side-by-side diffs Delta from patch set Stats (+16 lines, -12 lines) Patch
M chrome/browser/ui/omnibox/omnibox_popup_model.cc View 1 3 chunks +15 lines, -11 lines 0 comments Download
M chrome/browser/ui/omnibox/omnibox_popup_model_unittest.cc View 1 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 11 (2 generated)
Peter Kasting
No TEST= steps listed because the best way to test this is to modify the ...
5 years, 8 months ago (2015-04-22 02:17:49 UTC) #2
Mark P
I have a concern about one line. Otherwise, the rest of the code looks fine. ...
5 years, 8 months ago (2015-04-22 18:29:12 UTC) #3
Peter Kasting
https://codereview.chromium.org/1082833006/diff/1/chrome/browser/ui/omnibox/omnibox_popup_model.cc File chrome/browser/ui/omnibox/omnibox_popup_model.cc (right): https://codereview.chromium.org/1082833006/diff/1/chrome/browser/ui/omnibox/omnibox_popup_model.cc#newcode55 chrome/browser/ui/omnibox/omnibox_popup_model.cc:55: *contents_max_width = std::min(contents_width, available_width); On 2015/04/22 18:29:12, Mark P ...
5 years, 8 months ago (2015-04-22 23:08:07 UTC) #4
Mark P
Reminder: I will be happy to approve when you fix the bug. --mark
5 years, 8 months ago (2015-04-23 21:20:57 UTC) #5
Peter Kasting
Bug fixed and tests should pass; PTAL.
5 years, 8 months ago (2015-04-23 23:13:26 UTC) #6
Mark P
lgtm
5 years, 8 months ago (2015-04-23 23:19:48 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1082833006/20001
5 years, 8 months ago (2015-04-23 23:21:16 UTC) #9
commit-bot: I haz the power
Committed patchset #2 (id:20001)
5 years, 8 months ago (2015-04-24 00:24:26 UTC) #10
commit-bot: I haz the power
5 years, 8 months ago (2015-04-24 00:25:26 UTC) #11
Message was sent while issue was closed.
Patchset 2 (id:??) landed as
https://crrev.com/f01e1802853692c9b1e758e7b2a1029d4ccf655e
Cr-Commit-Position: refs/heads/master@{#326700}

Powered by Google App Engine
This is Rietveld 408576698