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