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

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

Issue 1660863002: Force all LayoutUnit construction to be explicit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also fix LayoutRectTest.cpp Created 4 years, 10 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 3c89c6e5fc14309ab09b8fcd023b27e18007164f..0964d2559f32c2b2a0dd155cdad4c73b0706bce3 100644
--- a/third_party/WebKit/Source/platform/geometry/LayoutRect.h
+++ b/third_party/WebKit/Source/platform/geometry/LayoutRect.h
@@ -52,6 +52,8 @@ public:
: m_location(location), m_size(size) { }
LayoutRect(LayoutUnit x, LayoutUnit y, LayoutUnit width, LayoutUnit height)
: m_location(LayoutPoint(x, y)), m_size(LayoutSize(width, height)) { }
+ LayoutRect(int x, int y, int width, int height)
+ : m_location(LayoutPoint(x, y)), m_size(LayoutSize(width, height)) { }
LayoutRect(const FloatPoint& location, const FloatSize& size)
: m_location(location), m_size(size) { }
LayoutRect(const DoublePoint& location, const DoubleSize& size)
@@ -98,6 +100,7 @@ public:
void moveBy(const LayoutPoint& offset) { m_location.move(offset.x(), offset.y()); }
void moveBy(const IntPoint& offset) { m_location.move(LayoutUnit(offset.x()), LayoutUnit(offset.y())); }
void move(LayoutUnit dx, LayoutUnit dy) { m_location.move(dx, dy); }
+ void move(int dx, int dy) { m_location.move(LayoutUnit(dx), LayoutUnit(dy)); }
void expand(const LayoutSize& size) { m_size += size; }
void expand(const LayoutRectOutsets& box)
@@ -113,6 +116,7 @@ public:
}
void contract(const LayoutSize& size) { m_size -= size; }
void contract(LayoutUnit dw, LayoutUnit dh) { m_size.expand(-dw, -dh); }
+ void contract(int dw, int dh) { m_size.expand(-dw, -dh); }
void contractEdges(LayoutUnit top, LayoutUnit right, LayoutUnit bottom, LayoutUnit left)
{
m_location.move(left, top);
@@ -175,6 +179,7 @@ public:
m_size.setHeight(m_size.height() + dy + dy);
}
void inflate(LayoutUnit d) { inflateX(d); inflateY(d); }
+ void inflate(int d) { inflate(LayoutUnit(d)); }
void scale(float s);
void scale(float xAxisScale, float yAxisScale);

Powered by Google App Engine
This is Rietveld 408576698