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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 if (layoutObject.isOutOfFlowPositioned() && !fixed) { | 75 if (layoutObject.isOutOfFlowPositioned() && !fixed) { |
76 if (LayoutObject* container = layoutObject.container()) { | 76 if (LayoutObject* container = layoutObject.container()) { |
77 if (container->style()->hasInFlowPosition() && | 77 if (container->style()->hasInFlowPosition() && |
78 container->isLayoutInline()) | 78 container->isLayoutInline()) |
79 m_layoutOffset += | 79 m_layoutOffset += |
80 toLayoutInline(container)->offsetForInFlowPositionedInline( | 80 toLayoutInline(container)->offsetForInFlowPositionedInline( |
81 layoutObject); | 81 layoutObject); |
82 } | 82 } |
83 } | 83 } |
84 // If we establish a new page height, then cache the offset to the top of the
first page. | 84 // If we establish a new page height, then cache the offset to the top of the |
85 // We can compare this later on to figure out what part of the page we're actu
ally on, | 85 // first page. We can compare this later on to figure out what part of the |
| 86 // page we're actually on. |
86 if (pageLogicalHeight || layoutObject.isLayoutFlowThread()) { | 87 if (pageLogicalHeight || layoutObject.isLayoutFlowThread()) { |
87 m_pageLogicalHeight = pageLogicalHeight; | 88 m_pageLogicalHeight = pageLogicalHeight; |
88 bool isFlipped = layoutObject.style()->isFlippedBlocksWritingMode(); | 89 bool isFlipped = layoutObject.style()->isFlippedBlocksWritingMode(); |
89 m_pageOffset = LayoutSize( | 90 m_pageOffset = LayoutSize( |
90 m_layoutOffset.width() + | 91 m_layoutOffset.width() + |
91 (!isFlipped | 92 (!isFlipped |
92 ? layoutObject.borderLeft() + layoutObject.paddingLeft() | 93 ? layoutObject.borderLeft() + layoutObject.paddingLeft() |
93 : layoutObject.borderRight() + layoutObject.paddingRight()), | 94 : layoutObject.borderRight() + layoutObject.paddingRight()), |
94 m_layoutOffset.height() + | 95 m_layoutOffset.height() + |
95 (!isFlipped | 96 (!isFlipped |
96 ? layoutObject.borderTop() + layoutObject.paddingTop() | 97 ? layoutObject.borderTop() + layoutObject.paddingTop() |
97 : layoutObject.borderBottom() + layoutObject.paddingBottom())); | 98 : layoutObject.borderBottom() + layoutObject.paddingBottom())); |
98 m_pageLogicalHeightChanged = pageLogicalHeightChanged; | 99 m_pageLogicalHeightChanged = pageLogicalHeightChanged; |
99 m_isPaginated = true; | 100 m_isPaginated = true; |
100 } else if (m_layoutObject.isSVG() && !m_layoutObject.isSVGRoot()) { | 101 } else if (m_layoutObject.isSVG() && !m_layoutObject.isSVGRoot()) { |
101 // Pagination inside SVG is not allowed. | 102 // Pagination inside SVG is not allowed. |
102 m_flowThread = nullptr; | 103 m_flowThread = nullptr; |
103 m_pageLogicalHeightChanged = false; | 104 m_pageLogicalHeightChanged = false; |
104 m_isPaginated = false; | 105 m_isPaginated = false; |
105 } else { | 106 } else { |
106 // If we don't establish a new page height, then propagate the old page heig
ht and offset down. | 107 // If we don't establish a new page height, then propagate the old page |
| 108 // height and offset down. |
107 m_pageLogicalHeight = m_next->m_pageLogicalHeight; | 109 m_pageLogicalHeight = m_next->m_pageLogicalHeight; |
108 m_pageLogicalHeightChanged = m_next->m_pageLogicalHeightChanged; | 110 m_pageLogicalHeightChanged = m_next->m_pageLogicalHeightChanged; |
109 m_pageOffset = m_next->m_pageOffset; | 111 m_pageOffset = m_next->m_pageOffset; |
110 | 112 |
111 // Disable pagination for objects we don't support. For now this includes ov
erflow:scroll/auto, inline blocks and | 113 // Disable pagination for objects we don't support. For now this includes |
112 // writing mode roots. | 114 // overflow:scroll/auto, inline blocks and writing mode roots. |
113 if (layoutObject.getPaginationBreakability() == LayoutBox::ForbidBreaks) { | 115 if (layoutObject.getPaginationBreakability() == LayoutBox::ForbidBreaks) { |
114 m_flowThread = nullptr; | 116 m_flowThread = nullptr; |
115 m_pageLogicalHeight = LayoutUnit(); | 117 m_pageLogicalHeight = LayoutUnit(); |
116 m_isPaginated = false; | 118 m_isPaginated = false; |
117 } else { | 119 } else { |
118 m_isPaginated = m_pageLogicalHeight || m_flowThread; | 120 m_isPaginated = m_pageLogicalHeight || m_flowThread; |
119 } | 121 } |
120 } | 122 } |
121 | 123 |
122 // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip if
present. | 124 // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip if |
| 125 // present. |
123 } | 126 } |
124 | 127 |
125 LayoutState::LayoutState(LayoutObject& root) | 128 LayoutState::LayoutState(LayoutObject& root) |
126 : m_isPaginated(false), | 129 : m_isPaginated(false), |
127 m_pageLogicalHeightChanged(false), | 130 m_pageLogicalHeightChanged(false), |
128 m_containingBlockLogicalWidthChanged(false), | 131 m_containingBlockLogicalWidthChanged(false), |
129 m_flowThread(nullptr), | 132 m_flowThread(nullptr), |
130 m_next(root.view()->layoutState()), | 133 m_next(root.view()->layoutState()), |
131 m_layoutObject(root) { | 134 m_layoutObject(root) { |
132 ASSERT(!m_next); | 135 ASSERT(!m_next); |
(...skipping 18 matching lines...) Expand all Loading... |
151 | 154 |
152 LayoutUnit LayoutState::pageLogicalOffset( | 155 LayoutUnit LayoutState::pageLogicalOffset( |
153 const LayoutBox& child, | 156 const LayoutBox& child, |
154 const LayoutUnit& childLogicalOffset) const { | 157 const LayoutUnit& childLogicalOffset) const { |
155 if (child.isHorizontalWritingMode()) | 158 if (child.isHorizontalWritingMode()) |
156 return m_layoutOffset.height() + childLogicalOffset - m_pageOffset.height(); | 159 return m_layoutOffset.height() + childLogicalOffset - m_pageOffset.height(); |
157 return m_layoutOffset.width() + childLogicalOffset - m_pageOffset.width(); | 160 return m_layoutOffset.width() + childLogicalOffset - m_pageOffset.width(); |
158 } | 161 } |
159 | 162 |
160 } // namespace blink | 163 } // namespace blink |
OLD | NEW |