RenderMathMLScripts.h [plain text]
#ifndef RenderMathMLScripts_h
#define RenderMathMLScripts_h
#if ENABLE(MATHML)
#include "RenderMathMLBlock.h"
namespace WebCore {
class RenderMathMLScripts;
class RenderMathMLScriptsWrapper final : public RenderMathMLBlock {
friend class RenderMathMLScripts;
public:
enum WrapperType { Base, SubSupPair };
virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0) override;
virtual void removeChild(RenderObject&) override;
private:
RenderMathMLScriptsWrapper(Document& document, Ref<RenderStyle>&& style, WrapperType kind)
: RenderMathMLBlock(document, WTF::move(style))
, m_kind(kind)
{
}
static RenderMathMLScriptsWrapper* createAnonymousWrapper(RenderMathMLScripts* renderObject, WrapperType);
void addChildInternal(bool normalInsertion, RenderObject* child, RenderObject* beforeChild = 0);
void removeChildInternal(bool normalRemoval, RenderObject& child);
virtual const char* renderName() const override { return m_kind == Base ? "Base Wrapper" : "SubSupPair Wrapper"; }
virtual bool isRenderMathMLScriptsWrapper() const override final { return true; }
RenderMathMLScripts* parentMathMLScripts();
WrapperType m_kind;
};
class RenderMathMLScripts final : public RenderMathMLBlock {
friend class RenderMathMLScriptsWrapper;
public:
RenderMathMLScripts(Element&, Ref<RenderStyle>&&);
virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0) override;
virtual void removeChild(RenderObject&) override;
virtual RenderMathMLOperator* unembellishedOperator() override;
virtual Optional<int> firstLineBaseline() const override;
protected:
virtual void layout() override;
private:
void addChildInternal(bool normalInsertion, RenderObject* child, RenderObject* beforeChild = 0);
void removeChildInternal(bool normalRemoval, RenderObject& child);
virtual bool isRenderMathMLScripts() const override { return true; }
virtual const char* renderName() const override { return "RenderMathMLScripts"; }
void fixAnonymousStyleForSubSupPair(RenderObject* subSupPair, bool isPostScript);
void fixAnonymousStyles();
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
RenderBoxModelObject* base() const;
enum ScriptsType { Sub, Super, SubSup, Multiscripts };
ScriptsType m_kind;
RenderMathMLScriptsWrapper* m_baseWrapper;
};
}
SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMathMLScriptsWrapper, isRenderMathMLScriptsWrapper())
SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMathMLScripts, isRenderMathMLScripts())
#endif // ENABLE(MATHML)
#endif // RenderMathMLScripts_h