RenderMathMLRow.cpp [plain text]
#include "config.h"
#if ENABLE(MATHML)
#include "RenderMathMLRow.h"
#include "MathMLNames.h"
#include "RenderMathMLOperator.h"
namespace WebCore {
using namespace MathMLNames;
RenderMathMLRow::RenderMathMLRow(Element* element)
: RenderMathMLBlock(element)
{
}
RenderMathMLRow* RenderMathMLRow::createAnonymousWithParentRenderer(const RenderObject* parent)
{
RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(parent->style(), FLEX);
RenderMathMLRow* newMRow = new (parent->renderArena()) RenderMathMLRow(0);
newMRow->setDocumentForAnonymous(parent->document());
newMRow->setStyle(newStyle.release());
return newMRow;
}
void RenderMathMLRow::computePreferredLogicalWidths()
{
ASSERT(preferredLogicalWidthsDirty() && needsLayout());
#ifndef NDEBUG
SetLayoutNeededForbiddenScope layoutForbiddenScope(this, false);
#endif
computeChildrenPreferredLogicalHeights();
int stretchLogicalHeight = 0;
for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
if (child->isRenderMathMLBlock()) {
RenderMathMLOperator* renderMo = toRenderMathMLBlock(child)->unembellishedOperator();
if (renderMo)
continue;
}
stretchLogicalHeight = max<int>(stretchLogicalHeight, roundToInt(preferredLogicalHeightAfterSizing(child)));
}
if (!stretchLogicalHeight)
stretchLogicalHeight = style()->fontSize();
for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
if (child->isRenderMathMLBlock()) {
RenderMathMLOperator* renderMo = toRenderMathMLBlock(child)->unembellishedOperator();
if (renderMo)
renderMo->stretchToHeight(stretchLogicalHeight);
}
}
RenderMathMLBlock::computePreferredLogicalWidths();
ASSERT(needsLayout() && logicalWidth() >= maxPreferredLogicalWidth());
setLogicalWidth(maxPreferredLogicalWidth());
}
void RenderMathMLRow::layout()
{
if (preferredLogicalWidthsDirty())
computePreferredLogicalWidths();
RenderMathMLBlock::layout();
}
}
#endif // ENABLE(MATHML)