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

Unified Diff: third_party/WebKit/Source/platform/geometry/LayoutRect.h

Issue 1648573002: Transition to explicit constructors in LayoutUnit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove int constructors for size/point... they result in incorrect conversions until LayoutUnit is … Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/geometry/LayoutRect.h
diff --git a/third_party/WebKit/Source/platform/geometry/LayoutRect.h b/third_party/WebKit/Source/platform/geometry/LayoutRect.h
index 45a93ddfba7007bd14ba9133f2ec5f02cf7ff8c6..f1418a96655e54fdcba275a4c4c02abf90cf5d6c 100644
--- a/third_party/WebKit/Source/platform/geometry/LayoutRect.h
+++ b/third_party/WebKit/Source/platform/geometry/LayoutRect.h
@@ -121,23 +121,23 @@ public:
{
LayoutUnit delta = edge - x();
setX(edge);
- setWidth(std::max<LayoutUnit>(0, width() - delta));
+ setWidth((width() - delta).clampToZero());
}
void shiftMaxXEdgeTo(LayoutUnit edge)
{
LayoutUnit delta = edge - maxX();
- setWidth(std::max<LayoutUnit>(0, width() + delta));
+ setWidth((width() + delta).clampToZero());
}
void shiftYEdgeTo(LayoutUnit edge)
{
LayoutUnit delta = edge - y();
setY(edge);
- setHeight(std::max<LayoutUnit>(0, height() - delta));
+ setHeight((height() - delta).clampToZero());
}
void shiftMaxYEdgeTo(LayoutUnit edge)
{
LayoutUnit delta = edge - maxY();
- setHeight(std::max<LayoutUnit>(0, height() + delta));
+ setHeight((height() + delta).clampToZero());
}
LayoutPoint minXMinYCorner() const { return m_location; } // typically topLeft
« no previous file with comments | « third_party/WebKit/Source/platform/geometry/LayoutPoint.h ('k') | third_party/WebKit/Source/platform/geometry/LayoutRect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698