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

Unified Diff: third_party/WebKit/Source/platform/geometry/LayoutSize.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/LayoutSize.h
diff --git a/third_party/WebKit/Source/platform/geometry/LayoutSize.h b/third_party/WebKit/Source/platform/geometry/LayoutSize.h
index d58be6ec65716e366691e57a98e2d839cb5f7391..4a2aa28287eb525341d9d773fe371aa5a9fff6bf 100644
--- a/third_party/WebKit/Source/platform/geometry/LayoutSize.h
+++ b/third_party/WebKit/Source/platform/geometry/LayoutSize.h
@@ -52,6 +52,8 @@ public:
LayoutSize() { }
explicit LayoutSize(const IntSize& size) : m_width(size.width()), m_height(size.height()) { }
LayoutSize(LayoutUnit width, LayoutUnit height) : m_width(width), m_height(height) { }
+ LayoutSize(int width, int height) : m_width(LayoutUnit(width)), m_height(LayoutUnit(height)) { }
+ LayoutSize(float width, float height) : m_width(LayoutUnit(width)), m_height(LayoutUnit(height)) { }
explicit LayoutSize(const FloatSize& size) : m_width(size.width()), m_height(size.height()) { }
explicit LayoutSize(const DoubleSize& size) : m_width(size.width()), m_height(size.height()) { }
@@ -73,6 +75,10 @@ public:
m_height += height;
}
+ void expand(int width, int height) { expand(LayoutUnit(width), LayoutUnit(height)); }
+
+ void shrink(int width, int height) { shrink(LayoutUnit(width), LayoutUnit(height)); }
+
void shrink(LayoutUnit width, LayoutUnit height)
{
m_width -= width;

Powered by Google App Engine
This is Rietveld 408576698