layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
-layer at (0,0) size 800x320
- RenderBlock {html} at (0,0) size 800x320
- RenderBody {body} at (8,16) size 784x288
+layer at (0,0) size 800x352
+ RenderBlock {html} at (0,0) size 800x352
+ RenderBody {body} at (8,16) size 784x320
RenderBlock {p} at (0,0) size 784x34
RenderText {#text} at (0,7) size 49x18
text run at (0,7) width 49: "simple: "
RenderText {#text} at (3,2) size 120x16
text run at (3,2) width 120: "number of changes"
RenderText {#text} at (0,0) size 0x0
- RenderBlock {p} at (0,150) size 784x38
- RenderText {#text} at (0,7) size 173x18
- text run at (0,7) width 173: "line thickness by keyword: "
- RenderBlock {math} at (173,0) size 16x34
- RenderBlock {mfrac} at (1,0) size 14x34
- RenderBlock {mfrac} at (0,0) size 14x16
- RenderInline {mn} at (0,0) size 8x16
- RenderText {#text} at (3,0) size 8x16
- text run at (3,0) width 8: "1"
- RenderBlock {mfrac} at (0,16) size 14x18
- RenderInline {mn} at (0,0) size 8x16
- RenderText {#text} at (3,2) size 8x16
- text run at (3,2) width 8: "2"
- RenderBlock {math} at (189,0) size 16x36
- RenderBlock {mfrac} at (1,0) size 14x36
- RenderBlock {mfrac} at (0,0) size 14x16
- RenderInline {mn} at (0,0) size 8x16
- RenderText {#text} at (3,0) size 8x16
- text run at (3,0) width 8: "1"
- RenderBlock {mfrac} at (0,16) size 14x20
- RenderInline {mn} at (0,0) size 8x16
- RenderText {#text} at (3,4) size 8x16
- text run at (3,4) width 8: "2"
- RenderBlock {math} at (205,0) size 16x38
- RenderBlock {mfrac} at (1,0) size 14x38
- RenderBlock {mfrac} at (0,0) size 14x16
- RenderInline {mn} at (0,0) size 8x16
- RenderText {#text} at (3,0) size 8x16
- text run at (3,0) width 8: "1"
- RenderBlock {mfrac} at (0,16) size 14x22
- RenderInline {mn} at (0,0) size 8x16
- RenderText {#text} at (3,6) size 8x16
- text run at (3,6) width 8: "2"
- RenderBlock {p} at (0,204) size 784x34
+ RenderBlock {p} at (0,150) size 784x70
+ RenderText {#text} at (0,26) size 173x18
+ text run at (0,26) width 173: "line thickness by keyword: "
+ RenderBlock {math} at (173,0) size 86x70
+ RenderBlock {mfrac} at (1,0) size 28x67
+ RenderBlock {mfrac} at (0,0) size 28x32
+ RenderInline {mn} at (0,0) size 16x32
+ RenderText {#text} at (6,0) size 16x32
+ text run at (6,0) width 16: "1"
+ RenderBlock {mfrac} at (0,32) size 28x35
+ RenderInline {mn} at (0,0) size 16x32
+ RenderText {#text} at (6,3) size 16x32
+ text run at (6,3) width 16: "2"
+ RenderBlock {mfrac} at (29,0) size 28x68
+ RenderBlock {mfrac} at (0,0) size 28x32
+ RenderInline {mn} at (0,0) size 16x32
+ RenderText {#text} at (6,0) size 16x32
+ text run at (6,0) width 16: "1"
+ RenderBlock {mfrac} at (0,32) size 28x36
+ RenderInline {mn} at (0,0) size 16x32
+ RenderText {#text} at (6,4) size 16x32
+ text run at (6,4) width 16: "2"
+ RenderBlock {mfrac} at (57,0) size 28x70
+ RenderBlock {mfrac} at (0,0) size 28x32
+ RenderInline {mn} at (0,0) size 16x32
+ RenderText {#text} at (6,0) size 16x32
+ text run at (6,0) width 16: "1"
+ RenderBlock {mfrac} at (0,32) size 28x38
+ RenderInline {mn} at (0,0) size 16x32
+ RenderText {#text} at (6,6) size 16x32
+ text run at (6,6) width 16: "2"
+ RenderText {#text} at (0,0) size 0x0
+ RenderBlock {p} at (0,236) size 784x34
RenderText {#text} at (0,7) size 138x18
text run at (0,7) width 138: "numerator alignment: "
RenderBlock {math} at (138,0) size 89x34
RenderText {#text} at (72,0) size 8x16
text run at (72,0) width 8: "5"
RenderText {#text} at (0,0) size 0x0
- RenderBlock {p} at (0,254) size 784x34
+ RenderBlock {p} at (0,286) size 784x34
RenderText {#text} at (0,7) size 153x18
text run at (0,7) width 153: "denominator alignment: "
RenderBlock {math} at (153,0) size 88x34
using namespace MathMLNames;
static const double gHorizontalPad = 0.2;
-static const int gLineThin = 1;
-static const int gLineMedium = 3;
-static const int gLineThick = 5;
-static const double gFractionAlignment = 0.25;
+static const double gLineThin = 0.33;
+static const double gLineMedium = 1.;
+static const double gLineThick = 3.;
static const double gFractionBarWidth = 0.05;
static const double gDenominatorPad = 0.1;
RenderMathMLFraction::RenderMathMLFraction(Element* fraction)
: RenderMathMLBlock(fraction)
- , m_lineThickness(gLineThin)
+ , m_lineThickness(gLineMedium)
{
setChildrenInline(false);
}
// FIXME: parse units
String thickness = fraction->getAttribute(MathMLNames::linethicknessAttr);
- m_lineThickness = gLineThin;
+ m_lineThickness = gLineMedium;
if (equalIgnoringCase(thickness, "thin"))
m_lineThickness = gLineThin;
else if (equalIgnoringCase(thickness, "medium"))
// Adjust the fraction line thickness for the zoom
if (lastChild() && lastChild()->isRenderBlock())
- m_lineThickness = static_cast<int>(m_lineThickness * ceil(gFractionBarWidth * style()->fontSize()));
+ m_lineThickness *= ceil(gFractionBarWidth * style()->fontSize());
RenderBlock::layout();
int verticalOffset = 0;
// The children are always RenderMathMLBlock instances
if (firstChild()->isRenderMathMLBlock()) {
- int adjustForThickness = m_lineThickness > 1 ? m_lineThickness / 2 : 1;
- if (m_lineThickness % 2 == 1)
+ int adjustForThickness = m_lineThickness > 1 ? int(m_lineThickness / 2) : 1;
+ if (int(m_lineThickness) % 2 == 1)
adjustForThickness++;
RenderMathMLBlock* numerator = toRenderMathMLBlock(firstChild());
if (numerator->isRenderMathMLRow())
info.context->save();
- info.context->setStrokeThickness(static_cast<float>(m_lineThickness));
+ info.context->setStrokeThickness(m_lineThickness);
info.context->setStrokeStyle(SolidStroke);
info.context->setStrokeColor(style()->visitedDependentColor(CSSPropertyColor), ColorSpaceSRGB);
{
if (firstChild() && firstChild()->isRenderMathMLBlock()) {
RenderMathMLBlock* numerator = toRenderMathMLBlock(firstChild());
- // FIXME: the baseline should adjust so the fraction line aligns
- // relative certain operators (e.g. aligns with the horizontal
- // stroke of the plus). 1/3 of the current font size is just
- // a good guess.
- return numerator->offsetHeight() + style()->fontSize() / 3;
+ RenderStyle* refStyle = style();
+ if (previousSibling())
+ refStyle = previousSibling()->style();
+ else if (nextSibling())
+ refStyle = nextSibling()->style();
+ int shift = int(ceil((refStyle->font().xHeight() + 1) / 2));
+ return numerator->offsetHeight() + shift;
}
return RenderBlock::baselinePosition(AlphabeticBaseline, firstLine, lineDirection, linePositionMode);
}