RenderMathMLSpace.cpp [plain text]
#include "config.h"
#include "RenderMathMLSpace.h"
#if ENABLE(MATHML)
#include "GraphicsContext.h"
#include "MathMLNames.h"
#include "PaintInfo.h"
namespace WebCore {
using namespace MathMLNames;
RenderMathMLSpace::RenderMathMLSpace(MathMLTextElement& element, PassRef<RenderStyle> style)
: RenderMathMLBlock(element, WTF::move(style))
, m_width(0)
, m_height(0)
, m_depth(0)
{
}
void RenderMathMLSpace::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
{
minLogicalWidth = m_width;
maxLogicalWidth = m_width;
}
void RenderMathMLSpace::updateFromElement()
{
const auto& spaceElement = element();
m_width = 0;
m_height = 0;
m_depth = 0;
parseMathMLLength(spaceElement.getAttribute(MathMLNames::widthAttr), m_width, &style());
parseMathMLLength(spaceElement.getAttribute(MathMLNames::heightAttr), m_height, &style());
parseMathMLLength(spaceElement.getAttribute(MathMLNames::depthAttr), m_depth, &style());
if (m_width < 0)
m_width = 0;
if (m_height + m_depth < 0) {
m_height = 0;
m_depth = 0;
}
setNeedsLayoutAndPrefWidthsRecalc();
}
void RenderMathMLSpace::updateLogicalWidth()
{
setLogicalWidth(m_width);
}
void RenderMathMLSpace::updateLogicalHeight()
{
setLogicalHeight(m_height + m_depth);
}
void RenderMathMLSpace::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
{
RenderMathMLBlock::styleDidChange(diff, oldStyle);
updateFromElement();
}
int RenderMathMLSpace::firstLineBaseline() const
{
return m_height;
}
}
#endif