haikuwebkit/LayoutTests/svg/text/text-vkern-on-horizontal-te...

16 lines
870 B
XML
Raw Permalink Normal View History

2010-05-11 Nikolas Zimmermann <nzimmermann@rim.com> Reviewed by Dirk Schulze. Move buildLayoutInformationForTextBox() from SVGRootInlineBox in SVGInlineTextBox where it belongs https://bugs.webkit.org/show_bug.cgi?id=38799 Cleanup SVGRootInlineBox/SVGInlineTextBox. Move buildLayoutInformationForTextBox to SVGInlineTextBox. Move lots of helper methods into new SVGTextLayoutUtilities class. Adapted all callsites. Fixed bug in kerning handling, hkern was applyable to vertical text as well. Covered by two new tests. Tests: svg/text/text-hkern-on-vertical-text.svg svg/text/text-vkern-on-horizontal-text.svg * Android.mk: Add SVGTextLayoutUtilities.cpp/h to build. * GNUmakefile.am: Ditto. * WebCore.gypi: Ditto. * WebCore.pro: Ditto. * WebCore.vcproj/WebCore.vcproj: Ditto. * WebCore.xcodeproj/project.pbxproj: Ditto. * rendering/SVGInlineTextBox.cpp: (WebCore::SVGInlineTextBox::calculateGlyphWidth): Use textRenderer()->characters() instead of textRenderer()->text()->characters() as shortcut. (WebCore::SVGInlineTextBox::svgCharacterHitsPosition): Fix style issue, no else if after a return branch. (WebCore::SVGInlineTextBox::paintSelection): Use !color.alpha() instead of color.alpha() == 0. (WebCore::SVGInlineTextBox::buildLayoutInformation): Moved from SVGRootInlineBox::buildLayoutInformationForTextBox. * rendering/SVGInlineTextBox.h: Fix indention. (WebCore::SVGInlineTextBox::selectionTop): Inlined. (WebCore::SVGInlineTextBox::selectionHeight): Inlined. * rendering/SVGRenderTreeAsText.cpp: Include SVGTextLayoutUtilities.h * rendering/SVGRootInlineBox.cpp: Move almost all static text layout helper functions in SVGTextLayoutUtilities (WebCore::calculateTextLengthCorrectionForTextChunk): Fixed style issue in long if conditions spanning multiple lines. (WebCore::SVGRootInlineBox::computePerCharacterLayoutInformation): Use different topLeftPositionOfCharacterRange() taking start/end iterators. (WebCore::SVGRootInlineBox::buildLayoutInformation): Use the moved SVGInlineTextBox::buildLayoutInformation() method. (WebCore::SVGRootInlineBox::buildTextChunks): Fixed small style issue, remove unneeded parenthesis. (WebCore::SVGRootInlineBox::layoutTextChunks): Fix style issue in debugging code. * rendering/SVGRootInlineBox.h: Rename 'LastGlyphInfo' to 'SVGLastGlyphInfo' and move to SVGTextLayoutUtilities. (WebCore::SVGRootInlineBox::svgTextChunks): Inlined for speed. * rendering/SVGTextLayoutUtilities.cpp: Added. (WebCore::isVerticalWritingMode): (WebCore::dominantBaselineToShift): (WebCore::alignmentBaselineToShift): (WebCore::glyphOrientationToAngle): (WebCore::glyphOrientationIsMultiplyOf180Degrees): (WebCore::applyGlyphAdvanceAndShiftRespectingOrientation): (WebCore::topLeftPositionOfCharacterRange): (WebCore::cummulatedWidthOfInlineBoxCharacterRange): (WebCore::cummulatedHeightOfInlineBoxCharacterRange): (WebCore::svgTextRunForInlineTextBox): (WebCore::calculateCSSKerning): (WebCore::applySVGKerning): * rendering/SVGTextLayoutUtilities.h: Added. (WebCore::): (WebCore::SVGTextPaintInfo::SVGTextPaintInfo): (WebCore::SVGLastGlyphInfo::SVGLastGlyphInfo): 2010-05-11 Nikolas Zimmermann <nzimmermann@rim.com> Reviewed by Dirk Schulze. Move buildLayoutInformationForTextBox() from SVGRootInlineBox in SVGInlineTextBox where it belongs https://bugs.webkit.org/show_bug.cgi?id=38799 * platform/mac/svg/text/text-hkern-on-vertical-text-expected.checksum: Added. * platform/mac/svg/text/text-hkern-on-vertical-text-expected.png: Added. * platform/mac/svg/text/text-hkern-on-vertical-text-expected.txt: Added. * platform/mac/svg/text/text-vkern-on-horizontal-text-expected.checksum: Added. * platform/mac/svg/text/text-vkern-on-horizontal-text-expected.png: Added. * platform/mac/svg/text/text-vkern-on-horizontal-text-expected.txt: Added. * svg/text/text-hkern-on-vertical-text.svg: Added. * svg/text/text-vkern-on-horizontal-text.svg: Added. Canonical link: https://commits.webkit.org/50387@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@59148 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-05-11 12:11:09 +00:00
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<font>
<font-face font-family="svgFont" units-per-em="1000"/>
<missing-glyph horiz-adv-x="800" d="M 0 0 L 750 0 L 750 1000 L 0 1000 Z"/>
<glyph unicode="1" glyph-name="gl_1" horiz-adv-x="250" d="M 0 0 L 250 0 L 250 250 L 0 250 Z"/>
<glyph unicode="2" glyph-name="gl_2" horiz-adv-x="500" d="M 0 0 L 500 0 L 500 500 L 0 500 Z"/>
<glyph unicode="3" glyph-name="gl_3" horiz-adv-x="750" d="M 0 0 L 750 0 L 750 750 L 0 750 Z"/>
<glyph unicode="4" glyph-name="gl_4" horiz-adv-x="1000" d="M 0 0 L 1000 0 L 1000 1000 L 0 1000 Z"/>
<!-- Should have no effect on horizontal text -->
<vkern g1="gl_1,gl_2,gl_3" g2="gl_2,gl_3,gl_4" k="-5000"/>
</font>
</defs>
<text font-family="svgFont" font-size="10" transform="translate(5, 45) scale(2)">1234</text>
</svg>