// FIXME: It's cleaner to only call updateFromElement when an attribute has changed. The body of
// this method should probably be moved to a private stretchHeightChanged or checkStretchHeight
// method. Probably at the same time, addChild/removeChild methods should be made to work for
// dynamic DOM changes.
void RenderMathMLOperator::updateFromElement()
{
    RenderElement* savedRenderer = element().renderer();

    // Destroy our current children
    destroyLeftoverChildren();

    // Since we share a node with our children, destroying our children may set our node's
    // renderer to 0, so we need to restore it.
    element().setRenderer(savedRenderer);

    RenderPtr<RenderMathMLBlock> container = createRenderer<RenderMathMLBlock>(element(), RenderStyle::createAnonymousStyleWithDisplay(&style(), FLEX));
    // This container doesn't offer any useful information to accessibility.
    container->setIgnoreInAccessibilityTree(true);
    container->initializeStyle();

    RenderPtr<RenderText> text;
    if (m_operator)
        text = createRenderer<RenderText>(document(), String(&m_operator, 1));
    else
        text = createRenderer<RenderText>(document(), element().textContent().replace(hyphenMinus, minusSign).impl());

    container->addChild(text.leakPtr());
    addChild(container.leakPtr());

    updateStyle();
    setNeedsLayoutAndPrefWidthsRecalc();
}
Esempio n. 2
0
RenderPtr<RenderMathMLOperator> RenderMathMLFenced::createMathMLOperator(UChar uChar, MathMLOperatorDictionary::Form form, MathMLOperatorDictionary::Flag flag)
{
    auto newStyle = RenderStyle::createAnonymousStyleWithDisplay(&style(), FLEX);
    newStyle.get().setFlexDirection(FlowColumn);
    newStyle.get().setMarginEnd(Length((flag == MathMLOperatorDictionary::Fence ? gFenceMarginEms : gSeparatorMarginEndEms) * style().fontSize(), Fixed));
    if (flag == MathMLOperatorDictionary::Fence)
        newStyle.get().setMarginStart(Length(gFenceMarginEms * style().fontSize(), Fixed));
    RenderPtr<RenderMathMLOperator> newOperator = createRenderer<RenderMathMLOperator>(element(), std::move(newStyle), uChar, form, flag);
    newOperator->initializeStyle();
    return newOperator;
}
Esempio n. 3
0
RenderPtr<RenderMathMLOperator> RenderMathMLFenced::createMathMLOperator(const String& operatorString, MathMLOperatorDictionary::Form form, MathMLOperatorDictionary::Flag flag)
{
    RenderPtr<RenderMathMLOperator> newOperator = createRenderer<RenderMathMLOperator>(document(), RenderStyle::createAnonymousStyleWithDisplay(&style(), FLEX), operatorString, form, flag);
    newOperator->initializeStyle();
    return newOperator;
}
Esempio n. 4
0
RenderPtr<RenderMathMLRow> RenderMathMLRow::createAnonymousWithParentRenderer(RenderMathMLRoot& parent)
{
    RenderPtr<RenderMathMLRow> newMRow = createRenderer<RenderMathMLRow>(parent.document(), RenderStyle::createAnonymousStyleWithDisplay(&parent.style(), FLEX));
    newMRow->initializeStyle();
    return newMRow;
}
RenderPtr<RenderMathMLSquareRoot> RenderMathMLSquareRoot::createAnonymousWithParentRenderer(RenderMathMLMenclose& parent)
{
    RenderPtr<RenderMathMLSquareRoot> squareRoot = createRenderer<RenderMathMLSquareRoot>(parent.document(), RenderStyle::createAnonymousStyleWithDisplay(&parent.style(), FLEX));
    squareRoot->initializeStyle();
    return squareRoot;
}
Esempio n. 6
0
RenderPtr<RenderMathMLBlock> RenderMathMLBlock::createAnonymousMathMLBlock()
{
    RenderPtr<RenderMathMLBlock> newBlock = createRenderer<RenderMathMLBlock>(document(), RenderStyle::createAnonymousStyleWithDisplay(&style(), FLEX));
    newBlock->initializeStyle();
    return newBlock;
}