haikuwebkit/LayoutTests/mathml/opentype/large-operators-displaystyl...

40 lines
2.0 KiB
HTML
Raw Permalink Normal View History

Implement an internal style property for displaystyle. https://bugs.webkit.org/show_bug.cgi?id=133845 Patch by Frederic Wang <fwang@igalia.com> on 2016-07-07 Reviewed by Brent Fulgham. Source/WebCore: Tests: mathml/opentype/large-operators-displaystyle-dynamic.html mathml/opentype/large-operators-displaystyle.html This is based on a patch by Alejandro G. Castro <alex@igalia.com> * CMakeLists.txt: Add MathMLStyle to the build system. * WebCore.xcodeproj/project.pbxproj: ditto. * mathml/MathMLInlineContainerElement.cpp: (WebCore::MathMLInlineContainerElement::parseAttribute): Resolve the mathml style when the displaystyle attribute changes on the mtable or mstyle elements. * mathml/MathMLInlineContainerElement.h: Define parseAttribute. * mathml/MathMLMathElement.cpp: (WebCore::MathMLMathElement::MathMLMathElement): Indicate that we have custom style. (WebCore::MathMLMathElement::parseAttribute): Resolve the mathml style when the display or displaystyle attributes change on the math element. (WebCore::MathMLMathElement::didAttachRenderers): Resolve the mathml style when one renderer is attached. * mathml/MathMLMathElement.h: Declare parseAttribute and didAttachRenderers. * mathml/mathattrs.in: Declare the display and displaystyle attributes. * rendering/mathml/MathMLStyle.cpp: Added. (WebCore::MathMLStyle::MathMLStyle): New class to handle custom MathML style. (WebCore::MathMLStyle::create): (WebCore::MathMLStyle::setDisplayStyle): Helper function to take the displaystyle from the specified rendered. (WebCore::MathMLStyle::resolveMathMLStyleTree): Helper function to resolve the custom MathML style in renderer subtree. (WebCore::MathMLStyle::getMathMLParentNode): Helper function to get a MathML ancestor of the specified renderer. (WebCore::MathMLStyle::updateStyleIfNeeded): Helper function to update the style of the specified renderer if needed. (WebCore::MathMLStyle::resolveMathMLStyle): Resolve the MathML style of a given renderer. For displaystyle, we inherit the value of the parent except for the cases mentioned in the MathML recommendation. * rendering/mathml/MathMLStyle.h: New class header for custom MathML style. Only displaystyle is supported for now. * rendering/mathml/RenderMathMLBlock.cpp: Add a member and getter for custom MathML style. (WebCore::RenderMathMLBlock::RenderMathMLBlock): * rendering/mathml/RenderMathMLBlock.h: ditto. (WebCore::RenderMathMLBlock::mathMLStyle): * rendering/mathml/RenderMathMLMath.h: Add definition to use the syntax is<RenderMathMLMath>. * rendering/mathml/RenderMathMLOperator.h: (WebCore::RenderMathMLOperator::isLargeOperatorInDisplayStyle): Do not rerturn true when the operator is not in displaystyle. * rendering/mathml/RenderMathMLRoot.h: Make updateStyle public, so that it can be called by MathMLStyle::updateStyleIfNeeded. * rendering/mathml/RenderMathMLUnderOver.h: Add definition to use the syntax is<RenderMathMLUnderOver>. LayoutTests: This is based on a patch by Alejandro G. Castro <alex@igalia.com> Add two new tests to verify that the displaystyle property is correctly inherited on various MathML elements. large-operators-displaystyle verifies that large operators are only drawn bigger when the displaystyle is true. large-operators-displaystyle-dynamic verifies the same displaystyle is calculated when the display and displaystyle attributes are changed dynamically. * mathml/opentype/large-operators-displaystyle-dynamic-expected.html: Added. * mathml/opentype/large-operators-displaystyle-dynamic.html: Added. * mathml/opentype/large-operators-displaystyle-expected.txt: Added. * imported/mathml-in-html5/fonts/math/largeop-displayoperatorminheight5000.woff: Added. * imported/mathml-in-html5/mathml/relations/css-styling/displaystyle-1.html: Added. * imported/mathml-in-html5/mathml/relations/css-styling/displaystyle-1-expected.txt: Added. Canonical link: https://commits.webkit.org/177684@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202960 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-07-08 05:40:20 +00:00
<!doctype html>
<html>
<head>
<title>Open Type MATH - large operators - displaystyle</title>
<meta charset="utf-8"/>
<style type="text/css">
@font-face {
font-family: stretchy;
src: url("stretchy.woff");
}
div.largeop_test * {
font-family: stretchy;
font-size: 10px;
}
</style>
</head>
<body>
<div class="largeop_test">
<math display="inline"><mo>&#x2A1B;</mo></math>
<math display="block"><mo>&#x2A1B;</mo></math>
<math displaystyle="false"><mo>&#x2A1B;</mo></math>
<math displaystyle="true"><mo>&#x2A1B;</mo></math>
<math><mstyle displaystyle="false"><mo>&#x2A1B;</mo></mstyle></math>
<math><mstyle displaystyle="true"><mo>&#x2A1B;</mo></mstyle></math>
<math displaystyle="true"><mtable><mtr><mtd><mo>&#x2A1B;</mo></mtd></mtr></mtable></math>
<math><mtable displaystyle="true"><mtr><mtd><mo>&#x2A1B;</mo></mtd></mtr></mtable></math>
<math displaystyle="true"><mtable displaystyle="false"><mtr><mtd><mo>&#x2A1B;</mo></mtd></mtr></mtable></math>
<math displaystyle="true"><mfrac><mo>&#x2A1B;</mo><mo>&#x2A1B;</mo></mfrac></math>
<math displaystyle="true"><mroot><mo>&#x2A1B;</mo><mo>&#x2A1B;</mo></mroot></math>
<math displaystyle="true"><msub><mo>&#x2A1B;</mo><mo>&#x2A1B;</mo></msub></math>
<math displaystyle="true"><msup><mo>&#x2A1B;</mo><mo>&#x2A1B;</mo></msup></math>
<math displaystyle="true"><msubsup><mo>&#x2A1B;</mo><mo>&#x2A1B;</mo><mo>&#x2A1B;</mo></msubsup></math>
<math displaystyle="true"><mmultiscripts><mo>&#x2A1B;</mo><mo>&#x2A1B;</mo><mo>&#x2A1B;</mo><mprescripts/><mo>&#x2A1B;</mo><mo>&#x2A1B;</mo></mmultiscripts></math>
<math displaystyle="true"><munder><mo>&#x2A1B;</mo><mo>&#x2A1B;</mo></munder></math>
<math displaystyle="true"><mover><mo>&#x2A1B;</mo><mo>&#x2A1B;</mo></mover></math>
<math displaystyle="true"><munderover><mo>&#x2A1B;</mo><mo>&#x2A1B;</mo><mo>&#x2A1B;</mo></munderover></math>
</div>
</body>
</html>