diff options
Diffstat (limited to 'WebCore/mathml')
-rw-r--r-- | WebCore/mathml/RenderMathMLBlock.cpp | 34 | ||||
-rw-r--r-- | WebCore/mathml/RenderMathMLBlock.h | 6 |
2 files changed, 40 insertions, 0 deletions
diff --git a/WebCore/mathml/RenderMathMLBlock.cpp b/WebCore/mathml/RenderMathMLBlock.cpp index 249c136..a897ff5 100644 --- a/WebCore/mathml/RenderMathMLBlock.cpp +++ b/WebCore/mathml/RenderMathMLBlock.cpp @@ -30,6 +30,7 @@ #include "RenderMathMLBlock.h" #include "FontSelector.h" +#include "GraphicsContext.h" #include "MathMLNames.h" #include "RenderInline.h" #include "RenderText.h" @@ -73,6 +74,39 @@ void RenderMathMLBlock::stretchToHeight(int height) } } +#if ENABLE(DEBUG_MATH_LAYOUT) +void RenderMathMLBlock::paint(PaintInfo& info, int tx, int ty) +{ + RenderBlock::paint(info, tx, ty); + + if (info.context->paintingDisabled() || info.phase != PaintPhaseForeground) + return; + + tx += x(); + ty += y(); + + info.context->save(); + + info.context->setStrokeThickness(1.0f); + info.context->setStrokeStyle(SolidStroke); + info.context->setStrokeColor(Color(0, 0, 255), sRGBColorSpace); + + info.context->drawLine(IntPoint(tx, ty), IntPoint(tx + offsetWidth(), ty)); + info.context->drawLine(IntPoint(tx + offsetWidth(), ty), IntPoint(tx + offsetWidth(), ty + offsetHeight())); + info.context->drawLine(IntPoint(tx, ty + offsetHeight()), IntPoint(tx + offsetWidth(), ty + offsetHeight())); + info.context->drawLine(IntPoint(tx, ty), IntPoint(tx, ty + offsetHeight())); + + int baseline = baselinePosition(true); + + info.context->setStrokeColor(Color(255, 0, 0), sRGBColorSpace); + + info.context->drawLine(IntPoint(tx, ty + baseline), IntPoint(tx + offsetWidth(), ty + baseline)); + + info.context->restore(); + +} +#endif // ENABLE(DEBUG_MATH_LAYOUT) + } diff --git a/WebCore/mathml/RenderMathMLBlock.h b/WebCore/mathml/RenderMathMLBlock.h index b274a69..e01a325 100644 --- a/WebCore/mathml/RenderMathMLBlock.h +++ b/WebCore/mathml/RenderMathMLBlock.h @@ -30,6 +30,8 @@ #include "RenderBlock.h" +#define ENABLE_DEBUG_MATH_LAYOUT 0 + namespace WebCore { class RenderMathMLBlock : public RenderBlock { @@ -44,6 +46,10 @@ public: virtual bool hasBase() const { return false; } virtual int nonOperatorHeight() const; virtual void stretchToHeight(int height); + +#if ENABLE(DEBUG_MATH_LAYOUT) + virtual void paint(PaintInfo&, int tx, int ty); +#endif protected: virtual PassRefPtr<RenderStyle> makeBlockStyle(); |