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 17 matching lines...) Expand all Loading... |
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/RenderRegion.h" | 31 #include "core/rendering/RenderRegion.h" |
32 #include "wtf/Vector.h" | 32 #include "wtf/Vector.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
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 LayoutObjects 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 : public RenderRegion { | 53 class RenderMultiColumnSet : public RenderRegion { |
54 public: | 54 public: |
55 enum BalancedHeightCalculation { GuessFromFlowThreadPortion, StretchBySpaceS
hortage }; | 55 enum BalancedHeightCalculation { GuessFromFlowThreadPortion, StretchBySpaceS
hortage }; |
56 | 56 |
57 static RenderMultiColumnSet* createAnonymous(RenderFlowThread*, RenderStyle*
parentStyle); | 57 static RenderMultiColumnSet* createAnonymous(RenderFlowThread*, RenderStyle*
parentStyle); |
58 | 58 |
59 virtual bool isOfType(RenderObjectType type) const override { return type ==
RenderObjectRenderMultiColumnSet || RenderRegion::isOfType(type); } | 59 virtual bool isOfType(LayoutObjectType type) const override { return type ==
LayoutObjectRenderMultiColumnSet || RenderRegion::isOfType(type); } |
60 | 60 |
61 virtual LayoutUnit pageLogicalWidth() const override final { return flowThre
ad()->logicalWidth(); } | 61 virtual LayoutUnit pageLogicalWidth() const override final { return flowThre
ad()->logicalWidth(); } |
62 virtual LayoutUnit pageLogicalHeight() const override final { return m_colum
nHeight; } | 62 virtual LayoutUnit pageLogicalHeight() const override final { return m_colum
nHeight; } |
63 | 63 |
64 RenderBlockFlow* multiColumnBlockFlow() const { return toRenderBlockFlow(par
ent()); } | 64 RenderBlockFlow* multiColumnBlockFlow() const { return toRenderBlockFlow(par
ent()); } |
65 RenderMultiColumnFlowThread* multiColumnFlowThread() const | 65 RenderMultiColumnFlowThread* multiColumnFlowThread() const |
66 { | 66 { |
67 ASSERT_WITH_SECURITY_IMPLICATION(!flowThread() || flowThread()->isRender
MultiColumnFlowThread()); | 67 ASSERT_WITH_SECURITY_IMPLICATION(!flowThread() || flowThread()->isRender
MultiColumnFlowThread()); |
68 return static_cast<RenderMultiColumnFlowThread*>(flowThread()); | 68 return static_cast<RenderMultiColumnFlowThread*>(flowThread()); |
69 } | 69 } |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 226 |
227 inline void RenderMultiColumnSet::endFlow(LayoutUnit offsetInFlowThread) | 227 inline void RenderMultiColumnSet::endFlow(LayoutUnit offsetInFlowThread) |
228 { | 228 { |
229 // At this point layout is exactly at the end of this set. Store block offse
t from flow thread | 229 // At this point layout is exactly at the end of this set. Store block offse
t from flow thread |
230 // start. This set is now considered "flowed", although we may have to revis
it it later (with | 230 // start. This set is now considered "flowed", although we may have to revis
it it later (with |
231 // beginFlow()), e.g. if a subtree in the flow thread has to be laid out ove
r again because the | 231 // beginFlow()), e.g. if a subtree in the flow thread has to be laid out ove
r again because the |
232 // initial margin collapsing estimates were wrong. | 232 // initial margin collapsing estimates were wrong. |
233 setLogicalBottomInFlowThread(offsetInFlowThread); | 233 setLogicalBottomInFlowThread(offsetInFlowThread); |
234 } | 234 } |
235 | 235 |
236 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderMultiColumnSet, isRenderMultiColumnSet()); | 236 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(RenderMultiColumnSet, isRenderMultiColumnSet()); |
237 | 237 |
238 } // namespace blink | 238 } // namespace blink |
239 | 239 |
240 #endif // RenderMultiColumnSet_h | 240 #endif // RenderMultiColumnSet_h |
241 | 241 |
OLD | NEW |