OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 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 |
11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
12 * | 12 * |
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef LayoutState_h | 26 #ifndef LayoutState_h |
27 #define LayoutState_h | 27 #define LayoutState_h |
28 | 28 |
29 #include "core/rendering/ColumnInfo.h" | |
30 #include "platform/geometry/LayoutRect.h" | 29 #include "platform/geometry/LayoutRect.h" |
31 #include "wtf/HashMap.h" | 30 #include "wtf/HashMap.h" |
32 #include "wtf/Noncopyable.h" | 31 #include "wtf/Noncopyable.h" |
33 | 32 |
34 namespace WebCore { | 33 namespace WebCore { |
35 | 34 |
36 class RenderBlockFlow; | 35 class RenderBlockFlow; |
37 class RenderBox; | 36 class RenderBox; |
38 class RenderObject; | 37 class RenderObject; |
39 class RenderFlowThread; | 38 class RenderFlowThread; |
40 class ShapeInsideInfo; | 39 class ShapeInsideInfo; |
41 | 40 |
42 class LayoutState { | 41 class LayoutState { |
43 WTF_MAKE_NONCOPYABLE(LayoutState); | 42 WTF_MAKE_NONCOPYABLE(LayoutState); |
44 public: | 43 public: |
45 LayoutState() | 44 LayoutState() |
46 : m_clipped(false) | 45 : m_clipped(false) |
47 , m_isPaginated(false) | 46 , m_isPaginated(false) |
48 , m_pageLogicalHeightChanged(false) | 47 , m_pageLogicalHeightChanged(false) |
49 #if !ASSERT_DISABLED | 48 #if !ASSERT_DISABLED |
50 , m_layoutDeltaXSaturated(false) | 49 , m_layoutDeltaXSaturated(false) |
51 , m_layoutDeltaYSaturated(false) | 50 , m_layoutDeltaYSaturated(false) |
52 #endif | 51 #endif |
53 , m_columnInfo(0) | |
54 , m_lineGrid(0) | 52 , m_lineGrid(0) |
55 , m_next(0) | 53 , m_next(0) |
56 , m_shapeInsideInfo(0) | 54 , m_shapeInsideInfo(0) |
57 , m_pageLogicalHeight(0) | 55 , m_pageLogicalHeight(0) |
58 #ifndef NDEBUG | 56 #ifndef NDEBUG |
59 , m_renderer(0) | 57 , m_renderer(0) |
60 #endif | 58 #endif |
61 { | 59 { |
62 } | 60 } |
63 | 61 |
64 LayoutState(LayoutState*, RenderBox*, const LayoutSize& offset, LayoutUnit p
ageHeight, bool pageHeightChanged, ColumnInfo*); | 62 LayoutState(LayoutState*, RenderBox*, const LayoutSize& offset, LayoutUnit p
ageHeight, bool pageHeightChanged); |
65 LayoutState(RenderObject*); | 63 LayoutState(RenderObject*); |
66 | 64 |
67 // LayoutState is allocated out of the rendering partition. | 65 // LayoutState is allocated out of the rendering partition. |
68 void* operator new(size_t); | 66 void* operator new(size_t); |
69 void operator delete(void*); | 67 void operator delete(void*); |
70 | 68 |
71 void clearPaginationInformation(); | |
72 bool isPaginatingColumns() const { return m_columnInfo && m_columnInfo->pagi
nationUnit() == ColumnInfo::Column; } | |
73 bool isPaginated() const { return m_isPaginated; } | 69 bool isPaginated() const { return m_isPaginated; } |
74 | 70 |
75 // The page logical offset is the object's offset from the top of the page i
n the page progression | 71 // The page logical offset is the object's offset from the top of the page i
n the page progression |
76 // direction (so an x-offset in vertical text and a y-offset for horizontal
text). | 72 // direction (so an x-offset in vertical text and a y-offset for horizontal
text). |
77 LayoutUnit pageLogicalOffset(RenderBox*, LayoutUnit childLogicalOffset) cons
t; | 73 LayoutUnit pageLogicalOffset(RenderBox*, LayoutUnit childLogicalOffset) cons
t; |
78 | 74 |
79 void addForcedColumnBreak(RenderBox*, LayoutUnit childLogicalOffset); | |
80 | |
81 LayoutUnit pageLogicalHeight() const { return m_pageLogicalHeight; } | 75 LayoutUnit pageLogicalHeight() const { return m_pageLogicalHeight; } |
82 bool pageLogicalHeightChanged() const { return m_pageLogicalHeightChanged; } | 76 bool pageLogicalHeightChanged() const { return m_pageLogicalHeightChanged; } |
83 | 77 |
84 RenderBlockFlow* lineGrid() const { return m_lineGrid; } | 78 RenderBlockFlow* lineGrid() const { return m_lineGrid; } |
85 LayoutSize lineGridOffset() const { return m_lineGridOffset; } | 79 LayoutSize lineGridOffset() const { return m_lineGridOffset; } |
86 LayoutSize lineGridPaginationOrigin() const { return m_lineGridPaginationOri
gin; } | 80 LayoutSize lineGridPaginationOrigin() const { return m_lineGridPaginationOri
gin; } |
87 | 81 |
88 LayoutSize layoutOffset() const { return m_layoutOffset; } | 82 LayoutSize layoutOffset() const { return m_layoutOffset; } |
89 | 83 |
90 bool needsBlockDirectionLocationSetBeforeLayout() const { return m_lineGrid
|| (m_isPaginated && m_pageLogicalHeight); } | 84 bool needsBlockDirectionLocationSetBeforeLayout() const { return m_lineGrid
|| (m_isPaginated && m_pageLogicalHeight); } |
91 | 85 |
92 ShapeInsideInfo* shapeInsideInfo() const { return m_shapeInsideInfo; } | 86 ShapeInsideInfo* shapeInsideInfo() const { return m_shapeInsideInfo; } |
93 | 87 |
94 #ifndef NDEBUG | 88 #ifndef NDEBUG |
95 RenderObject* renderer() const { return m_renderer; } | 89 RenderObject* renderer() const { return m_renderer; } |
96 #endif | 90 #endif |
97 private: | 91 private: |
98 void propagateLineGridInfo(RenderBox*); | 92 void propagateLineGridInfo(RenderBox*); |
99 void establishLineGrid(RenderBlockFlow*); | 93 void establishLineGrid(RenderBlockFlow*); |
100 | 94 |
101 void computeLineGridPaginationOrigin(RenderBox*); | |
102 | |
103 public: | 95 public: |
104 // Do not add anything apart from bitfields until after m_columnInfo. See ht
tps://bugs.webkit.org/show_bug.cgi?id=100173 | 96 // Do not add anything apart from bitfields until after m_lineGrid. See http
s://bugs.webkit.org/show_bug.cgi?id=100173 |
105 bool m_clipped:1; | 97 bool m_clipped:1; |
106 bool m_isPaginated:1; | 98 bool m_isPaginated:1; |
107 // If our page height has changed, this will force all blocks to relayout. | 99 // If our page height has changed, this will force all blocks to relayout. |
108 bool m_pageLogicalHeightChanged:1; | 100 bool m_pageLogicalHeightChanged:1; |
109 #if !ASSERT_DISABLED | 101 #if !ASSERT_DISABLED |
110 bool m_layoutDeltaXSaturated:1; | 102 bool m_layoutDeltaXSaturated:1; |
111 bool m_layoutDeltaYSaturated:1; | 103 bool m_layoutDeltaYSaturated:1; |
112 #endif | 104 #endif |
113 // If the enclosing pagination model is a column model, then this will store
column information for easy retrieval/manipulation. | |
114 ColumnInfo* m_columnInfo; | |
115 // The current line grid that we're snapping to and the offset of the start
of the grid. | 105 // The current line grid that we're snapping to and the offset of the start
of the grid. |
116 RenderBlockFlow* m_lineGrid; | 106 RenderBlockFlow* m_lineGrid; |
117 LayoutState* m_next; | 107 LayoutState* m_next; |
118 ShapeInsideInfo* m_shapeInsideInfo; | 108 ShapeInsideInfo* m_shapeInsideInfo; |
119 | 109 |
120 // FIXME: Distinguish between the layout clip rect and the paint clip rect w
hich may be larger, | 110 // FIXME: Distinguish between the layout clip rect and the paint clip rect w
hich may be larger, |
121 // e.g., because of composited scrolling. | 111 // e.g., because of composited scrolling. |
122 LayoutRect m_clipRect; | 112 LayoutRect m_clipRect; |
123 | 113 |
124 // x/y offset from container. Includes relative positioning and scroll offse
ts. | 114 // x/y offset from container. Includes relative positioning and scroll offse
ts. |
(...skipping 13 matching lines...) Expand all Loading... |
138 LayoutSize m_lineGridPaginationOrigin; | 128 LayoutSize m_lineGridPaginationOrigin; |
139 | 129 |
140 #ifndef NDEBUG | 130 #ifndef NDEBUG |
141 RenderObject* m_renderer; | 131 RenderObject* m_renderer; |
142 #endif | 132 #endif |
143 }; | 133 }; |
144 | 134 |
145 } // namespace WebCore | 135 } // namespace WebCore |
146 | 136 |
147 #endif // LayoutState_h | 137 #endif // LayoutState_h |
OLD | NEW |