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

Side by Side Diff: ui/gfx/size_base_impl.h

Issue 11410024: ui: Remove gfx::Size::ClampToNonNegative, prevent negative sizes always. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: no negative sizes Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/gfx/size_base.h"
6
7 #include "base/logging.h"
8
9 // This file provides the implementation for SizeBase template and
10 // used to instantiate the base class for Size and SizeF classes.
11 #if !defined(UI_IMPLEMENTATION)
12 #error "This file is intended for UI implementation only"
13 #endif
14
15 namespace gfx {
16
17 template<typename Class, typename Type>
18 void SizeBase<Class, Type>::set_width(Type width) {
19 DCHECK(!(width < 0));
sky 2012/11/12 04:21:46 DCHECK_GE for all of these.
danakj 2012/11/12 05:52:57 I did that at first, but then the DCHECK() fires f
20 width_ = width < 0 ? 0 : width;
21 }
22
23 template<typename Class, typename Type>
24 void SizeBase<Class, Type>::set_height(Type height) {
25 DCHECK(!(height < 0));
26 height_ = height < 0 ? 0 : height;
27 }
28
29 template<typename Class, typename Type>
30 SizeBase<Class, Type>::SizeBase(Type width, Type height)
31 : width_(width < 0 ? 0 : width),
32 height_(height < 0 ? 0 : height) {
33 DCHECK(!(width < 0));
34 DCHECK(!(height < 0));
35 }
36
37 } // namespace gfx
OLDNEW
« ui/base/gestures/gesture_sequence.cc ('K') | « ui/gfx/size_base.h ('k') | ui/gfx/size_f.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698