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 #include "ui/gfx/rect_base.h" | 5 #include "ui/gfx/rect_base.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 | 9 |
10 // This file provides the implementation for RectBaese template and | 10 // This file provides the implementation for RectBaese template and |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 void RectBase<Class, PointClass, SizeClass, InsetsClass, Type>::Offset( | 107 void RectBase<Class, PointClass, SizeClass, InsetsClass, Type>::Offset( |
108 Type horizontal, Type vertical) { | 108 Type horizontal, Type vertical) { |
109 origin_.Offset(horizontal, vertical); | 109 origin_.Offset(horizontal, vertical); |
110 } | 110 } |
111 | 111 |
112 template<typename Class, | 112 template<typename Class, |
113 typename PointClass, | 113 typename PointClass, |
114 typename SizeClass, | 114 typename SizeClass, |
115 typename InsetsClass, | 115 typename InsetsClass, |
116 typename Type> | 116 typename Type> |
117 bool RectBase<Class, PointClass, SizeClass, InsetsClass, Type>::operator==( | |
118 const Class& other) const { | |
119 return origin_ == other.origin_ && size_ == other.size_; | |
120 } | |
121 | |
122 template<typename Class, | |
123 typename PointClass, | |
124 typename SizeClass, | |
125 typename InsetsClass, | |
126 typename Type> | |
127 bool RectBase<Class, PointClass, SizeClass, InsetsClass, Type>::operator<( | 117 bool RectBase<Class, PointClass, SizeClass, InsetsClass, Type>::operator<( |
128 const Class& other) const { | 118 const Class& other) const { |
129 if (origin_ == other.origin_) { | 119 if (origin_ == other.origin_) { |
130 if (width() == other.width()) { | 120 if (width() == other.width()) { |
131 return height() < other.height(); | 121 return height() < other.height(); |
132 } else { | 122 } else { |
133 return width() < other.width(); | 123 return width() < other.width(); |
134 } | 124 } |
135 } else { | 125 } else { |
136 return origin_ < other.origin_; | 126 return origin_ < other.origin_; |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 typename Type> | 299 typename Type> |
310 bool RectBase<Class, PointClass, SizeClass, InsetsClass, Type>::SharesEdgeWith( | 300 bool RectBase<Class, PointClass, SizeClass, InsetsClass, Type>::SharesEdgeWith( |
311 const Class& rect) const { | 301 const Class& rect) const { |
312 return (y() == rect.y() && height() == rect.height() && | 302 return (y() == rect.y() && height() == rect.height() && |
313 (x() == rect.right() || right() == rect.x())) || | 303 (x() == rect.right() || right() == rect.x())) || |
314 (x() == rect.x() && width() == rect.width() && | 304 (x() == rect.x() && width() == rect.width() && |
315 (y() == rect.bottom() || bottom() == rect.y())); | 305 (y() == rect.bottom() || bottom() == rect.y())); |
316 } | 306 } |
317 | 307 |
318 } // namespace gfx | 308 } // namespace gfx |
OLD | NEW |