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

Issue 2255403002: Use int rather than size_t to pass DIP amounts to vector icon functions. (Closed)

Created:
4 years, 4 months ago by Peter Kasting
Modified:
4 years, 4 months ago
Reviewers:
sky, Evan Stade
CC:
chromium-reviews, tfarina
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Use int rather than size_t to pass DIP amounts to vector icon functions. These are basically signed integral values rather than byte lengths in memory. Clues that back this up: * The vector icon code cast the values back to int to negate them. * Nearly all callers actually supplied ints anyway (but by default our compilers don't warn on this) * The rest of views uses ints for px/DIP values This also makes an SkScalar->integral conversion that was happening implicitly explicit, using the same conversion the parsing code uses. BUG=none TEST=none TBR=sky Committed: https://crrev.com/21e243fe392999bd8a060469f68fdf45955d21b6 Cr-Commit-Position: refs/heads/master@{#413846}

Patch Set 1 #

Patch Set 2 : Missed one #

Total comments: 3

Patch Set 3 : Rebase #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+27 lines, -35 lines) Patch
M chrome/browser/ui/views/profiles/profile_chooser_view.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M ui/gfx/paint_vector_icon.h View 4 chunks +4 lines, -6 lines 0 comments Download
M ui/gfx/paint_vector_icon.cc View 1 2 9 chunks +20 lines, -24 lines 0 comments Download
M ui/views/examples/vector_example.cc View 3 chunks +2 lines, -4 lines 2 comments Download

Messages

Total messages: 37 (17 generated)
Peter Kasting
4 years, 4 months ago (2016-08-18 22:18:42 UTC) #4
Evan Stade
https://codereview.chromium.org/2255403002/diff/20001/ui/gfx/paint_vector_icon.cc File ui/gfx/paint_vector_icon.cc (left): https://codereview.chromium.org/2255403002/diff/20001/ui/gfx/paint_vector_icon.cc#oldcode298 ui/gfx/paint_vector_icon.cc:298: canvas->Translate(gfx::Vector2d(-static_cast<int>(canvas_size), 0)); I don't think this cast is an ...
4 years, 4 months ago (2016-08-18 23:25:37 UTC) #7
Peter Kasting
https://codereview.chromium.org/2255403002/diff/20001/ui/gfx/paint_vector_icon.cc File ui/gfx/paint_vector_icon.cc (left): https://codereview.chromium.org/2255403002/diff/20001/ui/gfx/paint_vector_icon.cc#oldcode298 ui/gfx/paint_vector_icon.cc:298: canvas->Translate(gfx::Vector2d(-static_cast<int>(canvas_size), 0)); On 2016/08/18 23:25:37, Evan Stade wrote: > ...
4 years, 4 months ago (2016-08-18 23:35:13 UTC) #8
Evan Stade
https://codereview.chromium.org/2255403002/diff/20001/ui/gfx/paint_vector_icon.cc File ui/gfx/paint_vector_icon.cc (left): https://codereview.chromium.org/2255403002/diff/20001/ui/gfx/paint_vector_icon.cc#oldcode298 ui/gfx/paint_vector_icon.cc:298: canvas->Translate(gfx::Vector2d(-static_cast<int>(canvas_size), 0)); On 2016/08/18 23:35:13, Peter Kasting wrote: > ...
4 years, 4 months ago (2016-08-19 04:21:49 UTC) #11
Peter Kasting
On 2016/08/19 04:21:49, Evan Stade wrote: > > The units involved here are DIP, and ...
4 years, 4 months ago (2016-08-19 05:38:24 UTC) #12
Evan Stade
On 2016/08/19 05:38:24, Peter Kasting wrote: > On 2016/08/19 04:21:49, Evan Stade wrote: > > ...
4 years, 4 months ago (2016-08-22 20:38:07 UTC) #13
Peter Kasting
On 2016/08/22 20:38:07, Evan Stade wrote: > On 2016/08/19 05:38:24, Peter Kasting wrote: > > ...
4 years, 4 months ago (2016-08-22 21:54:16 UTC) #14
Evan Stade
On 2016/08/22 21:54:16, Peter Kasting wrote: > On 2016/08/22 20:38:07, Evan Stade wrote: > > ...
4 years, 4 months ago (2016-08-23 01:26:18 UTC) #15
Peter Kasting
On 2016/08/23 01:26:18, Evan Stade wrote: > ok thanks, given the language in our own ...
4 years, 4 months ago (2016-08-23 01:33:37 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2255403002/20001
4 years, 4 months ago (2016-08-23 01:34:44 UTC) #18
commit-bot: I haz the power
Try jobs failed on following builders: ios-device on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-device/builds/56460) ios-simulator on master.tryserver.chromium.mac (JOB_FAILED, ...
4 years, 4 months ago (2016-08-23 01:37:28 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2255403002/40001
4 years, 4 months ago (2016-08-23 20:12:20 UTC) #23
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/244183)
4 years, 4 months ago (2016-08-23 20:21:41 UTC) #25
Peter Kasting
TBRing to sky for mechanical change in ui/views/examples/.
4 years, 4 months ago (2016-08-23 20:25:50 UTC) #28
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2255403002/40001
4 years, 4 months ago (2016-08-23 20:26:44 UTC) #30
commit-bot: I haz the power
Committed patchset #3 (id:40001)
4 years, 4 months ago (2016-08-23 21:37:21 UTC) #32
commit-bot: I haz the power
Patchset 3 (id:??) landed as https://crrev.com/21e243fe392999bd8a060469f68fdf45955d21b6 Cr-Commit-Position: refs/heads/master@{#413846}
4 years, 4 months ago (2016-08-23 21:40:01 UTC) #34
sky
Thanks for the interesting discussion! I'm wondering if there should be DCHECK_GE(xxx, 0) in some ...
4 years, 4 months ago (2016-08-23 23:53:37 UTC) #35
Peter Kasting
https://codereview.chromium.org/2255403002/diff/40001/ui/views/examples/vector_example.cc File ui/views/examples/vector_example.cc (right): https://codereview.chromium.org/2255403002/diff/40001/ui/views/examples/vector_example.cc#newcode100 ui/views/examples/vector_example.cc:100: if (base::StringToInt(new_contents, &size_)) On 2016/08/23 23:53:37, sky wrote: > ...
4 years, 4 months ago (2016-08-24 02:42:00 UTC) #36
sky
4 years, 4 months ago (2016-08-24 15:53:59 UTC) #37
Message was sent while issue was closed.
This is an example, so not terribly important. I leave it to you.

On Tue, Aug 23, 2016 at 7:42 PM,  <pkasting@chromium.org> wrote:
>
>
https://codereview.chromium.org/2255403002/diff/40001/ui/views/examples/vecto...
> File ui/views/examples/vector_example.cc (right):
>
>
https://codereview.chromium.org/2255403002/diff/40001/ui/views/examples/vecto...
> ui/views/examples/vector_example.cc:100: if
> (base::StringToInt(new_contents, &size_))
> On 2016/08/23 23:53:37, sky wrote:
>> If negative is considered an error condition shouldn't this DCHECK
> (which is
>> fine, give this is an example), or show the error some way?
>
> It looks like gfx::Size() will silently clamp negatives to zero, so I
> think right now you'll get the same effect as if you entered a zero.
>
> I figured given that this was an example, this kind of
> error-checking/handling didn't really matter, but this is, I think, a
> behavior change from before (sorry, I should have noticed this). I
> think previously, entering a negative would return false, so we'd just
> clear the input field.
>
> So the behavior-preserving change would be to add " || (size_ < 0)" to
> the condition.
>
> Should I make this change? Do something else?
>
> https://codereview.chromium.org/2255403002/

-- 
You received this message because you are subscribed to the Google Groups
"Chromium-reviews" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to chromium-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698