OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // is inside another fragmentation context (e.g. paged media, or an another mult
icol container), we | 57 // is inside another fragmentation context (e.g. paged media, or an another mult
icol container), we |
58 // may need to group the columns, so that we get one MultiColumnFragmentainerGro
up for each outer | 58 // may need to group the columns, so that we get one MultiColumnFragmentainerGro
up for each outer |
59 // fragmentainer (page / column) that the inner multicol container lives in. Eac
h fragmentainer | 59 // fragmentainer (page / column) that the inner multicol container lives in. Eac
h fragmentainer |
60 // group has its own column height, but the column height is uniform within a gr
oup. | 60 // group has its own column height, but the column height is uniform within a gr
oup. |
61 class CORE_EXPORT LayoutMultiColumnSet : public LayoutBlockFlow { | 61 class CORE_EXPORT LayoutMultiColumnSet : public LayoutBlockFlow { |
62 public: | 62 public: |
63 static LayoutMultiColumnSet* createAnonymous(LayoutFlowThread&, const Comput
edStyle& parentStyle); | 63 static LayoutMultiColumnSet* createAnonymous(LayoutFlowThread&, const Comput
edStyle& parentStyle); |
64 | 64 |
65 const MultiColumnFragmentainerGroup& firstFragmentainerGroup() const { retur
n m_fragmentainerGroups.first(); } | 65 const MultiColumnFragmentainerGroup& firstFragmentainerGroup() const { retur
n m_fragmentainerGroups.first(); } |
66 const MultiColumnFragmentainerGroup& lastFragmentainerGroup() const { return
m_fragmentainerGroups.last(); } | 66 const MultiColumnFragmentainerGroup& lastFragmentainerGroup() const { return
m_fragmentainerGroups.last(); } |
67 MultiColumnFragmentainerGroup& fragmentainerGroupAtFlowThreadOffset(LayoutUn
it); | 67 MultiColumnFragmentainerGroup& fragmentainerGroupAtFlowThreadOffset(LayoutUn
it flowThreadOffset) |
68 const MultiColumnFragmentainerGroup& fragmentainerGroupAtFlowThreadOffset(La
youtUnit) const; | 68 { |
| 69 return m_fragmentainerGroups[fragmentainerGroupIndexAtFlowThreadOffset(f
lowThreadOffset)]; |
| 70 } |
| 71 const MultiColumnFragmentainerGroup& fragmentainerGroupAtFlowThreadOffset(La
youtUnit flowThreadOffset) const |
| 72 { |
| 73 return m_fragmentainerGroups[fragmentainerGroupIndexAtFlowThreadOffset(f
lowThreadOffset)]; |
| 74 } |
69 const MultiColumnFragmentainerGroup& fragmentainerGroupAtVisualPoint(const L
ayoutPoint&) const; | 75 const MultiColumnFragmentainerGroup& fragmentainerGroupAtVisualPoint(const L
ayoutPoint&) const; |
70 | 76 |
71 bool isOfType(LayoutObjectType type) const override { return type == LayoutO
bjectLayoutMultiColumnSet || LayoutBlockFlow::isOfType(type); } | 77 bool isOfType(LayoutObjectType type) const override { return type == LayoutO
bjectLayoutMultiColumnSet || LayoutBlockFlow::isOfType(type); } |
72 bool canHaveChildren() const final { return false; } | 78 bool canHaveChildren() const final { return false; } |
73 | 79 |
74 // Return the width and height of a single column or page in the set. | 80 // Return the width and height of a single column or page in the set. |
75 LayoutUnit pageLogicalWidth() const { return flowThread()->logicalWidth(); } | 81 LayoutUnit pageLogicalWidth() const { return flowThread()->logicalWidth(); } |
76 LayoutUnit pageLogicalHeightForOffset(LayoutUnit) const; | 82 LayoutUnit pageLogicalHeightForOffset(LayoutUnit) const; |
77 LayoutUnit pageRemainingLogicalHeightForOffset(LayoutUnit, PageBoundaryRule)
const; | 83 LayoutUnit pageRemainingLogicalHeightForOffset(LayoutUnit, PageBoundaryRule)
const; |
78 bool isPageLogicalHeightKnown() const; | 84 bool isPageLogicalHeightKnown() const; |
79 | 85 |
80 LayoutFlowThread* flowThread() const { return m_flowThread; } | 86 LayoutFlowThread* flowThread() const { return m_flowThread; } |
81 | 87 |
82 LayoutBlockFlow* multiColumnBlockFlow() const { return toLayoutBlockFlow(par
ent()); } | 88 LayoutBlockFlow* multiColumnBlockFlow() const { return toLayoutBlockFlow(par
ent()); } |
83 LayoutMultiColumnFlowThread* multiColumnFlowThread() const { return toLayout
MultiColumnFlowThread(flowThread()); } | 89 LayoutMultiColumnFlowThread* multiColumnFlowThread() const { return toLayout
MultiColumnFlowThread(flowThread()); } |
84 | 90 |
85 LayoutMultiColumnSet* nextSiblingMultiColumnSet() const; | 91 LayoutMultiColumnSet* nextSiblingMultiColumnSet() const; |
86 LayoutMultiColumnSet* previousSiblingMultiColumnSet() const; | 92 LayoutMultiColumnSet* previousSiblingMultiColumnSet() const; |
87 | 93 |
| 94 MultiColumnFragmentainerGroup& appendNewFragmentainerGroup(); |
| 95 |
88 LayoutUnit logicalTopInFlowThread() const; | 96 LayoutUnit logicalTopInFlowThread() const; |
89 LayoutUnit logicalBottomInFlowThread() const; | 97 LayoutUnit logicalBottomInFlowThread() const; |
90 LayoutUnit logicalHeightInFlowThread() const { return logicalBottomInFlowThr
ead() - logicalTopInFlowThread(); } | 98 LayoutUnit logicalHeightInFlowThread() const { return logicalBottomInFlowThr
ead() - logicalTopInFlowThread(); } |
91 LayoutRect flowThreadPortionRect() const; | 99 LayoutRect flowThreadPortionRect() const; |
92 LayoutRect flowThreadPortionOverflowRect() const; | 100 LayoutRect flowThreadPortionOverflowRect() const; |
93 LayoutRect overflowRectForFlowThreadPortion(const LayoutRect& flowThreadPort
ionRect, bool isFirstPortion, bool isLastPortion) const; | 101 LayoutRect overflowRectForFlowThreadPortion(const LayoutRect& flowThreadPort
ionRect, bool isFirstPortion, bool isLastPortion) const; |
94 | 102 |
95 // The used CSS value of column-count, i.e. how many columns there are room
for without overflowing. | 103 // The used CSS value of column-count, i.e. how many columns there are room
for without overflowing. |
96 unsigned usedColumnCount() const { return multiColumnFlowThread()->columnCou
nt(); } | 104 unsigned usedColumnCount() const { return multiColumnFlowThread()->columnCou
nt(); } |
97 | 105 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 159 |
152 // The "CSS actual" value of column-count. This includes overflowing columns
, if any. | 160 // The "CSS actual" value of column-count. This includes overflowing columns
, if any. |
153 unsigned actualColumnCount() const; | 161 unsigned actualColumnCount() const; |
154 | 162 |
155 const char* name() const override { return "LayoutMultiColumnSet"; } | 163 const char* name() const override { return "LayoutMultiColumnSet"; } |
156 | 164 |
157 protected: | 165 protected: |
158 LayoutMultiColumnSet(LayoutFlowThread*); | 166 LayoutMultiColumnSet(LayoutFlowThread*); |
159 | 167 |
160 private: | 168 private: |
| 169 unsigned fragmentainerGroupIndexAtFlowThreadOffset(LayoutUnit) const; |
| 170 |
161 void insertedIntoTree() final; | 171 void insertedIntoTree() final; |
162 void willBeRemovedFromTree() final; | 172 void willBeRemovedFromTree() final; |
163 | 173 |
164 bool isSelfCollapsingBlock() const override { return false; } | 174 bool isSelfCollapsingBlock() const override { return false; } |
165 | 175 |
166 void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, L
ogicalExtentComputedValues&) const override; | 176 void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, L
ogicalExtentComputedValues&) const override; |
167 PositionWithAffinity positionForPoint(const LayoutPoint&) override; | 177 PositionWithAffinity positionForPoint(const LayoutPoint&) override; |
168 | 178 |
169 void paintObject(const PaintInfo&, const LayoutPoint& paintOffset) override; | 179 void paintObject(const PaintInfo&, const LayoutPoint& paintOffset) override; |
170 | 180 |
171 void addOverflowFromChildren() override; | 181 void addOverflowFromChildren() override; |
172 | 182 |
173 MultiColumnFragmentainerGroupList m_fragmentainerGroups; | 183 MultiColumnFragmentainerGroupList m_fragmentainerGroups; |
174 LayoutFlowThread* m_flowThread; | 184 LayoutFlowThread* m_flowThread; |
175 }; | 185 }; |
176 | 186 |
177 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutMultiColumnSet, isLayoutMultiColumnSet()); | 187 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutMultiColumnSet, isLayoutMultiColumnSet()); |
178 | 188 |
179 } // namespace blink | 189 } // namespace blink |
180 | 190 |
181 #endif // LayoutMultiColumnSet_h | 191 #endif // LayoutMultiColumnSet_h |
182 | 192 |
OLD | NEW |