Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutState.cpp

Issue 2529073002: No longer store page logical height in LayoutState. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 13 matching lines...) Expand all
24 */ 24 */
25 25
26 #include "core/layout/LayoutState.h" 26 #include "core/layout/LayoutState.h"
27 27
28 #include "core/layout/LayoutFlowThread.h" 28 #include "core/layout/LayoutFlowThread.h"
29 #include "core/layout/LayoutInline.h" 29 #include "core/layout/LayoutInline.h"
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(LayoutView& view)
35 LayoutView& view) 35 : m_isPaginated(view.pageLogicalHeight()),
36 : m_isPaginated(pageLogicalHeight),
37 m_containingBlockLogicalWidthChanged(false), 36 m_containingBlockLogicalWidthChanged(false),
38 m_paginationStateChanged(false), 37 m_paginationStateChanged(false),
39 m_flowThread(nullptr), 38 m_flowThread(nullptr),
40 m_next(nullptr), 39 m_next(nullptr),
41 m_pageLogicalHeight(pageLogicalHeight),
42 m_layoutObject(view) { 40 m_layoutObject(view) {
43 ASSERT(!view.layoutState()); 41 ASSERT(!view.layoutState());
44 view.pushLayoutState(*this); 42 view.pushLayoutState(*this);
45 } 43 }
46 44
47 LayoutState::LayoutState(LayoutBox& layoutObject, 45 LayoutState::LayoutState(LayoutBox& layoutObject,
48 LayoutUnit pageLogicalHeight,
49 bool containingBlockLogicalWidthChanged) 46 bool containingBlockLogicalWidthChanged)
50 : m_containingBlockLogicalWidthChanged(containingBlockLogicalWidthChanged), 47 : m_containingBlockLogicalWidthChanged(containingBlockLogicalWidthChanged),
51 m_next(layoutObject.view()->layoutState()), 48 m_next(layoutObject.view()->layoutState()),
52 m_layoutObject(layoutObject) { 49 m_layoutObject(layoutObject) {
53 if (layoutObject.isLayoutFlowThread()) 50 if (layoutObject.isLayoutFlowThread())
54 m_flowThread = toLayoutFlowThread(&layoutObject); 51 m_flowThread = toLayoutFlowThread(&layoutObject);
55 else 52 else
56 m_flowThread = m_next->flowThread(); 53 m_flowThread = m_next->flowThread();
57 m_paginationStateChanged = m_next->m_paginationStateChanged; 54 m_paginationStateChanged = m_next->m_paginationStateChanged;
58 layoutObject.view()->pushLayoutState(*this); 55 layoutObject.view()->pushLayoutState(*this);
59 m_heightOffsetForTableHeaders = m_next->heightOffsetForTableHeaders(); 56 m_heightOffsetForTableHeaders = m_next->heightOffsetForTableHeaders();
60 57
61 if (pageLogicalHeight || layoutObject.isLayoutFlowThread()) { 58 if (layoutObject.isLayoutFlowThread()) {
62 // Entering a new pagination context. 59 // Entering a new pagination context.
63 m_pageLogicalHeight = pageLogicalHeight;
64 m_paginationOffset = LayoutSize(); 60 m_paginationOffset = LayoutSize();
65 m_isPaginated = true; 61 m_isPaginated = true;
66 return; 62 return;
67 } 63 }
68 64
69 // Disable pagination for objects we don't support. For now this includes 65 // Disable pagination for objects we don't support. For now this includes
70 // overflow:scroll/auto, inline blocks and writing mode roots. Additionally, 66 // overflow:scroll/auto, inline blocks and writing mode roots. Additionally,
71 // pagination inside SVG is not allowed. 67 // pagination inside SVG is not allowed.
72 if (layoutObject.getPaginationBreakability() == LayoutBox::ForbidBreaks || 68 if (layoutObject.getPaginationBreakability() == LayoutBox::ForbidBreaks ||
73 (m_layoutObject.isSVG() && !m_layoutObject.isSVGRoot())) { 69 (m_layoutObject.isSVG() && !m_layoutObject.isSVGRoot())) {
74 m_flowThread = nullptr; 70 m_flowThread = nullptr;
75 m_pageLogicalHeight = LayoutUnit();
76 m_isPaginated = false; 71 m_isPaginated = false;
77 return; 72 return;
78 } 73 }
79 74
80 // Propagate the old page height and offset down. 75 m_isPaginated = m_next->m_isPaginated;
81 m_pageLogicalHeight = m_next->m_pageLogicalHeight;
82
83 m_isPaginated = m_pageLogicalHeight || m_flowThread;
84 if (!m_isPaginated) 76 if (!m_isPaginated)
85 return; 77 return;
86 78
87 // Now adjust the pagination offset, so that we can easily figure out how far 79 // Now adjust the pagination offset, so that we can easily figure out how far
88 // away we are from the start of the pagination context. 80 // away we are from the start of the pagination context.
89 m_paginationOffset = m_next->m_paginationOffset; 81 m_paginationOffset = m_next->m_paginationOffset;
90 bool fixed = layoutObject.isOutOfFlowPositioned() && 82 bool fixed = layoutObject.isOutOfFlowPositioned() &&
91 layoutObject.style()->position() == FixedPosition; 83 layoutObject.style()->position() == FixedPosition;
92 if (fixed) 84 if (fixed)
93 return; 85 return;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 124
133 LayoutUnit LayoutState::pageLogicalOffset( 125 LayoutUnit LayoutState::pageLogicalOffset(
134 const LayoutBox& child, 126 const LayoutBox& child,
135 const LayoutUnit& childLogicalOffset) const { 127 const LayoutUnit& childLogicalOffset) const {
136 if (child.isHorizontalWritingMode()) 128 if (child.isHorizontalWritingMode())
137 return m_paginationOffset.height() + childLogicalOffset; 129 return m_paginationOffset.height() + childLogicalOffset;
138 return m_paginationOffset.width() + childLogicalOffset; 130 return m_paginationOffset.width() + childLogicalOffset;
139 } 131 }
140 132
141 } // namespace blink 133 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutState.h ('k') | third_party/WebKit/Source/core/layout/LayoutTable.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698