OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2011 Adobe Systems Incorporated. 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 * | 7 * |
8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
10 * disclaimer. | 10 * disclaimer. |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "core/layout/LayoutBlockFlow.h" | 34 #include "core/layout/LayoutBlockFlow.h" |
35 #include "core/paint/PaintLayerFragment.h" | 35 #include "core/paint/PaintLayerFragment.h" |
36 #include "wtf/ListHashSet.h" | 36 #include "wtf/ListHashSet.h" |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
40 class LayoutMultiColumnSet; | 40 class LayoutMultiColumnSet; |
41 | 41 |
42 typedef ListHashSet<LayoutMultiColumnSet*> LayoutMultiColumnSetList; | 42 typedef ListHashSet<LayoutMultiColumnSet*> LayoutMultiColumnSetList; |
43 | 43 |
| 44 // Layout state for multicol. To be stored when laying out a block child, so tha
t we can roll back |
| 45 // to the initial state if we need to re-lay out said block child. |
| 46 class MultiColumnLayoutState { |
| 47 friend class LayoutMultiColumnFlowThread; |
| 48 |
| 49 public: |
| 50 MultiColumnLayoutState() : m_columnSet(nullptr) { } |
| 51 |
| 52 private: |
| 53 explicit MultiColumnLayoutState(LayoutMultiColumnSet* columnSet) : m_columnS
et(columnSet) { } |
| 54 LayoutMultiColumnSet* columnSet() const { return m_columnSet; } |
| 55 |
| 56 LayoutMultiColumnSet* m_columnSet; |
| 57 }; |
| 58 |
44 // LayoutFlowThread is used to collect all the layout objects that participate i
n a flow thread. It | 59 // LayoutFlowThread is used to collect all the layout objects that participate i
n a flow thread. It |
45 // will also help in doing the layout. However, it will not layout directly to s
creen. Instead, | 60 // will also help in doing the layout. However, it will not layout directly to s
creen. Instead, |
46 // LayoutMultiColumnSet objects will redirect their paint and nodeAtPoint method
s to this | 61 // LayoutMultiColumnSet objects will redirect their paint and nodeAtPoint method
s to this |
47 // object. Each LayoutMultiColumnSet will actually be a viewPort of the LayoutFl
owThread. | 62 // object. Each LayoutMultiColumnSet will actually be a viewPort of the LayoutFl
owThread. |
48 class CORE_EXPORT LayoutFlowThread: public LayoutBlockFlow { | 63 class CORE_EXPORT LayoutFlowThread: public LayoutBlockFlow { |
49 public: | 64 public: |
50 LayoutFlowThread(); | 65 LayoutFlowThread(); |
51 ~LayoutFlowThread() override { } | 66 ~LayoutFlowThread() override { } |
52 | 67 |
53 bool isLayoutFlowThread() const final { return true; } | 68 bool isLayoutFlowThread() const final { return true; } |
(...skipping 27 matching lines...) Expand all Loading... |
81 bool hasValidColumnSetInfo() const { return !m_columnSetsInvalidated && !m_m
ultiColumnSetList.isEmpty(); } | 96 bool hasValidColumnSetInfo() const { return !m_columnSetsInvalidated && !m_m
ultiColumnSetList.isEmpty(); } |
82 | 97 |
83 bool mapToVisualRectInAncestorSpace(const LayoutBoxModelObject* ancestor, La
youtRect&, VisualRectFlags = DefaultVisualRectFlags) const override; | 98 bool mapToVisualRectInAncestorSpace(const LayoutBoxModelObject* ancestor, La
youtRect&, VisualRectFlags = DefaultVisualRectFlags) const override; |
84 | 99 |
85 LayoutUnit pageLogicalHeightForOffset(LayoutUnit); | 100 LayoutUnit pageLogicalHeightForOffset(LayoutUnit); |
86 LayoutUnit pageRemainingLogicalHeightForOffset(LayoutUnit, PageBoundaryRule)
; | 101 LayoutUnit pageRemainingLogicalHeightForOffset(LayoutUnit, PageBoundaryRule)
; |
87 | 102 |
88 virtual void contentWasLaidOut(LayoutUnit logicalBottomInFlowThreadAfterPagi
nation) = 0; | 103 virtual void contentWasLaidOut(LayoutUnit logicalBottomInFlowThreadAfterPagi
nation) = 0; |
89 virtual bool canSkipLayout(const LayoutBox&) const = 0; | 104 virtual bool canSkipLayout(const LayoutBox&) const = 0; |
90 | 105 |
| 106 virtual MultiColumnLayoutState multiColumnLayoutState() const = 0; |
| 107 virtual void restoreMultiColumnLayoutState(const MultiColumnLayoutState&) =
0; |
| 108 |
91 // Find and return the next logical top after |flowThreadOffset| that can fi
t unbreakable | 109 // Find and return the next logical top after |flowThreadOffset| that can fi
t unbreakable |
92 // content as tall as |contentLogicalHeight|. |flowThreadOffset| is expected
to be at the exact | 110 // content as tall as |contentLogicalHeight|. |flowThreadOffset| is expected
to be at the exact |
93 // top of a column that's known to not have enough space for |contentLogical
Height|. This method | 111 // top of a column that's known to not have enough space for |contentLogical
Height|. This method |
94 // is called when the current column is too short to fit the content, in the
hope that there | 112 // is called when the current column is too short to fit the content, in the
hope that there |
95 // exists one that's tall enough further ahead. If no such column can be fou
nd, | 113 // exists one that's tall enough further ahead. If no such column can be fou
nd, |
96 // |flowThreadOffset| will be returned. | 114 // |flowThreadOffset| will be returned. |
97 LayoutUnit nextLogicalTopForUnbreakableContent(LayoutUnit flowThreadOffset,
LayoutUnit contentLogicalHeight) const; | 115 LayoutUnit nextLogicalTopForUnbreakableContent(LayoutUnit flowThreadOffset,
LayoutUnit contentLogicalHeight) const; |
98 | 116 |
99 virtual bool isPageLogicalHeightKnown() const { return true; } | 117 virtual bool isPageLogicalHeightKnown() const { return true; } |
100 bool pageLogicalSizeChanged() const { return m_pageLogicalSizeChanged; } | 118 bool pageLogicalSizeChanged() const { return m_pageLogicalSizeChanged; } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 // These structures are used by PODIntervalTree for debugging. | 168 // These structures are used by PODIntervalTree for debugging. |
151 #ifndef NDEBUG | 169 #ifndef NDEBUG |
152 template <> struct ValueToString<LayoutMultiColumnSet*> { | 170 template <> struct ValueToString<LayoutMultiColumnSet*> { |
153 static String toString(const LayoutMultiColumnSet* value) { return String::f
ormat("%p", value); } | 171 static String toString(const LayoutMultiColumnSet* value) { return String::f
ormat("%p", value); } |
154 }; | 172 }; |
155 #endif | 173 #endif |
156 | 174 |
157 } // namespace blink | 175 } // namespace blink |
158 | 176 |
159 #endif // LayoutFlowThread_h | 177 #endif // LayoutFlowThread_h |
OLD | NEW |