|
Lines 67-79
bool RenderMathMLBlock::isChildAllowed(const RenderObject& child, const RenderSt
a/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp_sec1
|
| 67 |
return is<Element>(child.node()); |
67 |
return is<Element>(child.node()); |
| 68 |
} |
68 |
} |
| 69 |
|
69 |
|
| 70 |
LayoutUnit RenderMathMLBlock::getMathAxisHeight() const |
70 |
static LayoutUnit axisHeight(const RenderStyle& style) |
| 71 |
{ |
71 |
{ |
| 72 |
const auto& primaryFont = style().fontCascade().primaryFont(); |
72 |
// If we have a MATH table we just return the AxisHeight constant. |
|
|
73 |
const auto& primaryFont = style.fontCascade().primaryFont(); |
| 73 |
if (auto* mathData = primaryFont.mathData()) |
74 |
if (auto* mathData = primaryFont.mathData()) |
| 74 |
return mathData->getMathConstant(primaryFont, OpenTypeMathData::AxisHeight); |
75 |
return mathData->getMathConstant(primaryFont, OpenTypeMathData::AxisHeight); |
| 75 |
|
76 |
|
| 76 |
return style().fontMetrics().xHeight() / 2; |
77 |
// Otherwise, the idea is to try and use the middle of operators as the math axis which we thus approximate by "half of the x-height". |
|
|
78 |
// Note that Gecko has a slower but more accurate version that measures half of the height of U+2212 MINUS SIGN. |
| 79 |
return style.fontMetrics().xHeight() / 2; |
| 80 |
} |
| 81 |
|
| 82 |
LayoutUnit RenderMathMLBlock::getMathAxisHeight() const |
| 83 |
{ |
| 84 |
return axisHeight(style()); |
| 77 |
} |
85 |
} |
| 78 |
|
86 |
|
| 79 |
LayoutUnit RenderMathMLBlock::mirrorIfNeeded(LayoutUnit horizontalOffset, LayoutUnit boxWidth) const |
87 |
LayoutUnit RenderMathMLBlock::mirrorIfNeeded(LayoutUnit horizontalOffset, LayoutUnit boxWidth) const |
|
Lines 304-313
bool parseMathMLNamedSpace(const String& string, LayoutUnit& lengthValue, const
a/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp_sec2
|
| 304 |
|
312 |
|
| 305 |
Optional<int> RenderMathMLTable::firstLineBaseline() const |
313 |
Optional<int> RenderMathMLTable::firstLineBaseline() const |
| 306 |
{ |
314 |
{ |
| 307 |
// In legal MathML, we'll have a MathML parent. That RenderFlexibleBox parent will use our firstLineBaseline() for baseline alignment, per |
315 |
// By default the vertical center of <mtable> is aligned on the math axis. |
| 308 |
// http://dev.w3.org/csswg/css3-flexbox/#flex-baselines. We want to vertically center an <mtable>, such as a matrix. Essentially the whole <mtable> element fits on a |
316 |
// This is different than RenderTable::firstLineBoxBaseline, which returns the baseline of the first row of a <table>. |
| 309 |
// single line, whose baseline gives this centering. This is different than RenderTable::firstLineBoxBaseline, which returns the baseline of the first row of a <table>. |
317 |
return Optional<int>(logicalHeight() / 2 + axisHeight(style())); |
| 310 |
return (logicalHeight() + style().fontMetrics().xHeight()) / 2; |
|
|
| 311 |
} |
318 |
} |
| 312 |
|
319 |
|
| 313 |
void RenderMathMLBlock::layoutItems(bool relayoutChildren) |
320 |
void RenderMathMLBlock::layoutItems(bool relayoutChildren) |