| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 void inflateY(FractionalLayoutUnit dy) | 158 void inflateY(FractionalLayoutUnit dy) |
| 159 { | 159 { |
| 160 m_location.setY(m_location.y() - dy); | 160 m_location.setY(m_location.y() - dy); |
| 161 m_size.setHeight(m_size.height() + dy + dy); | 161 m_size.setHeight(m_size.height() + dy + dy); |
| 162 } | 162 } |
| 163 void inflate(FractionalLayoutUnit d) { inflateX(d); inflateY(d); } | 163 void inflate(FractionalLayoutUnit d) { inflateX(d); inflateY(d); } |
| 164 void scale(float s); | 164 void scale(float s); |
| 165 | 165 |
| 166 FractionalLayoutRect transposedRect() const { return FractionalLayoutRect(m_
location.transposedPoint(), m_size.transposedSize()); } | 166 FractionalLayoutRect transposedRect() const { return FractionalLayoutRect(m_
location.transposedPoint(), m_size.transposedSize()); } |
| 167 | 167 |
| 168 static FractionalLayoutRect infiniteRect() {return FractionalLayoutRect(Frac
tionalLayoutUnit::min() / 2, FractionalLayoutUnit::min() / 2, FractionalLayoutUn
it::max(), FractionalLayoutUnit::max()); } | 168 static FractionalLayoutRect infiniteRect() |
| 169 { |
| 170 // 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. |
| 171 return FractionalLayoutRect(FractionalLayoutUnit::nearlyMin() / 2, Fract
ionalLayoutUnit::nearlyMin() / 2, FractionalLayoutUnit::nearlyMax(), FractionalL
ayoutUnit::nearlyMax()); |
| 172 } |
| 169 | 173 |
| 170 #if PLATFORM(QT) | 174 #if PLATFORM(QT) |
| 171 explicit FractionalLayoutRect(const QRect&); | 175 explicit FractionalLayoutRect(const QRect&); |
| 172 explicit FractionalLayoutRect(const QRectF&); | 176 explicit FractionalLayoutRect(const QRectF&); |
| 173 operator QRectF() const; | 177 operator QRectF() const; |
| 174 #endif | 178 #endif |
| 175 | 179 |
| 176 private: | 180 private: |
| 177 FractionalLayoutPoint m_location; | 181 FractionalLayoutPoint m_location; |
| 178 FractionalLayoutSize m_size; | 182 FractionalLayoutSize m_size; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 200 } | 204 } |
| 201 | 205 |
| 202 inline bool operator!=(const FractionalLayoutRect& a, const FractionalLayoutRect
& b) | 206 inline bool operator!=(const FractionalLayoutRect& a, const FractionalLayoutRect
& b) |
| 203 { | 207 { |
| 204 return a.location() != b.location() || a.size() != b.size(); | 208 return a.location() != b.location() || a.size() != b.size(); |
| 205 } | 209 } |
| 206 | 210 |
| 207 inline IntRect pixelSnappedIntRect(const FractionalLayoutRect& rect) | 211 inline IntRect pixelSnappedIntRect(const FractionalLayoutRect& rect) |
| 208 { | 212 { |
| 209 #if ENABLE(SUBPIXEL_LAYOUT) | 213 #if ENABLE(SUBPIXEL_LAYOUT) |
| 210 IntPoint roundedLocation = roundedIntPoint(rect.location()); | 214 return IntRect(roundedIntPoint(rect.location()), IntSize(snapSizeToPixel(rec
t.width(), rect.x()), |
| 211 return IntRect(roundedLocation, IntSize((rect.x() + rect.width()).round() -
roundedLocation.x(), | 215 snapSizeToPixel(rec
t.height(), rect.y()))); |
| 212 (rect.y() + rect.height()).round() -
roundedLocation.y())); | 216 |
| 213 #else | 217 #else |
| 214 return IntRect(rect); | 218 return IntRect(rect); |
| 215 #endif | 219 #endif |
| 216 } | 220 } |
| 217 | 221 |
| 218 IntRect enclosingIntRect(const FractionalLayoutRect&); | 222 IntRect enclosingIntRect(const FractionalLayoutRect&); |
| 219 FractionalLayoutRect enclosingFractionalLayoutRect(const FloatRect&); | 223 FractionalLayoutRect enclosingFractionalLayoutRect(const FloatRect&); |
| 220 | 224 |
| 221 } // namespace WebCore | 225 } // namespace WebCore |
| 222 | 226 |
| 223 #endif // FractionalLayoutRect_h | 227 #endif // FractionalLayoutRect_h |
| OLD | NEW |