DescriptionCompute 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 #
Messages
Total messages: 11 (2 generated)
|