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 10 matching lines...) Expand all Loading... |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 | 26 |
27 #ifndef RenderMultiColumnSet_h | 27 #ifndef RenderMultiColumnSet_h |
28 #define RenderMultiColumnSet_h | 28 #define RenderMultiColumnSet_h |
29 | 29 |
30 #include "core/rendering/RenderMultiColumnFlowThread.h" | 30 #include "core/rendering/RenderMultiColumnFlowThread.h" |
31 #include "core/rendering/RenderRegionSet.h" | 31 #include "core/rendering/RenderRegion.h" |
32 #include "wtf/Vector.h" | 32 #include "wtf/Vector.h" |
33 | 33 |
34 namespace WebCore { | 34 namespace WebCore { |
35 | 35 |
36 // RenderMultiColumnSet represents a set of columns that all have the same width
and height. By | 36 // RenderMultiColumnSet represents a set of columns that all have the same width
and height. By |
37 // combining runs of same-size columns into a single object, we significantly re
duce the number of | 37 // combining runs of same-size columns into a single object, we significantly re
duce the number of |
38 // unique RenderObjects required to represent columns. | 38 // unique RenderObjects required to represent columns. |
39 // | 39 // |
40 // Column sets are inserted as anonymous children of the actual multicol contain
er (i.e. the | 40 // Column sets are inserted as anonymous children of the actual multicol contain
er (i.e. the |
41 // renderer whose style computes to non-auto column-count and/or column-width). | 41 // renderer whose style computes to non-auto column-count and/or column-width). |
42 // | 42 // |
43 // Being a "region", a column set has no children on its own, but is merely used
to slice a portion | 43 // Being a "region", a column set has no children on its own, but is merely used
to slice a portion |
44 // of the tall "single-column" flow thread into actual columns visually, to conv
ert from flow thread | 44 // of the tall "single-column" flow thread into actual columns visually, to conv
ert from flow thread |
45 // coordinates to visual ones. It is in charge of both positioning columns corre
ctly relatively to | 45 // coordinates to visual ones. It is in charge of both positioning columns corre
ctly relatively to |
46 // the parent multicol container, and to calculate the correct translation for e
ach column's | 46 // the parent multicol container, and to calculate the correct translation for e
ach column's |
47 // contents, and to paint any rules between them. RenderMultiColumnSet objects a
re used for | 47 // contents, and to paint any rules between them. RenderMultiColumnSet objects a
re used for |
48 // painting, hit testing, and any other type of operation that requires mapping
from flow thread | 48 // painting, hit testing, and any other type of operation that requires mapping
from flow thread |
49 // coordinates to visual coordinates. | 49 // coordinates to visual coordinates. |
50 // | 50 // |
51 // Column spans result in the creation of new column sets, since a spanning rend
erer has to be | 51 // Column spans result in the creation of new column sets, since a spanning rend
erer has to be |
52 // placed in between the column sets that come before and after the span. | 52 // placed in between the column sets that come before and after the span. |
53 class RenderMultiColumnSet FINAL : public RenderRegionSet { | 53 class RenderMultiColumnSet FINAL : public RenderRegion { |
54 public: | 54 public: |
55 static RenderMultiColumnSet* createAnonymous(RenderFlowThread*, RenderStyle*
parentStyle); | 55 static RenderMultiColumnSet* createAnonymous(RenderFlowThread*, RenderStyle*
parentStyle); |
56 | 56 |
57 virtual bool isRenderMultiColumnSet() const OVERRIDE { return true; } | 57 virtual bool isRenderMultiColumnSet() const OVERRIDE { return true; } |
58 | 58 |
59 RenderBlockFlow* multiColumnBlockFlow() const { return toRenderBlockFlow(par
ent()); } | 59 RenderBlockFlow* multiColumnBlockFlow() const { return toRenderBlockFlow(par
ent()); } |
60 RenderMultiColumnFlowThread* multiColumnFlowThread() const | 60 RenderMultiColumnFlowThread* multiColumnFlowThread() const |
61 { | 61 { |
62 ASSERT_WITH_SECURITY_IMPLICATION(!flowThread() || flowThread()->isRender
MultiColumnFlowThread()); | 62 ASSERT_WITH_SECURITY_IMPLICATION(!flowThread() || flowThread()->isRender
MultiColumnFlowThread()); |
63 return static_cast<RenderMultiColumnFlowThread*>(flowThread()); | 63 return static_cast<RenderMultiColumnFlowThread*>(flowThread()); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // Record space shortage (the amount of space that would have been enough to
prevent some | 96 // Record space shortage (the amount of space that would have been enough to
prevent some |
97 // element from being moved to the next column) at a column break. The small
est amount of space | 97 // element from being moved to the next column) at a column break. The small
est amount of space |
98 // shortage we find is the amount with which we will stretch the column heig
ht, if it turns out | 98 // shortage we find is the amount with which we will stretch the column heig
ht, if it turns out |
99 // after layout that the columns weren't tall enough. | 99 // after layout that the columns weren't tall enough. |
100 void recordSpaceShortage(LayoutUnit spaceShortage); | 100 void recordSpaceShortage(LayoutUnit spaceShortage); |
101 | 101 |
102 virtual void updateLogicalWidth() OVERRIDE; | 102 virtual void updateLogicalWidth() OVERRIDE; |
103 | 103 |
104 void prepareForLayout(); | 104 void prepareForLayout(); |
105 | 105 |
| 106 // Expand this set's flow thread portion rectangle to contain all trailing f
low thread |
| 107 // overflow. Only to be called on the last set. |
| 108 void expandToEncompassFlowThreadContentsIfNeeded(); |
| 109 |
106 private: | 110 private: |
107 RenderMultiColumnSet(RenderFlowThread*); | 111 RenderMultiColumnSet(RenderFlowThread*); |
108 | 112 |
109 virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logic
alTop, LogicalExtentComputedValues&) const OVERRIDE; | 113 virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logic
alTop, LogicalExtentComputedValues&) const OVERRIDE; |
110 | 114 |
111 virtual void paintObject(PaintInfo&, const LayoutPoint& paintOffset) OVERRID
E; | 115 virtual void paintObject(PaintInfo&, const LayoutPoint& paintOffset) OVERRID
E; |
112 | 116 |
113 virtual LayoutUnit pageLogicalWidth() const OVERRIDE { return m_computedColu
mnWidth; } | 117 virtual LayoutUnit pageLogicalWidth() const OVERRIDE { return m_computedColu
mnWidth; } |
114 virtual LayoutUnit pageLogicalHeight() const OVERRIDE { return m_computedCol
umnHeight; } | 118 virtual LayoutUnit pageLogicalHeight() const OVERRIDE { return m_computedCol
umnHeight; } |
115 | 119 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 }; | 192 }; |
189 Vector<ContentRun, 1> m_contentRuns; | 193 Vector<ContentRun, 1> m_contentRuns; |
190 }; | 194 }; |
191 | 195 |
192 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderMultiColumnSet, isRenderMultiColumnSet()); | 196 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderMultiColumnSet, isRenderMultiColumnSet()); |
193 | 197 |
194 } // namespace WebCore | 198 } // namespace WebCore |
195 | 199 |
196 #endif // RenderMultiColumnSet_h | 200 #endif // RenderMultiColumnSet_h |
197 | 201 |
OLD | NEW |