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

Side by Side Diff: ui/gfx/range/range_win.cc

Issue 24012002: Move Range code to gfx. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: d Created 7 years, 3 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/range/range_unittest.cc ('k') | ui/gfx/range/range_win_unittest.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/base/range/range.h" 5 #include "ui/gfx/range/range.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
11 namespace ui { 11 namespace gfx {
12 12
13 Range::Range(const CHARRANGE& range, LONG total_length) { 13 Range::Range(const CHARRANGE& range, LONG total_length) {
14 // Check if this is an invalid range. 14 // Check if this is an invalid range.
15 if (range.cpMin == -1 && range.cpMax == -1) { 15 if (range.cpMin == -1 && range.cpMax == -1) {
16 *this = InvalidRange(); 16 *this = InvalidRange();
17 } else { 17 } else {
18 DCHECK_GE(range.cpMin, 0); 18 DCHECK_GE(range.cpMin, 0);
19 set_start(range.cpMin); 19 set_start(range.cpMin);
20 // {0,-1} is the "whole range" but that doesn't mean much out of context, 20 // {0,-1} is the "whole range" but that doesn't mean much out of context,
21 // so use the |total_length| parameter. 21 // so use the |total_length| parameter.
(...skipping 14 matching lines...) Expand all
36 36
37 const LONG kLONGMax = std::numeric_limits<LONG>::max(); 37 const LONG kLONGMax = std::numeric_limits<LONG>::max();
38 CHECK_LE(static_cast<LONG>(start()), kLONGMax); 38 CHECK_LE(static_cast<LONG>(start()), kLONGMax);
39 CHECK_LE(static_cast<LONG>(end()), kLONGMax); 39 CHECK_LE(static_cast<LONG>(end()), kLONGMax);
40 r.cpMin = static_cast<LONG>(start()); 40 r.cpMin = static_cast<LONG>(start());
41 r.cpMax = static_cast<LONG>(end()); 41 r.cpMax = static_cast<LONG>(end());
42 return r; 42 return r;
43 } 43 }
44 44
45 } // namespace gfx 45 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/range/range_unittest.cc ('k') | ui/gfx/range/range_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698