| 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 19 matching lines...) Expand all Loading... |
| 30 #include "core/layout/LayoutView.h" | 30 #include "core/layout/LayoutView.h" |
| 31 | 31 |
| 32 namespace blink { | 32 namespace blink { |
| 33 | 33 |
| 34 LayoutState::LayoutState(LayoutUnit pageLogicalHeight, | 34 LayoutState::LayoutState(LayoutUnit pageLogicalHeight, |
| 35 bool pageLogicalHeightChanged, | 35 bool pageLogicalHeightChanged, |
| 36 LayoutView& view) | 36 LayoutView& view) |
| 37 : m_isPaginated(pageLogicalHeight), | 37 : m_isPaginated(pageLogicalHeight), |
| 38 m_pageLogicalHeightChanged(pageLogicalHeightChanged), | 38 m_pageLogicalHeightChanged(pageLogicalHeightChanged), |
| 39 m_containingBlockLogicalWidthChanged(false), | 39 m_containingBlockLogicalWidthChanged(false), |
| 40 m_paginationStateChanged(false), |
| 40 m_flowThread(nullptr), | 41 m_flowThread(nullptr), |
| 41 m_next(nullptr), | 42 m_next(nullptr), |
| 42 m_pageLogicalHeight(pageLogicalHeight), | 43 m_pageLogicalHeight(pageLogicalHeight), |
| 43 m_layoutObject(view) { | 44 m_layoutObject(view) { |
| 44 ASSERT(!view.layoutState()); | 45 ASSERT(!view.layoutState()); |
| 45 view.pushLayoutState(*this); | 46 view.pushLayoutState(*this); |
| 46 } | 47 } |
| 47 | 48 |
| 48 LayoutState::LayoutState(LayoutBox& layoutObject, | 49 LayoutState::LayoutState(LayoutBox& layoutObject, |
| 49 const LayoutSize& offset, | 50 const LayoutSize& offset, |
| 50 LayoutUnit pageLogicalHeight, | 51 LayoutUnit pageLogicalHeight, |
| 51 bool pageLogicalHeightChanged, | 52 bool pageLogicalHeightChanged, |
| 52 bool containingBlockLogicalWidthChanged) | 53 bool containingBlockLogicalWidthChanged) |
| 53 : m_containingBlockLogicalWidthChanged(containingBlockLogicalWidthChanged), | 54 : m_containingBlockLogicalWidthChanged(containingBlockLogicalWidthChanged), |
| 54 m_next(layoutObject.view()->layoutState()), | 55 m_next(layoutObject.view()->layoutState()), |
| 55 m_layoutObject(layoutObject) { | 56 m_layoutObject(layoutObject) { |
| 56 if (layoutObject.isLayoutFlowThread()) | 57 if (layoutObject.isLayoutFlowThread()) |
| 57 m_flowThread = toLayoutFlowThread(&layoutObject); | 58 m_flowThread = toLayoutFlowThread(&layoutObject); |
| 58 else if (!layoutObject.isOutOfFlowPositioned()) | 59 else if (!layoutObject.isOutOfFlowPositioned()) |
| 59 m_flowThread = m_next->flowThread(); | 60 m_flowThread = m_next->flowThread(); |
| 60 else | 61 else |
| 61 m_flowThread = nullptr; | 62 m_flowThread = nullptr; |
| 63 m_paginationStateChanged = m_next->m_paginationStateChanged; |
| 62 layoutObject.view()->pushLayoutState(*this); | 64 layoutObject.view()->pushLayoutState(*this); |
| 63 bool fixed = layoutObject.isOutOfFlowPositioned() && | 65 bool fixed = layoutObject.isOutOfFlowPositioned() && |
| 64 layoutObject.style()->position() == FixedPosition; | 66 layoutObject.style()->position() == FixedPosition; |
| 65 if (fixed) { | 67 if (fixed) { |
| 66 // FIXME: This doesn't work correctly with transforms. | 68 // FIXME: This doesn't work correctly with transforms. |
| 67 FloatPoint fixedOffset = | 69 FloatPoint fixedOffset = |
| 68 layoutObject.view()->localToAbsolute(FloatPoint(), IsFixed); | 70 layoutObject.view()->localToAbsolute(FloatPoint(), IsFixed); |
| 69 m_layoutOffset = LayoutSize(fixedOffset.x(), fixedOffset.y()) + offset; | 71 m_layoutOffset = LayoutSize(fixedOffset.x(), fixedOffset.y()) + offset; |
| 70 } else { | 72 } else { |
| 71 m_layoutOffset = m_next->m_layoutOffset + offset; | 73 m_layoutOffset = m_next->m_layoutOffset + offset; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 } | 124 } |
| 123 | 125 |
| 124 // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip if | 126 // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip if |
| 125 // present. | 127 // present. |
| 126 } | 128 } |
| 127 | 129 |
| 128 LayoutState::LayoutState(LayoutObject& root) | 130 LayoutState::LayoutState(LayoutObject& root) |
| 129 : m_isPaginated(false), | 131 : m_isPaginated(false), |
| 130 m_pageLogicalHeightChanged(false), | 132 m_pageLogicalHeightChanged(false), |
| 131 m_containingBlockLogicalWidthChanged(false), | 133 m_containingBlockLogicalWidthChanged(false), |
| 134 m_paginationStateChanged(false), |
| 132 m_flowThread(nullptr), | 135 m_flowThread(nullptr), |
| 133 m_next(root.view()->layoutState()), | 136 m_next(root.view()->layoutState()), |
| 134 m_layoutObject(root) { | 137 m_layoutObject(root) { |
| 135 ASSERT(!m_next); | 138 ASSERT(!m_next); |
| 136 // We'll end up pushing in LayoutView itself, so don't bother adding it. | 139 // We'll end up pushing in LayoutView itself, so don't bother adding it. |
| 137 if (root.isLayoutView()) | 140 if (root.isLayoutView()) |
| 138 return; | 141 return; |
| 139 | 142 |
| 140 root.view()->pushLayoutState(*this); | 143 root.view()->pushLayoutState(*this); |
| 141 | 144 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 154 | 157 |
| 155 LayoutUnit LayoutState::pageLogicalOffset( | 158 LayoutUnit LayoutState::pageLogicalOffset( |
| 156 const LayoutBox& child, | 159 const LayoutBox& child, |
| 157 const LayoutUnit& childLogicalOffset) const { | 160 const LayoutUnit& childLogicalOffset) const { |
| 158 if (child.isHorizontalWritingMode()) | 161 if (child.isHorizontalWritingMode()) |
| 159 return m_layoutOffset.height() + childLogicalOffset - m_pageOffset.height(); | 162 return m_layoutOffset.height() + childLogicalOffset - m_pageOffset.height(); |
| 160 return m_layoutOffset.width() + childLogicalOffset - m_pageOffset.width(); | 163 return m_layoutOffset.width() + childLogicalOffset - m_pageOffset.width(); |
| 161 } | 164 } |
| 162 | 165 |
| 163 } // namespace blink | 166 } // namespace blink |
| OLD | NEW |