| OLD | NEW |
| 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 #ifndef UI_GFX_BREAK_LIST_H_ | 5 #ifndef UI_GFX_BREAK_LIST_H_ |
| 6 #define UI_GFX_BREAK_LIST_H_ | 6 #define UI_GFX_BREAK_LIST_H_ |
| 7 | 7 |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 const std::vector<Break>& breaks() const { return breaks_; } | 37 const std::vector<Break>& breaks() const { return breaks_; } |
| 38 | 38 |
| 39 // Clear the breaks and set a break at position 0 with the supplied |value|. | 39 // Clear the breaks and set a break at position 0 with the supplied |value|. |
| 40 void SetValue(T value); | 40 void SetValue(T value); |
| 41 | 41 |
| 42 // Adjust the breaks to apply |value| over the supplied |range|. | 42 // Adjust the breaks to apply |value| over the supplied |range|. |
| 43 void ApplyValue(T value, const ui::Range& range); | 43 void ApplyValue(T value, const ui::Range& range); |
| 44 | 44 |
| 45 // Set the max position and trim any breaks at or beyond that position. | 45 // Set the max position and trim any breaks at or beyond that position. |
| 46 void SetMax(size_t max); | 46 void SetMax(size_t max); |
| 47 size_t max() const { return max_; } |
| 47 | 48 |
| 48 // Get the break applicable to |position| (at or preceeding |position|). | 49 // Get the break applicable to |position| (at or preceeding |position|). |
| 49 typename std::vector<Break>::iterator GetBreak(size_t position); | 50 typename std::vector<Break>::iterator GetBreak(size_t position); |
| 50 typename std::vector<Break>::const_iterator GetBreak(size_t position) const; | 51 typename std::vector<Break>::const_iterator GetBreak(size_t position) const; |
| 51 | 52 |
| 52 // Get the range of the supplied break; returns the break's start position and | 53 // Get the range of the supplied break; returns the break's start position and |
| 53 // the next break's start position (or |max_| for the terminal break). | 54 // the next break's start position (or |max_| for the terminal break). |
| 54 ui::Range GetRange(const typename BreakList<T>::const_iterator& i) const; | 55 ui::Range GetRange(const typename BreakList<T>::const_iterator& i) const; |
| 55 | 56 |
| 56 // Comparison functions for testing purposes. | 57 // Comparison functions for testing purposes. |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 DCHECK_NE(breaks_[i].second, breaks_[i + 1].second) << "Redundant break."; | 166 DCHECK_NE(breaks_[i].second, breaks_[i + 1].second) << "Redundant break."; |
| 166 } | 167 } |
| 167 if (max_ > 0) | 168 if (max_ > 0) |
| 168 DCHECK_LT(breaks_.back().first, max_) << "Break beyond max position."; | 169 DCHECK_LT(breaks_.back().first, max_) << "Break beyond max position."; |
| 169 } | 170 } |
| 170 #endif | 171 #endif |
| 171 | 172 |
| 172 } // namespace gfx | 173 } // namespace gfx |
| 173 | 174 |
| 174 #endif // UI_GFX_BREAK_LIST_H_ | 175 #endif // UI_GFX_BREAK_LIST_H_ |
| OLD | NEW |