Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: Source/core/layout/ColumnInfo.h

Issue 1158183006: Remove the old multicol implementation. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/layout/LayoutBlock.h » ('j') | Source/core/paint/BoxPainter.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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.
24 */
25
26 #ifndef ColumnInfo_h
27 #define ColumnInfo_h
28
29 #include "platform/LayoutUnit.h"
30 #include "wtf/FastAllocBase.h"
31 #include "wtf/Noncopyable.h"
32 #include <algorithm>
33
34 namespace blink {
35
36 class ColumnInfo {
37 WTF_MAKE_NONCOPYABLE(ColumnInfo); WTF_MAKE_FAST_ALLOCATED(ColumnInfo);
38 public:
39 ColumnInfo()
40 : m_desiredColumnWidth(0)
41 , m_desiredColumnCount(1)
42 , m_progressionAxis(InlineAxis)
43 , m_columnCount(1)
44 , m_columnHeight(0)
45 , m_minimumColumnHeight(0)
46 , m_forcedBreaks(0)
47 , m_maximumDistanceBetweenForcedBreaks(0)
48 , m_forcedBreakOffset(0)
49 {
50 }
51
52 LayoutUnit desiredColumnWidth() const { return m_desiredColumnWidth; }
53 void setDesiredColumnWidth(LayoutUnit width) { m_desiredColumnWidth = width; }
54
55 unsigned desiredColumnCount() const { return m_desiredColumnCount; }
56 void setDesiredColumnCount(unsigned count) { m_desiredColumnCount = count; }
57
58 enum Axis { InlineAxis, BlockAxis };
59
60 Axis progressionAxis() const { return m_progressionAxis; }
61 void setProgressionAxis(Axis progressionAxis) { m_progressionAxis = progress ionAxis; }
62
63 unsigned columnCount() const { return m_columnCount; }
64 LayoutUnit columnHeight() const { return m_columnHeight; }
65
66 // Set our count and height. This is enough info for a LayoutBlock to compu te page rects
67 // dynamically.
68 void setColumnCountAndHeight(int count, LayoutUnit height)
69 {
70 m_columnCount = count;
71 m_columnHeight = height;
72 }
73 void setColumnHeight(LayoutUnit height) { m_columnHeight = height; }
74
75 void updateMinimumColumnHeight(LayoutUnit height) { m_minimumColumnHeight = std::max(height, m_minimumColumnHeight); }
76 LayoutUnit minimumColumnHeight() const { return m_minimumColumnHeight; }
77
78 int forcedBreaks() const { return m_forcedBreaks; }
79 LayoutUnit forcedBreakOffset() const { return m_forcedBreakOffset; }
80 LayoutUnit maximumDistanceBetweenForcedBreaks() const { return m_maximumDist anceBetweenForcedBreaks; }
81 void clearForcedBreaks()
82 {
83 m_forcedBreaks = 0;
84 m_maximumDistanceBetweenForcedBreaks = 0;
85 m_forcedBreakOffset = 0;
86 }
87 void addForcedBreak(LayoutUnit offsetFromFirstPage)
88 {
89 ASSERT(!m_columnHeight);
90 LayoutUnit distanceFromLastBreak = offsetFromFirstPage - m_forcedBreakOf fset;
91 if (!distanceFromLastBreak)
92 return;
93 m_forcedBreaks++;
94 m_maximumDistanceBetweenForcedBreaks = std::max(m_maximumDistanceBetween ForcedBreaks, distanceFromLastBreak);
95 m_forcedBreakOffset = offsetFromFirstPage;
96 }
97
98 private:
99 LayoutUnit m_desiredColumnWidth;
100 unsigned m_desiredColumnCount;
101 Axis m_progressionAxis;
102
103 unsigned m_columnCount;
104 LayoutUnit m_columnHeight;
105 LayoutUnit m_minimumColumnHeight;
106 int m_forcedBreaks; // FIXME: We will ultimately need to cache more informat ion to balance around forced breaks properly.
107 LayoutUnit m_maximumDistanceBetweenForcedBreaks;
108 LayoutUnit m_forcedBreakOffset;
109 };
110
111 }
112
113 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/core/layout/LayoutBlock.h » ('j') | Source/core/paint/BoxPainter.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698