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

Side by Side Diff: ui/gfx/size.cc

Issue 11410024: ui: Remove gfx::Size::ClampToNonNegative, prevent negative sizes always. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: negative-width Created 7 years, 11 months 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
« no previous file with comments | « ui/gfx/rect_unittest.cc ('k') | ui/gfx/size_base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/size.h" 5 #include "ui/gfx/size.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #endif 9 #endif
10 10
11 #include "base/logging.h"
12 #include "base/stringprintf.h" 11 #include "base/stringprintf.h"
13 #include "ui/gfx/size_base.h" 12 #include "ui/gfx/size_base_impl.h"
14 13
15 namespace gfx { 14 namespace gfx {
16 15
17 template class SizeBase<Size, int>; 16 template class SizeBase<Size, int>;
18 17
19 #if defined(OS_MACOSX) 18 #if defined(OS_MACOSX)
20 Size::Size(const CGSize& s) : SizeBase<Size, int>(0, 0) { 19 Size::Size(const CGSize& s)
21 set_width(s.width); 20 : SizeBase<Size, int>(s.width, s.height) {
22 set_height(s.height);
23 } 21 }
24 22
25 Size& Size::operator=(const CGSize& s) { 23 Size& Size::operator=(const CGSize& s) {
26 set_width(s.width); 24 set_width(s.width);
27 set_height(s.height); 25 set_height(s.height);
28 return *this; 26 return *this;
29 } 27 }
30 #endif 28 #endif
31 29
32 #if defined(OS_WIN) 30 #if defined(OS_WIN)
33 SIZE Size::ToSIZE() const { 31 SIZE Size::ToSIZE() const {
34 SIZE s; 32 SIZE s;
35 s.cx = width(); 33 s.cx = width();
36 s.cy = height(); 34 s.cy = height();
37 return s; 35 return s;
38 } 36 }
39 #elif defined(OS_MACOSX) 37 #elif defined(OS_MACOSX)
40 CGSize Size::ToCGSize() const { 38 CGSize Size::ToCGSize() const {
41 return CGSizeMake(width(), height()); 39 return CGSizeMake(width(), height());
42 } 40 }
43 #endif 41 #endif
44 42
45 std::string Size::ToString() const { 43 std::string Size::ToString() const {
46 return base::StringPrintf("%dx%d", width(), height()); 44 return base::StringPrintf("%dx%d", width(), height());
47 } 45 }
48 46
49 } // namespace gfx 47 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/rect_unittest.cc ('k') | ui/gfx/size_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698