2 * Copyright (C) 2002 Lars Knoll (knoll@kde.org)
3 * (C) 2002 Dirk Mueller (mueller@kde.org)
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
21 #ifndef TableLayoutAlgorithmAuto_h
22 #define TableLayoutAlgorithmAuto_h
24 #include "core/layout/TableLayoutAlgorithm.h"
25 #include "platform/LayoutUnit.h"
26 #include "platform/Length.h"
27 #include "wtf/Vector.h"
32 class LayoutTableCell
;
40 enum DistributionMode
{
46 enum DistributionDirection
{
51 class TableLayoutAlgorithmAuto final
: public TableLayoutAlgorithm
{
53 TableLayoutAlgorithmAuto(LayoutTable
*);
54 ~TableLayoutAlgorithmAuto() override
;
56 void computeIntrinsicLogicalWidths(LayoutUnit
& minWidth
, LayoutUnit
& maxWidth
) override
;
57 void applyPreferredLogicalWidthQuirks(LayoutUnit
& minWidth
, LayoutUnit
& maxWidth
) const override
;
58 void layout() override
;
59 void willChangeTableLayout() override
{ }
63 void recalcColumn(unsigned effCol
);
65 int calcEffectiveLogicalWidth();
66 void shrinkColumnWidth(const LengthType
&, int& available
);
67 template<typename Total
, LengthType
, CellsToProcess
, DistributionMode
, DistributionDirection
> void distributeWidthToColumns(int& available
, Total
);
69 void insertSpanCell(LayoutTableCell
*);
75 , effectiveMinLogicalWidth(0)
76 , effectiveMaxLogicalWidth(0)
77 , computedLogicalWidth(0)
78 , emptyCellsOnly(true)
79 , columnHasNoCells(true)
84 Length effectiveLogicalWidth
;
87 int effectiveMinLogicalWidth
;
88 int effectiveMaxLogicalWidth
;
89 int computedLogicalWidth
;
91 bool columnHasNoCells
;
92 int clampedEffectiveMaxLogicalWidth() { return std::max
<int>(1, effectiveMaxLogicalWidth
); }
95 Vector
<Layout
, 4> m_layoutStruct
;
96 Vector
<LayoutTableCell
*, 4> m_spanCells
;
97 bool m_hasPercent
: 1;
98 mutable bool m_effectiveLogicalWidthDirty
: 1;
103 #endif // TableLayoutAlgorithmAuto