OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "views/controls/textfield/text_range.h" |
| 6 |
| 7 #include <algorithm> |
| 8 |
| 9 namespace views { |
| 10 |
| 11 TextRange::TextRange() |
| 12 : start_(0), end_(0) { |
| 13 } |
| 14 |
| 15 TextRange::TextRange(size_t start, size_t end) |
| 16 : start_(start), end_(end) { |
| 17 } |
| 18 |
| 19 TextRange::TextRange(const TextRange& range) |
| 20 : start_(range.start_), end_(range.end_) { |
| 21 } |
| 22 |
| 23 size_t TextRange::GetMin() const { |
| 24 return std::min(start_, end_); |
| 25 } |
| 26 |
| 27 size_t TextRange::GetMax() const { |
| 28 return std::max(start_, end_); |
| 29 } |
| 30 bool TextRange::EqualsIgnoringDirection(const TextRange& range) const { |
| 31 return GetMin() == range.GetMin() && GetMax() == range.GetMax(); |
| 32 } |
| 33 |
| 34 void TextRange::SetRange(size_t start, size_t end) { |
| 35 start_ = start; |
| 36 end_ = end; |
| 37 } |
| 38 |
| 39 } // namespace views |
OLD | NEW |