MathMLMathElement.cpp [plain text]
#include "config.h"
#include "MathMLMathElement.h"
#if ENABLE(MATHML)
#include "MathMLNames.h"
#include "RenderMathMLMath.h"
#include <wtf/IsoMallocInlines.h>
namespace WebCore {
WTF_MAKE_ISO_ALLOCATED_IMPL(MathMLMathElement);
using namespace MathMLNames;
inline MathMLMathElement::MathMLMathElement(const QualifiedName& tagName, Document& document)
: MathMLRowElement(tagName, document)
{
setHasCustomStyleResolveCallbacks();
}
Ref<MathMLMathElement> MathMLMathElement::create(const QualifiedName& tagName, Document& document)
{
return adoptRef(*new MathMLMathElement(tagName, document));
}
RenderPtr<RenderElement> MathMLMathElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)
{
return createRenderer<RenderMathMLMath>(*this, WTFMove(style));
}
std::optional<bool> MathMLMathElement::specifiedDisplayStyle()
{
if (cachedBooleanAttribute(displaystyleAttr, m_displayStyle) == BooleanValue::Default) {
auto& value = attributeWithoutSynchronization(displayAttr);
if (value == "block")
m_displayStyle = BooleanValue::True;
else if (value == "inline")
m_displayStyle = BooleanValue::False;
}
return toOptionalBool(m_displayStyle.value());
}
void MathMLMathElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
bool displayStyleAttribute = (name == displaystyleAttr || name == displayAttr);
bool mathVariantAttribute = name == mathvariantAttr;
if (displayStyleAttribute)
m_displayStyle = std::nullopt;
if (mathVariantAttribute)
m_mathVariant = std::nullopt;
if ((displayStyleAttribute || mathVariantAttribute) && renderer())
MathMLStyle::resolveMathMLStyleTree(renderer());
MathMLElement::parseAttribute(name, value);
}
void MathMLMathElement::didAttachRenderers()
{
MathMLRowElement::didAttachRenderers();
MathMLStyle::resolveMathMLStyleTree(renderer());
}
}
#endif // ENABLE(MATHML)