Index: ui/gfx/point_base.h |
diff --git a/ui/gfx/point_base.h b/ui/gfx/point_base.h |
index 2eed6142d6c3b1a3999d88bf6b7e720118624966..870b2644e4f986bc1d99fbad30e80bbc094eae80 100644 |
--- a/ui/gfx/point_base.h |
+++ b/ui/gfx/point_base.h |
@@ -41,6 +41,16 @@ class UI_EXPORT PointBase { |
Offset(-vector.x(), -vector.y()); |
} |
+ void ClampToMax(const Class& max) { |
+ x_ = x_ <= max.x_ ? x_ : max.x_; |
+ y_ = y_ <= max.y_ ? y_ : max.y_; |
+ } |
+ |
+ void ClampToMin(const Class& min) { |
+ x_ = x_ >= min.x_ ? x_ : min.x_; |
+ y_ = y_ >= min.y_ ? y_ : min.y_; |
+ } |
+ |
Class Middle(const Class& other) const WARN_UNUSED_RESULT { |
return Class((x_ + other.x_) / 2, (y_ + other.y_) / 2); |
} |