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 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // for computations. | 60 // for computations. |
61 class LayoutState { | 61 class LayoutState { |
62 // LayoutState is always allocated on the stack. | 62 // LayoutState is always allocated on the stack. |
63 // The reason is that it is scoped to layout, thus we can avoid expensive | 63 // The reason is that it is scoped to layout, thus we can avoid expensive |
64 // mallocs. | 64 // mallocs. |
65 DISALLOW_NEW(); | 65 DISALLOW_NEW(); |
66 WTF_MAKE_NONCOPYABLE(LayoutState); | 66 WTF_MAKE_NONCOPYABLE(LayoutState); |
67 | 67 |
68 public: | 68 public: |
69 // Constructor for root LayoutState created by LayoutView | 69 // Constructor for root LayoutState created by LayoutView |
70 LayoutState(LayoutUnit pageLogicalHeight, | 70 explicit LayoutState(LayoutView&); |
71 LayoutView&); | |
72 // Constructor for sub-tree layout and orthogonal writing-mode roots | 71 // Constructor for sub-tree layout and orthogonal writing-mode roots |
73 explicit LayoutState(LayoutObject& root); | 72 explicit LayoutState(LayoutObject& root); |
74 | 73 |
75 LayoutState(LayoutBox&, | 74 LayoutState(LayoutBox&, |
76 LayoutUnit pageLogicalHeight = LayoutUnit(), | |
77 bool containingBlockLogicalWidthChanged = false); | 75 bool containingBlockLogicalWidthChanged = false); |
78 | 76 |
79 ~LayoutState(); | 77 ~LayoutState(); |
80 | 78 |
81 bool isPaginated() const { return m_isPaginated; } | 79 bool isPaginated() const { return m_isPaginated; } |
82 | 80 |
83 // The page logical offset is the object's offset from the top of the page in | 81 // The page logical offset is the object's offset from the top of the page in |
84 // the page progression direction (so an x-offset in vertical text and a | 82 // the page progression direction (so an x-offset in vertical text and a |
85 // y-offset for horizontal text). | 83 // y-offset for horizontal text). |
86 LayoutUnit pageLogicalOffset(const LayoutBox&, | 84 LayoutUnit pageLogicalOffset(const LayoutBox&, |
87 const LayoutUnit& childLogicalOffset) const; | 85 const LayoutUnit& childLogicalOffset) const; |
88 | 86 |
89 LayoutUnit heightOffsetForTableHeaders() const { | 87 LayoutUnit heightOffsetForTableHeaders() const { |
90 return m_heightOffsetForTableHeaders; | 88 return m_heightOffsetForTableHeaders; |
91 }; | 89 }; |
92 void setHeightOffsetForTableHeaders(LayoutUnit offset) { | 90 void setHeightOffsetForTableHeaders(LayoutUnit offset) { |
93 m_heightOffsetForTableHeaders = offset; | 91 m_heightOffsetForTableHeaders = offset; |
94 }; | 92 }; |
95 | 93 |
96 const LayoutSize& paginationOffset() const { return m_paginationOffset; } | 94 const LayoutSize& paginationOffset() const { return m_paginationOffset; } |
97 LayoutUnit pageLogicalHeight() const { return m_pageLogicalHeight; } | |
98 bool containingBlockLogicalWidthChanged() const { | 95 bool containingBlockLogicalWidthChanged() const { |
99 return m_containingBlockLogicalWidthChanged; | 96 return m_containingBlockLogicalWidthChanged; |
100 } | 97 } |
101 | 98 |
102 bool paginationStateChanged() const { return m_paginationStateChanged; } | 99 bool paginationStateChanged() const { return m_paginationStateChanged; } |
103 void setPaginationStateChanged() { m_paginationStateChanged = true; } | 100 void setPaginationStateChanged() { m_paginationStateChanged = true; } |
104 | 101 |
105 LayoutState* next() const { return m_next; } | 102 LayoutState* next() const { return m_next; } |
106 | 103 |
107 LayoutFlowThread* flowThread() const { return m_flowThread; } | 104 LayoutFlowThread* flowThread() const { return m_flowThread; } |
108 | 105 |
109 LayoutObject& layoutObject() const { return m_layoutObject; } | 106 LayoutObject& layoutObject() const { return m_layoutObject; } |
110 | 107 |
111 private: | 108 private: |
112 // Do not add anything apart from bitfields until after m_flowThread. See | 109 // Do not add anything apart from bitfields until after m_flowThread. See |
113 // https://bugs.webkit.org/show_bug.cgi?id=100173 | 110 // https://bugs.webkit.org/show_bug.cgi?id=100173 |
114 bool m_isPaginated : 1; | 111 bool m_isPaginated : 1; |
115 | 112 |
116 bool m_containingBlockLogicalWidthChanged : 1; | 113 bool m_containingBlockLogicalWidthChanged : 1; |
117 bool m_paginationStateChanged : 1; | 114 bool m_paginationStateChanged : 1; |
118 | 115 |
119 LayoutFlowThread* m_flowThread; | 116 LayoutFlowThread* m_flowThread; |
120 | 117 |
121 LayoutState* m_next; | 118 LayoutState* m_next; |
122 | 119 |
123 // x/y offset from the logical top / start of the first page. Does not include | 120 // x/y offset from the logical top / start of the first page. Does not include |
124 // relative positioning or scroll offsets. | 121 // relative positioning or scroll offsets. |
125 LayoutSize m_paginationOffset; | 122 LayoutSize m_paginationOffset; |
126 | 123 |
127 // The current page height for the pagination model that encloses us. | |
128 LayoutUnit m_pageLogicalHeight; | |
129 | |
130 // The height we need to make available for repeating table headers in | 124 // The height we need to make available for repeating table headers in |
131 // paginated layout. | 125 // paginated layout. |
132 LayoutUnit m_heightOffsetForTableHeaders; | 126 LayoutUnit m_heightOffsetForTableHeaders; |
133 | 127 |
134 LayoutObject& m_layoutObject; | 128 LayoutObject& m_layoutObject; |
135 }; | 129 }; |
136 | 130 |
137 } // namespace blink | 131 } // namespace blink |
138 | 132 |
139 #endif // LayoutState_h | 133 #endif // LayoutState_h |
OLD | NEW |