OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012, Google Inc. All rights reserved. | 2 * Copyright (c) 2012, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 17 matching lines...) Expand all Loading... |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef LayoutSize_h | 31 #ifndef LayoutSize_h |
32 #define LayoutSize_h | 32 #define LayoutSize_h |
33 | 33 |
34 #include "FloatSize.h" | 34 #include "FloatSize.h" |
35 #include "IntSize.h" | 35 #include "IntSize.h" |
36 #include "LayoutUnit.h" | 36 #include "LayoutUnit.h" |
37 | 37 |
38 #if PLATFORM(QT) | |
39 #include <qglobal.h> | |
40 QT_BEGIN_NAMESPACE | |
41 class QSize; | |
42 class QSizeF; | |
43 QT_END_NAMESPACE | |
44 #endif | |
45 | |
46 namespace WebCore { | 38 namespace WebCore { |
47 | 39 |
48 class LayoutPoint; | 40 class LayoutPoint; |
49 | 41 |
50 class LayoutSize { | 42 class LayoutSize { |
51 public: | 43 public: |
52 LayoutSize() : m_width(0), m_height(0) { } | 44 LayoutSize() : m_width(0), m_height(0) { } |
53 LayoutSize(const IntSize& size) : m_width(size.width()), m_height(size.heigh
t()) { } | 45 LayoutSize(const IntSize& size) : m_width(size.width()), m_height(size.heigh
t()) { } |
54 LayoutSize(LayoutUnit width, LayoutUnit height) : m_width(width), m_height(h
eight) { } | 46 LayoutSize(LayoutUnit width, LayoutUnit height) : m_width(width), m_height(h
eight) { } |
55 | 47 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 m_width = minimumSize.width(); | 105 m_width = minimumSize.width(); |
114 if (m_height < minimumSize.height()) | 106 if (m_height < minimumSize.height()) |
115 m_height = minimumSize.height(); | 107 m_height = minimumSize.height(); |
116 } | 108 } |
117 | 109 |
118 LayoutSize transposedSize() const | 110 LayoutSize transposedSize() const |
119 { | 111 { |
120 return LayoutSize(m_height, m_width); | 112 return LayoutSize(m_height, m_width); |
121 } | 113 } |
122 | 114 |
123 #if PLATFORM(QT) | |
124 explicit LayoutSize(const QSize&); | |
125 explicit LayoutSize(const QSizeF&); | |
126 operator QSizeF() const; | |
127 #endif | |
128 | |
129 private: | 115 private: |
130 LayoutUnit m_width, m_height; | 116 LayoutUnit m_width, m_height; |
131 }; | 117 }; |
132 | 118 |
133 inline LayoutSize& operator+=(LayoutSize& a, const LayoutSize& b) | 119 inline LayoutSize& operator+=(LayoutSize& a, const LayoutSize& b) |
134 { | 120 { |
135 a.setWidth(a.width() + b.width()); | 121 a.setWidth(a.width() + b.width()); |
136 a.setHeight(a.height() + b.height()); | 122 a.setHeight(a.height() + b.height()); |
137 return a; | 123 return a; |
138 } | 124 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 } | 166 } |
181 | 167 |
182 inline LayoutSize roundedLayoutSize(const FloatSize& s) | 168 inline LayoutSize roundedLayoutSize(const FloatSize& s) |
183 { | 169 { |
184 return LayoutSize(s); | 170 return LayoutSize(s); |
185 } | 171 } |
186 | 172 |
187 } // namespace WebCore | 173 } // namespace WebCore |
188 | 174 |
189 #endif // LayoutSize_h | 175 #endif // LayoutSize_h |
OLD | NEW |