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 22 matching lines...) Expand all Loading... |
33 #include "core/CoreExport.h" | 33 #include "core/CoreExport.h" |
34 #include "core/layout/LayoutBlockFlow.h" | 34 #include "core/layout/LayoutBlockFlow.h" |
35 #include "wtf/ListHashSet.h" | 35 #include "wtf/ListHashSet.h" |
36 | 36 |
37 namespace blink { | 37 namespace blink { |
38 | 38 |
39 class LayoutMultiColumnSet; | 39 class LayoutMultiColumnSet; |
40 | 40 |
41 typedef ListHashSet<LayoutMultiColumnSet*> LayoutMultiColumnSetList; | 41 typedef ListHashSet<LayoutMultiColumnSet*> LayoutMultiColumnSetList; |
42 | 42 |
43 // Layout state for multicol. To be stored when laying out a block child, so tha
t we can roll back | 43 // Layout state for multicol. To be stored when laying out a block child, so |
44 // to the initial state if we need to re-lay out said block child. | 44 // that we can roll back to the initial state if we need to re-lay out said |
| 45 // block child. |
45 class MultiColumnLayoutState { | 46 class MultiColumnLayoutState { |
46 friend class LayoutMultiColumnFlowThread; | 47 friend class LayoutMultiColumnFlowThread; |
47 | 48 |
48 public: | 49 public: |
49 MultiColumnLayoutState() : m_columnSet(nullptr) {} | 50 MultiColumnLayoutState() : m_columnSet(nullptr) {} |
50 | 51 |
51 private: | 52 private: |
52 explicit MultiColumnLayoutState(LayoutMultiColumnSet* columnSet) | 53 explicit MultiColumnLayoutState(LayoutMultiColumnSet* columnSet) |
53 : m_columnSet(columnSet) {} | 54 : m_columnSet(columnSet) {} |
54 LayoutMultiColumnSet* columnSet() const { return m_columnSet; } | 55 LayoutMultiColumnSet* columnSet() const { return m_columnSet; } |
55 | 56 |
56 LayoutMultiColumnSet* m_columnSet; | 57 LayoutMultiColumnSet* m_columnSet; |
57 }; | 58 }; |
58 | 59 |
59 // LayoutFlowThread is used to collect all the layout objects that participate i
n a flow thread. It | 60 // LayoutFlowThread is used to collect all the layout objects that participate |
60 // will also help in doing the layout. However, it will not layout directly to s
creen. Instead, | 61 // in a flow thread. It will also help in doing the layout. However, it will not |
61 // LayoutMultiColumnSet objects will redirect their paint and nodeAtPoint method
s to this | 62 // layout directly to screen. Instead, LayoutMultiColumnSet objects will |
62 // object. Each LayoutMultiColumnSet will actually be a viewPort of the LayoutFl
owThread. | 63 // redirect their paint and nodeAtPoint methods to this object. Each |
| 64 // LayoutMultiColumnSet will actually be a viewPort of the LayoutFlowThread. |
63 class CORE_EXPORT LayoutFlowThread : public LayoutBlockFlow { | 65 class CORE_EXPORT LayoutFlowThread : public LayoutBlockFlow { |
64 public: | 66 public: |
65 LayoutFlowThread(); | 67 LayoutFlowThread(); |
66 ~LayoutFlowThread() override {} | 68 ~LayoutFlowThread() override {} |
67 | 69 |
68 bool isLayoutFlowThread() const final { return true; } | 70 bool isLayoutFlowThread() const final { return true; } |
69 virtual bool isLayoutMultiColumnFlowThread() const { return false; } | 71 virtual bool isLayoutMultiColumnFlowThread() const { return false; } |
70 virtual bool isLayoutPagedFlowThread() const { return false; } | 72 virtual bool isLayoutPagedFlowThread() const { return false; } |
71 | 73 |
72 static LayoutFlowThread* locateFlowThreadContainingBlockOf( | 74 static LayoutFlowThread* locateFlowThreadContainingBlockOf( |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 LayoutUnit pageLogicalHeightForOffset(LayoutUnit); | 122 LayoutUnit pageLogicalHeightForOffset(LayoutUnit); |
121 LayoutUnit pageRemainingLogicalHeightForOffset(LayoutUnit, PageBoundaryRule); | 123 LayoutUnit pageRemainingLogicalHeightForOffset(LayoutUnit, PageBoundaryRule); |
122 | 124 |
123 virtual void contentWasLaidOut( | 125 virtual void contentWasLaidOut( |
124 LayoutUnit logicalBottomInFlowThreadAfterPagination) = 0; | 126 LayoutUnit logicalBottomInFlowThreadAfterPagination) = 0; |
125 virtual bool canSkipLayout(const LayoutBox&) const = 0; | 127 virtual bool canSkipLayout(const LayoutBox&) const = 0; |
126 | 128 |
127 virtual MultiColumnLayoutState multiColumnLayoutState() const = 0; | 129 virtual MultiColumnLayoutState multiColumnLayoutState() const = 0; |
128 virtual void restoreMultiColumnLayoutState(const MultiColumnLayoutState&) = 0; | 130 virtual void restoreMultiColumnLayoutState(const MultiColumnLayoutState&) = 0; |
129 | 131 |
130 // Find and return the next logical top after |flowThreadOffset| that can fit
unbreakable | 132 // Find and return the next logical top after |flowThreadOffset| that can fit |
131 // content as tall as |contentLogicalHeight|. |flowThreadOffset| is expected t
o be at the exact | 133 // unbreakable content as tall as |contentLogicalHeight|. |flowThreadOffset| |
132 // top of a column that's known to not have enough space for |contentLogicalHe
ight|. This method | 134 // is expected to be at the exact top of a column that's known to not have |
133 // is called when the current column is too short to fit the content, in the h
ope that there | 135 // enough space for |contentLogicalHeight|. This method is called when the |
134 // exists one that's tall enough further ahead. If no such column can be found
, | 136 // current column is too short to fit the content, in the hope that there |
135 // |flowThreadOffset| will be returned. | 137 // exists one that's tall enough further ahead. If no such column can be |
| 138 // found, |flowThreadOffset| will be returned. |
136 LayoutUnit nextLogicalTopForUnbreakableContent( | 139 LayoutUnit nextLogicalTopForUnbreakableContent( |
137 LayoutUnit flowThreadOffset, | 140 LayoutUnit flowThreadOffset, |
138 LayoutUnit contentLogicalHeight) const; | 141 LayoutUnit contentLogicalHeight) const; |
139 | 142 |
140 virtual bool isPageLogicalHeightKnown() const { return true; } | 143 virtual bool isPageLogicalHeightKnown() const { return true; } |
141 bool pageLogicalSizeChanged() const { return m_pageLogicalSizeChanged; } | 144 bool pageLogicalSizeChanged() const { return m_pageLogicalSizeChanged; } |
142 | 145 |
143 // Return the visual bounding box based on the supplied flow-thread bounding b
ox. Both | 146 // Return the visual bounding box based on the supplied flow-thread bounding |
144 // rectangles are completely physical in terms of writing mode. | 147 // box. Both rectangles are completely physical in terms of writing mode. |
145 LayoutRect fragmentsBoundingBox(const LayoutRect& layerBoundingBox) const; | 148 LayoutRect fragmentsBoundingBox(const LayoutRect& layerBoundingBox) const; |
146 | 149 |
147 // Convert a logical position in the flow thread coordinate space to a logical
position in the | 150 // Convert a logical position in the flow thread coordinate space to a logical |
148 // containing coordinate space. | 151 // position in the containing coordinate space. |
149 void flowThreadToContainingCoordinateSpace(LayoutUnit& blockPosition, | 152 void flowThreadToContainingCoordinateSpace(LayoutUnit& blockPosition, |
150 LayoutUnit& inlinePosition) const; | 153 LayoutUnit& inlinePosition) const; |
151 | 154 |
152 virtual LayoutPoint flowThreadPointToVisualPoint( | 155 virtual LayoutPoint flowThreadPointToVisualPoint( |
153 const LayoutPoint& flowThreadPoint) const = 0; | 156 const LayoutPoint& flowThreadPoint) const = 0; |
154 virtual LayoutPoint visualPointToFlowThreadPoint( | 157 virtual LayoutPoint visualPointToFlowThreadPoint( |
155 const LayoutPoint& visualPoint) const = 0; | 158 const LayoutPoint& visualPoint) const = 0; |
156 | 159 |
157 virtual LayoutMultiColumnSet* columnSetAtBlockOffset( | 160 virtual LayoutMultiColumnSet* columnSetAtBlockOffset( |
158 LayoutUnit, | 161 LayoutUnit, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 struct ValueToString<LayoutMultiColumnSet*> { | 202 struct ValueToString<LayoutMultiColumnSet*> { |
200 static String toString(const LayoutMultiColumnSet* value) { | 203 static String toString(const LayoutMultiColumnSet* value) { |
201 return String::format("%p", value); | 204 return String::format("%p", value); |
202 } | 205 } |
203 }; | 206 }; |
204 #endif | 207 #endif |
205 | 208 |
206 } // namespace blink | 209 } // namespace blink |
207 | 210 |
208 #endif // LayoutFlowThread_h | 211 #endif // LayoutFlowThread_h |
OLD | NEW |