Commit de7e844e authored by zimmermann@webkit.org's avatar zimmermann@webkit.org

Reviewed by Eric.

Fixes: http://bugs.webkit.org/show_bug.cgi?id=6424 (<text>, <tspan> dominant-baseline attribute is not respected)

Add (basic) support for dominant-baseline / alignment-baseline text properties.
Note: there are no official testcases, and no-one implemented it before. Only ASV3
      supported dominant-baseline, but not correct it seems.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@27692 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 4c6a0a37
2007-11-11 Nikolas Zimmermann <zimmermann@kde.org>
Reviewed by Eric.
Add some basic tests to check alignment-baseline / dominant-baseline functionality.
* platform/mac/svg/custom/alignment-baseline-modes-expected.checksum: Added.
* platform/mac/svg/custom/alignment-baseline-modes-expected.png: Added.
* platform/mac/svg/custom/alignment-baseline-modes-expected.txt: Added.
* platform/mac/svg/custom/dominant-baseline-hanging-expected.checksum: Added.
* platform/mac/svg/custom/dominant-baseline-hanging-expected.png: Added.
* platform/mac/svg/custom/dominant-baseline-hanging-expected.txt: Added.
* platform/mac/svg/custom/dominant-baseline-modes-expected.checksum: Added.
* platform/mac/svg/custom/dominant-baseline-modes-expected.png: Added.
* platform/mac/svg/custom/dominant-baseline-modes-expected.txt: Added.
2007-11-11 Adam Roben <aroben@apple.com>
Remove a now-passing test from the Windows Skipped file
......
66fc7f2cdf2f28e77235480013c44d25
\ No newline at end of file
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 400x400
RenderSVGRoot {svg} at (10,-3) size 103x371
RenderSVGContainer {g} at (10,-3) size 103x23
RenderSVGText {text} at (10,15) size 103x23 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,-18) size 41x23
chunk 1 text run 1 at (10.00,15.00) startOffset 0 endOffset 5 width 41.00: "This "
RenderSVGTSpan {tspan} at (0,0) size 28x23
RenderSVGInlineText {#text} at (41,-18) size 28x23
chunk 1 text run 2 at (51.00,15.00) startOffset 0 endOffset 4 width 28.00: "is a"
RenderSVGInlineText {#text} at (69,-18) size 34x23
chunk 1 text run 3 at (79.00,15.00) startOffset 0 endOffset 5 width 34.00: " test"
RenderPath {line} at (10,14.50) size 100x1 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#000000]}] [data="M10.00,15.00L110.00,15.00"]
RenderSVGContainer {g} at (10,27) size 103x23 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,30.00)}]
RenderSVGText {text} at (10,15) size 103x23 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,-18) size 41x23
chunk 1 text run 1 at (10.00,15.00) startOffset 0 endOffset 5 width 41.00: "This "
RenderSVGTSpan {tspan} at (0,0) size 28x23
RenderSVGInlineText {#text} at (41,-18) size 28x23
chunk 1 text run 2 at (51.00,15.00) startOffset 0 endOffset 4 width 28.00: "is a"
RenderSVGInlineText {#text} at (69,-18) size 34x23
chunk 1 text run 3 at (79.00,15.00) startOffset 0 endOffset 5 width 34.00: " test"
RenderPath {line} at (10,44.50) size 100x1 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#000000]}] [data="M10.00,15.00L110.00,15.00"]
RenderSVGContainer {g} at (10,57) size 103x23 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,60.00)}]
RenderSVGText {text} at (10,15) size 103x23 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,-18) size 41x23
chunk 1 text run 1 at (10.00,15.00) startOffset 0 endOffset 5 width 41.00: "This "
RenderSVGTSpan {tspan} at (0,0) size 28x23
RenderSVGInlineText {#text} at (41,-18) size 28x23
chunk 1 text run 2 at (51.00,15.00) startOffset 0 endOffset 4 width 28.00: "is a"
RenderSVGInlineText {#text} at (69,-18) size 34x23
chunk 1 text run 3 at (79.00,15.00) startOffset 0 endOffset 5 width 34.00: " test"
RenderPath {line} at (10,74.50) size 100x1 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#000000]}] [data="M10.00,15.00L110.00,15.00"]
RenderSVGContainer {g} at (10,87) size 103x23 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,90.00)}]
RenderSVGText {text} at (10,15) size 103x23 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,-18) size 41x23
chunk 1 text run 1 at (10.00,15.00) startOffset 0 endOffset 5 width 41.00: "This "
RenderSVGTSpan {tspan} at (0,0) size 28x23
RenderSVGInlineText {#text} at (41,-18) size 28x23
chunk 1 text run 2 at (51.00,15.00) startOffset 0 endOffset 4 width 28.00: "is a"
RenderSVGInlineText {#text} at (69,-18) size 34x23
chunk 1 text run 3 at (79.00,15.00) startOffset 0 endOffset 5 width 34.00: " test"
RenderPath {line} at (10,104.50) size 100x1 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#000000]}] [data="M10.00,15.00L110.00,15.00"]
RenderSVGContainer {g} at (10,117) size 103x28 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,120.00)}]
RenderSVGText {text} at (10,15) size 103x28 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,-13) size 41x23
chunk 1 text run 1 at (10.00,20.00) startOffset 0 endOffset 5 width 41.00: "This "
RenderSVGTSpan {tspan} at (0,0) size 28x23
RenderSVGInlineText {#text} at (41,-18) size 28x23
chunk 1 text run 2 at (51.00,15.00) startOffset 0 endOffset 4 width 28.00: "is a"
RenderSVGInlineText {#text} at (69,-13) size 34x23
chunk 1 text run 3 at (79.00,20.00) startOffset 0 endOffset 5 width 34.00: " test"
RenderPath {line} at (10,134.50) size 100x1 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#000000]}] [data="M10.00,15.00L110.00,15.00"]
RenderSVGContainer {g} at (10,147) size 103x23 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,150.00)}]
RenderSVGText {text} at (10,15) size 103x23 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,-18) size 41x23
chunk 1 text run 1 at (10.00,15.00) startOffset 0 endOffset 5 width 41.00: "This "
RenderSVGTSpan {tspan} at (0,0) size 28x23
RenderSVGInlineText {#text} at (41,-18) size 28x23
chunk 1 text run 2 at (51.00,15.00) startOffset 0 endOffset 4 width 28.00: "is a"
RenderSVGInlineText {#text} at (69,-18) size 34x23
chunk 1 text run 3 at (79.00,15.00) startOffset 0 endOffset 5 width 34.00: " test"
RenderPath {line} at (10,164.50) size 100x1 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#000000]}] [data="M10.00,15.00L110.00,15.00"]
RenderSVGContainer {g} at (10,177) size 103x37 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,180.00)}]
RenderSVGText {text} at (10,15) size 103x37 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,-4) size 41x23
chunk 1 text run 1 at (10.00,29.40) startOffset 0 endOffset 5 width 41.00: "This "
RenderSVGTSpan {tspan} at (0,0) size 28x23
RenderSVGInlineText {#text} at (41,-18) size 28x23
chunk 1 text run 2 at (51.00,15.00) startOffset 0 endOffset 4 width 28.00: "is a"
RenderSVGInlineText {#text} at (69,-4) size 34x23
chunk 1 text run 3 at (79.00,29.40) startOffset 0 endOffset 5 width 34.00: " test"
RenderPath {line} at (10,194.50) size 100x1 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#000000]}] [data="M10.00,15.00L110.00,15.00"]
RenderSVGContainer {g} at (10,207) size 103x32 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,210.00)}]
RenderSVGText {text} at (10,15) size 103x32 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,-9) size 41x23
chunk 1 text run 1 at (10.00,24.00) startOffset 0 endOffset 5 width 41.00: "This "
RenderSVGTSpan {tspan} at (0,0) size 28x23
RenderSVGInlineText {#text} at (41,-18) size 28x23
chunk 1 text run 2 at (51.00,15.00) startOffset 0 endOffset 4 width 28.00: "is a"
RenderSVGInlineText {#text} at (69,-9) size 34x23
chunk 1 text run 3 at (79.00,24.00) startOffset 0 endOffset 5 width 34.00: " test"
RenderPath {line} at (10,224.50) size 100x1 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#000000]}] [data="M10.00,15.00L110.00,15.00"]
RenderSVGContainer {g} at (10,237) size 103x23 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,240.00)}]
RenderSVGText {text} at (10,15) size 103x23 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,-18) size 41x23
chunk 1 text run 1 at (10.00,15.00) startOffset 0 endOffset 5 width 41.00: "This "
RenderSVGTSpan {tspan} at (0,0) size 28x23
RenderSVGInlineText {#text} at (41,-18) size 28x23
chunk 1 text run 2 at (51.00,15.00) startOffset 0 endOffset 4 width 28.00: "is a"
RenderSVGInlineText {#text} at (69,-18) size 34x23
chunk 1 text run 3 at (79.00,15.00) startOffset 0 endOffset 5 width 34.00: " test"
RenderPath {line} at (10,254.50) size 100x1 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#000000]}] [data="M10.00,15.00L110.00,15.00"]
RenderSVGContainer {g} at (10,267) size 103x28 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,270.00)}]
RenderSVGText {text} at (10,15) size 103x28 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,-14) size 41x24
chunk 1 text run 1 at (10.00,19.79) startOffset 0 endOffset 5 width 41.00: "This "
RenderSVGTSpan {tspan} at (0,0) size 28x23
RenderSVGInlineText {#text} at (41,-18) size 28x23
chunk 1 text run 2 at (51.00,15.00) startOffset 0 endOffset 4 width 28.00: "is a"
RenderSVGInlineText {#text} at (69,-14) size 34x24
chunk 1 text run 3 at (79.00,19.79) startOffset 0 endOffset 5 width 34.00: " test"
RenderPath {line} at (10,284.50) size 100x1 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#000000]}] [data="M10.00,15.00L110.00,15.00"]
RenderSVGContainer {g} at (10,297) size 103x28 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,300.00)}]
RenderSVGText {text} at (10,15) size 103x28 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,-13) size 41x23
chunk 1 text run 1 at (10.00,20.00) startOffset 0 endOffset 5 width 41.00: "This "
RenderSVGTSpan {tspan} at (0,0) size 28x23
RenderSVGInlineText {#text} at (41,-18) size 28x23
chunk 1 text run 2 at (51.00,15.00) startOffset 0 endOffset 4 width 28.00: "is a"
RenderSVGInlineText {#text} at (69,-13) size 34x23
chunk 1 text run 3 at (79.00,20.00) startOffset 0 endOffset 5 width 34.00: " test"
RenderPath {line} at (10,314.50) size 100x1 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#000000]}] [data="M10.00,15.00L110.00,15.00"]
RenderSVGContainer {g} at (10,327) size 103x41 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,330.00)}]
RenderSVGText {text} at (10,15) size 103x41 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,0) size 41x23
chunk 1 text run 1 at (10.00,33.00) startOffset 0 endOffset 5 width 41.00: "This "
RenderSVGTSpan {tspan} at (0,0) size 28x23
RenderSVGInlineText {#text} at (41,-18) size 28x23
chunk 1 text run 2 at (51.00,15.00) startOffset 0 endOffset 4 width 28.00: "is a"
RenderSVGInlineText {#text} at (69,0) size 34x23
chunk 1 text run 3 at (79.00,33.00) startOffset 0 endOffset 5 width 34.00: " test"
RenderPath {line} at (10,344.50) size 100x1 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#000000]}] [data="M10.00,15.00L110.00,15.00"]
c5cc5298c7d86acda72ed54ffa858950
\ No newline at end of file
KRenderingPaintServer {id="gradient" [type=LINEAR-GRADIENT] [stops=[(0.00,#FF72B47F), (1.00,#FF007B)]] [start=(0,0)] [end=(0,1)]}
KRenderingPaintServer {id="h_stroke_gradient" [type=LINEAR-GRADIENT] [stops=[(0.00,#000000), (1.00,#00000000)]] [start=(0,0)] [end=(1,0)]}
KRenderingPaintServer {id="v_stroke_gradient" [type=LINEAR-GRADIENT] [stops=[(0.00,#000000), (1.00,#00000000)]] [start=(0,0)] [end=(0,1)]}
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 400x400
RenderSVGRoot {svg} at (0,0) size 400x400
RenderSVGHiddenContainer {defs} at (0,0) size 0x0
RenderSVGHiddenContainer {linearGradient} at (0,0) size 0x0
RenderSVGGradientStop {stop} at (0,0) size 0x0
RenderSVGGradientStop {stop} at (0,0) size 0x0
RenderSVGHiddenContainer {linearGradient} at (0,0) size 0x0
RenderSVGGradientStop {stop} at (0,0) size 0x0
RenderSVGGradientStop {stop} at (0,0) size 0x0
RenderSVGHiddenContainer {linearGradient} at (0,0) size 0x0
RenderSVGGradientStop {stop} at (0,0) size 0x0
RenderSVGGradientStop {stop} at (0,0) size 0x0
RenderPath {rect} at (0,0) size 400x400 [fill={[type=LINEAR-GRADIENT] [stops=[(0.00,#FF72B47F), (1.00,#FF007B)]] [start=(0,0)] [end=(0,1)]}] [data="M0.00,0.00L400.00,0.00L400.00,400.00L0.00,400.00"]
RenderSVGContainer {g} at (9,7) size 381x28 [transform={m=((1.00,0.00)(0.00,1.00)) t=(10.00,10.00)}]
RenderPath {rect} at (10,10) size 380x25 [opacity=0.50] [fill={[type=SOLID] [color=#FFFFFF]}] [data="M0.00,0.00L380.00,0.00L380.00,25.00L0.00,25.00"]
RenderSVGContainer {g} at (9,9) size 380.50x25.50 [transform={m=((1.00,0.00)(0.00,1.00)) t=(-0.50,-0.50)}]
RenderPath {line} at (9.50,9) size 380x1 [stroke={[type=LINEAR-GRADIENT] [stops=[(0.00,#000000), (1.00,#00000000)]] [start=(0,0)] [end=(1,0)]}] [fill={[type=SOLID] [color=#000000]}] [data="M0.00,0.00L380.00,0.00"]
RenderPath {line} at (9,9) size 1x25.50 [stroke={[type=LINEAR-GRADIENT] [stops=[(0.00,#000000), (1.00,#00000000)]] [start=(0,0)] [end=(0,1)]}] [fill={[type=SOLID] [color=#000000]}] [data="M0.00,-0.50L0.00,25.00"]
RenderSVGText {text} at (2,14) size 323x22 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,-17) size 323x22
chunk 1 text run 1 at (2.00,14.40) startOffset 0 endOffset 40 width 323.00: "This is hanging from the top-left corner"
RenderForeignObject {foreignObject} at (0,0) size 380x124
RenderBlock {html} at (0,0) size 380x124
RenderBody {body} at (8,0) size 364x124
RenderBlock {p} at (0,0) size 364x90
RenderText {#text} at (0,0) size 347x36
text run at (0,0) width 347: "The piece of text above should be aligned with the top-"
text run at (0,18) width 286: "left corner of the rectangle below it. Both the "
RenderInline {code} at (0,0) size 48x15
RenderText {#text} at (286,20) size 48x15
text run at (286,20) width 48: "<text>"
RenderText {#text} at (334,18) size 361x36
text run at (334,18) width 27: " and"
text run at (0,36) width 23: "the "
RenderInline {code} at (0,0) size 48x15
RenderText {#text} at (23,38) size 48x15
text run at (23,38) width 48: "<rect>"
RenderText {#text} at (71,36) size 272x18
text run at (71,36) width 272: " are located at the same coordinates and the"
RenderInline {code} at (0,0) size 48x15
RenderText {#text} at (0,56) size 48x15
text run at (0,56) width 48: "<text>"
RenderText {#text} at (48,54) size 111x18
text run at (48,54) width 111: " element uses the "
RenderInline {code} at (0,0) size 56x15
RenderText {#text} at (159,56) size 56x15
text run at (159,56) width 56: "hanging"
RenderText {#text} at (215,54) size 78x18
text run at (215,54) width 78: " value for its"
RenderInline {code} at (0,0) size 136x15
RenderText {#text} at (0,74) size 136x15
text run at (0,74) width 136: "dominant-baseline"
RenderText {#text} at (136,72) size 59x18
text run at (136,72) width 59: " attribute."
RenderBlock {p} at (0,106) size 364x18
RenderInline {a} at (0,0) size 91x18 [color=#800000]
RenderText {#text} at (0,0) size 91x18
text run at (0,0) width 91: "Antoine Quint"
RenderText {#text} at (91,0) size 89x18
text run at (91,0) width 89: ", January 27th"
272c1797ece97538b691803957fff5af
\ No newline at end of file
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 400x400
RenderSVGRoot {svg} at (10,-3) size 103x371
RenderSVGContainer {g} at (10,-3) size 103x23
RenderSVGText {text} at (10,15) size 103x23 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,-18) size 103x23
chunk 1 text run 1 at (10.00,15.00) startOffset 0 endOffset 14 width 103.00: "This is a test"
RenderPath {line} at (10,14.50) size 100x1 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#000000]}] [data="M10.00,15.00L110.00,15.00"]
RenderSVGContainer {g} at (10,27) size 103x23 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,30.00)}]
RenderSVGText {text} at (10,15) size 103x23 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,-18) size 103x23
chunk 1 text run 1 at (10.00,15.00) startOffset 0 endOffset 14 width 103.00: "This is a test"
RenderPath {line} at (10,44.50) size 100x1 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#000000]}] [data="M10.00,15.00L110.00,15.00"]
RenderSVGContainer {g} at (10,57) size 103x23 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,60.00)}]
RenderSVGText {text} at (10,15) size 103x23 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,-18) size 103x23
chunk 1 text run 1 at (10.00,15.00) startOffset 0 endOffset 14 width 103.00: "This is a test"
RenderPath {line} at (10,74.50) size 100x1 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#000000]}] [data="M10.00,15.00L110.00,15.00"]
RenderSVGContainer {g} at (10,87) size 103x23 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,90.00)}]
RenderSVGText {text} at (10,15) size 103x23 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,-18) size 103x23
chunk 1 text run 1 at (10.00,15.00) startOffset 0 endOffset 14 width 103.00: "This is a test"
RenderPath {line} at (10,104.50) size 100x1 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#000000]}] [data="M10.00,15.00L110.00,15.00"]
RenderSVGContainer {g} at (10,122) size 103x23 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,120.00)}]
RenderSVGText {text} at (10,20) size 103x23 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,-18) size 103x23
chunk 1 text run 1 at (10.00,20.00) startOffset 0 endOffset 14 width 103.00: "This is a test"
RenderPath {line} at (10,134.50) size 100x1 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#000000]}] [data="M10.00,15.00L110.00,15.00"]
RenderSVGContainer {g} at (10,147) size 103x23 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,150.00)}]
RenderSVGText {text} at (10,15) size 103x23 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,-18) size 103x23
chunk 1 text run 1 at (10.00,15.00) startOffset 0 endOffset 14 width 103.00: "This is a test"
RenderPath {line} at (10,164.50) size 100x1 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#000000]}] [data="M10.00,15.00L110.00,15.00"]
RenderSVGContainer {g} at (10,191) size 103x23 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,180.00)}]
RenderSVGText {text} at (10,29) size 103x23 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,-18) size 103x23
chunk 1 text run 1 at (10.00,29.40) startOffset 0 endOffset 14 width 103.00: "This is a test"
RenderPath {line} at (10,194.50) size 100x1 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#000000]}] [data="M10.00,15.00L110.00,15.00"]
RenderSVGContainer {g} at (10,216) size 103x23 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,210.00)}]
RenderSVGText {text} at (10,24) size 103x23 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,-18) size 103x23
chunk 1 text run 1 at (10.00,24.00) startOffset 0 endOffset 14 width 103.00: "This is a test"
RenderPath {line} at (10,224.50) size 100x1 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#000000]}] [data="M10.00,15.00L110.00,15.00"]
RenderSVGContainer {g} at (10,237) size 103x23 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,240.00)}]
RenderSVGText {text} at (10,15) size 103x23 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,-18) size 103x23
chunk 1 text run 1 at (10.00,15.00) startOffset 0 endOffset 14 width 103.00: "This is a test"
RenderPath {line} at (10,254.50) size 100x1 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#000000]}] [data="M10.00,15.00L110.00,15.00"]
RenderSVGContainer {g} at (10,271) size 103x24 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,270.00)}]
RenderSVGText {text} at (10,19) size 103x24 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,-18) size 103x24
chunk 1 text run 1 at (10.00,19.79) startOffset 0 endOffset 14 width 103.00: "This is a test"
RenderPath {line} at (10,284.50) size 100x1 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#000000]}] [data="M10.00,15.00L110.00,15.00"]
RenderSVGContainer {g} at (10,302) size 103x23 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,300.00)}]
RenderSVGText {text} at (10,20) size 103x23 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,-18) size 103x23
chunk 1 text run 1 at (10.00,20.00) startOffset 0 endOffset 14 width 103.00: "This is a test"
RenderPath {line} at (10,314.50) size 100x1 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#000000]}] [data="M10.00,15.00L110.00,15.00"]
RenderSVGContainer {g} at (10,344.50) size 103x23.50 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,330.00)}]
RenderSVGText {text} at (10,33) size 103x23 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,-18) size 103x23
chunk 1 text run 1 at (10.00,33.00) startOffset 0 endOffset 14 width 103.00: "This is a test"
RenderPath {line} at (10,344.50) size 100x1 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#000000]}] [data="M10.00,15.00L110.00,15.00"]
......@@ -34,6 +34,7 @@
#include "SVGInlineFlowBox.h"
#include "SVGInlineTextBox.h"
#include "SVGPaintServer.h"
#include "SVGRenderStyleDefs.h"
#include "SVGRenderSupport.h"
#include "SVGResourceFilter.h"
#include "SVGTextPositioningElement.h"
......@@ -55,6 +56,119 @@ static inline bool isVerticalWritingMode(const SVGRenderStyle* style)
return style->writingMode() == WM_TBRL || style->writingMode() == WM_TB;
}
static inline EAlignmentBaseline dominantBaselineToShift(bool isVerticalText, const RenderObject* text, const Font& font)
{
ASSERT(text);
const SVGRenderStyle* style = text->style() ? text->style()->svgStyle() : 0;
ASSERT(style);
const SVGRenderStyle* parentStyle = text->parent() && text->parent()->style() ? text->parent()->style()->svgStyle() : 0;
EDominantBaseline baseline = style->dominantBaseline();
if (baseline == DB_AUTO) {
if (isVerticalText)
baseline = DB_CENTRAL;
else
baseline = DB_ALPHABETIC;
}
switch (baseline) {
case DB_USE_SCRIPT:
// TODO: The dominant-baseline and the baseline-table components are set by
// determining the predominant script of the character data content.
return AB_ALPHABETIC;
case DB_NO_CHANGE:
{
if (parentStyle)
return dominantBaselineToShift(isVerticalText, text->parent(), font);
ASSERT_NOT_REACHED();
return AB_AUTO;
}
case DB_RESET_SIZE:
{
if (parentStyle)
return dominantBaselineToShift(isVerticalText, text->parent(), font);
ASSERT_NOT_REACHED();
return AB_AUTO;
}
case DB_IDEOGRAPHIC:
return AB_IDEOGRAPHIC;
case DB_ALPHABETIC:
return AB_ALPHABETIC;
case DB_HANGING:
return AB_HANGING;
case DB_MATHEMATICAL:
return AB_MATHEMATICAL;
case DB_CENTRAL:
return AB_CENTRAL;
case DB_MIDDLE:
return AB_MIDDLE;
case DB_TEXT_AFTER_EDGE:
return AB_TEXT_AFTER_EDGE;
case DB_TEXT_BEFORE_EDGE:
return AB_TEXT_BEFORE_EDGE;
default:
ASSERT_NOT_REACHED();
return AB_AUTO;
}
}
static inline float alignmentBaselineToShift(bool isVerticalText, const RenderObject* text, const Font& font)
{
ASSERT(text);
const SVGRenderStyle* style = text->style() ? text->style()->svgStyle() : 0;
ASSERT(style);
const SVGRenderStyle* parentStyle = text->parent() && text->parent()->style() ? text->parent()->style()->svgStyle() : 0;
EAlignmentBaseline baseline = style->alignmentBaseline();
if (baseline == AB_AUTO) {
if (parentStyle && style->dominantBaseline() == DB_AUTO)
baseline = dominantBaselineToShift(isVerticalText, text->parent(), font);
else
baseline = dominantBaselineToShift(isVerticalText, text, font);
ASSERT(baseline != AB_AUTO);
}
// Note: http://wiki.apache.org/xmlgraphics-fop/LineLayout/AlignmentHandling
switch (baseline) {
case AB_BASELINE:
{
if (parentStyle)
return dominantBaselineToShift(isVerticalText, text->parent(), font);
return 0.0f;
}
case AB_BEFORE_EDGE:
case AB_TEXT_BEFORE_EDGE:
return font.ascent();
case AB_MIDDLE:
return font.xHeight() / 2.0f;
case AB_CENTRAL:
// Not needed, we're taking this into account already for vertical text!
// return (font.ascent() - font.descent()) / 2.0f;
return 0.0f;
case AB_AFTER_EDGE:
case AB_TEXT_AFTER_EDGE:
case AB_IDEOGRAPHIC:
return font.descent();
case AB_ALPHABETIC:
return 0.0f;
case AB_HANGING:
return font.ascent() * 8.0f / 10.0f;
case AB_MATHEMATICAL:
return font.ascent() / 2.0f;
default:
ASSERT_NOT_REACHED();
return 0.0f;
}
}
static inline float glyphOrientationToAngle(const SVGRenderStyle* svgStyle, bool isVerticalText, const UChar& character)
{
switch (isVerticalText ? svgStyle->glyphOrientationVertical() : svgStyle->glyphOrientationHorizontal()) {
......@@ -1119,6 +1233,9 @@ void SVGRootInlineBox::buildLayoutInformationForTextBox(SVGCharacterLayoutInfo&
info.shifty -= shift;
}
// Take dominant-baseline / alignment-baseline into account
yOrientationShift += alignmentBaselineToShift(isVerticalText, text, font);
svgChar.x = info.curx;
svgChar.y = info.cury;
svgChar.angle = info.angle;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment