| 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 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 LayoutRect_h | 31 #ifndef LayoutRect_h |
| 32 #define LayoutRect_h | 32 #define LayoutRect_h |
| 33 | 33 |
| 34 #include "core/platform/graphics/IntRect.h" | 34 #include "platform/geometry/IntRect.h" |
| 35 #include "core/platform/graphics/LayoutBoxExtent.h" | 35 #include "platform/geometry/LayoutBoxExtent.h" |
| 36 #include "core/platform/graphics/LayoutPoint.h" | 36 #include "platform/geometry/LayoutPoint.h" |
| 37 #include "wtf/Vector.h" | 37 #include "wtf/Vector.h" |
| 38 | 38 |
| 39 namespace WebCore { | 39 namespace WebCore { |
| 40 | 40 |
| 41 class FloatRect; | 41 class FloatRect; |
| 42 | 42 |
| 43 class LayoutRect { | 43 class LayoutRect { |
| 44 public: | 44 public: |
| 45 LayoutRect() { } | 45 LayoutRect() { } |
| 46 LayoutRect(const LayoutPoint& location, const LayoutSize& size) | 46 LayoutRect(const LayoutPoint& location, const LayoutSize& size) |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 return a.location() == b.location() && a.size() == b.size(); | 195 return a.location() == b.location() && a.size() == b.size(); |
| 196 } | 196 } |
| 197 | 197 |
| 198 inline bool operator!=(const LayoutRect& a, const LayoutRect& b) | 198 inline bool operator!=(const LayoutRect& a, const LayoutRect& b) |
| 199 { | 199 { |
| 200 return a.location() != b.location() || a.size() != b.size(); | 200 return a.location() != b.location() || a.size() != b.size(); |
| 201 } | 201 } |
| 202 | 202 |
| 203 inline IntRect pixelSnappedIntRect(const LayoutRect& rect) | 203 inline IntRect pixelSnappedIntRect(const LayoutRect& rect) |
| 204 { | 204 { |
| 205 return IntRect(roundedIntPoint(rect.location()), IntSize(snapSizeToPixel(rec
t.width(), rect.x()), | 205 return IntRect(roundedIntPoint(rect.location()), IntSize( |
| 206 snapSizeToPixel(rec
t.height(), rect.y()))); | 206 snapSizeToPixel(rect.width(), rect.x()), |
| 207 snapSizeToPixel(rect.height(), rect.y()))); |
| 207 } | 208 } |
| 208 | 209 |
| 209 IntRect enclosingIntRect(const LayoutRect&); | 210 IntRect enclosingIntRect(const LayoutRect&); |
| 210 LayoutRect enclosingLayoutRect(const FloatRect&); | 211 LayoutRect enclosingLayoutRect(const FloatRect&); |
| 211 | 212 |
| 212 | |
| 213 inline IntRect pixelSnappedIntRect(LayoutUnit left, LayoutUnit top, LayoutUnit w
idth, LayoutUnit height) | 213 inline IntRect pixelSnappedIntRect(LayoutUnit left, LayoutUnit top, LayoutUnit w
idth, LayoutUnit height) |
| 214 { | 214 { |
| 215 return IntRect(left.round(), top.round(), snapSizeToPixel(width, left), snap
SizeToPixel(height, top)); | 215 return IntRect(left.round(), top.round(), snapSizeToPixel(width, left), snap
SizeToPixel(height, top)); |
| 216 } | 216 } |
| 217 | 217 |
| 218 inline IntRect pixelSnappedIntRectFromEdges(LayoutUnit left, LayoutUnit top, Lay
outUnit right, LayoutUnit bottom) | 218 inline IntRect pixelSnappedIntRectFromEdges(LayoutUnit left, LayoutUnit top, Lay
outUnit right, LayoutUnit bottom) |
| 219 { | 219 { |
| 220 return IntRect(left.round(), top.round(), snapSizeToPixel(right - left, left
), snapSizeToPixel(bottom - top, top)); | 220 return IntRect(left.round(), top.round(), snapSizeToPixel(right - left, left
), snapSizeToPixel(bottom - top, top)); |
| 221 } | 221 } |
| 222 | 222 |
| 223 inline IntRect pixelSnappedIntRect(LayoutPoint location, LayoutSize size) | 223 inline IntRect pixelSnappedIntRect(LayoutPoint location, LayoutSize size) |
| 224 { | 224 { |
| 225 return IntRect(roundedIntPoint(location), pixelSnappedIntSize(size, location
)); | 225 return IntRect(roundedIntPoint(location), pixelSnappedIntSize(size, location
)); |
| 226 } | 226 } |
| 227 | 227 |
| 228 } // namespace WebCore | 228 } // namespace WebCore |
| 229 | 229 |
| 230 #endif // LayoutRect_h | 230 #endif // LayoutRect_h |
| OLD | NEW |