| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2009 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 IntRect::IntRect(const FloatRect& r) | 38 IntRect::IntRect(const FloatRect& r) |
| 39 : m_location(clampTo<int>(r.x()), clampTo<int>(r.y())) | 39 : m_location(clampTo<int>(r.x()), clampTo<int>(r.y())) |
| 40 , m_size(clampTo<int>(r.width()), clampTo<int>(r.height())) | 40 , m_size(clampTo<int>(r.width()), clampTo<int>(r.height())) |
| 41 { | 41 { |
| 42 } | 42 } |
| 43 | 43 |
| 44 IntRect::IntRect(const LayoutRect& r) | 44 IntRect::IntRect(const LayoutRect& r) |
| 45 : m_location(r.x(), r.y()) | 45 : m_location(r.x().toInt(), r.y().toInt()) |
| 46 , m_size(r.width(), r.height()) | 46 , m_size(r.width().toInt(), r.height().toInt()) |
| 47 { | 47 { |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool IntRect::intersects(const IntRect& other) const | 50 bool IntRect::intersects(const IntRect& other) const |
| 51 { | 51 { |
| 52 // Checking emptiness handles negative widths as well as zero. | 52 // Checking emptiness handles negative widths as well as zero. |
| 53 return !isEmpty() && !other.isEmpty() | 53 return !isEmpty() && !other.isEmpty() |
| 54 && x() < other.maxX() && other.x() < maxX() | 54 && x() < other.maxX() && other.x() < maxX() |
| 55 && y() < other.maxY() && other.y() < maxY(); | 55 && y() < other.maxY() && other.y() < maxY(); |
| 56 } | 56 } |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 } | 188 } |
| 189 | 189 |
| 190 String IntRect::toString() const | 190 String IntRect::toString() const |
| 191 { | 191 { |
| 192 return String::format("%s %s", | 192 return String::format("%s %s", |
| 193 location().toString().ascii().data(), | 193 location().toString().ascii().data(), |
| 194 size().toString().ascii().data()); | 194 size().toString().ascii().data()); |
| 195 } | 195 } |
| 196 | 196 |
| 197 } // namespace blink | 197 } // namespace blink |
| OLD | NEW |