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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 if (!count) | 145 if (!count) |
146 return LayoutRect(); | 146 return LayoutRect(); |
147 | 147 |
148 LayoutRect result = rects[0]; | 148 LayoutRect result = rects[0]; |
149 for (size_t i = 1; i < count; ++i) | 149 for (size_t i = 1; i < count; ++i) |
150 result.uniteEvenIfEmpty(rects[i]); | 150 result.uniteEvenIfEmpty(rects[i]); |
151 | 151 |
152 return result; | 152 return result; |
153 } | 153 } |
154 | 154 |
155 IntRect enclosingIntRect(const LayoutRect& rect) { | |
156 IntPoint location = flooredIntPoint(rect.minXMinYCorner()); | |
157 IntPoint maxPoint = ceiledIntPoint(rect.maxXMaxYCorner()); | |
158 | |
159 return IntRect(location, maxPoint - location); | |
160 } | |
161 | |
162 LayoutRect enclosingLayoutRect(const FloatRect& rect) { | 155 LayoutRect enclosingLayoutRect(const FloatRect& rect) { |
163 LayoutPoint location = flooredLayoutPoint(rect.minXMinYCorner()); | 156 LayoutPoint location = flooredLayoutPoint(rect.minXMinYCorner()); |
164 LayoutPoint maxPoint = ceiledLayoutPoint(rect.maxXMaxYCorner()); | 157 LayoutPoint maxPoint = ceiledLayoutPoint(rect.maxXMaxYCorner()); |
165 return LayoutRect(location, maxPoint - location); | 158 return LayoutRect(location, maxPoint - location); |
166 } | 159 } |
167 | 160 |
168 String LayoutRect::toString() const { | 161 String LayoutRect::toString() const { |
169 return String::format("%s %s", location().toString().ascii().data(), | 162 return String::format("%s %s", location().toString().ascii().data(), |
170 size().toString().ascii().data()); | 163 size().toString().ascii().data()); |
171 } | 164 } |
172 | 165 |
173 } // namespace blink | 166 } // namespace blink |
OLD | NEW |