OSDN Git Service

Merge WebKit at r71558: Initial merge by git.
[android-x86/external-webkit.git] / WebCore / rendering / AutoTableLayout.h
1 /*
2  * Copyright (C) 2002 Lars Knoll (knoll@kde.org)
3  *           (C) 2002 Dirk Mueller (mueller@kde.org)
4  *
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.
9  *
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.
14  *
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.
19  */
20
21 #ifndef AutoTableLayout_h
22 #define AutoTableLayout_h
23
24 #include "Length.h"
25 #include "TableLayout.h"
26 #include <wtf/Vector.h>
27
28 namespace WebCore {
29
30 class RenderTable;
31 class RenderTableCell;
32
33 class AutoTableLayout : public TableLayout {
34 public:
35     AutoTableLayout(RenderTable*);
36     ~AutoTableLayout();
37
38     virtual void computePreferredLogicalWidths(int& minWidth, int& maxWidth);
39     virtual void layout();
40
41 private:
42     void fullRecalc();
43     void recalcColumn(int effCol);
44
45     int calcEffectiveLogicalWidth();
46
47     void insertSpanCell(RenderTableCell*);
48
49     struct Layout {
50         Layout()
51             : minLogicalWidth(0)
52             , maxLogicalWidth(0)
53             , effectiveMinLogicalWidth(0)
54             , effectiveMaxLogicalWidth(0)
55             , computedLogicalWidth(0)
56             , emptyCellsOnly(true)
57         {
58         }
59
60         Length logicalWidth;
61         Length effectiveLogicalWidth;
62         int minLogicalWidth;
63         int maxLogicalWidth;
64         int effectiveMinLogicalWidth;
65         int effectiveMaxLogicalWidth;
66         int computedLogicalWidth;
67         bool emptyCellsOnly;
68     };
69
70     Vector<Layout, 4> m_layoutStruct;
71     Vector<RenderTableCell*, 4> m_spanCells;
72     bool m_hasPercent : 1;
73     mutable bool m_effectiveLogicalWidthDirty : 1;
74 };
75
76 } // namespace WebCore
77
78 #endif // AutoTableLayout_h