| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 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(RenderObjectType type) const override { return type ==
RenderObjectRenderMultiColumnSet || 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 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 88 void updateMinimumColumnHeight(LayoutUnit height) { m_minimumColumnHeight =
std::max(height, m_minimumColumnHeight); } | 88 void updateMinimumColumnHeight(LayoutUnit height) { m_minimumColumnHeight =
std::max(height, m_minimumColumnHeight); } |
| 89 LayoutUnit minimumColumnHeight() const { return m_minimumColumnHeight; } | 89 LayoutUnit minimumColumnHeight() const { return m_minimumColumnHeight; } |
| 90 | 90 |
| 91 // Add a content run, specified by its end position. A content run is append
ed at every | 91 // Add a content run, specified by its end position. A content run is append
ed at every |
| 92 // forced/explicit break and at the end of the column set. The content runs
are used to | 92 // forced/explicit break and at the end of the column set. The content runs
are used to |
| 93 // determine where implicit/soft breaks will occur, in order to calculate an
initial column | 93 // determine where implicit/soft breaks will occur, in order to calculate an
initial column |
| 94 // height. | 94 // height. |
| 95 void addContentRun(LayoutUnit endOffsetFromFirstPage); | 95 void addContentRun(LayoutUnit endOffsetFromFirstPage); |
| 96 | 96 |
| 97 // (Re-)calculate the column height if it's auto. | 97 // (Re-)calculate the column height if it's auto. |
| 98 bool recalculateColumnHeight(BalancedHeightCalculation); | 98 virtual bool recalculateColumnHeight(BalancedHeightCalculation); |
| 99 | 99 |
| 100 // Record space shortage (the amount of space that would have been enough to
prevent some | 100 // Record space shortage (the amount of space that would have been enough to
prevent some |
| 101 // element from being moved to the next column) at a column break. The small
est amount of space | 101 // element from being moved to the next column) at a column break. The small
est amount of space |
| 102 // shortage we find is the amount with which we will stretch the column heig
ht, if it turns out | 102 // shortage we find is the amount with which we will stretch the column heig
ht, if it turns out |
| 103 // after layout that the columns weren't tall enough. | 103 // after layout that the columns weren't tall enough. |
| 104 void recordSpaceShortage(LayoutUnit spaceShortage); | 104 void recordSpaceShortage(LayoutUnit spaceShortage); |
| 105 | 105 |
| 106 // Reset previously calculated column height. Will mark for layout if needed
. | 106 // Reset previously calculated column height. Will mark for layout if needed
. |
| 107 void resetColumnHeight(); | 107 void resetColumnHeight(); |
| 108 | 108 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 120 // page. | 120 // page. |
| 121 LayoutUnit pageLogicalTopForOffset(LayoutUnit offset) const; | 121 LayoutUnit pageLogicalTopForOffset(LayoutUnit offset) const; |
| 122 | 122 |
| 123 void collectLayerFragments(LayerFragments&, const LayoutRect& layerBoundingB
ox, const LayoutRect& dirtyRect); | 123 void collectLayerFragments(LayerFragments&, const LayoutRect& layerBoundingB
ox, const LayoutRect& dirtyRect); |
| 124 | 124 |
| 125 LayoutUnit columnGap() const; | 125 LayoutUnit columnGap() const; |
| 126 | 126 |
| 127 // The "CSS actual" value of column-count. This includes overflowing columns
, if any. | 127 // The "CSS actual" value of column-count. This includes overflowing columns
, if any. |
| 128 unsigned actualColumnCount() const; | 128 unsigned actualColumnCount() const; |
| 129 | 129 |
| 130 private: | 130 protected: |
| 131 RenderMultiColumnSet(RenderFlowThread*); | 131 RenderMultiColumnSet(RenderFlowThread*); |
| 132 | 132 |
| 133 private: |
| 133 virtual void insertedIntoTree() override final; | 134 virtual void insertedIntoTree() override final; |
| 134 virtual void willBeRemovedFromTree() override final; | 135 virtual void willBeRemovedFromTree() override final; |
| 135 | 136 |
| 136 virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logic
alTop, LogicalExtentComputedValues&) const override; | 137 virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logic
alTop, LogicalExtentComputedValues&) const override; |
| 137 | 138 |
| 138 virtual void paintObject(PaintInfo&, const LayoutPoint& paintOffset) overrid
e; | 139 virtual void paintObject(PaintInfo&, const LayoutPoint& paintOffset) overrid
e; |
| 139 | 140 |
| 140 virtual void addOverflowFromChildren() override; | 141 virtual void addOverflowFromChildren() override; |
| 141 | 142 |
| 142 virtual const char* renderName() const override; | 143 virtual const char* renderName() const override; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 }; | 202 }; |
| 202 Vector<ContentRun, 1> m_contentRuns; | 203 Vector<ContentRun, 1> m_contentRuns; |
| 203 }; | 204 }; |
| 204 | 205 |
| 205 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderMultiColumnSet, isRenderMultiColumnSet()); | 206 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderMultiColumnSet, isRenderMultiColumnSet()); |
| 206 | 207 |
| 207 } // namespace blink | 208 } // namespace blink |
| 208 | 209 |
| 209 #endif // RenderMultiColumnSet_h | 210 #endif // RenderMultiColumnSet_h |
| 210 | 211 |
| OLD | NEW |