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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef WebDoubleSize_h
6 #define WebDoubleSize_h
7
8 #include "WebCommon.h"
9
10 #if INSIDE_BLINK
11 #include "platform/geometry/DoubleSize.h"
12 #else
13 #include <ui/gfx/geometry/size_f.h>
14 #include <ui/gfx/geometry/vector2d_f.h>
15 #endif
16
17 namespace blink {
18
19 class WebDoubleSize {
20 public:
21 bool isEmpty() const { return m_width <= 0 || m_height <= 0; }
22
23 WebDoubleSize()
24 : m_width(0)
25 , m_height(0)
26 {
27 }
28
29 WebDoubleSize(double m_width, double m_height)
30 : m_width(m_width)
31 , m_height(m_height)
32 {
33 }
34
35 #if INSIDE_BLINK
36 WebDoubleSize(const DoubleSize& size)
37 : m_width(size.width())
38 , m_height(size.height())
39 {
40 }
41
42 WebDoubleSize& operator=(const DoubleSize& size)
43 {
44 m_width = size.width();
45 m_height = size.height();
46 return *this;
47 }
48
49 operator DoubleSize() const
50 {
51 return DoubleSize(m_width, m_height);
52 }
53 #else
54 WebDoubleSize(const gfx::SizeF& size)
55 : m_width(size.width())
56 , m_height(size.height())
57 {
58 }
59
60 WebDoubleSize(const gfx::Vector2dF& vector)
61 : m_width(vector.x())
62 , m_height(vector.y())
63 {
64 }
65
66 WebDoubleSize& operator=(const gfx::SizeF& size)
67 {
68 m_width = size.width();
69 m_height = size.height();
70 return *this;
71 }
72
73 WebDoubleSize& operator=(const gfx::Vector2dF& vector)
74 {
75 m_width = vector.x();
76 m_height = vector.y();
77 return *this;
78 }
79 #endif
80
81 double width() const { return m_width; }
82 double height() const { return m_height; }
83
84 private:
85 double m_width;
86 double m_height;
87 };
88
89 inline bool operator==(const WebDoubleSize& a, const WebDoubleSize& b)
90 {
91 return a.width() == b.width() && a.height() == b.height();
92 }
93
94 inline bool operator!=(const WebDoubleSize& a, const WebDoubleSize& b)
95 {
96 return !(a == b);
97 }
98
99 } // namespace blink
100
101 #endif
OLDNEW
« 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