LEFT | RIGHT |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2005 Nokia. All rights reserved. | 3 * Copyright (C) 2005 Nokia. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 t = 0; | 88 t = 0; |
89 r = 0; | 89 r = 0; |
90 b = 0; | 90 b = 0; |
91 } | 91 } |
92 | 92 |
93 setLocationAndSizeFromEdges(l, t, r, b); | 93 setLocationAndSizeFromEdges(l, t, r, b); |
94 } | 94 } |
95 | 95 |
96 bool FloatRect::inclusiveIntersect(const FloatRect& other) | 96 bool FloatRect::inclusiveIntersect(const FloatRect& other) |
97 { | 97 { |
98 float l = std::max(x(), other.x()); | 98 float left = std::max(x(), other.x()); |
99 float t = std::max(y(), other.y()); | 99 float top = std::max(y(), other.y()); |
100 float r = std::min(maxX(), other.maxX()); | 100 float right = std::min(maxX(), other.maxX()); |
101 float b = std::min(maxY(), other.maxY()); | 101 float bottom = std::min(maxY(), other.maxY()); |
102 | 102 |
103 // Return a clean empty rectangle for non-intersecting cases. | 103 // Return a clean empty rectangle for non-intersecting cases. |
104 if (l > r || t > b) { | 104 if (left > right || top > bottom) { |
105 l = 0; | 105 left = 0; |
106 t = 0; | 106 top = 0; |
107 r = 0; | 107 right = 0; |
108 b = 0; | 108 bottom = 0; |
109 return false; | 109 return false; |
110 } | 110 } |
111 | 111 |
112 setLocationAndSizeFromEdges(l, t, r, b); | 112 setLocationAndSizeFromEdges(left, top, right, bottom); |
113 return true; | 113 return true; |
114 } | 114 } |
115 | 115 |
116 | 116 |
117 void FloatRect::unite(const FloatRect& other) | 117 void FloatRect::unite(const FloatRect& other) |
118 { | 118 { |
119 // Handle empty special cases first. | 119 // Handle empty special cases first. |
120 if (other.isEmpty()) | 120 if (other.isEmpty()) |
121 return; | 121 return; |
122 if (isEmpty()) { | 122 if (isEmpty()) { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 if (ts.hasFormattingFlag(TextStream::Formatting::SVGStyleRect)) { | 251 if (ts.hasFormattingFlag(TextStream::Formatting::SVGStyleRect)) { |
252 // FIXME: callers should use the NumberRespectingIntegers flag. | 252 // FIXME: callers should use the NumberRespectingIntegers flag. |
253 return ts << "at (" << TextStream::FormatNumberRespectingIntegers(r.x())
<< "," << TextStream::FormatNumberRespectingIntegers(r.y()) | 253 return ts << "at (" << TextStream::FormatNumberRespectingIntegers(r.x())
<< "," << TextStream::FormatNumberRespectingIntegers(r.y()) |
254 << ") size " << TextStream::FormatNumberRespectingIntegers(r.width()
) << "x" << TextStream::FormatNumberRespectingIntegers(r.height()); | 254 << ") size " << TextStream::FormatNumberRespectingIntegers(r.width()
) << "x" << TextStream::FormatNumberRespectingIntegers(r.height()); |
255 } | 255 } |
256 | 256 |
257 return ts << r.location() << " " << r.size(); | 257 return ts << r.location() << " " << r.size(); |
258 } | 258 } |
259 | 259 |
260 } | 260 } |
LEFT | RIGHT |