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 of width/height overflow, fix the right/bottom edge and shift the top/left ones |
93 m_layoutOverflow.setHeight(maxY - m_layoutOverflow.y()); | 93 if (minX < 0 && maxX >= 0 && minX + INT_MAX < maxX) |
eae
2013/08/21 15:40:09
I don't understand what this code is trying to do.
| |
94 minX = maxX - INT_MAX; | |
95 if (minY < 0 && maxY >= 0 && minY + INT_MAX < maxY) | |
96 minY = maxY - INT_MAX; | |
97 | |
98 m_layoutOverflow.setX(minX); | |
99 m_layoutOverflow.setY(minY); | |
100 m_layoutOverflow.setWidth(maxX - minX); | |
101 m_layoutOverflow.setHeight(maxY - minY); | |
94 } | 102 } |
95 | 103 |
96 inline void RenderOverflow::addVisualOverflow(const LayoutRect& rect) | 104 inline void RenderOverflow::addVisualOverflow(const LayoutRect& rect) |
97 { | 105 { |
98 LayoutUnit maxX = std::max(rect.maxX(), m_visualOverflow.maxX()); | 106 LayoutUnit maxX = std::max(rect.maxX(), m_visualOverflow.maxX()); |
99 LayoutUnit maxY = std::max(rect.maxY(), m_visualOverflow.maxY()); | 107 LayoutUnit maxY = std::max(rect.maxY(), m_visualOverflow.maxY()); |
100 m_visualOverflow.setX(std::min(rect.x(), m_visualOverflow.x())); | 108 m_visualOverflow.setX(std::min(rect.x(), m_visualOverflow.x())); |
101 m_visualOverflow.setY(std::min(rect.y(), m_visualOverflow.y())); | 109 m_visualOverflow.setY(std::min(rect.y(), m_visualOverflow.y())); |
102 m_visualOverflow.setWidth(maxX - m_visualOverflow.x()); | 110 m_visualOverflow.setWidth(maxX - m_visualOverflow.x()); |
103 m_visualOverflow.setHeight(maxY - m_visualOverflow.y()); | 111 m_visualOverflow.setHeight(maxY - m_visualOverflow.y()); |
104 } | 112 } |
105 | 113 |
106 inline void RenderOverflow::setLayoutOverflow(const LayoutRect& rect) | 114 inline void RenderOverflow::setLayoutOverflow(const LayoutRect& rect) |
107 { | 115 { |
108 m_layoutOverflow = rect; | 116 m_layoutOverflow = rect; |
109 } | 117 } |
110 | 118 |
111 inline void RenderOverflow::setVisualOverflow(const LayoutRect& rect) | 119 inline void RenderOverflow::setVisualOverflow(const LayoutRect& rect) |
112 { | 120 { |
113 m_visualOverflow = rect; | 121 m_visualOverflow = rect; |
114 } | 122 } |
115 | 123 |
116 } // namespace WebCore | 124 } // namespace WebCore |
117 | 125 |
118 #endif // RenderOverflow_h | 126 #endif // RenderOverflow_h |
OLD | NEW |