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 19 matching lines...) Expand all Loading... |
30 #include "core/rendering/RenderBlock.h" | 30 #include "core/rendering/RenderBlock.h" |
31 | 31 |
32 namespace WebCore { | 32 namespace WebCore { |
33 | 33 |
34 class RenderMultiColumnFlowThread; | 34 class RenderMultiColumnFlowThread; |
35 | 35 |
36 class RenderMultiColumnBlock FINAL : public RenderBlock { | 36 class RenderMultiColumnBlock FINAL : public RenderBlock { |
37 public: | 37 public: |
38 RenderMultiColumnBlock(Element*); | 38 RenderMultiColumnBlock(Element*); |
39 | 39 |
40 LayoutUnit columnHeight() const { return m_columnHeight; } | 40 LayoutUnit columnHeightAvailable() const { return m_columnHeightAvailable; } |
41 void setColumnHeight(LayoutUnit columnHeight) { m_columnHeight = columnHeigh
t; } | |
42 | 41 |
43 LayoutUnit columnWidth() const { return m_columnWidth; } | 42 LayoutUnit columnWidth() const { return m_columnWidth; } |
44 unsigned columnCount() const { return m_columnCount; } | 43 unsigned columnCount() const { return m_columnCount; } |
45 | 44 |
46 RenderMultiColumnFlowThread* flowThread() const { return m_flowThread; } | 45 RenderMultiColumnFlowThread* flowThread() const { return m_flowThread; } |
47 | 46 |
48 bool requiresBalancing() const { return m_requiresBalancing; } | 47 bool requiresBalancing() const { return !m_columnHeightAvailable; } |
49 | 48 |
50 private: | 49 private: |
51 virtual bool isRenderMultiColumnBlock() const { return true; } | 50 virtual bool isRenderMultiColumnBlock() const { return true; } |
52 | 51 |
53 virtual const char* renderName() const; | 52 virtual const char* renderName() const; |
54 | 53 |
55 virtual RenderObject* layoutSpecialExcludedChild(bool relayoutChildren) OVER
RIDE; | 54 virtual RenderObject* layoutSpecialExcludedChild(bool relayoutChildren) OVER
RIDE; |
56 | 55 |
57 virtual void styleDidChange(StyleDifference, const RenderStyle*) OVERRIDE; | 56 virtual void styleDidChange(StyleDifference, const RenderStyle*) OVERRIDE; |
58 | 57 |
59 virtual bool updateLogicalWidthAndColumnWidth() OVERRIDE; | 58 virtual bool updateLogicalWidthAndColumnWidth() OVERRIDE; |
60 virtual void checkForPaginationLogicalHeightChange(LayoutUnit& pageLogicalHe
ight, bool& pageLogicalHeightChanged, bool& hasSpecifiedPageLogicalHeight) OVERR
IDE; | 59 virtual void checkForPaginationLogicalHeightChange(LayoutUnit& pageLogicalHe
ight, bool& pageLogicalHeightChanged, bool& hasSpecifiedPageLogicalHeight) OVERR
IDE; |
61 virtual bool relayoutForPagination(bool hasSpecifiedPageLogicalHeight, Layou
tUnit pageLogicalHeight, LayoutStateMaintainer&) OVERRIDE; | 60 virtual bool relayoutForPagination(bool hasSpecifiedPageLogicalHeight, Layou
tUnit pageLogicalHeight, LayoutStateMaintainer&) OVERRIDE; |
62 | 61 |
63 virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0)
OVERRIDE; | 62 virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0)
OVERRIDE; |
64 | 63 |
65 void computeColumnCountAndWidth(); | 64 void computeColumnCountAndWidth(); |
66 | 65 |
67 void ensureColumnSets(); | 66 void ensureColumnSets(); |
68 | 67 |
69 RenderMultiColumnFlowThread* m_flowThread; | 68 RenderMultiColumnFlowThread* m_flowThread; |
70 unsigned m_columnCount; // The default column count/width that are based o
ff our containing block width. These values represent only the default, | 69 unsigned m_columnCount; // The default column count/width that are based o
ff our containing block width. These values represent only the default, |
71 LayoutUnit m_columnWidth; // since a multi-column block that is split across
variable width pages or regions will have different column counts and widths in
each. | 70 LayoutUnit m_columnWidth; // since a multi-column block that is split across
variable width pages or regions will have different column counts and widths in
each. |
72 // These values will be cached (eventually) for mu
lti-column blocks. | 71 // These values will be cached (eventually) for mu
lti-column blocks. |
73 LayoutUnit m_columnHeight; // The current column height. | 72 LayoutUnit m_columnHeightAvailable; // Total height available to columns, or
0 if auto. |
74 bool m_requiresBalancing; // Whether or not the block specified any kind of
logical height. We have to balance by default if it didn't. | 73 bool m_inBalancingPass; // Set when relayouting for column balancing. |
75 }; | 74 }; |
76 | 75 |
77 inline RenderMultiColumnBlock* toRenderMultiColumnBlock(RenderObject* object) | 76 inline RenderMultiColumnBlock* toRenderMultiColumnBlock(RenderObject* object) |
78 { | 77 { |
79 ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderMultiColumnBlock
()); | 78 ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderMultiColumnBlock
()); |
80 return static_cast<RenderMultiColumnBlock*>(object); | 79 return static_cast<RenderMultiColumnBlock*>(object); |
81 } | 80 } |
82 | 81 |
83 inline const RenderMultiColumnBlock* toRenderMultiColumnBlock(const RenderObject
* object) | 82 inline const RenderMultiColumnBlock* toRenderMultiColumnBlock(const RenderObject
* object) |
84 { | 83 { |
85 ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderMultiColumnBlock
()); | 84 ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderMultiColumnBlock
()); |
86 return static_cast<const RenderMultiColumnBlock*>(object); | 85 return static_cast<const RenderMultiColumnBlock*>(object); |
87 } | 86 } |
88 | 87 |
89 // This will catch anyone doing an unnecessary cast. | 88 // This will catch anyone doing an unnecessary cast. |
90 void toRenderMultiColumnBlock(const RenderMultiColumnBlock*); | 89 void toRenderMultiColumnBlock(const RenderMultiColumnBlock*); |
91 | 90 |
92 } // namespace WebCore | 91 } // namespace WebCore |
93 | 92 |
94 #endif // RenderMultiColumnBlock_h | 93 #endif // RenderMultiColumnBlock_h |
95 | 94 |
OLD | NEW |