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/layout/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 blink { | 33 namespace blink { |
35 | 34 |
36 class ForceHorriblySlowRectMapping; | 35 class ForceHorriblySlowRectMapping; |
37 class LayoutBox; | 36 class LayoutBox; |
38 class LayoutFlowThread; | 37 class LayoutFlowThread; |
39 class LayoutObject; | 38 class LayoutObject; |
40 class LayoutView; | 39 class LayoutView; |
41 | 40 |
42 class LayoutState { | 41 class LayoutState { |
43 WTF_MAKE_NONCOPYABLE(LayoutState); | 42 WTF_MAKE_NONCOPYABLE(LayoutState); |
44 public: | 43 public: |
45 // Constructor for root LayoutState created by LayoutView | 44 // Constructor for root LayoutState created by LayoutView |
46 LayoutState(LayoutUnit pageLogicalHeight, bool pageLogicalHeightChanged, Lay
outView&); | 45 LayoutState(LayoutUnit pageLogicalHeight, bool pageLogicalHeightChanged, Lay
outView&); |
47 // Constructor for sub-tree layout | 46 // Constructor for sub-tree layout |
48 explicit LayoutState(LayoutObject& root); | 47 explicit LayoutState(LayoutObject& root); |
49 | 48 |
50 LayoutState(LayoutBox&, const LayoutSize& offset, LayoutUnit pageLogicalHeig
ht = 0, bool pageHeightLogicalChanged = false, ColumnInfo* = 0, bool containingB
lockLogicalWidthChanged = false); | 49 LayoutState(LayoutBox&, const LayoutSize& offset, LayoutUnit pageLogicalHeig
ht = 0, bool pageHeightLogicalChanged = false, bool containingBlockLogicalWidthC
hanged = false); |
51 | 50 |
52 ~LayoutState(); | 51 ~LayoutState(); |
53 | 52 |
54 void clearPaginationInformation(); | 53 void clearPaginationInformation(); |
55 bool isPaginatingColumns() const { return m_columnInfo; } | |
56 bool isPaginated() const { return m_isPaginated; } | 54 bool isPaginated() const { return m_isPaginated; } |
57 | 55 |
58 // The page logical offset is the object's offset from the top of the page i
n the page progression | 56 // The page logical offset is the object's offset from the top of the page i
n the page progression |
59 // direction (so an x-offset in vertical text and a y-offset for horizontal
text). | 57 // direction (so an x-offset in vertical text and a y-offset for horizontal
text). |
60 LayoutUnit pageLogicalOffset(const LayoutBox&, const LayoutUnit& childLogica
lOffset) const; | 58 LayoutUnit pageLogicalOffset(const LayoutBox&, const LayoutUnit& childLogica
lOffset) const; |
61 | 59 |
62 void addForcedColumnBreak(const LayoutBox&, const LayoutUnit& childLogicalOf
fset); | |
63 | |
64 void setColumnInfo(ColumnInfo* columnInfo) { m_columnInfo = columnInfo; } | |
65 | |
66 const LayoutSize& layoutOffset() const { return m_layoutOffset; } | 60 const LayoutSize& layoutOffset() const { return m_layoutOffset; } |
67 const LayoutSize& pageOffset() const { return m_pageOffset; } | 61 const LayoutSize& pageOffset() const { return m_pageOffset; } |
68 LayoutUnit pageLogicalHeight() const { return m_pageLogicalHeight; } | 62 LayoutUnit pageLogicalHeight() const { return m_pageLogicalHeight; } |
69 bool pageLogicalHeightChanged() const { return m_pageLogicalHeightChanged; } | 63 bool pageLogicalHeightChanged() const { return m_pageLogicalHeightChanged; } |
70 bool containingBlockLogicalWidthChanged() const { return m_containingBlockLo
gicalWidthChanged; } | 64 bool containingBlockLogicalWidthChanged() const { return m_containingBlockLo
gicalWidthChanged; } |
71 | 65 |
72 LayoutState* next() const { return m_next; } | 66 LayoutState* next() const { return m_next; } |
73 | 67 |
74 bool needsBlockDirectionLocationSetBeforeLayout() const { return m_isPaginat
ed && m_pageLogicalHeight; } | 68 bool needsBlockDirectionLocationSetBeforeLayout() const { return m_isPaginat
ed && m_pageLogicalHeight; } |
75 | 69 |
76 LayoutFlowThread* flowThread() const { return m_flowThread; } | 70 LayoutFlowThread* flowThread() const { return m_flowThread; } |
77 | 71 |
78 ColumnInfo* columnInfo() const { return m_columnInfo; } | |
79 | |
80 LayoutObject& layoutObject() const { return m_layoutObject; } | 72 LayoutObject& layoutObject() const { return m_layoutObject; } |
81 | 73 |
82 private: | 74 private: |
83 friend class ForceHorriblySlowRectMapping; | 75 friend class ForceHorriblySlowRectMapping; |
84 | 76 |
85 // Do not add anything apart from bitfields until after m_columnInfo. See ht
tps://bugs.webkit.org/show_bug.cgi?id=100173 | 77 // Do not add anything apart from bitfields until after m_flowThread. See ht
tps://bugs.webkit.org/show_bug.cgi?id=100173 |
86 bool m_isPaginated : 1; | 78 bool m_isPaginated : 1; |
87 // If our page height has changed, this will force all blocks to relayout. | 79 // If our page height has changed, this will force all blocks to relayout. |
88 bool m_pageLogicalHeightChanged : 1; | 80 bool m_pageLogicalHeightChanged : 1; |
89 bool m_containingBlockLogicalWidthChanged : 1; | 81 bool m_containingBlockLogicalWidthChanged : 1; |
90 | 82 |
91 LayoutFlowThread* m_flowThread; | 83 LayoutFlowThread* m_flowThread; |
92 | 84 |
93 // If the enclosing pagination model is a column model, then this will store
column information for easy retrieval/manipulation. | |
94 ColumnInfo* m_columnInfo; | |
95 LayoutState* m_next; | 85 LayoutState* m_next; |
96 | 86 |
97 // x/y offset from container. Does not include relative positioning or scrol
l offsets. | 87 // x/y offset from container. Does not include relative positioning or scrol
l offsets. |
98 LayoutSize m_layoutOffset; | 88 LayoutSize m_layoutOffset; |
99 | 89 |
100 // The current page height for the pagination model that encloses us. | 90 // The current page height for the pagination model that encloses us. |
101 LayoutUnit m_pageLogicalHeight; | 91 LayoutUnit m_pageLogicalHeight; |
102 // The offset of the start of the first page in the nearest enclosing pagina
tion model. | 92 // The offset of the start of the first page in the nearest enclosing pagina
tion model. |
103 LayoutSize m_pageOffset; | 93 LayoutSize m_pageOffset; |
104 | 94 |
105 LayoutObject& m_layoutObject; | 95 LayoutObject& m_layoutObject; |
106 }; | 96 }; |
107 | 97 |
108 } // namespace blink | 98 } // namespace blink |
109 | 99 |
110 #endif // LayoutState_h | 100 #endif // LayoutState_h |
OLD | NEW |