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

Unified Diff: third_party/WebKit/public/platform/WebDoubleSize.h

Issue 2116283002: Don't let rounding prematurely influence document size when printing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@620456-2
Patch Set: bug 467579 Created 4 years, 4 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
« no previous file with comments | « third_party/WebKit/Source/web/WebLocalFrameImpl.cpp ('k') | third_party/WebKit/public/web/WebLocalFrame.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/public/platform/WebDoubleSize.h
diff --git a/third_party/WebKit/public/platform/WebDoubleSize.h b/third_party/WebKit/public/platform/WebDoubleSize.h
new file mode 100644
index 0000000000000000000000000000000000000000..c847d77c6fc05f4ed83ef6aff26a13f21a8bb75e
--- /dev/null
+++ b/third_party/WebKit/public/platform/WebDoubleSize.h
@@ -0,0 +1,101 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WebDoubleSize_h
+#define WebDoubleSize_h
+
+#include "WebCommon.h"
+
+#if INSIDE_BLINK
+#include "platform/geometry/DoubleSize.h"
+#else
+#include <ui/gfx/geometry/size_f.h>
+#include <ui/gfx/geometry/vector2d_f.h>
+#endif
+
+namespace blink {
+
+class WebDoubleSize {
+public:
+ bool isEmpty() const { return m_width <= 0 || m_height <= 0; }
+
+ WebDoubleSize()
+ : m_width(0)
+ , m_height(0)
+ {
+ }
+
+ WebDoubleSize(double m_width, double m_height)
+ : m_width(m_width)
+ , m_height(m_height)
+ {
+ }
+
+#if INSIDE_BLINK
+ WebDoubleSize(const DoubleSize& size)
+ : m_width(size.width())
+ , m_height(size.height())
+ {
+ }
+
+ WebDoubleSize& operator=(const DoubleSize& size)
+ {
+ m_width = size.width();
+ m_height = size.height();
+ return *this;
+ }
+
+ operator DoubleSize() const
+ {
+ return DoubleSize(m_width, m_height);
+ }
+#else
+ WebDoubleSize(const gfx::SizeF& size)
+ : m_width(size.width())
+ , m_height(size.height())
+ {
+ }
+
+ WebDoubleSize(const gfx::Vector2dF& vector)
+ : m_width(vector.x())
+ , m_height(vector.y())
+ {
+ }
+
+ WebDoubleSize& operator=(const gfx::SizeF& size)
+ {
+ m_width = size.width();
+ m_height = size.height();
+ return *this;
+ }
+
+ WebDoubleSize& operator=(const gfx::Vector2dF& vector)
+ {
+ m_width = vector.x();
+ m_height = vector.y();
+ return *this;
+ }
+#endif
+
+ double width() const { return m_width; }
+ double height() const { return m_height; }
+
+private:
+ double m_width;
+ double m_height;
+};
+
+inline bool operator==(const WebDoubleSize& a, const WebDoubleSize& b)
+{
+ return a.width() == b.width() && a.height() == b.height();
+}
+
+inline bool operator!=(const WebDoubleSize& a, const WebDoubleSize& b)
+{
+ return !(a == b);
+}
+
+} // namespace blink
+
+#endif
« no previous file with comments | « third_party/WebKit/Source/web/WebLocalFrameImpl.cpp ('k') | third_party/WebKit/public/web/WebLocalFrame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698