168 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = preferredWidth;
169
170 setPreferredLogicalWidthsDirty(false);
171}
172
173LayoutUnit RenderMathMLUnderOver::horizontalOffset(const RenderBox& child) const
174{
175 return (logicalWidth() - child.logicalWidth()) / 2;
176}
177
178void RenderMathMLUnderOver::layoutBlock(bool relayoutChildren, LayoutUnit)
179{
180 ASSERT(needsLayout());
181
182 if (!relayoutChildren && simplifiedLayout())
183 return;
184
185 if (!isValid()) {
186 setLogicalWidth(0);
187 setLogicalHeight(0);
188 clearNeedsLayout();
189 return;
190 }
191
192 recomputeLogicalWidth();
193
194 computeOperatorsHorizontalStretch();
195
196 base().layoutIfNeeded();
197 if (m_kind == Under || m_kind == UnderOver)
198 under().layoutIfNeeded();
199 if (m_kind == Over || m_kind == UnderOver)
200 over().layoutIfNeeded();
201
202 // We set the logical width.
203 LayoutUnit logicalWidth = base().logicalWidth();
204 if (m_kind == Under || m_kind == UnderOver)
205 logicalWidth = std::max(logicalWidth, under().logicalWidth());
206 if (m_kind == Over || m_kind == UnderOver)
207 logicalWidth = std::max(logicalWidth, over().logicalWidth());
208 setLogicalWidth(logicalWidth);
209
210 LayoutUnit verticalOffset = 0;
211 if (m_kind == Over || m_kind == UnderOver) {
212 over().setLocation(LayoutPoint(horizontalOffset(over()), 0));
213 verticalOffset += over().logicalHeight();
214 }
215 base().setLocation(LayoutPoint(horizontalOffset(base()), verticalOffset));
216 verticalOffset += base().logicalHeight();
217 if (m_kind == Under || m_kind == UnderOver) {
218 under().setLocation(LayoutPoint(horizontalOffset(under()), verticalOffset));
219 verticalOffset += under().logicalHeight();
220 }
221
222 setLogicalHeight(verticalOffset);
223
224 clearNeedsLayout();
225}
226
227void RenderMathMLUnderOver::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintOffset, PaintInfo& paintInfoForChild, bool usePrintRect)
228{
229 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
230 if (!paintChild(*child, paintInfo, paintOffset, paintInfoForChild, usePrintRect, PaintAsInlineBlock))
231 return;
232 }