| 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 |
| 3 * reserved. |
| 3 * | 4 * |
| 4 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 8 * | 9 * |
| 9 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 * Library General Public License for more details. | 13 * Library General Public License for more details. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 24 #include "platform/geometry/LayoutRect.h" | 25 #include "platform/geometry/LayoutRect.h" |
| 25 | 26 |
| 26 namespace blink { | 27 namespace blink { |
| 27 | 28 |
| 28 inline void uniteLayoutOverflowRect(LayoutRect& layoutOverflow, | 29 inline void uniteLayoutOverflowRect(LayoutRect& layoutOverflow, |
| 29 const LayoutRect& rect) { | 30 const LayoutRect& rect) { |
| 30 LayoutUnit maxX = std::max(rect.maxX(), layoutOverflow.maxX()); | 31 LayoutUnit maxX = std::max(rect.maxX(), layoutOverflow.maxX()); |
| 31 LayoutUnit maxY = std::max(rect.maxY(), layoutOverflow.maxY()); | 32 LayoutUnit maxY = std::max(rect.maxY(), layoutOverflow.maxY()); |
| 32 LayoutUnit minX = std::min(rect.x(), layoutOverflow.x()); | 33 LayoutUnit minX = std::min(rect.x(), layoutOverflow.x()); |
| 33 LayoutUnit minY = std::min(rect.y(), layoutOverflow.y()); | 34 LayoutUnit minY = std::min(rect.y(), layoutOverflow.y()); |
| 34 // In case the width/height is larger than LayoutUnit can represent, fix the r
ight/bottom edge and shift the top/left ones. | 35 // In case the width/height is larger than LayoutUnit can represent, fix the |
| 36 // right/bottom edge and shift the top/left ones. |
| 35 layoutOverflow.setWidth(maxX - minX); | 37 layoutOverflow.setWidth(maxX - minX); |
| 36 layoutOverflow.setHeight(maxY - minY); | 38 layoutOverflow.setHeight(maxY - minY); |
| 37 layoutOverflow.setX(maxX - layoutOverflow.width()); | 39 layoutOverflow.setX(maxX - layoutOverflow.width()); |
| 38 layoutOverflow.setY(maxY - layoutOverflow.height()); | 40 layoutOverflow.setY(maxY - layoutOverflow.height()); |
| 39 } | 41 } |
| 40 | 42 |
| 41 // OverflowModel classes track content that spills out of an object. | 43 // OverflowModel classes track content that spills out of an object. |
| 42 // SimpleOverflowModel is used by InlineFlowBox, and BoxOverflowModel is | 44 // SimpleOverflowModel is used by InlineFlowBox, and BoxOverflowModel is |
| 43 // used by LayoutBox. | 45 // used by LayoutBox. |
| 44 // | 46 // |
| (...skipping 24 matching lines...) Expand all Loading... |
| 69 // Due to how scrollbars work, no overflow in the logical top and logical left | 71 // Due to how scrollbars work, no overflow in the logical top and logical left |
| 70 // direction is allowed(see LayoutBox::addLayoutOverflow). | 72 // direction is allowed(see LayoutBox::addLayoutOverflow). |
| 71 // | 73 // |
| 72 // Visual overflow covers all the effects that visually bleed out of the box. | 74 // Visual overflow covers all the effects that visually bleed out of the box. |
| 73 // Its primary use is to determine the area to invalidate. | 75 // Its primary use is to determine the area to invalidate. |
| 74 // Visual overflow includes ('text-shadow' / 'box-shadow'), text stroke, | 76 // Visual overflow includes ('text-shadow' / 'box-shadow'), text stroke, |
| 75 // 'outline', 'border-image', etc. | 77 // 'outline', 'border-image', etc. |
| 76 // | 78 // |
| 77 // An overflow model object is allocated only when some of these fields have | 79 // An overflow model object is allocated only when some of these fields have |
| 78 // non-default values in the owning object. Care should be taken to use adder | 80 // non-default values in the owning object. Care should be taken to use adder |
| 79 // functions (addLayoutOverflow, addVisualOverflow, etc.) to keep this invariant
. | 81 // functions (addLayoutOverflow, addVisualOverflow, etc.) to keep this |
| 82 // invariant. |
| 80 | 83 |
| 81 class SimpleOverflowModel { | 84 class SimpleOverflowModel { |
| 82 WTF_MAKE_NONCOPYABLE(SimpleOverflowModel); | 85 WTF_MAKE_NONCOPYABLE(SimpleOverflowModel); |
| 83 USING_FAST_MALLOC(SimpleOverflowModel); | 86 USING_FAST_MALLOC(SimpleOverflowModel); |
| 84 | 87 |
| 85 public: | 88 public: |
| 86 SimpleOverflowModel(const LayoutRect& layoutRect, | 89 SimpleOverflowModel(const LayoutRect& layoutRect, |
| 87 const LayoutRect& visualRect) | 90 const LayoutRect& visualRect) |
| 88 : m_layoutOverflow(layoutRect), m_visualOverflow(visualRect) {} | 91 : m_layoutOverflow(layoutRect), m_visualOverflow(visualRect) {} |
| 89 | 92 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 102 void move(LayoutUnit dx, LayoutUnit dy) { | 105 void move(LayoutUnit dx, LayoutUnit dy) { |
| 103 m_layoutOverflow.move(dx, dy); | 106 m_layoutOverflow.move(dx, dy); |
| 104 m_visualOverflow.move(dx, dy); | 107 m_visualOverflow.move(dx, dy); |
| 105 } | 108 } |
| 106 | 109 |
| 107 private: | 110 private: |
| 108 LayoutRect m_layoutOverflow; | 111 LayoutRect m_layoutOverflow; |
| 109 LayoutRect m_visualOverflow; | 112 LayoutRect m_visualOverflow; |
| 110 }; | 113 }; |
| 111 | 114 |
| 112 // BoxModelOverflow tracks overflows of a LayoutBox. It separates visual overflo
w | 115 // BoxModelOverflow tracks overflows of a LayoutBox. It separates visual |
| 113 // into self visual overflow and contents visual overflow. | 116 // overflow into self visual overflow and contents visual overflow. |
| 114 // | 117 // |
| 115 // Self visual overflow covers all the effects of the object itself that visuall
y | 118 // Self visual overflow covers all the effects of the object itself that |
| 116 // bleed out of the box. | 119 // visually bleed out of the box. |
| 117 // | 120 // |
| 118 // Content visual overflow includes anything that would bleed out of the box and | 121 // Content visual overflow includes anything that would bleed out of the box and |
| 119 // would be clipped by the overflow clip ('overflow' != visible). This | 122 // would be clipped by the overflow clip ('overflow' != visible). This |
| 120 // corresponds to children that overflows their parent. | 123 // corresponds to children that overflows their parent. |
| 121 // It's important to note that this overflow ignores descendants with | 124 // It's important to note that this overflow ignores descendants with |
| 122 // self-painting layers (see the SELF-PAINTING LAYER section in PaintLayer). | 125 // self-painting layers (see the SELF-PAINTING LAYER section in PaintLayer). |
| 123 // This is required by the simplification made by this model (single united | 126 // This is required by the simplification made by this model (single united |
| 124 // rectangle) to avoid gigantic invalidation. A good example for this is | 127 // rectangle) to avoid gigantic invalidation. A good example for this is |
| 125 // positioned objects that can be anywhere on the page and could artificially | 128 // positioned objects that can be anywhere on the page and could artificially |
| 126 // inflate the visual overflow. | 129 // inflate the visual overflow. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 private: | 180 private: |
| 178 LayoutRect m_layoutOverflow; | 181 LayoutRect m_layoutOverflow; |
| 179 LayoutRect m_selfVisualOverflow; | 182 LayoutRect m_selfVisualOverflow; |
| 180 LayoutRect m_contentsVisualOverflow; | 183 LayoutRect m_contentsVisualOverflow; |
| 181 LayoutUnit m_layoutClientAfterEdge; | 184 LayoutUnit m_layoutClientAfterEdge; |
| 182 }; | 185 }; |
| 183 | 186 |
| 184 } // namespace blink | 187 } // namespace blink |
| 185 | 188 |
| 186 #endif // OverflowModel_h | 189 #endif // OverflowModel_h |
| OLD | NEW |