| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 void contractEdges(LayoutUnit top, LayoutUnit right, LayoutUnit bottom, Layo
utUnit left) | 114 void contractEdges(LayoutUnit top, LayoutUnit right, LayoutUnit bottom, Layo
utUnit left) |
| 115 { | 115 { |
| 116 m_location.move(left, top); | 116 m_location.move(left, top); |
| 117 m_size.shrink(left + right, top + bottom); | 117 m_size.shrink(left + right, top + bottom); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void shiftXEdgeTo(LayoutUnit edge) | 120 void shiftXEdgeTo(LayoutUnit edge) |
| 121 { | 121 { |
| 122 LayoutUnit delta = edge - x(); | 122 LayoutUnit delta = edge - x(); |
| 123 setX(edge); | 123 setX(edge); |
| 124 setWidth((width() - delta).clampToZero()); | 124 setWidth((width() - delta).clampNegativeToZero()); |
| 125 } | 125 } |
| 126 void shiftMaxXEdgeTo(LayoutUnit edge) | 126 void shiftMaxXEdgeTo(LayoutUnit edge) |
| 127 { | 127 { |
| 128 LayoutUnit delta = edge - maxX(); | 128 LayoutUnit delta = edge - maxX(); |
| 129 setWidth((width() + delta).clampToZero()); | 129 setWidth((width() + delta).clampNegativeToZero()); |
| 130 } | 130 } |
| 131 void shiftYEdgeTo(LayoutUnit edge) | 131 void shiftYEdgeTo(LayoutUnit edge) |
| 132 { | 132 { |
| 133 LayoutUnit delta = edge - y(); | 133 LayoutUnit delta = edge - y(); |
| 134 setY(edge); | 134 setY(edge); |
| 135 setHeight((height() - delta).clampToZero()); | 135 setHeight((height() - delta).clampNegativeToZero()); |
| 136 } | 136 } |
| 137 void shiftMaxYEdgeTo(LayoutUnit edge) | 137 void shiftMaxYEdgeTo(LayoutUnit edge) |
| 138 { | 138 { |
| 139 LayoutUnit delta = edge - maxY(); | 139 LayoutUnit delta = edge - maxY(); |
| 140 setHeight((height() + delta).clampToZero()); | 140 setHeight((height() + delta).clampNegativeToZero()); |
| 141 } | 141 } |
| 142 | 142 |
| 143 LayoutPoint minXMinYCorner() const { return m_location; } // typically topLe
ft | 143 LayoutPoint minXMinYCorner() const { return m_location; } // typically topLe
ft |
| 144 LayoutPoint maxXMinYCorner() const { return LayoutPoint(m_location.x() + m_s
ize.width(), m_location.y()); } // typically topRight | 144 LayoutPoint maxXMinYCorner() const { return LayoutPoint(m_location.x() + m_s
ize.width(), m_location.y()); } // typically topRight |
| 145 LayoutPoint minXMaxYCorner() const { return LayoutPoint(m_location.x(), m_lo
cation.y() + m_size.height()); } // typically bottomLeft | 145 LayoutPoint minXMaxYCorner() const { return LayoutPoint(m_location.x(), m_lo
cation.y() + m_size.height()); } // typically bottomLeft |
| 146 LayoutPoint maxXMaxYCorner() const { return LayoutPoint(m_location.x() + m_s
ize.width(), m_location.y() + m_size.height()); } // typically bottomRight | 146 LayoutPoint maxXMaxYCorner() const { return LayoutPoint(m_location.x() + m_s
ize.width(), m_location.y() + m_size.height()); } // typically bottomRight |
| 147 | 147 |
| 148 bool intersects(const LayoutRect&) const; | 148 bool intersects(const LayoutRect&) const; |
| 149 bool contains(const LayoutRect&) const; | 149 bool contains(const LayoutRect&) const; |
| 150 | 150 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 return IntRect(roundedIntPoint(location), pixelSnappedIntSize(size, location
)); | 255 return IntRect(roundedIntPoint(location), pixelSnappedIntSize(size, location
)); |
| 256 } | 256 } |
| 257 | 257 |
| 258 // Redeclared here to avoid ODR issues. | 258 // Redeclared here to avoid ODR issues. |
| 259 // See platform/testing/GeometryPrinters.h. | 259 // See platform/testing/GeometryPrinters.h. |
| 260 void PrintTo(const LayoutRect&, std::ostream*); | 260 void PrintTo(const LayoutRect&, std::ostream*); |
| 261 | 261 |
| 262 } // namespace blink | 262 } // namespace blink |
| 263 | 263 |
| 264 #endif // LayoutRect_h | 264 #endif // LayoutRect_h |
| OLD | NEW |