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. |
(...skipping 28 matching lines...) Expand all Loading... |
39 using namespace HTMLNames; | 39 using namespace HTMLNames; |
40 | 40 |
41 LayoutFieldset::LayoutFieldset(Element* element) | 41 LayoutFieldset::LayoutFieldset(Element* element) |
42 : RenderBlockFlow(element) | 42 : RenderBlockFlow(element) |
43 { | 43 { |
44 } | 44 } |
45 | 45 |
46 void LayoutFieldset::computePreferredLogicalWidths() | 46 void LayoutFieldset::computePreferredLogicalWidths() |
47 { | 47 { |
48 RenderBlockFlow::computePreferredLogicalWidths(); | 48 RenderBlockFlow::computePreferredLogicalWidths(); |
49 if (RenderBox* legend = findLegend()) { | 49 if (LayoutBox* 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* LayoutFieldset::layoutSpecialExcludedChild(bool relayoutChildren,
SubtreeLayoutScope&) | 65 LayoutObject* LayoutFieldset::layoutSpecialExcludedChild(bool relayoutChildren,
SubtreeLayoutScope&) |
66 { | 66 { |
67 RenderBox* legend = findLegend(); | 67 LayoutBox* 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()) { |
76 case CENTER: | 76 case CENTER: |
77 logicalLeft = (logicalWidth() - logicalWidthForChild(*legend)) /
2; | 77 logicalLeft = (logicalWidth() - logicalWidthForChild(*legend)) /
2; |
(...skipping 41 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* LayoutFieldset::findLegend(FindLegendOption option) const | 129 LayoutBox* 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 toLayoutBox(legend); |
137 } | 137 } |
138 return 0; | 138 return 0; |
139 } | 139 } |
140 | 140 |
141 void LayoutFieldset::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 LayoutFieldset::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 |