WebCore:
authormjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Mar 2008 10:10:08 +0000 (10:10 +0000)
committermjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Mar 2008 10:10:08 +0000 (10:10 +0000)
commit4c5f4478f46fff967bee5d3af8f6307562f434e0
tree56af3137a27ee01261516ca464754b538c84bb92
parent2d15955c3761caa29837233ee0b976d510300fbd
WebCore:

2008-03-24  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Maciej.

        - fixed "SVGTextElement.getStartPositionOfChar does not correctly account for multichar glyphs"
        http://bugs.webkit.org/show_bug.cgi?id=18046

        * platform/graphics/Font.cpp:
        (WebCore::Font::floatWidth): Allow expressing a run that has extra "context" characters beyond the end,
        and reporting of how many characters were actually consumed, to support multichar glyphs in SVG fonts.
        * platform/graphics/Font.h:
        * rendering/SVGInlineTextBox.cpp:
        (WebCore::SVGInlineTextBox::calculateGlyphWidth): Pass along extra chars in argument and chars consumed out
        argument.
        (WebCore::SVGInlineTextBox::calculateGlyphHeight): Pass along extra chars in argument.
        (WebCore::SVGInlineTextBox::calculateGlyphBoundaries): Add boilerplate; may not handle multichar glyphs
        right but I don't know what effects this would have.
        * rendering/SVGInlineTextBox.h:
        * rendering/SVGRootInlineBox.cpp:
        (WebCore::cummulatedWidthOrHeightOfTextChunk): Add boilerplate; may not handle multichar glyphs right
        but again I am not sure what effect this would have.
        (WebCore::SVGRootInlineBox::buildLayoutInformationForTextBox): Account for multichar glyphs - let glyph
        selection consider extra chars, and account for the fact that a glyph may have consumed multiple chars.
        * rendering/SVGRootInlineBox.h:
        * svg/SVGFont.cpp:
        (WebCore::SVGTextRunWalker::walk): This is the place where glyph selection happens, so this is where
        we accout for multichar glyphs (both looking at extra chars past the end of the run, and reporting how
        many chars were consumed).
        (WebCore::floatWidthOfSubStringUsingSVGFont): Pass aforementioned info through the layers.
        (WebCore::Font::floatWidthUsingSVGFont): ditto
        (WebCore::Font::drawTextUsingSVGFont): ditto
        (WebCore::Font::selectionRectForTextUsingSVGFont): ditto
        * svg/SVGTextContentElement.cpp:
        (WebCore::cummulatedCharacterRangeLength): ditto
        (WebCore::SVGInlineTextBoxQueryWalker::chunkPortionCallback): ditto

LayoutTests:

2008-03-24  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Maciej.

        - test case and new results for "SVGTextElement.getStartPositionOfChar does not correctly account for multichar glyphs"
        http://bugs.webkit.org/show_bug.cgi?id=18046

        * svg/text/multichar-glyph.svg: Added. New test case for both rendering and getStartPositionOfChar
        access of multichar glyphs.
        * platform/mac/svg/text/multichar-glyph-expected.txt: Added.

        The following test results changed, all appear to be improvements.

        * platform/mac/svg/W3C-SVG-1.1/fonts-glyph-04-t-expected.txt:
        * platform/mac/svg/W3C-SVG-1.1/text-altglyph-01-b-expected.txt:
        * platform/mac/svg/W3C-SVG-1.1/text-text-06-t-expected.txt:
        * platform/mac/svg/text/text-altglyph-01-b-expected.txt:
        * platform/mac/svg/text/text-text-06-t-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@31310 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac/svg/W3C-SVG-1.1/fonts-glyph-04-t-expected.txt
LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-altglyph-01-b-expected.txt
LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-text-06-t-expected.txt
LayoutTests/platform/mac/svg/text/multichar-glyph-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/svg/text/text-altglyph-01-b-expected.txt
LayoutTests/platform/mac/svg/text/text-text-06-t-expected.txt
LayoutTests/svg/text/multichar-glyph.svg [new file with mode: 0644]
WebCore/ChangeLog
WebCore/platform/graphics/Font.cpp
WebCore/platform/graphics/Font.h
WebCore/rendering/SVGInlineTextBox.cpp
WebCore/rendering/SVGInlineTextBox.h
WebCore/rendering/SVGRootInlineBox.cpp
WebCore/svg/SVGFont.cpp
WebCore/svg/SVGGlyphElement.h
WebCore/svg/SVGTextContentElement.cpp