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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
157 // This checks to see if the rect contains x,y in the traditional sense. | 157 // This checks to see if the rect contains x,y in the traditional sense. |
158 // Equivalent to checking if the rect contains a 1x1 rect below and to the r ight of (px,py). | 158 // Equivalent to checking if the rect contains a 1x1 rect below and to the r ight of (px,py). |
159 bool contains(LayoutUnit px, LayoutUnit py) const | 159 bool contains(LayoutUnit px, LayoutUnit py) const |
160 { return px >= x() && px < maxX() && py >= y() && py < maxY(); } | 160 { return px >= x() && px < maxX() && py >= y() && py < maxY(); } |
161 bool contains(const LayoutPoint& point) const { return contains(point.x(), p oint.y()); } | 161 bool contains(const LayoutPoint& point) const { return contains(point.x(), p oint.y()); } |
162 | 162 |
163 void intersect(const LayoutRect&); | 163 void intersect(const LayoutRect&); |
164 void unite(const LayoutRect&); | 164 void unite(const LayoutRect&); |
165 void uniteIfNonZero(const LayoutRect&); | 165 void uniteIfNonZero(const LayoutRect&); |
166 | 166 |
167 bool inclusiveIntersect(const LayoutRect&); | |
chrishtr
2016/03/21 22:14:50
Document this.
| |
168 | |
167 // Besides non-empty rects, this method also unites empty rects (as points o r line segments). | 169 // Besides non-empty rects, this method also unites empty rects (as points o r line segments). |
168 // For example, union of (100, 100, 0x0) and (200, 200, 50x0) is (100, 100, 150x100). | 170 // For example, union of (100, 100, 0x0) and (200, 200, 50x0) is (100, 100, 150x100). |
169 void uniteEvenIfEmpty(const LayoutRect&); | 171 void uniteEvenIfEmpty(const LayoutRect&); |
170 | 172 |
171 void inflateX(LayoutUnit dx) | 173 void inflateX(LayoutUnit dx) |
172 { | 174 { |
173 m_location.setX(m_location.x() - dx); | 175 m_location.setX(m_location.x() - dx); |
174 m_size.setWidth(m_size.width() + dx + dx); | 176 m_size.setWidth(m_size.width() + dx + dx); |
175 } | 177 } |
176 void inflateY(LayoutUnit dy) | 178 void inflateY(LayoutUnit dy) |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
263 return IntRect(roundedIntPoint(location), pixelSnappedIntSize(size, location )); | 265 return IntRect(roundedIntPoint(location), pixelSnappedIntSize(size, location )); |
264 } | 266 } |
265 | 267 |
266 // Redeclared here to avoid ODR issues. | 268 // Redeclared here to avoid ODR issues. |
267 // See platform/testing/GeometryPrinters.h. | 269 // See platform/testing/GeometryPrinters.h. |
268 void PrintTo(const LayoutRect&, std::ostream*); | 270 void PrintTo(const LayoutRect&, std::ostream*); |
269 | 271 |
270 } // namespace blink | 272 } // namespace blink |
271 | 273 |
272 #endif // LayoutRect_h | 274 #endif // LayoutRect_h |
OLD | NEW |