haikuwebkit/LayoutTests/mathml/very-large-stretchy-operato...

24 lines
72 B
Plaintext
Raw Permalink Normal View History

[MathML] Remove RenderTree modification during layout and refactor the StretchyOp code https://bugs.webkit.org/show_bug.cgi?id=121416 Source/WebCore: Reviewed by David Hyatt. Tests: mathml/presentation/mo-minus.html mathml/presentation/mo-stacked-glyphs.html mathml/presentation/mo-stretchy-vertical-bar.html mathml/very-large-stretchy-operators.html MathML stretched operators by both modifying the width of the operator and adding children to the operator node in the render tree. Instead we make the operator width equal to the widest glyph possible that we use to represent the operator. Additionally instead of rendering stretchy glyphs via stacked operator pieces in separate render tree nodes, keep only one node for the glyph, and use a custom paint method to paint the stacked representation. With this patch, rendering seems roughly equivalent on Mac and markedly better on Linux. * css/mathml.css: Not sure what this line-height:0 was here for, but it caused bugs with the new code * mathml/MathMLTextElement.cpp: (WebCore::MathMLTextElement::attach): (WebCore): (WebCore::MathMLTextElement::childrenChanged): Need to update the anonymous render tree below <mo> elements when their children change or when the renderer is first attached. * mathml/MathMLTextElement.h: (MathMLTextElement): * rendering/mathml/RenderMathMLBlock.cpp: (WebCore::RenderMathMLBlock::RenderMathMLBlock): * rendering/mathml/RenderMathMLBlock.h: Now that the preferred width doesn't depend on the height, we don't need to override computePreferredLogicalWidths at all. * rendering/mathml/RenderMathMLFenced.cpp: (WebCore::RenderMathMLFenced::makeFences): (WebCore::RenderMathMLFenced::styleDidChange): Need to update the anonymous renderers for the anonymous RenderMathMLOperators. * rendering/mathml/RenderMathMLOperator.cpp: (WebCore::RenderMathMLOperator::expandedStretchHeight): Store the non-expanded stretch height so that we can detect when the height actually changed. (WebCore::RenderMathMLOperator::stretchToHeight): Only update the style on the anonymous render tree since this is called from RenderMathMLRow::layout (WebCore::RenderMathMLOperator::styleDidChange): (WebCore::RenderMathMLOperator::glyphBoundsForCharacter): A helper to get glyph boundaries. (WebCore::RenderMathMLOperator::glyphHeightForCharacter): Ditto for glyph width. (WebCore::RenderMathMLOperator::advanceForCharacter): The advance is different from the width, and we want the width of the operator to be the advance instead of the tight bounding width. (WebCore::RenderMathMLOperator::computePreferredLogicalWidths): Use the max of all possible glyphs we can use to render this operator. (WebCore::RenderMathMLOperator::computeLogicalHeight): Return the stretched operator height, if appropriate. (WebCore::RenderMathMLOperator::updateFromElement): We add a child for rendering the non-scaled version of the glyph. (WebCore::RenderMathMLOperator::firstCharacterForStretching): Helper to figure out what character is the character used for stretching operations. (WebCore::RenderMathMLOperator::findAcceptableStretchyCharacter): Helper to find an acceptable set of glyph pieces for stretching characters. (WebCore::RenderMathMLOperator::updateStyle): Resize the operator to the appropriate height and hide the child if we are using the stretchy style. (WebCore::RenderMathMLOperator::firstLineBoxBaseline): (WebCore::RenderMathMLOperator::paintCharacter): Helper to paint a single character component of the stretchy glyph. (WebCore::RenderMathMLOperator::fillWithExtensionGlyph): Helper to paint the extender glue between features of the stretchy glyph. (WebCore::RenderMathMLOperator::paint): Properly paint stretchy glyphs. * rendering/mathml/RenderMathMLOperator.h: Update method declarations. LayoutTests: Patch by Frédéric Wang <fred.wang@free.fr> on 2013-10-04 Reviewed by David Hyatt. Add some reftests for stretchy operators. * TestExpectations: The remaining MathML pixel tests are broken by this patch. * LayoutTests/platform/gtk/TestExpectations: * LayoutTests/platform/mac/TestExpectations: * LayoutTests/platform/win/TestExpectations: * mathml/presentation/mo-minus.html: Added. * mathml/presentation/mo-stacked-glyphs-expected.html: Added. * mathml/presentation/mo-stacked-glyphs.html: Added. * mathml/presentation/mo-stretchy-vertical-bar-expected-mismatch.html: Added. * mathml/presentation/mo-stretchy-vertical-bar.html: Added. * mathml/very-large-stretchy-operators-expected.txt: Added. * mathml/very-large-stretchy-operators.html: Added. Canonical link: https://commits.webkit.org/140541@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@157070 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-10-08 00:36:07 +00:00
This test should not timeout.
Refactor RenderMathMLOperator and RenderMathMLToken to avoid using anonymous renderers. https://bugs.webkit.org/show_bug.cgi?id=155018 Patch by Frederic Wang <fwang@igalia.com> on 2016-06-24 Reviewed by Martin Robinson. Source/WebCore: No new tests, already covered by existing tests. We use MathOperator for RenderMathMLOperator to avoid creating anonymous text nodes again and again. We reimplement implicit mathvariant="italic" on single-char mi in a way that does not rely on creating anonymous text nodes. Finally, we improve the determination/update of when mathvariant is italic to avoid breaking foreign-mi-dynamic test. The change in the render tree structure breaks mfenced accessibility support but that will be fixed in follow-up patches. The simplifications made here will also allow to simplify the accessibility code. * css/mathml.css: (mo): Deleted. This flexbox rule is no longer needed. * rendering/mathml/RenderMathMLBlock.cpp: (WebCore::RenderMathMLBlock::createAnonymousMathMLBlock): Deleted. We no longer need to create anonymous renderer with this function. * rendering/mathml/RenderMathMLBlock.h: Delete createAnonymousMathMLBlock. * rendering/mathml/RenderMathMLOperator.cpp: Implement layout functions without relying on flexbox or anonymous. (WebCore::RenderMathMLOperator::computePreferredLogicalWidths): Handle the case of !useMathOperator() for which we need to add extra operator spacing after the RenderMathMLToken layout. (WebCore::RenderMathMLOperator::layoutBlock): Ditto. (WebCore::RenderMathMLOperator::isChildAllowed): Deleted. We allow the non-anonymous text. (WebCore::RenderMathMLOperator::rebuildTokenContent): No longer destroy and rebuild anonymous wrapper. Remove updateStyle call. (WebCore::RenderMathMLOperator::updateStyle): Deleted. We no longer need anonymous style for the spacing. * rendering/mathml/RenderMathMLOperator.h: Remove updateStyle() and isChildAllowed(). Make textContent() public so that it can be accessed from the accessibility code. * rendering/mathml/RenderMathMLToken.cpp: Reimplement implicit mathvariant="italic" by painting MATHEMATICAL ITALIC characters instead of styling an anonymous wrapper. (WebCore::RenderMathMLToken::RenderMathMLToken): Init m_mathVariantGlyph and m_mathVariantGlyphDirty (WebCore::RenderMathMLToken::updateTokenContent): Set mathvariant glyph dirty when the content changes. (WebCore::transformToItalic): Helper function to map latin and greek alphabets to their MATHEMATICAL ITALIC counterpart. (WebCore::RenderMathMLToken::computePreferredLogicalWidths): Implement this function to handle the case where the mathvariant glyph is used. (WebCore::RenderMathMLToken::updateMathVariantGlyph): Helper function to update the mathvariant glyph. For now, we try and keep with the old (and limited) implementation: a mathvariant glyph may only used for single-char <mi> without mathvariant attribute attached to it. (WebCore::RenderMathMLToken::styleDidChange): Set the mathvariant glyph dirty when the style changes. (WebCore::RenderMathMLToken::updateFromElement): Remove updateStyle call and set mathvariant glyph dirty. (WebCore::RenderMathMLToken::firstLineBaseline): Implement this function to handle the case where the mathvariant glyph is used. (WebCore::RenderMathMLToken::layoutBlock): Ditto. (WebCore::RenderMathMLToken::paint): Ditto. (WebCore::RenderMathMLToken::paintChildren): Ditto. (WebCore::RenderMathMLToken::addChild): Deleted. No need to bother with anonymous renderer or style. (WebCore::RenderMathMLToken::createWrapperIfNeeded): Deleted. Ditto. (WebCore::RenderMathMLToken::updateStyle): Deleted. Ditto. * rendering/mathml/RenderMathMLToken.h: Update declarations of functions. (WebCore::RenderMathMLToken::setMathVariantGlyphDirty): Helper function to indicate that the mathvariant glyph will need to be updated. LayoutTests: We update the test expectations. Most of the adjustments are irrelevant visual modifications (small shift and size differences) or due to changes in the renderer tree structure (removal of anonymous, operator text appearing in the dumped text). We disable the accessibility for mfenced for now, but this will be enabled again and improved in follow-up accessibility patches. * platform/ios-simulator/TestExpectations: We disable two reftests that use a character from the Mathematical Alphanumeric Symbols block as a reference, since iOS does not have appropriate fonts pre-installed. * accessibility/mac/mathml-elements.html: Disable the mfenced test for now. * accessibility/mac/mathml-elements-expected.txt: Ditto. * accessibility/ios-simulator/math-expected.txt: Update the reference now that the text of the operator appears in the render tree. * accessibility/mac/math-alttext-expected.txt: Ditto. * mathml/opentype/large-operators-italic-correction-expected.txt: Ditto. * mathml/opentype/large-operators-munderover-expected.txt: Ditto. * mathml/presentation/inferred-mrow-stretchy-expected.txt: Ditto. * mathml/presentation/mfrac-nested-expected.txt: Ditto. * mathml/presentation/stretchy-depth-height-expected.txt: Ditto. * mathml/presentation/stretchy-depth-height-symmetric-expected.txt: Ditto. * mathml/presentation/sup-nested-expected.txt: Ditto. * mathml/very-large-stretchy-operators-expected.txt: Ditto. * platform/mac/accessibility/math-text-expected.txt: Ditto. * platform/gtk/accessibility/math-text-expected.txt: Ditto. * fast/css/readonly-pseudoclass-common-element-expected.txt: Ditto. * fast/css/readwrite-pseudoclass-editable-expected.txt: Ditto. * imported/w3c/web-platform-tests/html/dom/documents/dom-tree-accessors/document.getElementsByName/document.getElementsByName-namespace-expected.txt: Ditto. * imported/w3c/web-platform-tests/html/dom/documents/dom-tree-accessors/document.getElementsByName/document.getElementsByName-namespace-xhtml-expected.txt: Ditto. * mathml/presentation/attributes-background-color.html: Add some padding to workaround some small rendering failures. * mathml/presentation/attributes-background-color-expected.html: Ditto. * mathml/presentation/attributes-display.html: Ditto. * mathml/presentation/attributes-display-expected.html: Ditto. * mathml/presentation/bug97990-expected.html: Ditto. * mathml/presentation/bug97990.html: Ditto. * mathml/presentation/attributes-mathvariant-expected.html: Update the reftest to use italic characters from the Mathematical Alphanumeric Symbols. * mathml/presentation/tokenElements-mathvariant-expected.html: Ditto. * mathml/presentation/mo-whitespaces-expected.html: Adjust one edge case since we now only collapse whitespace for operators that use MathOperator. * accessibility/math-multiscript-attributes-expected.txt: Small size/coordinate adjustment. * platform/gtk/accessibility/math-multiscript-attributes-expected.txt: Dottp. * platform/gtk/mathml/presentation/roots-expected.txt: Size/coordinate adjustment, removal of anonymous renderers and use italic characters from the Mathematical Alphanumeric Symbols. * platform/gtk/mathml/presentation/roots-expected.png: Ditto. * platform/ios-simulator/mathml/presentation/roots-expected.txt: Ditto. * platform/gtk/mathml/opentype/horizontal-expected.txt: Size/coordinate adjustment and removal of anonymous renderers. * platform/gtk/mathml/opentype/horizontal-munderover-expected.txt: Ditto. * platform/gtk/mathml/opentype/large-operators-expected.txt: Ditto. * platform/gtk/mathml/opentype/opentype-stretchy-expected.txt: Ditto. * platform/gtk/mathml/opentype/opentype-stretchy-horizontal-expected.txt: Ditto. * platform/gtk/mathml/opentype/vertical-expected.txt: Ditto. * platform/gtk/mathml/presentation/mo-stretch-expected.txt: Ditto. * platform/ios-simulator/mathml/opentype/horizontal-munderover-expected.txt: Ditto. * platform/ios-simulator/mathml/opentype/opentype-stretchy-expected.txt: Ditto. * platform/mac/mathml/opentype/large-operators-expected.txt: Ditto. * platform/mac/mathml/opentype/opentype-stretchy-expected.txt: Ditto. * platform/mac/mathml/opentype/opentype-stretchy-horizontal-expected.txt: Ditto. * platform/mac/mathml/opentype/vertical-expected.txt: Ditto. Canonical link: https://commits.webkit.org/177180@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202420 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-06-24 14:39:58 +00:00
[
[
[
[
[
[
[
[
[
[
]
]
]
]
]
]
]
]
]
]
[MathML] Remove RenderTree modification during layout and refactor the StretchyOp code https://bugs.webkit.org/show_bug.cgi?id=121416 Source/WebCore: Reviewed by David Hyatt. Tests: mathml/presentation/mo-minus.html mathml/presentation/mo-stacked-glyphs.html mathml/presentation/mo-stretchy-vertical-bar.html mathml/very-large-stretchy-operators.html MathML stretched operators by both modifying the width of the operator and adding children to the operator node in the render tree. Instead we make the operator width equal to the widest glyph possible that we use to represent the operator. Additionally instead of rendering stretchy glyphs via stacked operator pieces in separate render tree nodes, keep only one node for the glyph, and use a custom paint method to paint the stacked representation. With this patch, rendering seems roughly equivalent on Mac and markedly better on Linux. * css/mathml.css: Not sure what this line-height:0 was here for, but it caused bugs with the new code * mathml/MathMLTextElement.cpp: (WebCore::MathMLTextElement::attach): (WebCore): (WebCore::MathMLTextElement::childrenChanged): Need to update the anonymous render tree below <mo> elements when their children change or when the renderer is first attached. * mathml/MathMLTextElement.h: (MathMLTextElement): * rendering/mathml/RenderMathMLBlock.cpp: (WebCore::RenderMathMLBlock::RenderMathMLBlock): * rendering/mathml/RenderMathMLBlock.h: Now that the preferred width doesn't depend on the height, we don't need to override computePreferredLogicalWidths at all. * rendering/mathml/RenderMathMLFenced.cpp: (WebCore::RenderMathMLFenced::makeFences): (WebCore::RenderMathMLFenced::styleDidChange): Need to update the anonymous renderers for the anonymous RenderMathMLOperators. * rendering/mathml/RenderMathMLOperator.cpp: (WebCore::RenderMathMLOperator::expandedStretchHeight): Store the non-expanded stretch height so that we can detect when the height actually changed. (WebCore::RenderMathMLOperator::stretchToHeight): Only update the style on the anonymous render tree since this is called from RenderMathMLRow::layout (WebCore::RenderMathMLOperator::styleDidChange): (WebCore::RenderMathMLOperator::glyphBoundsForCharacter): A helper to get glyph boundaries. (WebCore::RenderMathMLOperator::glyphHeightForCharacter): Ditto for glyph width. (WebCore::RenderMathMLOperator::advanceForCharacter): The advance is different from the width, and we want the width of the operator to be the advance instead of the tight bounding width. (WebCore::RenderMathMLOperator::computePreferredLogicalWidths): Use the max of all possible glyphs we can use to render this operator. (WebCore::RenderMathMLOperator::computeLogicalHeight): Return the stretched operator height, if appropriate. (WebCore::RenderMathMLOperator::updateFromElement): We add a child for rendering the non-scaled version of the glyph. (WebCore::RenderMathMLOperator::firstCharacterForStretching): Helper to figure out what character is the character used for stretching operations. (WebCore::RenderMathMLOperator::findAcceptableStretchyCharacter): Helper to find an acceptable set of glyph pieces for stretching characters. (WebCore::RenderMathMLOperator::updateStyle): Resize the operator to the appropriate height and hide the child if we are using the stretchy style. (WebCore::RenderMathMLOperator::firstLineBoxBaseline): (WebCore::RenderMathMLOperator::paintCharacter): Helper to paint a single character component of the stretchy glyph. (WebCore::RenderMathMLOperator::fillWithExtensionGlyph): Helper to paint the extender glue between features of the stretchy glyph. (WebCore::RenderMathMLOperator::paint): Properly paint stretchy glyphs. * rendering/mathml/RenderMathMLOperator.h: Update method declarations. LayoutTests: Patch by Frédéric Wang <fred.wang@free.fr> on 2013-10-04 Reviewed by David Hyatt. Add some reftests for stretchy operators. * TestExpectations: The remaining MathML pixel tests are broken by this patch. * LayoutTests/platform/gtk/TestExpectations: * LayoutTests/platform/mac/TestExpectations: * LayoutTests/platform/win/TestExpectations: * mathml/presentation/mo-minus.html: Added. * mathml/presentation/mo-stacked-glyphs-expected.html: Added. * mathml/presentation/mo-stacked-glyphs.html: Added. * mathml/presentation/mo-stretchy-vertical-bar-expected-mismatch.html: Added. * mathml/presentation/mo-stretchy-vertical-bar.html: Added. * mathml/very-large-stretchy-operators-expected.txt: Added. * mathml/very-large-stretchy-operators.html: Added. Canonical link: https://commits.webkit.org/140541@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@157070 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-10-08 00:36:07 +00:00