Changeset 31342 in webkit
- Timestamp:
- Mar 26, 2008, 7:34:14 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r31331 r31342 1 2008-03-26 Maciej Stachowiak <mjs@apple.com> 2 3 Reviewed by Hyatt and Adam. 4 5 - new test case and test fixes for SVG text kerning 6 7 * svg/text/kerning.svg: Added. 8 * platform/mac/svg/text/kerning-expected.txt: Added. 9 10 * platform/mac/svg/W3C-SVG-1.1/fonts-kern-01-t-expected.txt: 11 * platform/mac/svg/W3C-SVG-1.1/masking-mask-01-b-expected.txt: 12 * platform/mac/svg/W3C-SVG-1.1/render-groups-01-b-expected.txt: 13 * platform/mac/svg/W3C-SVG-1.1/render-groups-03-t-expected.txt: 14 * platform/mac/svg/custom/scrolling-embedded-svg-file-image-repaint-problem-expected.txt: 15 1 16 2008-03-26 Stephanie Lewis <slewis@apple.com> 2 17 -
trunk/LayoutTests/platform/mac/svg/W3C-SVG-1.1/fonts-kern-01-t-expected.txt
r30635 r31342 2 2 RenderView at (0,0) size 480x360 3 3 layer at (0,0) size 480x360 4 RenderSVGRoot {svg} at (0.50,0.50) size 482.50x3595 RenderSVGContainer {g} at (9.50,12) size 473.50x263.504 RenderSVGRoot {svg} at (0.50,0.50) size 9344.50x359 5 RenderSVGContainer {g} at (9.50,12) size 9335.50x263.50 6 6 RenderSVGHiddenContainer {defs} at (0,0) size 0x0 7 7 RenderSVGContainer {g} at (-2,-12) size 14x14 … … 16 16 RenderSVGInlineText {#text} at (0,-18) size 68x23 17 17 chunk 1 (middle anchor) text run 1 at (206.00,30.00) startOffset 0 endOffset 7 width 68.00: "<hkern>" 18 RenderSVGContainer {g} at (9.50,59.50) size 473.50x216 [transform={m=((1.00,0.00)(0.00,1.00)) t=(30.00,60.00)}]19 RenderSVGContainer {g} at (9.50,59.50) size 2 21x5118 RenderSVGContainer {g} at (9.50,59.50) size 9335.50x216 [transform={m=((1.00,0.00)(0.00,1.00)) t=(30.00,60.00)}] 19 RenderSVGContainer {g} at (9.50,59.50) size 2041.50x51 20 20 RenderSVGContainer {g} at (9.50,59.50) size 21x51 21 21 RenderPath {rect} at (9.50,59.50) size 21x51 [stroke={[type=SOLID] [color=#000000]}] [data="M-20.00,0.00L0.00,0.00L0.00,50.00L-20.00,50.00"] … … 32 32 RenderSVGInlineText {#text} at (0,-11) size 73x14 33 33 chunk 1 text run 1 at (5.00,15.00) startOffset 0 endOffset 13 width 73.00: "u1=\"1\" u2=\"2\"" 34 RenderSVGContainer {g} at (31,81) size 53x28 [transform={m=((2.00,0.00)(0.00,2.00)) t=(5.00,45.00)}]34 RenderSVGContainer {g} at (31,81) size 2020x28 [transform={m=((2.00,0.00)(0.00,2.00)) t=(5.00,45.00)}] 35 35 RenderSVGContainer {use} at (31,81) size 28x28 36 36 RenderSVGContainer {g} at (31,81) size 28x28 … … 45 45 RenderPath {line} at (60,104) size 24x2 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#8888FF]}] [data="M0.00,0.00L12.00,0.00"] 46 46 RenderPath {rect} at (56,101) size 8x8 [fill={[type=SOLID] [color=#FF0000]}] [data="M-2.00,-2.00L2.00,-2.00L2.00,2.00L-2.00,2.00"] 47 RenderSVGText {text} at (0,0) size 8x10 contains 1 chunk(s)48 RenderSVGInlineText {#text} at (0,-8) size 8x1047 RenderSVGText {text} at (0,0) size 1008x10 contains 1 chunk(s) 48 RenderSVGInlineText {#text} at (0,-8) size 1008x10 49 49 chunk 1 text run 1 at (0.00,0.00) startOffset 0 endOffset 2 width 7.50: "12" 50 RenderSVGContainer {g} at (9.50,114.50) size 221x51 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,55.00)}]50 RenderSVGContainer {g} at (9.50,114.50) size 4041.50x51 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,55.00)}] 51 51 RenderSVGContainer {g} at (9.50,114.50) size 21x51 52 52 RenderPath {rect} at (9.50,114.50) size 21x51 [stroke={[type=SOLID] [color=#000000]}] [data="M-20.00,0.00L0.00,0.00L0.00,50.00L-20.00,50.00"] … … 63 63 RenderSVGInlineText {#text} at (0,-14) size 138x18 64 64 chunk 1 text run 1 at (5.00,15.00) startOffset 0 endOffset 19 width 138.00: "g1=\"gl_1\" g2=\"gl_2\"" 65 RenderSVGContainer {g} at (31,136) size 73x28 [transform={m=((2.00,0.00)(0.00,2.00)) t=(5.00,45.00)}]65 RenderSVGContainer {g} at (31,136) size 4020x28 [transform={m=((2.00,0.00)(0.00,2.00)) t=(5.00,45.00)}] 66 66 RenderSVGContainer {use} at (31,136) size 28x28 67 67 RenderSVGContainer {g} at (31,136) size 28x28 … … 76 76 RenderPath {line} at (80,159) size 24x2 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#8888FF]}] [data="M0.00,0.00L12.00,0.00"] 77 77 RenderPath {rect} at (76,156) size 8x8 [fill={[type=SOLID] [color=#FF0000]}] [data="M-2.00,-2.00L2.00,-2.00L2.00,2.00L-2.00,2.00"] 78 RenderSVGText {text} at (0,0) size 8x10 contains 1 chunk(s)79 RenderSVGInlineText {#text} at (0,-8) size 8x1078 RenderSVGText {text} at (0,0) size 2008x10 contains 1 chunk(s) 79 RenderSVGInlineText {#text} at (0,-8) size 2008x10 80 80 chunk 1 text run 1 at (0.00,0.00) startOffset 0 endOffset 2 width 7.50: "12" 81 81 RenderSVGContainer {g} at (9.50,169.50) size 265.50x51 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,110.00)}] … … 208 208 RenderSVGInlineText {#text} at (0,-8) size 35x10 209 209 chunk 1 text run 1 at (0.00,0.00) startOffset 0 endOffset 4 width 35.00: "1234" 210 RenderSVGContainer {g} at (249.50,114.50) size 233.50x51 [transform={m=((1.00,0.00)(0.00,1.00)) t=(240.00,55.00)}]210 RenderSVGContainer {g} at (249.50,114.50) size 9095.50x51 [transform={m=((1.00,0.00)(0.00,1.00)) t=(240.00,55.00)}] 211 211 RenderSVGContainer {g} at (249.50,114.50) size 21x51 212 212 RenderPath {rect} at (249.50,114.50) size 21x51 [stroke={[type=SOLID] [color=#000000]}] [data="M-20.00,0.00L0.00,0.00L0.00,50.00L-20.00,50.00"] … … 223 223 RenderSVGInlineText {#text} at (0,-14) size 208x18 224 224 chunk 1 text run 1 at (5.00,15.00) startOffset 0 endOffset 26 width 208.00: "u1=\"U+003?\" u2=\"U+0031-34\"" 225 RenderSVGContainer {g} at (271,136) size 168x28 [transform={m=((2.00,0.00)(0.00,2.00)) t=(5.00,45.00)}]225 RenderSVGContainer {g} at (271,136) size 9074x28 [transform={m=((2.00,0.00)(0.00,2.00)) t=(5.00,45.00)}] 226 226 RenderSVGContainer {use} at (271,136) size 28x28 227 227 RenderSVGContainer {g} at (271,136) size 28x28 … … 248 248 RenderPath {line} at (415,159) size 24x2 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#8888FF]}] [data="M0.00,0.00L12.00,0.00"] 249 249 RenderPath {rect} at (411,156) size 8x8 [fill={[type=SOLID] [color=#FF0000]}] [data="M-2.00,-2.00L2.00,-2.00L2.00,2.00L-2.00,2.00"] 250 RenderSVGText {text} at (0,0) size 35x10 contains 1 chunk(s)251 RenderSVGInlineText {#text} at (0,-8) size 35x10252 chunk 1 text run 1 at (0.00,0.00) startOffset 0 endOffset 4 width 35.00: "1234" 253 RenderSVGContainer {g} at (249.50,169.50) size 2 21x51 [transform={m=((1.00,0.00)(0.00,1.00)) t=(240.00,110.00)}]250 RenderSVGText {text} at (0,0) size 4535x10 contains 1 chunk(s) 251 RenderSVGInlineText {#text} at (0,-8) size 4535x10 252 chunk 1 text run 1 at (0.00,0.00) startOffset 0 endOffset 4 width 35.00: "1234" 253 RenderSVGContainer {g} at (249.50,169.50) size 2061.50x51 [transform={m=((1.00,0.00)(0.00,1.00)) t=(240.00,110.00)}] 254 254 RenderSVGContainer {g} at (249.50,169.50) size 21x51 255 255 RenderPath {rect} at (249.50,169.50) size 21x51 [stroke={[type=SOLID] [color=#000000]}] [data="M-20.00,0.00L0.00,0.00L0.00,50.00L-20.00,50.00"] … … 266 266 RenderSVGInlineText {#text} at (0,-14) size 118x18 267 267 chunk 1 text run 1 at (5.00,15.00) startOffset 0 endOffset 16 width 118.00: "u1=\"1\" g2=\"gl_2\"" 268 RenderSVGContainer {g} at (271,191) size 53x28 [transform={m=((2.00,0.00)(0.00,2.00)) t=(5.00,45.00)}]268 RenderSVGContainer {g} at (271,191) size 2040x28 [transform={m=((2.00,0.00)(0.00,2.00)) t=(5.00,45.00)}] 269 269 RenderSVGContainer {use} at (271,191) size 28x28 270 270 RenderSVGContainer {g} at (271,191) size 28x28 … … 279 279 RenderPath {line} at (300,214) size 24x2 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#8888FF]}] [data="M0.00,0.00L12.00,0.00"] 280 280 RenderPath {rect} at (296,211) size 8x8 [fill={[type=SOLID] [color=#FF0000]}] [data="M-2.00,-2.00L2.00,-2.00L2.00,2.00L-2.00,2.00"] 281 RenderSVGText {text} at (0,0) size 1 8x10 contains 1 chunk(s)282 RenderSVGInlineText {#text} at (0,-8) size 1 8x10281 RenderSVGText {text} at (0,0) size 1018x10 contains 1 chunk(s) 282 RenderSVGInlineText {#text} at (0,-8) size 1018x10 283 283 chunk 1 text run 1 at (0.00,0.00) startOffset 0 endOffset 2 width 17.50: "12" 284 284 RenderSVGContainer {g} at (320,100) size 0x0 [transform={m=((1.00,0.00)(0.00,1.00)) t=(320.00,100.00)}] -
trunk/LayoutTests/platform/mac/svg/W3C-SVG-1.1/masking-mask-01-b-expected.txt
r30635 r31342 41 41 RenderPath {rect} at (60,250) size 200x25 [fill={[type=SOLID] [color=#FFFFFF]}] [data="M60.00,250.00L260.00,250.00L260.00,275.00L60.00,275.00"] 42 42 RenderPath {rect} at (60,275) size 200x25 [fill={[type=SOLID] [color=#FFFFFF] [opacity=0.70]}] [data="M60.00,275.00L260.00,275.00L260.00,300.00L60.00,300.00"] 43 RenderSVGText {text} at (60,280) size 1 21x110 contains 1 chunk(s)44 RenderSVGInlineText {#text} at (0,-88) size 1 21x11043 RenderSVGText {text} at (60,280) size 161x110 contains 1 chunk(s) 44 RenderSVGInlineText {#text} at (0,-88) size 161x110 45 45 chunk 1 text run 1 at (60.00,280.00) startOffset 0 endOffset 3 width 121.33: "SVG" 46 46 RenderSVGText {text} at (200,225) size 200x14 contains 1 chunk(s) -
trunk/LayoutTests/platform/mac/svg/W3C-SVG-1.1/render-groups-01-b-expected.txt
r30635 r31342 17 17 RenderPath {rect} at (35.10,17.10) size 415.80x280.80 [stroke={[type=SOLID] [color=#000000]}] [data="M20.00,10.00L250.00,10.00L250.00,165.00L20.00,165.00"] 18 18 RenderSVGContainer {g} at (54,-10.80) size 381.60x289.80 [opacity=0.50] 19 RenderSVGText {text} at (30,90) size 1 32x120 contains 1 chunk(s)20 RenderSVGInlineText {#text} at (0,-96) size 1 32x12019 RenderSVGText {text} at (30,90) size 172x120 contains 1 chunk(s) 20 RenderSVGInlineText {#text} at (0,-96) size 172x120 21 21 chunk 1 text run 1 at (30.00,90.00) startOffset 0 endOffset 3 width 132.36: "SVG" 22 22 RenderPath {rect} at (126,99) size 234x126 [fill={[type=SOLID] [color=#820032]}] [data="M70.00,55.00L200.00,55.00L200.00,125.00L70.00,125.00"] -
trunk/LayoutTests/platform/mac/svg/W3C-SVG-1.1/render-groups-03-t-expected.txt
r30635 r31342 16 16 RenderPath {line} at (436.50,18) size 27x297 [stroke={[type=SOLID] [color=#FFFFFF] [stroke width=15.00]}] [fill={[type=SOLID] [color=#000000]}] [data="M250.00,10.00L250.00,175.00"] 17 17 RenderPath {rect} at (35.10,17.10) size 415.80x280.80 [stroke={[type=SOLID] [color=#000000]}] [data="M20.00,10.00L250.00,10.00L250.00,165.00L20.00,165.00"] 18 RenderSVGText {text} at (30,90) size 1 32x120 contains 1 chunk(s)19 RenderSVGInlineText {#text} at (0,-96) size 1 32x12018 RenderSVGText {text} at (30,90) size 172x120 contains 1 chunk(s) 19 RenderSVGInlineText {#text} at (0,-96) size 172x120 20 20 chunk 1 text run 1 at (30.00,90.00) startOffset 0 endOffset 3 width 132.36: "SVG" 21 21 RenderPath {rect} at (126,99) size 234x126 [fill={[type=SOLID] [color=#820032]}] [data="M70.00,55.00L200.00,55.00L200.00,125.00L70.00,125.00"] -
trunk/LayoutTests/platform/mac/svg/custom/scrolling-embedded-svg-file-image-repaint-problem-expected.txt
r30635 r31342 74 74 RenderPath {rect} at (35.10,17.10) size 415.80x280.80 [stroke={[type=SOLID] [color=#000000]}] [data="M20.00,10.00L250.00,10.00L250.00,165.00L20.00,165.00"] 75 75 RenderSVGContainer {g} at (54,-10.80) size 381.60x289.80 [opacity=0.50] 76 RenderSVGText {text} at (30,90) size 1 32x120 contains 1 chunk(s)77 RenderSVGInlineText {#text} at (0,-96) size 1 32x12076 RenderSVGText {text} at (30,90) size 172x120 contains 1 chunk(s) 77 RenderSVGInlineText {#text} at (0,-96) size 172x120 78 78 chunk 1 text run 1 at (30.00,90.00) startOffset 0 endOffset 3 width 132.36: "SVG" 79 79 RenderPath {rect} at (126,99) size 234x126 [fill={[type=SOLID] [color=#820032]}] [data="M70.00,55.00L200.00,55.00L200.00,125.00L70.00,125.00"] -
trunk/WebCore/ChangeLog
r31341 r31342 1 2008-03-26 Maciej Stachowiak <mjs@apple.com> 2 3 Reviewed by Hyatt and Adam. 4 5 Coded by me and Darin. 6 7 - SVG kerning support (horizontal kerning only for now since we don't do vertical text layout right yet) 8 9 Acid3 100/100 10 11 * DerivedSources.make: 12 * WebCore.vcproj/WebCore.vcproj: 13 * WebCore.xcodeproj/project.pbxproj: 14 * platform/graphics/Font.cpp: 15 (WebCore::Font::floatWidth): 16 (WebCore::Font::isSVGFont): 17 * platform/graphics/Font.h: 18 * rendering/SVGInlineTextBox.cpp: 19 (WebCore::SVGInlineTextBox::calculateGlyphWidth): 20 (WebCore::SVGInlineTextBox::calculateGlyphBoundaries): 21 * rendering/SVGInlineTextBox.h: 22 * rendering/SVGRootInlineBox.cpp: 23 (WebCore::cummulatedWidthOrHeightOfTextChunk): 24 (WebCore::SVGRootInlineBox::buildLayoutInformation): 25 (WebCore::SVGRootInlineBox::buildLayoutInformationForTextBox): 26 * rendering/SVGRootInlineBox.h: 27 (WebCore::LastGlyphInfo::LastGlyphInfo): 28 * svg/SVGFont.cpp: 29 (WebCore::SVGTextRunWalker::walk): 30 (WebCore::Font::svgFont): 31 (WebCore::floatWidthOfSubStringUsingSVGFont): 32 (WebCore::Font::floatWidthUsingSVGFont): 33 (WebCore::Font::drawTextUsingSVGFont): 34 (WebCore::Font::selectionRectForTextUsingSVGFont): 35 * svg/SVGFontElement.cpp: 36 (WebCore::SVGFontElement::invalidateGlyphCache): 37 (WebCore::SVGFontElement::ensureGlyphCache): 38 (WebCore::parseUnicodeRange): 39 (WebCore::parseUnicodeRangeList): 40 (WebCore::stringMatchesUnicodeRange): 41 (WebCore::matches): 42 (WebCore::SVGFontElement::getHorizontalKerningPairForStringsAndGlyphs): 43 * svg/SVGFontElement.h: 44 * svg/SVGGlyphElement.cpp: 45 (WebCore::SVGGlyphElement::insertedIntoDocument): 46 (WebCore::SVGGlyphElement::removedFromDocument): 47 * svg/SVGHKernElement.cpp: Added. 48 (WebCore::SVGHKernElement::SVGHKernElement): 49 (WebCore::SVGHKernElement::~SVGHKernElement): 50 (WebCore::SVGHKernElement::insertedIntoDocument): 51 (WebCore::SVGHKernElement::removedFromDocument): 52 (WebCore::SVGHKernElement::buildHorizontalKerningPair): 53 * svg/SVGHKernElement.h: Added. 54 (WebCore::SVGHorizontalKerningPair::SVGHorizontalKerningPair): 55 (WebCore::SVGHKernElement::rendererIsNeeded): 56 * svg/SVGHKernElement.idl: Added. 57 * svg/SVGTextContentElement.cpp: 58 (WebCore::cummulatedCharacterRangeLength): 59 (WebCore::SVGInlineTextBoxQueryWalker::chunkPortionCallback): 60 * svg/svgtags.in: 61 1 62 2008-03-26 Sam Weinig <sam@webkit.org> 2 63 -
trunk/WebCore/DerivedSources.make
r31341 r31342 251 251 SVGGlyphElement \ 252 252 SVGGradientElement \ 253 SVGHKernElement \ 253 254 SVGImageElement \ 254 255 SVGLangSpace \ -
trunk/WebCore/WebCore.vcproj/WebCore.vcproj
r31341 r31342 11823 11823 </File> 11824 11824 <File 11825 RelativePath="..\svg\SVGHKernElement.cpp" 11826 > 11827 </File> 11828 <File 11829 RelativePath="..\svg\SVGHKernElement.h" 11830 > 11831 </File> 11832 <File 11825 11833 RelativePath="..\svg\SVGAngle.cpp" 11826 11834 > -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r31341 r31342 521 521 650F53DC09D15DDA00C9B0C8 /* CSSGrammar.h in Headers */ = {isa = PBXBuildFile; fileRef = 650F53DB09D15DDA00C9B0C8 /* CSSGrammar.h */; }; 522 522 650F53DD09D15DDF00C9B0C8 /* CSSGrammar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6565814409D13043000E61D7 /* CSSGrammar.cpp */; }; 523 650FBF2A0D9AF047008FC292 /* SVGHKernElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 650FBF270D9AF046008FC292 /* SVGHKernElement.cpp */; }; 524 650FBF2B0D9AF047008FC292 /* SVGHKernElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 650FBF280D9AF047008FC292 /* SVGHKernElement.h */; }; 525 650FBF2C0D9AF047008FC292 /* SVGHKernElement.idl in Resources */ = {isa = PBXBuildFile; fileRef = 650FBF290D9AF047008FC292 /* SVGHKernElement.idl */; }; 523 526 6515EC910D9723FF0063D49A /* JSSVGAltGlyphElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6515EC8F0D9723FF0063D49A /* JSSVGAltGlyphElement.cpp */; }; 524 527 6515EC920D9723FF0063D49A /* JSSVGAltGlyphElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6515EC900D9723FF0063D49A /* JSSVGAltGlyphElement.h */; }; … … 4901 4904 5DCF836C0D59159800953BC6 /* PluginInfoStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginInfoStore.h; sourceTree = "<group>"; }; 4902 4905 650F53DB09D15DDA00C9B0C8 /* CSSGrammar.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSGrammar.h; sourceTree = "<group>"; }; 4906 650FBF270D9AF046008FC292 /* SVGHKernElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGHKernElement.cpp; sourceTree = "<group>"; }; 4907 650FBF280D9AF047008FC292 /* SVGHKernElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGHKernElement.h; sourceTree = "<group>"; }; 4908 650FBF290D9AF047008FC292 /* SVGHKernElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SVGHKernElement.idl; sourceTree = "<group>"; }; 4903 4909 6515EC8F0D9723FF0063D49A /* JSSVGAltGlyphElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSVGAltGlyphElement.cpp; sourceTree = "<group>"; }; 4904 4910 6515EC900D9723FF0063D49A /* JSSVGAltGlyphElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSVGAltGlyphElement.h; sourceTree = "<group>"; }; … … 11020 11026 B22277FF0D00BF1F0071B782 /* SVGAnimateTransformElement.h */, 11021 11027 B22278000D00BF1F0071B782 /* SVGAnimateTransformElement.idl */, 11028 650FBF270D9AF046008FC292 /* SVGHKernElement.cpp */, 11029 650FBF280D9AF047008FC292 /* SVGHKernElement.h */, 11030 650FBF290D9AF047008FC292 /* SVGHKernElement.idl */, 11022 11031 B22278010D00BF1F0071B782 /* SVGAnimationElement.cpp */, 11023 11032 B22278020D00BF1F0071B782 /* SVGAnimationElement.h */, … … 14665 14674 BCE1C43C0D9830D3003B02F2 /* JSLocation.h in Headers */, 14666 14675 E415F1840D9A1A830033CE97 /* ElementTimeControl.h in Headers */, 14676 650FBF2B0D9AF047008FC292 /* SVGHKernElement.h in Headers */, 14667 14677 ); 14668 14678 runOnlyForDeploymentPostprocessing = 0; … … 14781 14791 BCA83E370D7CDC4E003421A8 /* Clipboard.idl in Resources */, 14782 14792 65653F2F0D9727D200CA9723 /* SVGAltGlyphElement.idl in Resources */, 14793 650FBF2C0D9AF047008FC292 /* SVGHKernElement.idl in Resources */, 14783 14794 BCE1C4230D9829F2003B02F2 /* Location.idl in Resources */, 14784 14795 ); … … 16312 16323 65653F2D0D9727D200CA9723 /* SVGAltGlyphElement.cpp in Sources */, 16313 16324 65AA6BB00D974A00000541AE /* DOMSVGAltGlyphElement.mm in Sources */, 16325 650FBF2A0D9AF047008FC292 /* SVGHKernElement.cpp in Sources */, 16314 16326 BCE1C41C0D982981003B02F2 /* Location.cpp in Sources */, 16315 16327 BCE1C43B0D9830D3003B02F2 /* JSLocation.cpp in Sources */, -
trunk/WebCore/platform/graphics/Font.cpp
r31310 r31342 709 709 } 710 710 711 float Font::floatWidth(const TextRun& run, int extraCharsAvailable, int& charsConsumed ) const711 float Font::floatWidth(const TextRun& run, int extraCharsAvailable, int& charsConsumed, String& glyphName) const 712 712 { 713 713 #if ENABLE(SVG_FONTS) 714 714 if (primaryFont()->isSVGFont()) 715 return floatWidthUsingSVGFont(run, extraCharsAvailable, charsConsumed );715 return floatWidthUsingSVGFont(run, extraCharsAvailable, charsConsumed, glyphName); 716 716 #endif 717 717 718 718 charsConsumed = run.length(); 719 glyphName = ""; 719 720 if (canUseGlyphCache(run)) 720 721 return floatWidthForSimpleText(run, 0); … … 815 816 } 816 817 818 #if ENABLE(SVG_FONTS) 819 bool Font::isSVGFont() const 820 { 821 return primaryFont()->isSVGFont(); 822 } 823 #endif 824 817 825 FontSelector* Font::fontSelector() const 818 826 { -
trunk/WebCore/platform/graphics/Font.h
r31310 r31342 49 49 class RenderObject; 50 50 class SimpleFontData; 51 class SVGFontElement; 51 52 class SVGPaintServer; 52 53 … … 171 172 int width(const TextRun&) const; 172 173 float floatWidth(const TextRun&) const; 173 float floatWidth(const TextRun& run, int extraCharsAvailable, int& charsConsumed ) const;174 float floatWidth(const TextRun& run, int extraCharsAvailable, int& charsConsumed, String& glyphName) const; 174 175 175 176 int offsetForPosition(const TextRun&, int position, bool includePartialGlyphs) const; … … 236 237 void drawTextUsingSVGFont(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const; 237 238 float floatWidthUsingSVGFont(const TextRun&) const; 238 float floatWidthUsingSVGFont(const TextRun&, int extraCharsAvailable, int& charsConsumed ) const;239 float floatWidthUsingSVGFont(const TextRun&, int extraCharsAvailable, int& charsConsumed, String& glyphName) const; 239 240 FloatRect selectionRectForTextUsingSVGFont(const TextRun&, const IntPoint&, int h, int from, int to) const; 240 241 int offsetForPositionForTextUsingSVGFont(const TextRun&, int position, bool includePartialGlyphs) const; … … 270 271 static bool treatAsSpace(UChar c) { return c == ' ' || c == '\t' || c == '\n' || c == 0x00A0; } 271 272 static bool treatAsZeroWidthSpace(UChar c) { return c < 0x20 || (c >= 0x7F && c < 0xA0) || c == 0x200e || c == 0x200f || c >= 0x202a && c <= 0x202e; } 273 274 #if ENABLE(SVG_FONTS) 275 bool isSVGFont() const; 276 SVGFontElement* svgFont() const; 277 #endif 278 272 279 private: 273 280 FontDescription m_fontDescription; -
trunk/WebCore/rendering/SVGInlineTextBox.cpp
r31310 r31342 75 75 } 76 76 77 float SVGInlineTextBox::calculateGlyphWidth(RenderStyle* style, int offset, int extraCharsAvailable, int& charsConsumed ) const77 float SVGInlineTextBox::calculateGlyphWidth(RenderStyle* style, int offset, int extraCharsAvailable, int& charsConsumed, String& glyphName) const 78 78 { 79 79 ASSERT(style); 80 return style->font().floatWidth(svgTextRunForInlineTextBox(textObject()->text()->characters() + offset, 1, style, this, 0), extraCharsAvailable, charsConsumed );80 return style->font().floatWidth(svgTextRunForInlineTextBox(textObject()->text()->characters() + offset, 1, style, this, 0), extraCharsAvailable, charsConsumed, glyphName); 81 81 } 82 82 … … 99 99 // FIXME: account for multi-character glyphs 100 100 int charsConsumed; 101 String glyphName; 101 102 if (!m_reversed) 102 glyphWidth = calculateGlyphWidth(style, offset, 0, charsConsumed );103 glyphWidth = calculateGlyphWidth(style, offset, 0, charsConsumed, glyphName); 103 104 else 104 glyphWidth = calculateGlyphWidth(style, start() + end() - offset, 0, charsConsumed );105 glyphWidth = calculateGlyphWidth(style, start() + end() - offset, 0, charsConsumed, glyphName); 105 106 106 107 float x1 = svgChar.x; -
trunk/WebCore/rendering/SVGInlineTextBox.h
r31310 r31342 59 59 60 60 // Helper functions shared with SVGRootInlineBox 61 float calculateGlyphWidth(RenderStyle* style, int offset, int extraCharsAvailable, int& charsConsumed ) const;61 float calculateGlyphWidth(RenderStyle* style, int offset, int extraCharsAvailable, int& charsConsumed, String& glyphName) const; 62 62 float calculateGlyphHeight(RenderStyle*, int offset, int extraCharsAvailable) const; 63 63 -
trunk/WebCore/rendering/SVGRootInlineBox.cpp
r31310 r31342 34 34 #include "SVGInlineFlowBox.h" 35 35 #include "SVGInlineTextBox.h" 36 #include "SVGFontElement.h" 36 37 #include "SVGPaintServer.h" 37 38 #include "SVGRenderStyleDefs.h" … … 713 714 // FIXME: does this need to change to handle multichar glyphs? 714 715 int charsConsumed = 1; 716 String glyphName; 715 717 if (calcWidthOnly) { 716 float lastGlyphWidth = box->calculateGlyphWidth(style, offset, 0, charsConsumed );718 float lastGlyphWidth = box->calculateGlyphWidth(style, offset, 0, charsConsumed, glyphName); 717 719 length += currentCharacter.x - lastCharacter.x - lastGlyphWidth; 718 720 } else { … … 905 907 } 906 908 909 LastGlyphInfo lastGlyph; 910 907 911 for (InlineBox* curr = start->firstChild(); curr; curr = curr->nextOnLine()) { 908 912 if (curr->object()->isText()) 909 buildLayoutInformationForTextBox(info, static_cast<InlineTextBox*>(curr) );913 buildLayoutInformationForTextBox(info, static_cast<InlineTextBox*>(curr), lastGlyph); 910 914 else { 911 915 ASSERT(curr->isInlineFlowBox()); … … 1097 1101 } 1098 1102 1099 void SVGRootInlineBox::buildLayoutInformationForTextBox(SVGCharacterLayoutInfo& info, InlineTextBox* textBox )1103 void SVGRootInlineBox::buildLayoutInformationForTextBox(SVGCharacterLayoutInfo& info, InlineTextBox* textBox, LastGlyphInfo& lastGlyph) 1100 1104 { 1101 1105 RenderText* text = textBox->textObject(); … … 1125 1129 int extraCharsAvailable = length - i - 1; 1126 1130 1131 String unicodeStr; 1132 String glyphName; 1127 1133 if (textBox->m_reversed) { 1128 glyphWidth = svgTextBox->calculateGlyphWidth(style, textBox->end() - i, extraCharsAvailable, charsConsumed );1134 glyphWidth = svgTextBox->calculateGlyphWidth(style, textBox->end() - i, extraCharsAvailable, charsConsumed, glyphName); 1129 1135 glyphHeight = svgTextBox->calculateGlyphHeight(style, textBox->end() - i, extraCharsAvailable); 1136 unicodeStr = String(textBox->textObject()->text()->characters() + textBox->end() - i, charsConsumed); 1130 1137 } else { 1131 glyphWidth = svgTextBox->calculateGlyphWidth(style, textBox->start() + i, extraCharsAvailable, charsConsumed );1138 glyphWidth = svgTextBox->calculateGlyphWidth(style, textBox->start() + i, extraCharsAvailable, charsConsumed, glyphName); 1132 1139 glyphHeight = svgTextBox->calculateGlyphHeight(style, textBox->start() + i, extraCharsAvailable); 1140 unicodeStr = String(textBox->textObject()->text()->characters() + textBox->start() + i, charsConsumed); 1133 1141 } 1134 1142 … … 1298 1306 } 1299 1307 1308 SVGFontElement* svgFont; 1309 if (style->font().isSVGFont()) 1310 svgFont = style->font().svgFont(); 1311 1312 double kerning = 0.0; 1313 if (lastGlyph.isValid && style->font().isSVGFont()) { 1314 SVGHorizontalKerningPair kerningPair; 1315 if (svgFont->getHorizontalKerningPairForStringsAndGlyphs(lastGlyph.unicode, lastGlyph.glyphName, unicodeStr, glyphName, kerningPair)) 1316 kerning = kerningPair.kerning; 1317 } 1318 1319 if (style->font().isSVGFont()) { 1320 lastGlyph.unicode = unicodeStr; 1321 lastGlyph.glyphName = glyphName; 1322 lastGlyph.isValid = true; 1323 } else { 1324 lastGlyph.isValid = false; 1325 } 1326 1327 svgChar.x -= (float)kerning; 1328 1300 1329 // Advance to new position 1301 1330 if (isVerticalText) { … … 1303 1332 info.cury += glyphAdvance + spacing; 1304 1333 } else 1305 info.curx += glyphAdvance + spacing ;1334 info.curx += glyphAdvance + spacing - (float)kerning; 1306 1335 1307 1336 // Advance to next character group -
trunk/WebCore/rendering/SVGRootInlineBox.h
r29663 r31342 36 36 class SVGInlineTextBox; 37 37 38 struct LastGlyphInfo { 39 LastGlyphInfo() : isValid(false) { } 40 41 String unicode; 42 String glyphName; 43 bool isValid; 44 }; 45 38 46 class SVGRootInlineBox : public RootInlineBox { 39 47 public: … … 64 72 65 73 void buildLayoutInformation(InlineFlowBox* start, SVGCharacterLayoutInfo&); 66 void buildLayoutInformationForTextBox(SVGCharacterLayoutInfo&, InlineTextBox* );74 void buildLayoutInformationForTextBox(SVGCharacterLayoutInfo&, InlineTextBox*, LastGlyphInfo&); 67 75 68 76 void buildTextChunks(Vector<SVGChar>&, Vector<SVGTextChunk>&, InlineFlowBox* start); -
trunk/WebCore/svg/SVGFont.cpp
r31338 r31342 291 291 i += identifier.nameLength - 1; 292 292 m_walkerData.charsConsumed += identifier.nameLength; 293 293 m_walkerData.glyphName = identifier.glyphName; 294 294 295 foundGlyph = true; 295 296 SVGGlyphElement::inheritUnspecifiedAttributes(identifier, m_fontData); … … 337 338 int extraCharsAvailable; 338 339 int charsConsumed; 340 String glyphName; 339 341 340 342 float scale; … … 363 365 } 364 366 365 static float floatWidthOfSubStringUsingSVGFont(const Font* font, const TextRun& run, int extraCharsAvailable, int from, int to, int& charsConsumed) 367 368 SVGFontElement* Font::svgFont() const 369 { 370 if (!isSVGFont()) 371 return 0; 372 373 SVGFontElement* fontElement = 0; 374 SVGFontFaceElement* fontFaceElement = 0; 375 if (svgFontAndFontFaceElementForFontData(primaryFont(), fontFaceElement, fontElement)) 376 return fontElement; 377 378 return 0; 379 } 380 381 static float floatWidthOfSubStringUsingSVGFont(const Font* font, const TextRun& run, int extraCharsAvailable, int from, int to, int& charsConsumed, String& glyphName) 366 382 { 367 383 int newFrom = to > from ? from : to; … … 403 419 runWalker.walk(run, isVerticalText, language, 0, run.length()); 404 420 charsConsumed = data.charsConsumed; 421 glyphName = data.glyphName; 405 422 return data.length; 406 423 } … … 412 429 { 413 430 int charsConsumed; 414 return floatWidthOfSubStringUsingSVGFont(this, run, 0, 0, run.length(), charsConsumed); 415 } 416 417 float Font::floatWidthUsingSVGFont(const TextRun& run, int extraCharsAvailable, int& charsConsumed) const 418 { 419 return floatWidthOfSubStringUsingSVGFont(this, run, extraCharsAvailable, 0, run.length(), charsConsumed); 431 String glyphName; 432 return floatWidthOfSubStringUsingSVGFont(this, run, 0, 0, run.length(), charsConsumed, glyphName); 433 } 434 435 float Font::floatWidthUsingSVGFont(const TextRun& run, int extraCharsAvailable, int& charsConsumed, String& glyphName) const 436 { 437 return floatWidthOfSubStringUsingSVGFont(this, run, extraCharsAvailable, 0, run.length(), charsConsumed, glyphName); 420 438 } 421 439 … … 426 444 int extraCharsAvailable; 427 445 int charsConsumed; 446 String glyphName; 428 447 429 448 float xStartOffset; … … 525 544 526 545 int charsConsumed; 546 String glyphName; 527 547 data.isVerticalText = false; 528 data.xStartOffset = floatWidthOfSubStringUsingSVGFont(this, run, 0, run.rtl() ? to : 0, run.rtl() ? run.length() : from, charsConsumed );548 data.xStartOffset = floatWidthOfSubStringUsingSVGFont(this, run, 0, run.rtl() ? to : 0, run.rtl() ? run.length() : from, charsConsumed, glyphName); 529 549 data.glyphOrigin = FloatPoint(); 530 550 data.context = context; … … 555 575 { 556 576 int charsConsumed; 557 return FloatRect(point.x() + floatWidthOfSubStringUsingSVGFont(this, run, 0, run.rtl() ? to : 0, run.rtl() ? run.length() : from, charsConsumed), 558 point.y(), floatWidthOfSubStringUsingSVGFont(this, run, 0, from, to, charsConsumed), height); 577 String glyphName; 578 579 return FloatRect(point.x() + floatWidthOfSubStringUsingSVGFont(this, run, 0, run.rtl() ? to : 0, run.rtl() ? run.length() : from, charsConsumed, glyphName), 580 point.y(), floatWidthOfSubStringUsingSVGFont(this, run, 0, from, to, charsConsumed, glyphName), height); 559 581 } 560 582 -
trunk/WebCore/svg/SVGFontElement.cpp
r31324 r31342 30 30 #include "SVGNames.h" 31 31 #include "SVGParserUtilities.h" 32 #include <wtf/ASCIICType.h> 33 34 using namespace WTF; 32 35 33 36 namespace WebCore { … … 45 48 } 46 49 47 void SVGFontElement:: addGlyphToCache(SVGGlyphElement* glyphElement)48 { 49 if (m_isGlyphCacheValid) 50 void SVGFontElement::invalidateGlyphCache() 51 { 52 if (m_isGlyphCacheValid) { 50 53 m_glyphMap.clear(); 51 m_isGlyphCacheValid = false; 52 } 53 54 void SVGFontElement::removeGlyphFromCache(SVGGlyphElement* glyphElement) 55 { 56 if (m_isGlyphCacheValid) 57 m_glyphMap.clear(); 54 m_kerningPairs.clear(); 55 } 58 56 m_isGlyphCacheValid = false; 59 57 } … … 80 78 if (unicode.length()) 81 79 m_glyphMap.add(unicode, glyph->buildGlyphIdentifier()); 80 } else if (child->hasTagName(hkernTag)) { 81 SVGHKernElement* hkern = static_cast<SVGHKernElement*>(child); 82 SVGHorizontalKerningPair kerningPair = hkern->buildHorizontalKerningPair(); 83 m_kerningPairs.append(kerningPair); 82 84 } 83 85 } 84 86 85 87 m_isGlyphCacheValid = true; 88 } 89 90 // Returns the number of characters consumed or 0 if no range was found. 91 static unsigned parseUnicodeRange(const UChar* characters, unsigned length, pair<unsigned, unsigned>& range) 92 { 93 if (length < 2) 94 return 0; 95 if (characters[0] != 'U') 96 return 0; 97 if (characters[1] != '+') 98 return 0; 99 100 // Parse the starting hex number (or its prefix). 101 unsigned start = 0; 102 unsigned startLength = 0; 103 for (unsigned i = 2; i < length; ++i) { 104 if (!isASCIIHexDigit(characters[i])) 105 break; 106 if (++startLength > 6) 107 return 0; 108 start = (start << 4) | toASCIIHexValue(characters[i]); 109 } 110 111 // Handle the case of ranges separated by "-" sign. 112 if (2 + startLength < length && characters[2 + startLength] == '-') { 113 if (!startLength) 114 return 0; 115 116 // Parse the ending hex number (or its prefix). 117 unsigned end = 0; 118 unsigned endLength = 0; 119 for (unsigned i = 2 + startLength + 1; i < length; ++i) { 120 if (!isASCIIHexDigit(characters[i])) 121 break; 122 if (++endLength > 6) 123 return 0; 124 end = (end << 4) | toASCIIHexValue(characters[i]); 125 } 126 127 if (!endLength) 128 return 0; 129 130 range.first = start; 131 range.second = end; 132 return 2 + startLength + 1 + endLength; 133 } 134 135 // Handle the case of a number with some optional trailing question marks. 136 unsigned end = start; 137 for (unsigned i = 2 + startLength; i < length; ++i) { 138 if (characters[i] != '?') 139 break; 140 if (++startLength > 6) 141 return 0; 142 start <<= 4; 143 end = (end << 4) | 0xF; 144 } 145 146 if (!startLength) 147 return 0; 148 149 range.first = start; 150 range.second = end; 151 return 2 + startLength; 152 } 153 154 static bool parseUnicodeRangeList(const UChar* characters, unsigned length, Vector<pair<unsigned, unsigned> >& ranges) 155 { 156 ranges.clear(); 157 if (!length) 158 return true; 159 160 const UChar* remainingCharacters = characters; 161 unsigned remainingLength = length; 162 163 while (1) { 164 pair<unsigned, unsigned> range; 165 unsigned charactersConsumed = parseUnicodeRange(remainingCharacters, remainingLength, range); 166 if (charactersConsumed) { 167 ranges.append(range); 168 remainingCharacters += charactersConsumed; 169 remainingLength -= charactersConsumed; 170 } else { 171 if (!remainingLength) 172 return false; 173 UChar character = remainingCharacters[0]; 174 if (character == ',') 175 return false; 176 ranges.append(make_pair(character, character)); 177 ++remainingCharacters; 178 --remainingLength; 179 } 180 if (!remainingLength) 181 return true; 182 if (remainingCharacters[0] != ',') 183 return false; 184 ++remainingCharacters; 185 --remainingLength; 186 } 187 } 188 189 static bool stringMatchesUnicodeRange(const String& unicodeString, const String& unicodeRangeSpec) 190 { 191 Vector<pair<unsigned, unsigned> > ranges; 192 if (!parseUnicodeRangeList(unicodeRangeSpec.characters(), unicodeRangeSpec.length(), ranges)) 193 return false; 194 195 if (unicodeString.length() != ranges.size()) 196 return false; 197 198 for (size_t i = 0; i < unicodeString.length(); ++i) { 199 UChar c = unicodeString[i]; 200 if (c < ranges[i].first || c > ranges[i].second) 201 return false; 202 } 203 204 return true; 205 } 206 207 static bool matches(const String& u1, const String& g1, const String& u2, const String& g2, const SVGHorizontalKerningPair& kerningPair) 208 { 209 if (kerningPair.unicode1.length() && !stringMatchesUnicodeRange(u1, kerningPair.unicode1)) 210 return false; 211 if (kerningPair.glyphName1.length() && kerningPair.glyphName1 != g1) 212 return false; 213 214 if (kerningPair.unicode2.length() && !stringMatchesUnicodeRange(u2, kerningPair.unicode2)) 215 return false; 216 if (kerningPair.glyphName2.length() && kerningPair.glyphName2 != g2) 217 return false; 218 219 return true; 220 } 221 222 bool SVGFontElement::getHorizontalKerningPairForStringsAndGlyphs(const String& u1, const String& g1, const String& u2, const String& g2, SVGHorizontalKerningPair& kerningPair) const 223 { 224 for (size_t i = 0; i < m_kerningPairs.size(); ++i) { 225 if (matches(u1, g1, u2, g2, m_kerningPairs[i])) { 226 kerningPair = m_kerningPairs[i]; 227 return true; 228 } 229 } 230 231 return false; 86 232 } 87 233 -
trunk/WebCore/svg/SVGFontElement.h
r31324 r31342 26 26 #include "SVGGlyphElement.h" 27 27 #include "SVGGlyphMap.h" 28 #include "SVGHKernElement.h" 28 29 #include "SVGStyledElement.h" 29 30 … … 40 41 virtual const SVGElement* contextElement() const { return this; } 41 42 42 void addGlyphToCache(SVGGlyphElement*); 43 void removeGlyphFromCache(SVGGlyphElement*); 43 void invalidateGlyphCache(); 44 44 45 45 void getGlyphIdentifiersForString(const String&, Vector<SVGGlyphIdentifier>&) const; 46 47 bool getHorizontalKerningPairForStringsAndGlyphs(const String& u1, const String& g1, const String& u2, const String& g2, SVGHorizontalKerningPair& kerningPair) const; 46 48 47 49 SVGMissingGlyphElement* firstMissingGlyphElement() const; … … 50 52 void ensureGlyphCache() const; 51 53 54 typedef Vector<SVGHorizontalKerningPair> KerningPairVector; 55 56 mutable KerningPairVector m_kerningPairs; 52 57 mutable SVGGlyphMap m_glyphMap; 53 58 mutable bool m_isGlyphCacheValid; -
trunk/WebCore/svg/SVGGlyphElement.cpp
r31338 r31342 50 50 if (fontNode && fontNode->hasTagName(fontTag)) { 51 51 if (SVGFontElement* element = static_cast<SVGFontElement*>(fontNode)) 52 element-> addGlyphToCache(this);52 element->invalidateGlyphCache(); 53 53 } 54 54 SVGStyledElement::insertedIntoDocument(); … … 60 60 if (fontNode && fontNode->hasTagName(fontTag)) { 61 61 if (SVGFontElement* element = static_cast<SVGFontElement*>(fontNode)) 62 element-> removeGlyphFromCache(this);62 element->invalidateGlyphCache(); 63 63 } 64 64 SVGStyledElement::removedFromDocument(); -
trunk/WebCore/svg/SVGTextContentElement.cpp
r31310 r31342 82 82 // FIXME: does this handle multichar glyphs ok? not sure 83 83 int charsConsumed = 0; 84 String glyphName; 84 85 if (isVerticalText) 85 86 textLength += textBox->calculateGlyphHeight(style, newOffset, 0); 86 87 else 87 textLength += textBox->calculateGlyphWidth(style, newOffset, 0, charsConsumed );88 textLength += textBox->calculateGlyphWidth(style, newOffset, 0, charsConsumed, glyphName); 88 89 } 89 90 … … 197 198 198 199 int charsConsumed; 200 String glyphName; 199 201 if (isVerticalText) 200 202 m_queryPointResult.move(it->x, it->y + textBox->calculateGlyphHeight(style, newOffset, end - it)); 201 203 else 202 m_queryPointResult.move(it->x + textBox->calculateGlyphWidth(style, newOffset, end - it, charsConsumed ), it->y);204 m_queryPointResult.move(it->x + textBox->calculateGlyphWidth(style, newOffset, end - it, charsConsumed, glyphName), it->y); 203 205 204 206 m_stopProcessing = true; -
trunk/WebCore/svg/svgtags.in
r31337 r31342 71 71 #if 0 72 72 glyphRef 73 #endif 73 74 hkern 74 #endif75 75 image 76 76 line
Note:
See TracChangeset
for help on using the changeset viewer.