OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 inline void RenderOverflow::move(LayoutUnit dx, LayoutUnit dy) | 80 inline void RenderOverflow::move(LayoutUnit dx, LayoutUnit dy) |
81 { | 81 { |
82 m_layoutOverflow.move(dx, dy); | 82 m_layoutOverflow.move(dx, dy); |
83 m_visualOverflow.move(dx, dy); | 83 m_visualOverflow.move(dx, dy); |
84 } | 84 } |
85 | 85 |
86 inline void RenderOverflow::addLayoutOverflow(const LayoutRect& rect) | 86 inline void RenderOverflow::addLayoutOverflow(const LayoutRect& rect) |
87 { | 87 { |
88 LayoutUnit maxX = std::max(rect.maxX(), m_layoutOverflow.maxX()); | 88 LayoutUnit maxX = std::max(rect.maxX(), m_layoutOverflow.maxX()); |
89 LayoutUnit maxY = std::max(rect.maxY(), m_layoutOverflow.maxY()); | 89 LayoutUnit maxY = std::max(rect.maxY(), m_layoutOverflow.maxY()); |
90 m_layoutOverflow.setX(std::min(rect.x(), m_layoutOverflow.x())); | 90 LayoutUnit minX = std::min(rect.x(), m_layoutOverflow.x()); |
91 m_layoutOverflow.setY(std::min(rect.y(), m_layoutOverflow.y())); | 91 LayoutUnit minY = std::min(rect.y(), m_layoutOverflow.y()); |
92 m_layoutOverflow.setWidth(maxX - m_layoutOverflow.x()); | 92 // In case the width/height is larger than LayoutUnit can represent, fix the
right/bottom edge and shift the top/left ones |
93 m_layoutOverflow.setHeight(maxY - m_layoutOverflow.y()); | 93 m_layoutOverflow.setWidth(maxX - minX); |
| 94 m_layoutOverflow.setHeight(maxY - minY); |
| 95 m_layoutOverflow.setX(maxX - m_layoutOverflow.width()); |
| 96 m_layoutOverflow.setY(maxY - m_layoutOverflow.height()); |
94 } | 97 } |
95 | 98 |
96 inline void RenderOverflow::addVisualOverflow(const LayoutRect& rect) | 99 inline void RenderOverflow::addVisualOverflow(const LayoutRect& rect) |
97 { | 100 { |
98 LayoutUnit maxX = std::max(rect.maxX(), m_visualOverflow.maxX()); | 101 LayoutUnit maxX = std::max(rect.maxX(), m_visualOverflow.maxX()); |
99 LayoutUnit maxY = std::max(rect.maxY(), m_visualOverflow.maxY()); | 102 LayoutUnit maxY = std::max(rect.maxY(), m_visualOverflow.maxY()); |
100 m_visualOverflow.setX(std::min(rect.x(), m_visualOverflow.x())); | 103 m_visualOverflow.setX(std::min(rect.x(), m_visualOverflow.x())); |
101 m_visualOverflow.setY(std::min(rect.y(), m_visualOverflow.y())); | 104 m_visualOverflow.setY(std::min(rect.y(), m_visualOverflow.y())); |
102 m_visualOverflow.setWidth(maxX - m_visualOverflow.x()); | 105 m_visualOverflow.setWidth(maxX - m_visualOverflow.x()); |
103 m_visualOverflow.setHeight(maxY - m_visualOverflow.y()); | 106 m_visualOverflow.setHeight(maxY - m_visualOverflow.y()); |
104 } | 107 } |
105 | 108 |
106 inline void RenderOverflow::setLayoutOverflow(const LayoutRect& rect) | 109 inline void RenderOverflow::setLayoutOverflow(const LayoutRect& rect) |
107 { | 110 { |
108 m_layoutOverflow = rect; | 111 m_layoutOverflow = rect; |
109 } | 112 } |
110 | 113 |
111 inline void RenderOverflow::setVisualOverflow(const LayoutRect& rect) | 114 inline void RenderOverflow::setVisualOverflow(const LayoutRect& rect) |
112 { | 115 { |
113 m_visualOverflow = rect; | 116 m_visualOverflow = rect; |
114 } | 117 } |
115 | 118 |
116 } // namespace WebCore | 119 } // namespace WebCore |
117 | 120 |
118 #endif // RenderOverflow_h | 121 #endif // RenderOverflow_h |
OLD | NEW |