OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. | 5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
11 * | 11 * |
12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
16 * | 16 * |
17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
21 * | 21 * |
22 */ | 22 */ |
23 | 23 |
24 #include "config.h" | 24 #include "config.h" |
25 #include "core/rendering/RenderFieldset.h" | 25 #include "core/layout/LayoutFieldset.h" |
26 | 26 |
27 #include "core/CSSPropertyNames.h" | 27 #include "core/CSSPropertyNames.h" |
28 #include "core/HTMLNames.h" | 28 #include "core/HTMLNames.h" |
29 #include "core/html/HTMLLegendElement.h" | 29 #include "core/html/HTMLLegendElement.h" |
30 #include "core/layout/PaintInfo.h" | 30 #include "core/layout/PaintInfo.h" |
31 #include "core/paint/FieldsetPainter.h" | 31 #include "core/paint/FieldsetPainter.h" |
32 #include "platform/graphics/GraphicsContextStateSaver.h" | 32 #include "platform/graphics/GraphicsContextStateSaver.h" |
33 | 33 |
34 using std::min; | 34 using std::min; |
35 using std::max; | 35 using std::max; |
36 | 36 |
37 namespace blink { | 37 namespace blink { |
38 | 38 |
39 using namespace HTMLNames; | 39 using namespace HTMLNames; |
40 | 40 |
41 RenderFieldset::RenderFieldset(Element* element) | 41 LayoutFieldset::LayoutFieldset(Element* element) |
42 : RenderBlockFlow(element) | 42 : RenderBlockFlow(element) |
43 { | 43 { |
44 } | 44 } |
45 | 45 |
46 void RenderFieldset::computePreferredLogicalWidths() | 46 void LayoutFieldset::computePreferredLogicalWidths() |
47 { | 47 { |
48 RenderBlockFlow::computePreferredLogicalWidths(); | 48 RenderBlockFlow::computePreferredLogicalWidths(); |
49 if (RenderBox* legend = findLegend()) { | 49 if (RenderBox* legend = findLegend()) { |
50 int legendMinWidth = legend->minPreferredLogicalWidth(); | 50 int legendMinWidth = legend->minPreferredLogicalWidth(); |
51 | 51 |
52 Length legendMarginLeft = legend->style()->marginLeft(); | 52 Length legendMarginLeft = legend->style()->marginLeft(); |
53 Length legendMarginRight = legend->style()->marginLeft(); | 53 Length legendMarginRight = legend->style()->marginLeft(); |
54 | 54 |
55 if (legendMarginLeft.isFixed()) | 55 if (legendMarginLeft.isFixed()) |
56 legendMinWidth += legendMarginLeft.value(); | 56 legendMinWidth += legendMarginLeft.value(); |
57 | 57 |
58 if (legendMarginRight.isFixed()) | 58 if (legendMarginRight.isFixed()) |
59 legendMinWidth += legendMarginRight.value(); | 59 legendMinWidth += legendMarginRight.value(); |
60 | 60 |
61 m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, legendMinWi
dth + borderAndPaddingWidth()); | 61 m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, legendMinWi
dth + borderAndPaddingWidth()); |
62 } | 62 } |
63 } | 63 } |
64 | 64 |
65 LayoutObject* RenderFieldset::layoutSpecialExcludedChild(bool relayoutChildren,
SubtreeLayoutScope&) | 65 LayoutObject* LayoutFieldset::layoutSpecialExcludedChild(bool relayoutChildren,
SubtreeLayoutScope&) |
66 { | 66 { |
67 RenderBox* legend = findLegend(); | 67 RenderBox* legend = findLegend(); |
68 if (legend) { | 68 if (legend) { |
69 if (relayoutChildren) | 69 if (relayoutChildren) |
70 legend->setNeedsLayoutAndFullPaintInvalidation(); | 70 legend->setNeedsLayoutAndFullPaintInvalidation(); |
71 legend->layoutIfNeeded(); | 71 legend->layoutIfNeeded(); |
72 | 72 |
73 LayoutUnit logicalLeft; | 73 LayoutUnit logicalLeft; |
74 if (style()->isLeftToRightDirection()) { | 74 if (style()->isLeftToRightDirection()) { |
75 switch (legend->style()->textAlign()) { | 75 switch (legend->style()->textAlign()) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 } else { | 119 } else { |
120 collapsedLegendExtent = legendLogicalHeight + marginAfterForChild(*l
egend); | 120 collapsedLegendExtent = legendLogicalHeight + marginAfterForChild(*l
egend); |
121 } | 121 } |
122 | 122 |
123 setLogicalTopForChild(*legend, legendLogicalTop); | 123 setLogicalTopForChild(*legend, legendLogicalTop); |
124 setLogicalHeight(paddingBefore() + collapsedLegendExtent); | 124 setLogicalHeight(paddingBefore() + collapsedLegendExtent); |
125 } | 125 } |
126 return legend; | 126 return legend; |
127 } | 127 } |
128 | 128 |
129 RenderBox* RenderFieldset::findLegend(FindLegendOption option) const | 129 RenderBox* LayoutFieldset::findLegend(FindLegendOption option) const |
130 { | 130 { |
131 for (LayoutObject* legend = firstChild(); legend; legend = legend->nextSibli
ng()) { | 131 for (LayoutObject* legend = firstChild(); legend; legend = legend->nextSibli
ng()) { |
132 if (option == IgnoreFloatingOrOutOfFlow && legend->isFloatingOrOutOfFlow
Positioned()) | 132 if (option == IgnoreFloatingOrOutOfFlow && legend->isFloatingOrOutOfFlow
Positioned()) |
133 continue; | 133 continue; |
134 | 134 |
135 if (isHTMLLegendElement(legend->node())) | 135 if (isHTMLLegendElement(legend->node())) |
136 return toRenderBox(legend); | 136 return toRenderBox(legend); |
137 } | 137 } |
138 return 0; | 138 return 0; |
139 } | 139 } |
140 | 140 |
141 void RenderFieldset::paintBoxDecorationBackground(const PaintInfo& paintInfo, co
nst LayoutPoint& paintOffset) | 141 void LayoutFieldset::paintBoxDecorationBackground(const PaintInfo& paintInfo, co
nst LayoutPoint& paintOffset) |
142 { | 142 { |
143 FieldsetPainter(*this).paintBoxDecorationBackground(paintInfo, paintOffset); | 143 FieldsetPainter(*this).paintBoxDecorationBackground(paintInfo, paintOffset); |
144 } | 144 } |
145 | 145 |
146 void RenderFieldset::paintMask(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) | 146 void LayoutFieldset::paintMask(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) |
147 { | 147 { |
148 FieldsetPainter(*this).paintMask(paintInfo, paintOffset); | 148 FieldsetPainter(*this).paintMask(paintInfo, paintOffset); |
149 } | 149 } |
150 | 150 |
151 } // namespace blink | 151 } // namespace blink |
OLD | NEW |