From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/WebCore/mathml/MathMLMathElement.cpp | 53 +++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 11 deletions(-) (limited to 'Source/WebCore/mathml/MathMLMathElement.cpp') diff --git a/Source/WebCore/mathml/MathMLMathElement.cpp b/Source/WebCore/mathml/MathMLMathElement.cpp index 6f2f389ba..783e9ff95 100644 --- a/Source/WebCore/mathml/MathMLMathElement.cpp +++ b/Source/WebCore/mathml/MathMLMathElement.cpp @@ -1,6 +1,7 @@ /* * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2016 Igalia S.L. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -25,35 +26,65 @@ */ #include "config.h" +#include "MathMLMathElement.h" #if ENABLE(MATHML) -#include "MathMLMathElement.h" +#include "MathMLNames.h" #include "RenderMathMLMath.h" namespace WebCore { +using namespace MathMLNames; + inline MathMLMathElement::MathMLMathElement(const QualifiedName& tagName, Document& document) - : MathMLInlineContainerElement(tagName, document) + : MathMLRowElement(tagName, document) +{ + setHasCustomStyleResolveCallbacks(); +} + +Ref MathMLMathElement::create(const QualifiedName& tagName, Document& document) { + return adoptRef(*new MathMLMathElement(tagName, document)); } -PassRefPtr MathMLMathElement::create(const QualifiedName& tagName, Document& document) +RenderPtr MathMLMathElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&) { - return adoptRef(new MathMLMathElement(tagName, document)); + return createRenderer(*this, WTFMove(style)); } -Node::InsertionNotificationRequest MathMLMathElement::insertedInto(ContainerNode& insertionPoint) +std::optional MathMLMathElement::specifiedDisplayStyle() { - // There are sibling rules in the MathML default style. - if (insertionPoint.inDocument()) - document().styleSheetCollection().setUsesSiblingRulesOverride(true); - return MathMLInlineContainerElement::insertedInto(insertionPoint); + if (cachedBooleanAttribute(displaystyleAttr, m_displayStyle) == BooleanValue::Default) { + // The default displaystyle value of the depends on the display attribute, so we parse it here. + auto& value = attributeWithoutSynchronization(displayAttr); + if (value == "block") + m_displayStyle = BooleanValue::True; + else if (value == "inline") + m_displayStyle = BooleanValue::False; + } + return toOptionalBool(m_displayStyle.value()); } -RenderPtr MathMLMathElement::createElementRenderer(PassRef style) +void MathMLMathElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { - return createRenderer(*this, std::move(style)); + 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()); } } -- cgit v1.2.1