haikuwebkit/LayoutTests/svg/text/bidi-embedded-direction.svg

18 lines
777 B
XML
Raw Permalink Normal View History

2011-03-29 Nikolas Zimmermann <nzimmermann@rim.com> Reviewed by Eric Seidel. REGRESSION (r68976): Incorrect bidi rendering in SVG text https://bugs.webkit.org/show_bug.cgi?id=53980 Deconvolute SVGTextLayoutEngine code, which was confusing due to the simultaneous processing of the rendered text in visual and logical order. Added several helper methods to make the code more readable. Fix Unicode directional formatting characters support, now works as expected. Test: svg/text/bidi-embedded-direction.svg * editing/visible_units.cpp: Refactor getLeafBoxesInLogicalOrder(), move to InlineFlowBox. (WebCore::getLogicalStartBoxAndNode): Use new collectLeafBoxesInLogicalOrder() method in InlineFlowBox. (WebCore::getLogicalEndBoxAndNode): Ditto. * rendering/InlineFlowBox.cpp: Add new helper function, that returns a list of all leaf boxes in logical order. (WebCore::InlineFlowBox::collectLeafBoxesInLogicalOrder): * rendering/InlineFlowBox.h: * rendering/svg/RenderSVGText.cpp: Actually trigger reordering the x/y/dx/dy/rotate value lists, if needed. (WebCore::RenderSVGText::RenderSVGText): (WebCore::RenderSVGText::layout): * rendering/svg/RenderSVGText.h: Ditto. (WebCore::RenderSVGText::layoutAttributes): (WebCore::RenderSVGText::needsReordering): * rendering/svg/SVGRootInlineBox.cpp: Use new InlineFlowBox::collectLeafBoxesINLogicalOrder(), with a custom "inline box reverse" implementation, which not only reverses the order of InlineBoxes, but also the order of the x/y/dx/dy/rotate value lists, if needed. (WebCore::SVGRootInlineBox::computePerCharacterLayoutInformation): (WebCore::SVGRootInlineBox::layoutCharactersInTextBoxes): (WebCore::swapItems): (WebCore::reverseInlineBoxRangeAndValueListsIfNeeded): (WebCore::SVGRootInlineBox::reorderValueLists): * rendering/svg/SVGRootInlineBox.h: * rendering/svg/SVGTextLayoutAttributes.cpp: Store RenderSVGInlineText* pointer, where we belong to. (WebCore::SVGTextLayoutAttributes::SVGTextLayoutAttributes): (WebCore::SVGTextLayoutAttributes::dump): * rendering/svg/SVGTextLayoutAttributes.h: (WebCore::SVGTextLayoutAttributes::context): * rendering/svg/SVGTextLayoutAttributesBuilder.cpp: Pass RenderSVGInlineText* object when creating SVGTextLayoutAttributes. (WebCore::SVGTextLayoutAttributesBuilder::buildLayoutAttributesForTextSubtree): (WebCore::SVGTextLayoutAttributesBuilder::propagateLayoutAttributes): * rendering/svg/SVGTextLayoutAttributesBuilder.h: * rendering/svg/SVGTextLayoutEngine.cpp: Rewrite & cleanup the main layout algorithm, to be less confusing. (WebCore::SVGTextLayoutEngine::SVGTextLayoutEngine): (WebCore::SVGTextLayoutEngine::updateRelativePositionAdjustmentsIfNeeded): (WebCore::SVGTextLayoutEngine::recordTextFragment): (WebCore::SVGTextLayoutEngine::currentLogicalCharacterAttributes): (WebCore::SVGTextLayoutEngine::currentLogicalCharacterMetrics): (WebCore::SVGTextLayoutEngine::currentVisualCharacterMetrics): (WebCore::SVGTextLayoutEngine::advanceToNextLogicalCharacter): (WebCore::SVGTextLayoutEngine::advanceToNextVisualCharacter): (WebCore::SVGTextLayoutEngine::layoutTextOnLineOrPath): * rendering/svg/SVGTextLayoutEngine.h: 2011-03-29 Nikolas Zimmermann <nzimmermann@rim.com> Reviewed by Eric Seidel. REGRESSION (r68976): Incorrect bidi rendering in SVG text https://bugs.webkit.org/show_bug.cgi?id=53980 Add testcase from bug 53980, assuring that BiDi works as well, when using the Unicode directional formatting characters. * platform/mac/svg/text/bidi-embedded-direction-expected.checksum: Added. * platform/mac/svg/text/bidi-embedded-direction-expected.png: Added. * platform/mac/svg/text/bidi-embedded-direction-expected.txt: Added. * platform/mac/svg/text/bidi-reorder-value-lists-expected.checksum: * platform/mac/svg/text/bidi-reorder-value-lists-expected.png: * platform/mac/svg/text/bidi-reorder-value-lists-expected.txt: * platform/mac/svg/text/font-size-below-point-five-expected.txt: Update result, as text runs aren't created anymore for empty text. * svg/text/bidi-embedded-direction.svg: Added. * svg/text/bidi-reorder-value-lists.svg: Extend testcase, to cover more reordering cases. Canonical link: https://commits.webkit.org/72209@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@82411 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2011-03-30 08:36:42 +00:00
<svg xmlns="http://www.w3.org/2000/svg"
width="150px" height="275px" viewBox="0 -25 150 275">
<line x1="10" y1="25" x2="10" y2="225" stroke="black" stroke-width="1"/>
<text x="10" y="50" font-size="24" font-family="Arial" direction="rtl" unicode-bidi="embed">
שלום <tspan direction="ltr" unicode-bidi="embed">world</tspan>
</text>
<text x="10" y="100" font-size="24" font-family="Arial">
&#x202B;שלום &#x202A;world&#x202C;&#x202C;
</text>
<text x="10" y="150" font-size="24" font-family="Arial" direction="rtl" unicode-bidi="bidi-override">
hello <tspan direction="ltr" unicode-bidi="embed">world</tspan>
</text>
<text x="10" y="200" font-size="24" font-family="Arial">
&#x202E;hello &#x202A;world&#x202C;&#x202C;
</text>
</svg>