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 18 matching lines...) Expand all Loading... |
29 */ | 29 */ |
30 | 30 |
31 #ifndef LayoutRect_h | 31 #ifndef LayoutRect_h |
32 #define LayoutRect_h | 32 #define LayoutRect_h |
33 | 33 |
34 #include "IntRect.h" | 34 #include "IntRect.h" |
35 #include "LayoutBoxExtent.h" | 35 #include "LayoutBoxExtent.h" |
36 #include "LayoutPoint.h" | 36 #include "LayoutPoint.h" |
37 #include <wtf/Vector.h> | 37 #include <wtf/Vector.h> |
38 | 38 |
39 #if PLATFORM(QT) | |
40 #include <qglobal.h> | |
41 QT_BEGIN_NAMESPACE | |
42 class QRect; | |
43 class QRectF; | |
44 QT_END_NAMESPACE | |
45 #endif | |
46 | |
47 namespace WebCore { | 39 namespace WebCore { |
48 | 40 |
49 class FloatRect; | 41 class FloatRect; |
50 | 42 |
51 class LayoutRect { | 43 class LayoutRect { |
52 public: | 44 public: |
53 LayoutRect() { } | 45 LayoutRect() { } |
54 LayoutRect(const LayoutPoint& location, const LayoutSize& size) | 46 LayoutRect(const LayoutPoint& location, const LayoutSize& size) |
55 : m_location(location), m_size(size) { } | 47 : m_location(location), m_size(size) { } |
56 LayoutRect(LayoutUnit x, LayoutUnit y, LayoutUnit width, LayoutUnit height) | 48 LayoutRect(LayoutUnit x, LayoutUnit y, LayoutUnit width, LayoutUnit height) |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 void scale(float s); | 161 void scale(float s); |
170 | 162 |
171 LayoutRect transposedRect() const { return LayoutRect(m_location.transposedP
oint(), m_size.transposedSize()); } | 163 LayoutRect transposedRect() const { return LayoutRect(m_location.transposedP
oint(), m_size.transposedSize()); } |
172 | 164 |
173 static LayoutRect infiniteRect() | 165 static LayoutRect infiniteRect() |
174 { | 166 { |
175 // Return a rect that is slightly smaller than the true max rect to allo
w pixelSnapping to round up to the nearest IntRect without overflowing. | 167 // Return a rect that is slightly smaller than the true max rect to allo
w pixelSnapping to round up to the nearest IntRect without overflowing. |
176 return LayoutRect(LayoutUnit::nearlyMin() / 2, LayoutUnit::nearlyMin() /
2, LayoutUnit::nearlyMax(), LayoutUnit::nearlyMax()); | 168 return LayoutRect(LayoutUnit::nearlyMin() / 2, LayoutUnit::nearlyMin() /
2, LayoutUnit::nearlyMax(), LayoutUnit::nearlyMax()); |
177 } | 169 } |
178 | 170 |
179 #if PLATFORM(QT) | |
180 explicit LayoutRect(const QRect&); | |
181 explicit LayoutRect(const QRectF&); | |
182 operator QRectF() const; | |
183 #endif | |
184 | |
185 private: | 171 private: |
186 LayoutPoint m_location; | 172 LayoutPoint m_location; |
187 LayoutSize m_size; | 173 LayoutSize m_size; |
188 }; | 174 }; |
189 | 175 |
190 inline LayoutRect intersection(const LayoutRect& a, const LayoutRect& b) | 176 inline LayoutRect intersection(const LayoutRect& a, const LayoutRect& b) |
191 { | 177 { |
192 LayoutRect c = a; | 178 LayoutRect c = a; |
193 c.intersect(b); | 179 c.intersect(b); |
194 return c; | 180 return c; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 } | 220 } |
235 | 221 |
236 inline IntRect pixelSnappedIntRect(LayoutPoint location, LayoutSize size) | 222 inline IntRect pixelSnappedIntRect(LayoutPoint location, LayoutSize size) |
237 { | 223 { |
238 return IntRect(roundedIntPoint(location), pixelSnappedIntSize(size, location
)); | 224 return IntRect(roundedIntPoint(location), pixelSnappedIntSize(size, location
)); |
239 } | 225 } |
240 | 226 |
241 } // namespace WebCore | 227 } // namespace WebCore |
242 | 228 |
243 #endif // LayoutRect_h | 229 #endif // LayoutRect_h |
OLD | NEW |