[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

zimmermann at webkit.org zimmermann at webkit.org
Wed Dec 22 13:17:38 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 6e96afd515d5f0790f9d9e2ebb5886d3ac96c9e8
Author: zimmermann at webkit.org <zimmermann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Sep 10 15:35:50 2010 +0000

    2010-09-10  Nikolas Zimmermann  <nzimmermann at rim.com>
    
            Reviewed by Dirk Schulze.
    
            SVG text chunk concept needs to be integrated in the InlineBox structure
            https://bugs.webkit.org/show_bug.cgi?id=45533
    
            Begin rewriting the SVG text layout code. As first step move the text chunk concept right into the inline box structure.
            This obsoletes the whole text chunk part concept (see SVGTextChunkLayoutInfo.h for details), and will soon simplify the
            whole layout code a lot. Previously we hacked around the fact that a single InlineTextBox could contain multiple text chunks
            For example: <text x="20 30 40">ABC</text> only led to the creation of one InlineTextBox containing three chunks. When
            painting such an InlineTextBox, we had to do nasty hacks (same for text selection etc.)
    
            This is finally fixed by incorporating the knownledge about text chunks into the line layout algorithm.
            Note, this has no impact on HTML at all, no worries.
    
            It's even required to do it this way as BiDi reordering shouldn't happen across text chunks.
            These are only the first bits, and currently slows down text layouting. Follow-up patches will remove the old layout
            algorithm, and will rely on the stored SVGTextLayoutAttributes in the RenerSVGInlineText renderers (instead of computing again).
    
            * Android.mk: Add rendering/svg/SVGTextLayoutAttributes.* & rendering/svg/SVGTextLayoutBuilder.* to build.
            * CMakeLists.txt: Ditto.
            * GNUmakefile.am: Ditto.
            * WebCore.gyp/WebCore.gyp: Ditto.
            * WebCore.gypi: Ditto.
            * WebCore.pro: Ditto.
            * WebCore.vcproj/WebCore.vcproj: Ditto.
            * WebCore.vcproj/WebCoreCommon.vsprops: Ditto. (Recognize new rendering/svg directory.)
            * WebCore.vcproj/copyForwardingHeaders.cmd: Ditto. (Copy forwarding headers from rendering/svg directory.)
            * WebCore.xcodeproj/project.pbxproj: Ditto.
            * rendering/RenderBlockLineLayout.cpp: This is the key of the new concept, take text chunks into account when building the InlineBox structure.
            (WebCore::RenderBlock::findNextLineBreak): Split midpointState, if we encounter the beginning of a new text chunk.
            * rendering/RenderObject.h:
            (WebCore::RenderObject::isSVGInline): New method, which will be used to identify RenderSVGInline objects.
            * rendering/RenderSVGInline.h:
            (WebCore::RenderSVGInline::isSVGInline): Return true.
            * rendering/RenderSVGInlineText.cpp:
            (WebCore::RenderSVGInlineText::linesBoundingBox): Overriden, to simplify the calculations for SVG.
            (WebCore::RenderSVGInlineText::characterStartsNewTextChunk): Determines wheter the given position starts a new text chunk.
            * rendering/RenderSVGInlineText.h:
            (WebCore::RenderSVGInlineText::storeLayoutAttributes): Stores the layout attributes calculated in the text layout process (will be used everywhere in follow-up patches).
            * rendering/RenderSVGText.cpp:
            (WebCore::RenderSVGText::layout): Invoke SVGTextLayoutBuilder before creating the inline box tree, so we can decide which characters start new text chunks.
            * rendering/RenderText.h: Made linesBoundingBox() virtual so RenderSVGInlineText can override it.
            * rendering/svg: Added.
            * rendering/svg/SVGTextLayoutAttributes.cpp: Added. Holds x/y/dx/dy/rotate values and all kerning/ligature information used during layout.
            * rendering/svg/SVGTextLayoutAttributes.h: Added.
            * rendering/svg/SVGTextLayoutBuilder.cpp: Added.
            * rendering/svg/SVGTextLayoutBuilder.h: Added.
    2010-09-10  Nikolas Zimmermann  <nzimmermann at rim.com>
    
            Reviewed by Dirk Schulze.
    
            SVG text chunk concept needs to be integrated in the InlineBox structure
            https://bugs.webkit.org/show_bug.cgi?id=45533
    
            Updated all tests containing text chunks, to reflect the fact that more SVGInlineTextBoxes are created now.
            All 'startOffset' dumps now begin at 0, indicating that there's only one chunk contained in a single SVGInlineTextBox.
            These dumps will be removed in follow-up patches, as they don't make any sense anymore in the new concept.
    
            * platform/gtk/svg/text/select-x-list-1-expected.txt:
            * platform/gtk/svg/text/select-x-list-2-expected.txt:
            * platform/gtk/svg/text/select-x-list-3-expected.txt:
            * platform/gtk/svg/text/select-x-list-4-expected.txt:
            * platform/gtk/svg/text/select-x-list-with-tspans-1-expected.txt:
            * platform/gtk/svg/text/select-x-list-with-tspans-2-expected.txt:
            * platform/gtk/svg/text/select-x-list-with-tspans-3-expected.txt:
            * platform/gtk/svg/text/select-x-list-with-tspans-4-expected.txt:
            * platform/mac/svg/W3C-SVG-1.1/animate-elem-40-t-expected.txt:
            * platform/mac/svg/W3C-SVG-1.1/text-text-04-t-expected.txt:
            * platform/mac/svg/W3C-SVG-1.1/text-text-05-t-expected.txt:
            * platform/mac/svg/W3C-SVG-1.1/text-text-06-t-expected.txt:
            * platform/mac/svg/W3C-SVG-1.1/text-text-07-t-expected.txt:
            * platform/mac/svg/W3C-SVG-1.1/text-tspan-01-b-expected.txt:
            * platform/mac/svg/batik/text/textAnchor2-expected.txt:
            * platform/mac/svg/batik/text/textAnchor3-expected.txt:
            * platform/mac/svg/batik/text/textLayout-expected.txt:
            * platform/mac/svg/batik/text/textLayout2-expected.txt:
            * platform/mac/svg/batik/text/textOnPathSpaces-expected.txt:
            * platform/mac/svg/batik/text/textPosition-expected.txt:
            * platform/mac/svg/batik/text/textPosition2-expected.txt:
            * platform/mac/svg/custom/text-letter-spacing-expected.txt:
            * platform/mac/svg/custom/text-x-dx-lists-expected.txt:
            * platform/mac/svg/custom/text-x-override-in-tspan-child-expected.txt:
            * platform/mac/svg/text/select-x-list-1-expected.txt:
            * platform/mac/svg/text/select-x-list-2-expected.txt:
            * platform/mac/svg/text/select-x-list-3-expected.txt:
            * platform/mac/svg/text/select-x-list-4-expected.txt:
            * platform/mac/svg/text/select-x-list-with-tspans-1-expected.txt:
            * platform/mac/svg/text/select-x-list-with-tspans-2-expected.txt:
            * platform/mac/svg/text/select-x-list-with-tspans-3-expected.txt:
            * platform/mac/svg/text/select-x-list-with-tspans-4-expected.txt:
            * platform/mac/svg/text/text-text-04-t-expected.txt:
            * platform/mac/svg/text/text-text-05-t-expected.txt:
            * platform/mac/svg/text/text-text-06-t-expected.txt:
            * platform/mac/svg/text/text-text-07-t-expected.txt:
            * platform/mac/svg/text/text-tspan-01-b-expected.txt:
            * svg/custom/glyph-transformation-with-hkern-expected.txt:
            * platform/qt/svg/text/select-x-list-1-expected.txt:
            * platform/qt/svg/text/select-x-list-2-expected.txt:
            * platform/qt/svg/text/select-x-list-3-expected.txt:
            * platform/qt/svg/text/select-x-list-4-expected.txt:
            * platform/qt/svg/text/select-x-list-with-tspans-1-expected.txt:
            * platform/qt/svg/text/select-x-list-with-tspans-2-expected.txt:
            * platform/qt/svg/text/select-x-list-with-tspans-3-expected.txt:
            * platform/qt/svg/text/select-x-list-with-tspans-4-expected.txt:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67200 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 53e9d17..2bbc4c2 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,61 @@
+2010-09-10  Nikolas Zimmermann  <nzimmermann at rim.com>
+
+        Reviewed by Dirk Schulze.
+
+        SVG text chunk concept needs to be integrated in the InlineBox structure
+        https://bugs.webkit.org/show_bug.cgi?id=45533
+
+        Updated all tests containing text chunks, to reflect the fact that more SVGInlineTextBoxes are created now.
+        All 'startOffset' dumps now begin at 0, indicating that there's only one chunk contained in a single SVGInlineTextBox.
+        These dumps will be removed in follow-up patches, as they don't make any sense anymore in the new concept.
+
+        * platform/gtk/svg/text/select-x-list-1-expected.txt:
+        * platform/gtk/svg/text/select-x-list-2-expected.txt:
+        * platform/gtk/svg/text/select-x-list-3-expected.txt:
+        * platform/gtk/svg/text/select-x-list-4-expected.txt:
+        * platform/gtk/svg/text/select-x-list-with-tspans-1-expected.txt:
+        * platform/gtk/svg/text/select-x-list-with-tspans-2-expected.txt:
+        * platform/gtk/svg/text/select-x-list-with-tspans-3-expected.txt:
+        * platform/gtk/svg/text/select-x-list-with-tspans-4-expected.txt: 
+        * platform/mac/svg/W3C-SVG-1.1/animate-elem-40-t-expected.txt:
+        * platform/mac/svg/W3C-SVG-1.1/text-text-04-t-expected.txt:
+        * platform/mac/svg/W3C-SVG-1.1/text-text-05-t-expected.txt:
+        * platform/mac/svg/W3C-SVG-1.1/text-text-06-t-expected.txt:
+        * platform/mac/svg/W3C-SVG-1.1/text-text-07-t-expected.txt:
+        * platform/mac/svg/W3C-SVG-1.1/text-tspan-01-b-expected.txt:
+        * platform/mac/svg/batik/text/textAnchor2-expected.txt:
+        * platform/mac/svg/batik/text/textAnchor3-expected.txt:
+        * platform/mac/svg/batik/text/textLayout-expected.txt:
+        * platform/mac/svg/batik/text/textLayout2-expected.txt:
+        * platform/mac/svg/batik/text/textOnPathSpaces-expected.txt:
+        * platform/mac/svg/batik/text/textPosition-expected.txt:
+        * platform/mac/svg/batik/text/textPosition2-expected.txt:
+        * platform/mac/svg/custom/text-letter-spacing-expected.txt:
+        * platform/mac/svg/custom/text-x-dx-lists-expected.txt:
+        * platform/mac/svg/custom/text-x-override-in-tspan-child-expected.txt:
+        * platform/mac/svg/text/select-x-list-1-expected.txt:
+        * platform/mac/svg/text/select-x-list-2-expected.txt:
+        * platform/mac/svg/text/select-x-list-3-expected.txt:
+        * platform/mac/svg/text/select-x-list-4-expected.txt:
+        * platform/mac/svg/text/select-x-list-with-tspans-1-expected.txt:
+        * platform/mac/svg/text/select-x-list-with-tspans-2-expected.txt:
+        * platform/mac/svg/text/select-x-list-with-tspans-3-expected.txt:
+        * platform/mac/svg/text/select-x-list-with-tspans-4-expected.txt:
+        * platform/mac/svg/text/text-text-04-t-expected.txt:
+        * platform/mac/svg/text/text-text-05-t-expected.txt:
+        * platform/mac/svg/text/text-text-06-t-expected.txt:
+        * platform/mac/svg/text/text-text-07-t-expected.txt:
+        * platform/mac/svg/text/text-tspan-01-b-expected.txt:
+        * svg/custom/glyph-transformation-with-hkern-expected.txt:
+        * platform/qt/svg/text/select-x-list-1-expected.txt:
+        * platform/qt/svg/text/select-x-list-2-expected.txt:
+        * platform/qt/svg/text/select-x-list-3-expected.txt:
+        * platform/qt/svg/text/select-x-list-4-expected.txt:
+        * platform/qt/svg/text/select-x-list-with-tspans-1-expected.txt:
+        * platform/qt/svg/text/select-x-list-with-tspans-2-expected.txt:
+        * platform/qt/svg/text/select-x-list-with-tspans-3-expected.txt:
+        * platform/qt/svg/text/select-x-list-with-tspans-4-expected.txt:
+
 2010-09-10  Anton Muhin <antonm at chromium.org>
 
         Unreview fixed.
diff --git a/LayoutTests/platform/gtk/svg/text/select-x-list-1-expected.txt b/LayoutTests/platform/gtk/svg/text/select-x-list-1-expected.txt
index 8e8a2d8..826a00d 100644
--- a/LayoutTests/platform/gtk/svg/text/select-x-list-1-expected.txt
+++ b/LayoutTests/platform/gtk/svg/text/select-x-list-1-expected.txt
@@ -7,7 +7,7 @@ layer at (0,0) size 800x600
     RenderSVGText {text} at (10,2) size 150x10 contains 3 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 150x10
         chunk 1 text run 1 at (10.00,10.00) startOffset 0 endOffset 1 width 10.00: "T"
-        chunk 2 text run 1 at (20.00,10.00) startOffset 1 endOffset 2 width 10.00: "h"
-        chunk 3 text run 1 at (40.00,10.00) startOffset 2 endOffset 14 width 120.00: "is is a test"
+        chunk 2 text run 1 at (20.00,10.00) startOffset 0 endOffset 1 width 10.00: "h"
+        chunk 3 text run 1 at (40.00,10.00) startOffset 1 endOffset 12 width 120.00: "is is a test"
 selection start: position 0 of child 0 {#text} of child 5 {text} of child 0 {svg} of document
 selection end:   position 4 of child 0 {#text} of child 5 {text} of child 0 {svg} of document
diff --git a/LayoutTests/platform/gtk/svg/text/select-x-list-2-expected.txt b/LayoutTests/platform/gtk/svg/text/select-x-list-2-expected.txt
index de67638..19d981d 100644
--- a/LayoutTests/platform/gtk/svg/text/select-x-list-2-expected.txt
+++ b/LayoutTests/platform/gtk/svg/text/select-x-list-2-expected.txt
@@ -7,7 +7,7 @@ layer at (0,0) size 800x600
     RenderSVGText {text} at (10,2) size 150x10 contains 3 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 150x10
         chunk 1 text run 1 at (10.00,10.00) startOffset 0 endOffset 1 width 10.00: "T"
-        chunk 2 text run 1 at (20.00,10.00) startOffset 1 endOffset 2 width 10.00: "h"
-        chunk 3 text run 1 at (40.00,10.00) startOffset 2 endOffset 14 width 120.00: "is is a test"
+        chunk 2 text run 1 at (20.00,10.00) startOffset 0 endOffset 1 width 10.00: "h"
+        chunk 3 text run 1 at (40.00,10.00) startOffset 0 endOffset 12 width 120.00: "is is a test"
 selection start: position 2 of child 0 {#text} of child 5 {text} of child 0 {svg} of document
 selection end:   position 7 of child 0 {#text} of child 5 {text} of child 0 {svg} of document
diff --git a/LayoutTests/platform/gtk/svg/text/select-x-list-3-expected.txt b/LayoutTests/platform/gtk/svg/text/select-x-list-3-expected.txt
index 3d0edc6..59b5550 100644
--- a/LayoutTests/platform/gtk/svg/text/select-x-list-3-expected.txt
+++ b/LayoutTests/platform/gtk/svg/text/select-x-list-3-expected.txt
@@ -7,7 +7,7 @@ layer at (0,0) size 800x600
     RenderSVGText {text} at (10,2) size 150x10 contains 3 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 150x10
         chunk 1 text run 1 at (10.00,10.00) startOffset 0 endOffset 1 width 10.00: "T"
-        chunk 2 text run 1 at (20.00,10.00) startOffset 1 endOffset 2 width 10.00: "h"
-        chunk 3 text run 1 at (40.00,10.00) startOffset 2 endOffset 14 width 120.00: "is is a test"
+        chunk 2 text run 1 at (20.00,10.00) startOffset 0 endOffset 1 width 10.00: "h"
+        chunk 3 text run 1 at (40.00,10.00) startOffset 0 endOffset 12 width 120.00: "is is a test"
 selection start: position 8 of child 0 {#text} of child 5 {text} of child 0 {svg} of document
 selection end:   position 9 of child 0 {#text} of child 5 {text} of child 0 {svg} of document
diff --git a/LayoutTests/platform/gtk/svg/text/select-x-list-4-expected.txt b/LayoutTests/platform/gtk/svg/text/select-x-list-4-expected.txt
index 7ebb698..3d584c9 100644
--- a/LayoutTests/platform/gtk/svg/text/select-x-list-4-expected.txt
+++ b/LayoutTests/platform/gtk/svg/text/select-x-list-4-expected.txt
@@ -7,7 +7,7 @@ layer at (0,0) size 800x600
     RenderSVGText {text} at (10,2) size 150x10 contains 3 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 150x10
         chunk 1 text run 1 at (10.00,10.00) startOffset 0 endOffset 1 width 10.00: "T"
-        chunk 2 text run 1 at (20.00,10.00) startOffset 1 endOffset 2 width 10.00: "h"
-        chunk 3 text run 1 at (40.00,10.00) startOffset 2 endOffset 14 width 120.00: "is is a test"
+        chunk 2 text run 1 at (20.00,10.00) startOffset 0 endOffset 1 width 10.00: "h"
+        chunk 3 text run 1 at (40.00,10.00) startOffset 0 endOffset 12 width 120.00: "is is a test"
 selection start: position 0 of child 0 {#text} of child 5 {text} of child 0 {svg} of document
 selection end:   position 14 of child 0 {#text} of child 5 {text} of child 0 {svg} of document
diff --git a/LayoutTests/platform/gtk/svg/text/select-x-list-with-tspans-1-expected.txt b/LayoutTests/platform/gtk/svg/text/select-x-list-with-tspans-1-expected.txt
index 4bec4a0..a38f2cb 100644
--- a/LayoutTests/platform/gtk/svg/text/select-x-list-with-tspans-1-expected.txt
+++ b/LayoutTests/platform/gtk/svg/text/select-x-list-with-tspans-1-expected.txt
@@ -7,7 +7,7 @@ layer at (0,0) size 800x600
     RenderSVGText {text} at (10,2) size 150x10 contains 3 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 20x10
         chunk 1 text run 1 at (10.00,10.00) startOffset 0 endOffset 1 width 10.00: "T"
-        chunk 2 text run 1 at (20.00,10.00) startOffset 1 endOffset 2 width 10.00: "h"
+        chunk 2 text run 1 at (20.00,10.00) startOffset 0 endOffset 1 width 10.00: "h"
       RenderSVGTSpan {tspan} at (0,0) size 10x10
         RenderSVGInlineText {#text} at (30,0) size 10x10
           chunk 3 text run 1 at (40.00,10.00) startOffset 0 endOffset 1 width 10.00: "i"
diff --git a/LayoutTests/platform/gtk/svg/text/select-x-list-with-tspans-2-expected.txt b/LayoutTests/platform/gtk/svg/text/select-x-list-with-tspans-2-expected.txt
index 5efca98..cf311d6 100644
--- a/LayoutTests/platform/gtk/svg/text/select-x-list-with-tspans-2-expected.txt
+++ b/LayoutTests/platform/gtk/svg/text/select-x-list-with-tspans-2-expected.txt
@@ -7,7 +7,7 @@ layer at (0,0) size 800x600
     RenderSVGText {text} at (10,2) size 150x10 contains 3 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 20x10
         chunk 1 text run 1 at (10.00,10.00) startOffset 0 endOffset 1 width 10.00: "T"
-        chunk 2 text run 1 at (20.00,10.00) startOffset 1 endOffset 2 width 10.00: "h"
+        chunk 2 text run 1 at (20.00,10.00) startOffset 0 endOffset 1 width 10.00: "h"
       RenderSVGTSpan {tspan} at (0,0) size 10x10
         RenderSVGInlineText {#text} at (30,0) size 10x10
           chunk 3 text run 1 at (40.00,10.00) startOffset 0 endOffset 1 width 10.00: "i"
diff --git a/LayoutTests/platform/gtk/svg/text/select-x-list-with-tspans-3-expected.txt b/LayoutTests/platform/gtk/svg/text/select-x-list-with-tspans-3-expected.txt
index 5470fac..b63c600 100644
--- a/LayoutTests/platform/gtk/svg/text/select-x-list-with-tspans-3-expected.txt
+++ b/LayoutTests/platform/gtk/svg/text/select-x-list-with-tspans-3-expected.txt
@@ -7,7 +7,7 @@ layer at (0,0) size 800x600
     RenderSVGText {text} at (10,2) size 150x10 contains 3 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 20x10
         chunk 1 text run 1 at (10.00,10.00) startOffset 0 endOffset 1 width 10.00: "T"
-        chunk 2 text run 1 at (20.00,10.00) startOffset 1 endOffset 2 width 10.00: "h"
+        chunk 2 text run 1 at (20.00,10.00) startOffset 0 endOffset 1 width 10.00: "h"
       RenderSVGTSpan {tspan} at (0,0) size 10x10
         RenderSVGInlineText {#text} at (30,0) size 10x10
           chunk 3 text run 1 at (40.00,10.00) startOffset 0 endOffset 1 width 10.00: "i"
diff --git a/LayoutTests/platform/gtk/svg/text/select-x-list-with-tspans-4-expected.txt b/LayoutTests/platform/gtk/svg/text/select-x-list-with-tspans-4-expected.txt
index 4482afc..4809dd7 100644
--- a/LayoutTests/platform/gtk/svg/text/select-x-list-with-tspans-4-expected.txt
+++ b/LayoutTests/platform/gtk/svg/text/select-x-list-with-tspans-4-expected.txt
@@ -7,7 +7,7 @@ layer at (0,0) size 800x600
     RenderSVGText {text} at (10,2) size 150x10 contains 3 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 20x10
         chunk 1 text run 1 at (10.00,10.00) startOffset 0 endOffset 1 width 10.00: "T"
-        chunk 2 text run 1 at (20.00,10.00) startOffset 1 endOffset 2 width 10.00: "h"
+        chunk 2 text run 1 at (20.00,10.00) startOffset 0 endOffset 1 width 10.00: "h"
       RenderSVGTSpan {tspan} at (0,0) size 10x10
         RenderSVGInlineText {#text} at (30,0) size 10x10
           chunk 3 text run 1 at (40.00,10.00) startOffset 0 endOffset 1 width 10.00: "i"
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/animate-elem-40-t-expected.txt b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/animate-elem-40-t-expected.txt
index 6532154..e53d6b6 100644
--- a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/animate-elem-40-t-expected.txt
+++ b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/animate-elem-40-t-expected.txt
@@ -125,7 +125,7 @@ layer at (0,0) size 480x360
         RenderSVGText {text} at (-35,-49) size 64x40 contains 2 chunk(s)
           RenderSVGInlineText {#text} at (0,0) size 64x40
             chunk 1 text run 1 at (-35.00,-15.00) startOffset 0 endOffset 1 width 22.32: "1"
-            chunk 2 text run 1 at (5.00,-15.00) startOffset 1 endOffset 2 width 23.40: "2"
+            chunk 2 text run 1 at (5.00,-15.00) startOffset 0 endOffset 1 width 23.40: "2"
         RenderSVGContainer {use} at (21,191) size 38x38
           RenderSVGContainer {g} at (21,191) size 38x38 [transform={m=((1.00,0.00)(0.00,1.00)) t=(-20.00,0.00)}]
             RenderSVGContainer {g} at (21,191) size 38x38
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-text-04-t-expected.txt b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-text-04-t-expected.txt
index ff96507..74d2efd 100644
--- a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-text-04-t-expected.txt
+++ b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-text-04-t-expected.txt
@@ -48,9 +48,9 @@ layer at (0,0) size 480x360
         RenderSVGText {text} at (20,-21) size 75x25 contains 4 chunk(s)
           RenderSVGInlineText {#text} at (0,0) size 75x25
             chunk 1 text run 1 at (20.00,0.00) startOffset 0 endOffset 1 width 15.00: "1"
-            chunk 2 text run 1 at (40.00,0.00) startOffset 1 endOffset 2 width 15.00: "2"
-            chunk 3 text run 1 at (60.00,0.00) startOffset 2 endOffset 3 width 15.00: "3"
-            chunk 4 text run 1 at (80.00,0.00) startOffset 3 endOffset 4 width 15.00: "4"
+            chunk 2 text run 1 at (40.00,0.00) startOffset 0 endOffset 1 width 15.00: "2"
+            chunk 3 text run 1 at (60.00,0.00) startOffset 0 endOffset 1 width 15.00: "3"
+            chunk 4 text run 1 at (80.00,0.00) startOffset 0 endOffset 1 width 15.00: "4"
       RenderSVGContainer {g} at (56,99) size 178x25 [transform={m=((1.00,0.00)(0.00,1.00)) t=(130.00,120.00)}]
         RenderSVGText {text} at (-74,-14) size 44x18 contains 1 chunk(s)
           RenderSVGInlineText {#text} at (0,0) size 44x18
@@ -76,9 +76,9 @@ layer at (0,0) size 480x360
         RenderSVGText {text} at (20,-21) size 75x25 contains 4 chunk(s)
           RenderSVGInlineText {#text} at (0,0) size 75x25
             chunk 1 text run 1 at (20.00,0.00) startOffset 0 endOffset 1 width 15.00: "1"
-            chunk 2 text run 1 at (40.00,0.00) startOffset 1 endOffset 2 width 15.00: "2"
-            chunk 3 text run 1 at (60.00,0.00) startOffset 2 endOffset 3 width 15.00: "3"
-            chunk 4 text run 1 at (80.00,0.00) startOffset 3 endOffset 4 width 15.00: "4"
+            chunk 2 text run 1 at (40.00,0.00) startOffset 0 endOffset 1 width 15.00: "2"
+            chunk 3 text run 1 at (60.00,0.00) startOffset 0 endOffset 1 width 15.00: "3"
+            chunk 4 text run 1 at (80.00,0.00) startOffset 0 endOffset 1 width 15.00: "4"
       RenderSVGContainer {g} at (52,139) size 168x25 [transform={m=((1.00,0.00)(0.00,1.00)) t=(130.00,160.00)}]
         RenderSVGText {text} at (-78,-14) size 48x18 contains 1 chunk(s)
           RenderSVGInlineText {#text} at (0,0) size 48x18
@@ -101,8 +101,8 @@ layer at (0,0) size 480x360
         RenderSVGText {text} at (20,-21) size 70x25 contains 3 chunk(s)
           RenderSVGInlineText {#text} at (0,0) size 70x25
             chunk 1 text run 1 at (20.00,0.00) startOffset 0 endOffset 1 width 15.00: "1"
-            chunk 2 text run 1 at (40.00,0.00) startOffset 1 endOffset 2 width 15.00: "2"
-            chunk 3 text run 1 at (60.00,0.00) startOffset 2 endOffset 4 width 30.00: "34"
+            chunk 2 text run 1 at (40.00,0.00) startOffset 0 endOffset 1 width 15.00: "2"
+            chunk 3 text run 1 at (60.00,0.00) startOffset 0 endOffset 2 width 30.00: "34"
       RenderSVGContainer {g} at (73,169) size 117x45 [transform={m=((1.00,0.00)(0.00,1.00)) t=(130.00,200.00)}]
         RenderSVGText {text} at (-57,-14) size 27x18 contains 1 chunk(s)
           RenderSVGInlineText {#text} at (0,0) size 27x18
@@ -183,9 +183,9 @@ layer at (0,0) size 480x360
           RenderSVGText {text} at (20,-31) size 75x45 contains 4 chunk(s)
             RenderSVGInlineText {#text} at (0,0) size 75x45
               chunk 1 text run 1 at (20.00,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-              chunk 2 text run 1 at (40.00,-5.00) startOffset 1 endOffset 2 width 15.00: "2"
-              chunk 3 text run 1 at (60.00,5.00) startOffset 2 endOffset 3 width 15.00: "3"
-              chunk 4 text run 1 at (80.00,10.00) startOffset 3 endOffset 4 width 15.00: "4"
+              chunk 2 text run 1 at (40.00,-5.00) startOffset 0 endOffset 1 width 15.00: "2"
+              chunk 3 text run 1 at (60.00,5.00) startOffset 0 endOffset 1 width 15.00: "3"
+              chunk 4 text run 1 at (80.00,10.00) startOffset 0 endOffset 1 width 15.00: "4"
         RenderSVGContainer {g} at (264,89) size 190x55 [transform={m=((1.00,0.00)(0.00,1.00)) t=(130.00,120.00)}]
           RenderSVGText {text} at (-86,-14) size 56x18 contains 1 chunk(s)
             RenderSVGInlineText {#text} at (0,0) size 56x18
@@ -211,9 +211,9 @@ layer at (0,0) size 480x360
           RenderSVGText {text} at (20,-31) size 75x45 contains 4 chunk(s)
             RenderSVGInlineText {#text} at (0,0) size 75x45
               chunk 1 text run 1 at (20.00,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-              chunk 2 text run 1 at (40.00,-5.00) startOffset 1 endOffset 2 width 15.00: "2"
-              chunk 3 text run 1 at (60.00,5.00) startOffset 2 endOffset 3 width 15.00: "3"
-              chunk 4 text run 1 at (80.00,10.00) startOffset 3 endOffset 4 width 15.00: "4"
+              chunk 2 text run 1 at (40.00,-5.00) startOffset 0 endOffset 1 width 15.00: "2"
+              chunk 3 text run 1 at (60.00,5.00) startOffset 0 endOffset 1 width 15.00: "3"
+              chunk 4 text run 1 at (80.00,10.00) startOffset 0 endOffset 1 width 15.00: "4"
         RenderSVGContainer {g} at (260,129) size 180x40 [transform={m=((1.00,0.00)(0.00,1.00)) t=(130.00,160.00)}]
           RenderSVGText {text} at (-90,-14) size 60x18 contains 1 chunk(s)
             RenderSVGInlineText {#text} at (0,0) size 60x18
@@ -236,8 +236,8 @@ layer at (0,0) size 480x360
           RenderSVGText {text} at (20,-31) size 70x40 contains 3 chunk(s)
             RenderSVGInlineText {#text} at (0,0) size 70x40
               chunk 1 text run 1 at (20.00,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-              chunk 2 text run 1 at (40.00,-5.00) startOffset 1 endOffset 2 width 15.00: "2"
-              chunk 3 text run 1 at (60.00,5.00) startOffset 2 endOffset 4 width 30.00: "34"
+              chunk 2 text run 1 at (40.00,-5.00) startOffset 0 endOffset 1 width 15.00: "2"
+              chunk 3 text run 1 at (60.00,5.00) startOffset 0 endOffset 2 width 30.00: "34"
         RenderSVGContainer {g} at (241,169) size 204x40 [transform={m=((1.00,0.00)(0.00,1.00)) t=(130.00,200.00)}]
           RenderSVGText {text} at (-109,-14) size 79x18 contains 1 chunk(s)
             RenderSVGInlineText {#text} at (0,0) size 79x18
@@ -260,9 +260,9 @@ layer at (0,0) size 480x360
           RenderSVGText {text} at (20,-31) size 75x40 contains 4 chunk(s)
             RenderSVGInlineText {#text} at (0,0) size 75x40
               chunk 1 text run 1 at (20.00,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-              chunk 2 text run 1 at (40.00,-5.00) startOffset 1 endOffset 2 width 15.00: "2"
-              chunk 3 text run 1 at (60.00,5.00) startOffset 2 endOffset 3 width 15.00: "3"
-              chunk 4 text run 1 at (80.00,5.00) startOffset 3 endOffset 4 width 15.00: "4"
+              chunk 2 text run 1 at (40.00,-5.00) startOffset 0 endOffset 1 width 15.00: "2"
+              chunk 3 text run 1 at (60.00,5.00) startOffset 0 endOffset 1 width 15.00: "3"
+              chunk 4 text run 1 at (80.00,5.00) startOffset 0 endOffset 1 width 15.00: "4"
         RenderSVGContainer {g} at (241,209) size 199x45 [transform={m=((1.00,0.00)(0.00,1.00)) t=(130.00,240.00)}]
           RenderSVGText {text} at (-109,-14) size 79x18 contains 1 chunk(s)
             RenderSVGInlineText {#text} at (0,0) size 79x18
@@ -285,8 +285,8 @@ layer at (0,0) size 480x360
           RenderSVGText {text} at (20,-31) size 70x45 contains 3 chunk(s)
             RenderSVGInlineText {#text} at (0,0) size 70x45
               chunk 1 text run 1 at (20.00,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-              chunk 2 text run 1 at (40.00,-5.00) startOffset 1 endOffset 2 width 15.00: "2"
-              chunk 3 text run 1 at (60.00,5.00) startOffset 2 endOffset 4 width 30.00: "34"
+              chunk 2 text run 1 at (40.00,-5.00) startOffset 0 endOffset 1 width 15.00: "2"
+              chunk 3 text run 1 at (60.00,5.00) startOffset 0 endOffset 2 width 30.00: "34"
     RenderSVGText {text} at (10,304) size 284x46 contains 1 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 284x46
         chunk 1 text run 1 at (10.00,340.00) startOffset 0 endOffset 17 width 284.00: "$Revision: 1.13 $"
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-text-05-t-expected.txt b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-text-05-t-expected.txt
index 343524a..5d3e15a 100644
--- a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-text-05-t-expected.txt
+++ b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-text-05-t-expected.txt
@@ -76,9 +76,9 @@ layer at (0,0) size 480x360
           RenderSVGText {text} at (10,51) size 45x11 contains 4 chunk(s)
             RenderSVGInlineText {#text} at (0,0) size 45x11
               chunk 1 text run 1 at (10.00,60.00) startOffset 0 endOffset 1 width 15.00: "1"
-              chunk 2 text run 1 at (20.00,60.00) startOffset 1 endOffset 2 width 15.00: "2"
-              chunk 3 text run 1 at (30.00,60.00) startOffset 2 endOffset 3 width 15.00: "3"
-              chunk 4 text run 1 at (40.00,60.00) startOffset 3 endOffset 4 width 15.00: "4"
+              chunk 2 text run 1 at (20.00,60.00) startOffset 0 endOffset 1 width 15.00: "2"
+              chunk 3 text run 1 at (30.00,60.00) startOffset 0 endOffset 1 width 15.00: "3"
+              chunk 4 text run 1 at (40.00,60.00) startOffset 0 endOffset 1 width 15.00: "4"
           RenderSVGContainer {use} at (156,115) size 8x19
             RenderSVGContainer {g} at (156,115) size 8x19 [transform={m=((1.00,0.00)(0.00,1.00)) t=(10.00,90.00)}]
               RenderSVGContainer {g} at (156,115) size 8x19
@@ -92,7 +92,7 @@ layer at (0,0) size 480x360
           RenderSVGText {text} at (10,81) size 95x11 contains 2 chunk(s)
             RenderSVGInlineText {#text} at (0,0) size 95x11
               chunk 1 text run 1 at (10.00,90.00) startOffset 0 endOffset 1 width 15.00: "1"
-              chunk 2 text run 1 at (60.00,90.00) startOffset 1 endOffset 4 width 45.00: "234"
+              chunk 2 text run 1 at (60.00,90.00) startOffset 0 endOffset 3 width 45.00: "234"
           RenderSVGContainer {g} at (146,135) size 64x39 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,120.00)}]
             RenderSVGContainer {use} at (146,135) size 8x19
               RenderSVGContainer {g} at (146,135) size 8x19 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,-10.00)}]
@@ -141,9 +141,9 @@ layer at (0,0) size 480x360
             RenderSVGText {text} at (10,-19) size 45x31 contains 4 chunk(s)
               RenderSVGInlineText {#text} at (0,0) size 45x31
                 chunk 1 text run 1 at (10.00,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-                chunk 2 text run 1 at (20.00,-5.00) startOffset 1 endOffset 2 width 15.00: "2"
-                chunk 3 text run 1 at (30.00,5.00) startOffset 2 endOffset 3 width 15.00: "3"
-                chunk 4 text run 1 at (40.00,10.00) startOffset 3 endOffset 4 width 15.00: "4"
+                chunk 2 text run 1 at (20.00,-5.00) startOffset 0 endOffset 1 width 15.00: "2"
+                chunk 3 text run 1 at (30.00,5.00) startOffset 0 endOffset 1 width 15.00: "3"
+                chunk 4 text run 1 at (40.00,10.00) startOffset 0 endOffset 1 width 15.00: "4"
           RenderSVGContainer {g} at (156,195) size 59x39 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,180.00)}]
             RenderSVGContainer {use} at (156,195) size 8x19
               RenderSVGContainer {g} at (156,195) size 8x19 [transform={m=((1.00,0.00)(0.00,1.00)) t=(10.00,-10.00)}]
@@ -168,7 +168,7 @@ layer at (0,0) size 480x360
             RenderSVGText {text} at (10,-19) size 55x31 contains 2 chunk(s)
               RenderSVGInlineText {#text} at (0,0) size 55x31
                 chunk 1 text run 1 at (10.00,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-                chunk 2 text run 1 at (20.00,-5.00) startOffset 1 endOffset 4 width 45.00: "234"
+                chunk 2 text run 1 at (20.00,-5.00) startOffset 0 endOffset 3 width 45.00: "234"
           RenderSVGContainer {g} at (146,225) size 64x34 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,210.00)}]
             RenderSVGContainer {use} at (146,225) size 8x19
               RenderSVGContainer {g} at (146,225) size 8x19 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,-10.00)}]
@@ -207,9 +207,9 @@ layer at (0,0) size 480x360
             RenderSVGText {text} at (10,-19) size 45x16 contains 4 chunk(s)
               RenderSVGInlineText {#text} at (0,0) size 45x16
                 chunk 1 text run 1 at (10.00,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-                chunk 2 text run 1 at (20.00,-5.00) startOffset 1 endOffset 2 width 15.00: "2"
-                chunk 3 text run 1 at (30.00,-5.00) startOffset 2 endOffset 3 width 15.00: "3"
-                chunk 4 text run 1 at (40.00,-5.00) startOffset 3 endOffset 4 width 15.00: "4"
+                chunk 2 text run 1 at (20.00,-5.00) startOffset 0 endOffset 1 width 15.00: "2"
+                chunk 3 text run 1 at (30.00,-5.00) startOffset 0 endOffset 1 width 15.00: "3"
+                chunk 4 text run 1 at (40.00,-5.00) startOffset 0 endOffset 1 width 15.00: "4"
           RenderSVGContainer {g} at (156,285) size 99x24 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,270.00)}]
             RenderSVGContainer {use} at (156,285) size 8x19
               RenderSVGContainer {g} at (156,285) size 8x19 [transform={m=((1.00,0.00)(0.00,1.00)) t=(10.00,-10.00)}]
@@ -224,7 +224,7 @@ layer at (0,0) size 480x360
             RenderSVGText {text} at (10,-19) size 95x16 contains 2 chunk(s)
               RenderSVGInlineText {#text} at (0,0) size 95x16
                 chunk 1 text run 1 at (10.00,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-                chunk 2 text run 1 at (60.00,-5.00) startOffset 1 endOffset 4 width 45.00: "234"
+                chunk 2 text run 1 at (60.00,-5.00) startOffset 0 endOffset 3 width 45.00: "234"
       RenderSVGContainer {g} at (214,9) size 119x321 [transform={m=((1.00,0.00)(0.00,1.00)) t=(250.00,40.00)}]
         RenderSVGText {text} at (-36,-31) size 72x18 contains 1 chunk(s)
           RenderSVGInlineText {#text} at (0,0) size 72x18
@@ -262,9 +262,9 @@ layer at (0,0) size 480x360
               RenderSVGText {text} at (2,51) size 46x11 contains 4 chunk(s)
                 RenderSVGInlineText {#text} at (0,0) size 46x11
                   chunk 1 (middle anchor) text run 1 at (2.50,60.00) startOffset 0 endOffset 1 width 15.00: "1"
-                  chunk 2 (middle anchor) text run 1 at (12.50,60.00) startOffset 1 endOffset 2 width 15.00: "2"
-                  chunk 3 (middle anchor) text run 1 at (22.50,60.00) startOffset 2 endOffset 3 width 15.00: "3"
-                  chunk 4 (middle anchor) text run 1 at (32.50,60.00) startOffset 3 endOffset 4 width 15.00: "4"
+                  chunk 2 (middle anchor) text run 1 at (12.50,60.00) startOffset 0 endOffset 1 width 15.00: "2"
+                  chunk 3 (middle anchor) text run 1 at (22.50,60.00) startOffset 0 endOffset 1 width 15.00: "3"
+                  chunk 4 (middle anchor) text run 1 at (32.50,60.00) startOffset 0 endOffset 1 width 15.00: "4"
               RenderSVGContainer {g} at (256,115) size 8x19 [transform={m=((1.00,0.00)(0.00,1.00)) t=(10.00,90.00)}]
                 RenderSVGContainer {g} at (256,115) size 8x19
                   RenderPath {line} at (259,115) size 2x15 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#8888FF]}] [data="M0.00,0.00 L0.00,-15.00"]
@@ -276,7 +276,7 @@ layer at (0,0) size 480x360
               RenderSVGText {text} at (2,81) size 81x11 contains 2 chunk(s)
                 RenderSVGInlineText {#text} at (0,0) size 81x11
                   chunk 1 (middle anchor) text run 1 at (2.50,90.00) startOffset 0 endOffset 1 width 15.00: "1"
-                  chunk 2 (middle anchor) text run 1 at (37.50,90.00) startOffset 1 endOffset 4 width 45.00: "234"
+                  chunk 2 (middle anchor) text run 1 at (37.50,90.00) startOffset 0 endOffset 3 width 45.00: "234"
               RenderSVGContainer {g} at (220,135) size 79x39 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,120.00)}]
                 RenderSVGContainer {g} at (246,135) size 8x19 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,-10.00)}]
                   RenderSVGContainer {g} at (246,135) size 8x19
@@ -317,9 +317,9 @@ layer at (0,0) size 480x360
                 RenderSVGText {text} at (2,-19) size 46x31 contains 4 chunk(s)
                   RenderSVGInlineText {#text} at (0,0) size 46x31
                     chunk 1 (middle anchor) text run 1 at (2.50,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-                    chunk 2 (middle anchor) text run 1 at (12.50,-5.00) startOffset 1 endOffset 2 width 15.00: "2"
-                    chunk 3 (middle anchor) text run 1 at (22.50,5.00) startOffset 2 endOffset 3 width 15.00: "3"
-                    chunk 4 (middle anchor) text run 1 at (32.50,10.00) startOffset 3 endOffset 4 width 15.00: "4"
+                    chunk 2 (middle anchor) text run 1 at (12.50,-5.00) startOffset 0 endOffset 1 width 15.00: "2"
+                    chunk 3 (middle anchor) text run 1 at (22.50,5.00) startOffset 0 endOffset 1 width 15.00: "3"
+                    chunk 4 (middle anchor) text run 1 at (32.50,10.00) startOffset 0 endOffset 1 width 15.00: "4"
               RenderSVGContainer {g} at (247,195) size 57x39 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,180.00)}]
                 RenderSVGContainer {g} at (256,195) size 8x19 [transform={m=((1.00,0.00)(0.00,1.00)) t=(10.00,-10.00)}]
                   RenderSVGContainer {g} at (256,195) size 8x19
@@ -338,9 +338,9 @@ layer at (0,0) size 480x360
                     RenderPath {line} at (299,215) size 2x15 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#8888FF]}] [data="M0.00,0.00 L0.00,-15.00"]
                     RenderPath {rect} at (296,226) size 8x8 [fill={[type=SOLID] [color=#8888FF]}] [data="M-4.00,-4.00 L4.00,-4.00 L4.00,4.00 L-4.00,4.00 Z"]
                 RenderSVGText {text} at (-3,-19) size 46x31 contains 2 chunk(s)
-                  RenderSVGInlineText {#text} at (0,0) size 46x31
+                  RenderSVGInlineText {#text} at (5,0) size 46x31
                     chunk 1 (middle anchor) text run 1 at (2.50,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-                    chunk 2 (middle anchor) text run 1 at (-2.50,-5.00) startOffset 1 endOffset 4 width 45.00: "234"
+                    chunk 2 (middle anchor) text run 1 at (-2.50,-5.00) startOffset 0 endOffset 3 width 45.00: "234"
               RenderSVGContainer {g} at (220,225) size 60x34 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,210.00)}]
                 RenderSVGContainer {g} at (246,225) size 8x19 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,-10.00)}]
                   RenderSVGContainer {g} at (246,225) size 8x19
@@ -373,9 +373,9 @@ layer at (0,0) size 480x360
                 RenderSVGText {text} at (2,-19) size 46x16 contains 4 chunk(s)
                   RenderSVGInlineText {#text} at (0,0) size 46x16
                     chunk 1 (middle anchor) text run 1 at (2.50,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-                    chunk 2 (middle anchor) text run 1 at (12.50,-5.00) startOffset 1 endOffset 2 width 15.00: "2"
-                    chunk 3 (middle anchor) text run 1 at (22.50,-5.00) startOffset 2 endOffset 3 width 15.00: "3"
-                    chunk 4 (middle anchor) text run 1 at (32.50,-5.00) startOffset 3 endOffset 4 width 15.00: "4"
+                    chunk 2 (middle anchor) text run 1 at (12.50,-5.00) startOffset 0 endOffset 1 width 15.00: "2"
+                    chunk 3 (middle anchor) text run 1 at (22.50,-5.00) startOffset 0 endOffset 1 width 15.00: "3"
+                    chunk 4 (middle anchor) text run 1 at (32.50,-5.00) startOffset 0 endOffset 1 width 15.00: "4"
               RenderSVGContainer {g} at (252,285) size 81x24 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,270.00)}]
                 RenderSVGContainer {g} at (256,285) size 8x19 [transform={m=((1.00,0.00)(0.00,1.00)) t=(10.00,-10.00)}]
                   RenderSVGContainer {g} at (256,285) size 8x19
@@ -388,7 +388,7 @@ layer at (0,0) size 480x360
                 RenderSVGText {text} at (2,-19) size 81x16 contains 2 chunk(s)
                   RenderSVGInlineText {#text} at (0,0) size 81x16
                     chunk 1 (middle anchor) text run 1 at (2.50,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-                    chunk 2 (middle anchor) text run 1 at (37.50,-5.00) startOffset 1 endOffset 4 width 45.00: "234"
+                    chunk 2 (middle anchor) text run 1 at (37.50,-5.00) startOffset 0 endOffset 3 width 45.00: "234"
       RenderSVGContainer {g} at (290,9) size 124x321 [transform={m=((1.00,0.00)(0.00,1.00)) t=(350.00,40.00)}]
         RenderSVGText {text} at (-36,-31) size 72x18 contains 1 chunk(s)
           RenderSVGInlineText {#text} at (0,0) size 72x18
@@ -426,9 +426,9 @@ layer at (0,0) size 480x360
               RenderSVGText {text} at (-5,51) size 45x11 contains 4 chunk(s)
                 RenderSVGInlineText {#text} at (0,0) size 45x11
                   chunk 1 (end anchor) text run 1 at (-5.00,60.00) startOffset 0 endOffset 1 width 15.00: "1"
-                  chunk 2 (end anchor) text run 1 at (5.00,60.00) startOffset 1 endOffset 2 width 15.00: "2"
-                  chunk 3 (end anchor) text run 1 at (15.00,60.00) startOffset 2 endOffset 3 width 15.00: "3"
-                  chunk 4 (end anchor) text run 1 at (25.00,60.00) startOffset 3 endOffset 4 width 15.00: "4"
+                  chunk 2 (end anchor) text run 1 at (5.00,60.00) startOffset 0 endOffset 1 width 15.00: "2"
+                  chunk 3 (end anchor) text run 1 at (15.00,60.00) startOffset 0 endOffset 1 width 15.00: "3"
+                  chunk 4 (end anchor) text run 1 at (25.00,60.00) startOffset 0 endOffset 1 width 15.00: "4"
               RenderSVGContainer {g} at (356,115) size 8x19 [transform={m=((1.00,0.00)(0.00,1.00)) t=(10.00,90.00)}]
                 RenderSVGContainer {g} at (356,115) size 8x19
                   RenderPath {line} at (359,115) size 2x15 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#8888FF]}] [data="M0.00,0.00 L0.00,-15.00"]
@@ -440,7 +440,7 @@ layer at (0,0) size 480x360
               RenderSVGText {text} at (-5,81) size 65x11 contains 2 chunk(s)
                 RenderSVGInlineText {#text} at (0,0) size 65x11
                   chunk 1 (end anchor) text run 1 at (-5.00,90.00) startOffset 0 endOffset 1 width 15.00: "1"
-                  chunk 2 (end anchor) text run 1 at (15.00,90.00) startOffset 1 endOffset 4 width 45.00: "234"
+                  chunk 2 (end anchor) text run 1 at (15.00,90.00) startOffset 0 endOffset 3 width 45.00: "234"
               RenderSVGContainer {g} at (290,135) size 109x39 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,120.00)}]
                 RenderSVGContainer {g} at (346,135) size 8x19 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,-10.00)}]
                   RenderSVGContainer {g} at (346,135) size 8x19
@@ -481,9 +481,9 @@ layer at (0,0) size 480x360
                 RenderSVGText {text} at (-5,-19) size 45x31 contains 4 chunk(s)
                   RenderSVGInlineText {#text} at (0,0) size 45x31
                     chunk 1 (end anchor) text run 1 at (-5.00,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-                    chunk 2 (end anchor) text run 1 at (5.00,-5.00) startOffset 1 endOffset 2 width 15.00: "2"
-                    chunk 3 (end anchor) text run 1 at (15.00,5.00) startOffset 2 endOffset 3 width 15.00: "3"
-                    chunk 4 (end anchor) text run 1 at (25.00,10.00) startOffset 3 endOffset 4 width 15.00: "4"
+                    chunk 2 (end anchor) text run 1 at (5.00,-5.00) startOffset 0 endOffset 1 width 15.00: "2"
+                    chunk 3 (end anchor) text run 1 at (15.00,5.00) startOffset 0 endOffset 1 width 15.00: "3"
+                    chunk 4 (end anchor) text run 1 at (25.00,10.00) startOffset 0 endOffset 1 width 15.00: "4"
               RenderSVGContainer {g} at (325,195) size 79x39 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,180.00)}]
                 RenderSVGContainer {g} at (356,195) size 8x19 [transform={m=((1.00,0.00)(0.00,1.00)) t=(10.00,-10.00)}]
                   RenderSVGContainer {g} at (356,195) size 8x19
@@ -502,9 +502,9 @@ layer at (0,0) size 480x360
                     RenderPath {line} at (399,215) size 2x15 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#8888FF]}] [data="M0.00,0.00 L0.00,-15.00"]
                     RenderPath {rect} at (396,226) size 8x8 [fill={[type=SOLID] [color=#8888FF]}] [data="M-4.00,-4.00 L4.00,-4.00 L4.00,4.00 L-4.00,4.00 Z"]
                 RenderSVGText {text} at (-25,-19) size 45x31 contains 2 chunk(s)
-                  RenderSVGInlineText {#text} at (0,0) size 45x31
+                  RenderSVGInlineText {#text} at (20,0) size 45x31
                     chunk 1 (end anchor) text run 1 at (-5.00,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-                    chunk 2 (end anchor) text run 1 at (-25.00,-5.00) startOffset 1 endOffset 4 width 45.00: "234"
+                    chunk 2 (end anchor) text run 1 at (-25.00,-5.00) startOffset 0 endOffset 3 width 45.00: "234"
               RenderSVGContainer {g} at (290,225) size 79x34 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,210.00)}]
                 RenderSVGContainer {g} at (346,225) size 8x19 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,-10.00)}]
                   RenderSVGContainer {g} at (346,225) size 8x19
@@ -537,9 +537,9 @@ layer at (0,0) size 480x360
                 RenderSVGText {text} at (-5,-19) size 45x16 contains 4 chunk(s)
                   RenderSVGInlineText {#text} at (0,0) size 45x16
                     chunk 1 (end anchor) text run 1 at (-5.00,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-                    chunk 2 (end anchor) text run 1 at (5.00,-5.00) startOffset 1 endOffset 2 width 15.00: "2"
-                    chunk 3 (end anchor) text run 1 at (15.00,-5.00) startOffset 2 endOffset 3 width 15.00: "3"
-                    chunk 4 (end anchor) text run 1 at (25.00,-5.00) startOffset 3 endOffset 4 width 15.00: "4"
+                    chunk 2 (end anchor) text run 1 at (5.00,-5.00) startOffset 0 endOffset 1 width 15.00: "2"
+                    chunk 3 (end anchor) text run 1 at (15.00,-5.00) startOffset 0 endOffset 1 width 15.00: "3"
+                    chunk 4 (end anchor) text run 1 at (25.00,-5.00) startOffset 0 endOffset 1 width 15.00: "4"
               RenderSVGContainer {g} at (345,285) size 69x24 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,270.00)}]
                 RenderSVGContainer {g} at (356,285) size 8x19 [transform={m=((1.00,0.00)(0.00,1.00)) t=(10.00,-10.00)}]
                   RenderSVGContainer {g} at (356,285) size 8x19
@@ -552,7 +552,7 @@ layer at (0,0) size 480x360
                 RenderSVGText {text} at (-5,-19) size 65x16 contains 2 chunk(s)
                   RenderSVGInlineText {#text} at (0,0) size 65x16
                     chunk 1 (end anchor) text run 1 at (-5.00,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-                    chunk 2 (end anchor) text run 1 at (15.00,-5.00) startOffset 1 endOffset 4 width 45.00: "234"
+                    chunk 2 (end anchor) text run 1 at (15.00,-5.00) startOffset 0 endOffset 3 width 45.00: "234"
     RenderSVGText {text} at (10,314) size 264x46 contains 1 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 264x46
         chunk 1 text run 1 at (10.00,350.00) startOffset 0 endOffset 16 width 264.00: "$Revision: 1.8 $"
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-text-06-t-expected.txt b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-text-06-t-expected.txt
index eff2e81..4c2244c 100644
--- a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-text-06-t-expected.txt
+++ b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-text-06-t-expected.txt
@@ -53,10 +53,10 @@ layer at (0,0) size 480x360
           RenderSVGText {text} at (10,-9) size 135x11 contains 5 chunk(s)
             RenderSVGInlineText {#text} at (0,0) size 135x11
               chunk 1 text run 1 at (10.00,0.00) startOffset 0 endOffset 2 width 15.00: "fi"
-              chunk 2 text run 1 at (40.00,0.00) startOffset 2 endOffset 3 width 15.00: "1"
-              chunk 3 text run 1 at (70.00,0.00) startOffset 3 endOffset 4 width 15.00: "2"
-              chunk 4 text run 1 at (100.00,0.00) startOffset 4 endOffset 5 width 15.00: "3"
-              chunk 5 text run 1 at (130.00,0.00) startOffset 5 endOffset 6 width 15.00: "4"
+              chunk 2 text run 1 at (40.00,0.00) startOffset 0 endOffset 1 width 15.00: "1"
+              chunk 3 text run 1 at (70.00,0.00) startOffset 0 endOffset 1 width 15.00: "2"
+              chunk 4 text run 1 at (100.00,0.00) startOffset 0 endOffset 1 width 15.00: "3"
+              chunk 5 text run 1 at (130.00,0.00) startOffset 0 endOffset 1 width 15.00: "4"
         RenderSVGContainer {g} at (116,85) size 79x79 [transform={m=((1.00,0.00)(0.00,1.00)) t=(100.00,80.00)}]
           RenderSVGContainer {use} at (116,85) size 8x19
             RenderSVGContainer {g} at (116,85) size 8x19 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,-10.00)}]
@@ -125,10 +125,10 @@ layer at (0,0) size 480x360
           RenderSVGText {text} at (10,-19) size 135x51 contains 5 chunk(s)
             RenderSVGInlineText {#text} at (0,0) size 135x51
               chunk 1 text run 1 at (10.00,-10.00) startOffset 0 endOffset 2 width 15.00: "fi"
-              chunk 2 text run 1 at (40.00,0.00) startOffset 2 endOffset 3 width 15.00: "1"
-              chunk 3 text run 1 at (70.00,10.00) startOffset 3 endOffset 4 width 15.00: "2"
-              chunk 4 text run 1 at (100.00,20.00) startOffset 4 endOffset 5 width 15.00: "3"
-              chunk 5 text run 1 at (130.00,30.00) startOffset 5 endOffset 6 width 15.00: "4"
+              chunk 2 text run 1 at (40.00,0.00) startOffset 0 endOffset 1 width 15.00: "1"
+              chunk 3 text run 1 at (70.00,10.00) startOffset 0 endOffset 1 width 15.00: "2"
+              chunk 4 text run 1 at (100.00,20.00) startOffset 0 endOffset 1 width 15.00: "3"
+              chunk 5 text run 1 at (130.00,30.00) startOffset 0 endOffset 1 width 15.00: "4"
     RenderSVGText {text} at (10,304) size 264x46 contains 1 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 264x46
         chunk 1 text run 1 at (10.00,340.00) startOffset 0 endOffset 16 width 264.00: "$Revision: 1.9 $"
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-text-07-t-expected.txt b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-text-07-t-expected.txt
index dbed722..abd1dd1 100644
--- a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-text-07-t-expected.txt
+++ b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-text-07-t-expected.txt
@@ -6,30 +6,30 @@ layer at (0,0) size 480x360
       RenderSVGText {text} at (240,29) size 179x180 contains 7 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 179x180
           chunk 1 text run 1 at (240.00,60.00) startOffset 0 endOffset 1 width 31.00: "M"
-          chunk 2 text run 1 at (260.00,80.00) startOffset 1 endOffset 2 width 18.00: "u"
-          chunk 3 text run 1 at (280.00,100.00) startOffset 2 endOffset 3 width 10.00: "l"
-          chunk 4 text run 1 at (300.00,120.00) startOffset 3 endOffset 4 width 10.00: "t"
-          chunk 5 text run 1 at (320.00,140.00) startOffset 4 endOffset 5 width 10.00: "i"
-          chunk 6 text run 1 at (340.00,160.00) startOffset 5 endOffset 6 width 9.00: " "
-          chunk 7 text run 1 at (360.00,180.00) startOffset 6 endOffset 9 width 59.00: "X Y"
+          chunk 2 text run 1 at (260.00,80.00) startOffset 0 endOffset 1 width 18.00: "u"
+          chunk 3 text run 1 at (280.00,100.00) startOffset 0 endOffset 1 width 10.00: "l"
+          chunk 4 text run 1 at (300.00,120.00) startOffset 0 endOffset 1 width 10.00: "t"
+          chunk 5 text run 1 at (320.00,140.00) startOffset 0 endOffset 1 width 10.00: "i"
+          chunk 6 text run 1 at (340.00,160.00) startOffset 0 endOffset 1 width 9.00: " "
+          chunk 7 text run 1 at (360.00,180.00) startOffset 0 endOffset 3 width 59.00: "X Y"
       RenderSVGText {text} at (10,29) size 153x53 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 153x53
           chunk 1 text run 1 at (10.00,60.00) startOffset 0 endOffset 6 width 136.00: "ROTATE"
       RenderSVGText {text} at (10,165) size 248x144 contains 13 chunk(s)
-        RenderSVGInlineText {#text} at (0,0) size 248x144
+        RenderSVGInlineText {#text} at (0,104) size 248x144
           chunk 1 text run 1 at (10.00,300.00) startOffset 0 endOffset 1 width 23.00: "B"
-          chunk 2 text run 1 at (30.00,290.00) startOffset 1 endOffset 2 width 18.00: "o"
-          chunk 3 text run 1 at (50.00,280.00) startOffset 2 endOffset 3 width 10.00: "t"
-          chunk 4 text run 1 at (70.00,270.00) startOffset 3 endOffset 4 width 18.00: "h"
-          chunk 5 text run 1 at (90.00,260.00) startOffset 4 endOffset 5 width 9.00: " "
-          chunk 6 text run 1 at (110.00,250.00) startOffset 5 endOffset 6 width 21.00: "T"
-          chunk 7 text run 1 at (130.00,240.00) startOffset 6 endOffset 7 width 18.00: "o"
-          chunk 8 text run 1 at (150.00,230.00) startOffset 7 endOffset 8 width 18.00: "g"
-          chunk 9 text run 1 at (170.00,220.00) startOffset 8 endOffset 9 width 16.00: "e"
-          chunk 10 text run 1 at (190.00,210.00) startOffset 9 endOffset 10 width 10.00: "t"
-          chunk 11 text run 1 at (210.00,200.00) startOffset 10 endOffset 11 width 18.00: "h"
-          chunk 12 text run 1 at (230.00,190.00) startOffset 11 endOffset 12 width 16.00: "e"
-          chunk 13 text run 1 at (250.00,180.00) startOffset 12 endOffset 13 width 12.00: "r"
+          chunk 2 text run 1 at (30.00,290.00) startOffset 0 endOffset 1 width 18.00: "o"
+          chunk 3 text run 1 at (50.00,280.00) startOffset 0 endOffset 1 width 10.00: "t"
+          chunk 4 text run 1 at (70.00,270.00) startOffset 0 endOffset 1 width 18.00: "h"
+          chunk 5 text run 1 at (90.00,260.00) startOffset 0 endOffset 1 width 9.00: " "
+          chunk 6 text run 1 at (110.00,250.00) startOffset 0 endOffset 1 width 21.00: "T"
+          chunk 7 text run 1 at (130.00,240.00) startOffset 0 endOffset 1 width 18.00: "o"
+          chunk 8 text run 1 at (150.00,230.00) startOffset 0 endOffset 1 width 18.00: "g"
+          chunk 9 text run 1 at (170.00,220.00) startOffset 0 endOffset 1 width 16.00: "e"
+          chunk 10 text run 1 at (190.00,210.00) startOffset 0 endOffset 1 width 10.00: "t"
+          chunk 11 text run 1 at (210.00,200.00) startOffset 0 endOffset 1 width 18.00: "h"
+          chunk 12 text run 1 at (230.00,190.00) startOffset 0 endOffset 1 width 16.00: "e"
+          chunk 13 text run 1 at (250.00,180.00) startOffset 0 endOffset 1 width 12.00: "r"
     RenderSVGText {text} at (10,304) size 264x46 contains 1 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 264x46
         chunk 1 text run 1 at (10.00,340.00) startOffset 0 endOffset 16 width 264.00: "$Revision: 1.8 $"
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-tspan-01-b-expected.txt b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-tspan-01-b-expected.txt
index a97e69d..5f946e7 100644
--- a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-tspan-01-b-expected.txt
+++ b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/text-tspan-01-b-expected.txt
@@ -50,21 +50,21 @@ layer at (0,0) size 480x360
           RenderSVGTSpan {tspan} at (0,0) size 145x17
             RenderSVGInlineText {#text} at (0,0) size 145x17
               chunk 1 text run 1 at (35.00,200.00) startOffset 0 endOffset 1 width 12.00: "C"
-              chunk 2 text run 1 at (53.75,200.00) startOffset 1 endOffset 2 width 9.00: "u"
-              chunk 3 text run 1 at (72.50,200.00) startOffset 2 endOffset 3 width 4.00: "t"
-              chunk 4 text run 1 at (91.25,200.00) startOffset 3 endOffset 4 width 9.00: "e"
-              chunk 5 text run 1 at (110.50,200.00) startOffset 4 endOffset 5 width 4.00: " "
-              chunk 6 text run 1 at (128.75,200.00) startOffset 5 endOffset 6 width 9.00: "a"
-              chunk 7 text run 1 at (147.50,200.00) startOffset 6 endOffset 7 width 9.00: "n"
-              chunk 8 text run 1 at (166.25,200.00) startOffset 7 endOffset 9 width 13.00: "d "
+              chunk 2 text run 1 at (53.75,200.00) startOffset 0 endOffset 1 width 9.00: "u"
+              chunk 3 text run 1 at (72.50,200.00) startOffset 0 endOffset 1 width 4.00: "t"
+              chunk 4 text run 1 at (91.25,200.00) startOffset 0 endOffset 1 width 9.00: "e"
+              chunk 5 text run 1 at (110.50,200.00) startOffset 0 endOffset 1 width 4.00: " "
+              chunk 6 text run 1 at (128.75,200.00) startOffset 0 endOffset 1 width 9.00: "a"
+              chunk 7 text run 1 at (147.50,200.00) startOffset 0 endOffset 1 width 9.00: "n"
+              chunk 8 text run 1 at (166.25,200.00) startOffset 0 endOffset 2 width 13.00: "d "
           RenderSVGInlineText {#text} at (0,0) size 0x0
           RenderSVGTSpan {tspan} at (0,0) size 88x18
             RenderSVGInlineText {#text} at (28,30) size 88x18
               chunk 9 text run 1 at (63.13,230.50) startOffset 0 endOffset 1 width 4.00: "f"
-              chunk 10 text run 1 at (81.88,230.50) startOffset 1 endOffset 2 width 9.00: "u"
-              chunk 11 text run 1 at (100.63,230.50) startOffset 2 endOffset 3 width 8.00: "z"
-              chunk 12 text run 1 at (119.38,230.50) startOffset 3 endOffset 4 width 8.00: "z"
-              chunk 13 text run 1 at (138.13,230.50) startOffset 4 endOffset 6 width 12.00: "y."
+              chunk 10 text run 1 at (81.88,230.50) startOffset 0 endOffset 1 width 9.00: "u"
+              chunk 11 text run 1 at (100.63,230.50) startOffset 0 endOffset 1 width 8.00: "z"
+              chunk 12 text run 1 at (119.38,230.50) startOffset 0 endOffset 1 width 8.00: "z"
+              chunk 13 text run 1 at (138.13,230.50) startOffset 0 endOffset 2 width 12.00: "y."
           RenderSVGInlineText {#text} at (0,0) size 0x0
         RenderPath {rect} at (17,244) size 337x55 [stroke={[type=SOLID] [color=#000000]}] [data="M17.50,244.75 L353.00,244.75 L353.00,298.25 L17.50,298.25 Z"]
         RenderSVGText {text} at (25,244) size 162x17 contains 1 chunk(s)
diff --git a/LayoutTests/platform/mac/svg/batik/text/textAnchor2-expected.txt b/LayoutTests/platform/mac/svg/batik/text/textAnchor2-expected.txt
index 3a9ef42..aa152bc 100644
--- a/LayoutTests/platform/mac/svg/batik/text/textAnchor2-expected.txt
+++ b/LayoutTests/platform/mac/svg/batik/text/textAnchor2-expected.txt
@@ -48,26 +48,26 @@ layer at (0,0) size 450x500
         RenderSVGTSpan {tspan} at (0,0) size 168x18
           RenderSVGInlineText {#text} at (0,0) size 168x18
             chunk 1 text run 1 at (0.00,0.00) startOffset 0 endOffset 1 width 11.00: "B"
-            chunk 2 text run 1 at (40.00,0.00) startOffset 1 endOffset 2 width 7.00: "a"
-            chunk 3 text run 1 at (80.00,0.00) startOffset 2 endOffset 3 width 4.00: "t"
-            chunk 4 text run 1 at (120.00,0.00) startOffset 3 endOffset 4 width 4.00: "i"
-            chunk 5 text run 1 at (160.00,0.00) startOffset 4 endOffset 5 width 8.00: "k"
+            chunk 2 text run 1 at (40.00,0.00) startOffset 0 endOffset 1 width 7.00: "a"
+            chunk 3 text run 1 at (80.00,0.00) startOffset 0 endOffset 1 width 4.00: "t"
+            chunk 4 text run 1 at (120.00,0.00) startOffset 0 endOffset 1 width 4.00: "i"
+            chunk 5 text run 1 at (160.00,0.00) startOffset 0 endOffset 1 width 8.00: "k"
       RenderSVGText {text} at (-6,-14) size 170x18 contains 5 chunk(s)
         RenderSVGTSpan {tspan} at (0,0) size 170x18
           RenderSVGInlineText {#text} at (0,0) size 170x18
             chunk 1 (middle anchor) text run 1 at (-5.50,0.00) startOffset 0 endOffset 1 width 11.00: "B"
-            chunk 2 (middle anchor) text run 1 at (36.50,0.00) startOffset 1 endOffset 2 width 7.00: "a"
-            chunk 3 (middle anchor) text run 1 at (78.00,0.00) startOffset 2 endOffset 3 width 4.00: "t"
-            chunk 4 (middle anchor) text run 1 at (118.00,0.00) startOffset 3 endOffset 4 width 4.00: "i"
-            chunk 5 (middle anchor) text run 1 at (156.00,0.00) startOffset 4 endOffset 5 width 8.00: "k"
+            chunk 2 (middle anchor) text run 1 at (36.50,0.00) startOffset 0 endOffset 1 width 7.00: "a"
+            chunk 3 (middle anchor) text run 1 at (78.00,0.00) startOffset 0 endOffset 1 width 4.00: "t"
+            chunk 4 (middle anchor) text run 1 at (118.00,0.00) startOffset 0 endOffset 1 width 4.00: "i"
+            chunk 5 (middle anchor) text run 1 at (156.00,0.00) startOffset 0 endOffset 1 width 8.00: "k"
       RenderSVGText {text} at (-11,-14) size 171x18 contains 5 chunk(s)
         RenderSVGTSpan {tspan} at (0,0) size 171x18
           RenderSVGInlineText {#text} at (0,0) size 171x18
             chunk 1 (end anchor) text run 1 at (-11.00,0.00) startOffset 0 endOffset 1 width 11.00: "B"
-            chunk 2 (end anchor) text run 1 at (33.00,0.00) startOffset 1 endOffset 2 width 7.00: "a"
-            chunk 3 (end anchor) text run 1 at (76.00,0.00) startOffset 2 endOffset 3 width 4.00: "t"
-            chunk 4 (end anchor) text run 1 at (116.00,0.00) startOffset 3 endOffset 4 width 4.00: "i"
-            chunk 5 (end anchor) text run 1 at (152.00,0.00) startOffset 4 endOffset 5 width 8.00: "k"
+            chunk 2 (end anchor) text run 1 at (33.00,0.00) startOffset 0 endOffset 1 width 7.00: "a"
+            chunk 3 (end anchor) text run 1 at (76.00,0.00) startOffset 0 endOffset 1 width 4.00: "t"
+            chunk 4 (end anchor) text run 1 at (116.00,0.00) startOffset 0 endOffset 1 width 4.00: "i"
+            chunk 5 (end anchor) text run 1 at (152.00,0.00) startOffset 0 endOffset 1 width 8.00: "k"
       RenderSVGText {text} at (0,-14) size 34x28 contains 1 chunk(s)
         RenderSVGTSpan {tspan} at (0,0) size 34x28
           RenderSVGInlineText {#text} at (0,0) size 34x28
@@ -84,23 +84,23 @@ layer at (0,0) size 450x500
         RenderSVGTSpan {tspan} at (0,0) size 168x28
           RenderSVGInlineText {#text} at (0,0) size 168x28
             chunk 1 text run 1 at (0.00,0.00) startOffset 0 endOffset 1 width 11.00: "B"
-            chunk 2 text run 1 at (40.00,10.00) startOffset 1 endOffset 2 width 7.00: "a"
-            chunk 3 text run 1 at (80.00,0.00) startOffset 2 endOffset 3 width 4.00: "t"
-            chunk 4 text run 1 at (120.00,10.00) startOffset 3 endOffset 4 width 4.00: "i"
-            chunk 5 text run 1 at (160.00,0.00) startOffset 4 endOffset 5 width 8.00: "k"
+            chunk 2 text run 1 at (40.00,10.00) startOffset 0 endOffset 1 width 7.00: "a"
+            chunk 3 text run 1 at (80.00,0.00) startOffset 0 endOffset 1 width 4.00: "t"
+            chunk 4 text run 1 at (120.00,10.00) startOffset 0 endOffset 1 width 4.00: "i"
+            chunk 5 text run 1 at (160.00,0.00) startOffset 0 endOffset 1 width 8.00: "k"
       RenderSVGText {text} at (-6,-14) size 170x28 contains 5 chunk(s)
         RenderSVGTSpan {tspan} at (0,0) size 170x28
           RenderSVGInlineText {#text} at (0,0) size 170x28
             chunk 1 (middle anchor) text run 1 at (-5.50,0.00) startOffset 0 endOffset 1 width 11.00: "B"
-            chunk 2 (middle anchor) text run 1 at (36.50,10.00) startOffset 1 endOffset 2 width 7.00: "a"
-            chunk 3 (middle anchor) text run 1 at (78.00,0.00) startOffset 2 endOffset 3 width 4.00: "t"
-            chunk 4 (middle anchor) text run 1 at (118.00,10.00) startOffset 3 endOffset 4 width 4.00: "i"
-            chunk 5 (middle anchor) text run 1 at (156.00,0.00) startOffset 4 endOffset 5 width 8.00: "k"
+            chunk 2 (middle anchor) text run 1 at (36.50,10.00) startOffset 0 endOffset 1 width 7.00: "a"
+            chunk 3 (middle anchor) text run 1 at (78.00,0.00) startOffset 0 endOffset 1 width 4.00: "t"
+            chunk 4 (middle anchor) text run 1 at (118.00,10.00) startOffset 0 endOffset 1 width 4.00: "i"
+            chunk 5 (middle anchor) text run 1 at (156.00,0.00) startOffset 0 endOffset 1 width 8.00: "k"
       RenderSVGText {text} at (-11,-14) size 171x28 contains 5 chunk(s)
         RenderSVGTSpan {tspan} at (0,0) size 171x28
           RenderSVGInlineText {#text} at (0,0) size 171x28
             chunk 1 (end anchor) text run 1 at (-11.00,0.00) startOffset 0 endOffset 1 width 11.00: "B"
-            chunk 2 (end anchor) text run 1 at (33.00,10.00) startOffset 1 endOffset 2 width 7.00: "a"
-            chunk 3 (end anchor) text run 1 at (76.00,0.00) startOffset 2 endOffset 3 width 4.00: "t"
-            chunk 4 (end anchor) text run 1 at (116.00,10.00) startOffset 3 endOffset 4 width 4.00: "i"
-            chunk 5 (end anchor) text run 1 at (152.00,0.00) startOffset 4 endOffset 5 width 8.00: "k"
+            chunk 2 (end anchor) text run 1 at (33.00,10.00) startOffset 0 endOffset 1 width 7.00: "a"
+            chunk 3 (end anchor) text run 1 at (76.00,0.00) startOffset 0 endOffset 1 width 4.00: "t"
+            chunk 4 (end anchor) text run 1 at (116.00,10.00) startOffset 0 endOffset 1 width 4.00: "i"
+            chunk 5 (end anchor) text run 1 at (152.00,0.00) startOffset 0 endOffset 1 width 8.00: "k"
diff --git a/LayoutTests/platform/mac/svg/batik/text/textAnchor3-expected.txt b/LayoutTests/platform/mac/svg/batik/text/textAnchor3-expected.txt
index e255ac9..5d13339 100644
--- a/LayoutTests/platform/mac/svg/batik/text/textAnchor3-expected.txt
+++ b/LayoutTests/platform/mac/svg/batik/text/textAnchor3-expected.txt
@@ -49,10 +49,10 @@ layer at (0,0) size 450x500
         RenderSVGTSpan {tspan} at (0,0) size 168x28
           RenderSVGInlineText {#text} at (0,0) size 168x28
             chunk 1 text run 1 at (0.00,0.00) startOffset 0 endOffset 1 width 11.00: "B"
-            chunk 2 text run 1 at (40.00,0.00) startOffset 1 endOffset 2 width 7.00: "a"
-            chunk 3 text run 1 at (80.00,0.00) startOffset 2 endOffset 3 width 4.00: "t"
-            chunk 4 text run 1 at (120.00,0.00) startOffset 3 endOffset 4 width 4.00: "i"
-            chunk 5 text run 1 at (160.00,10.00) startOffset 4 endOffset 5 width 8.00: "k"
+            chunk 2 text run 1 at (40.00,0.00) startOffset 0 endOffset 1 width 7.00: "a"
+            chunk 3 text run 1 at (80.00,0.00) startOffset 0 endOffset 1 width 4.00: "t"
+            chunk 4 text run 1 at (120.00,0.00) startOffset 0 endOffset 1 width 4.00: "i"
+            chunk 5 text run 1 at (160.00,10.00) startOffset 0 endOffset 1 width 8.00: "k"
         RenderSVGTSpan {tspan} at (0,0) size 39x18
           RenderSVGInlineText {#text} at (168,10) size 39x18
             chunk 5 text run 2 at (168.00,10.00) startOffset 0 endOffset 7 width 39.00: " rules!"
@@ -60,10 +60,10 @@ layer at (0,0) size 450x500
         RenderSVGTSpan {tspan} at (0,0) size 151x28
           RenderSVGInlineText {#text} at (0,0) size 151x28
             chunk 1 (middle anchor) text run 1 at (-5.50,0.00) startOffset 0 endOffset 1 width 11.00: "B"
-            chunk 2 (middle anchor) text run 1 at (36.50,0.00) startOffset 1 endOffset 2 width 7.00: "a"
-            chunk 3 (middle anchor) text run 1 at (78.00,0.00) startOffset 2 endOffset 3 width 4.00: "t"
-            chunk 4 (middle anchor) text run 1 at (118.00,0.00) startOffset 3 endOffset 4 width 4.00: "i"
-            chunk 5 (middle anchor) text run 1 at (136.50,10.00) startOffset 4 endOffset 5 width 8.00: "k"
+            chunk 2 (middle anchor) text run 1 at (36.50,0.00) startOffset 0 endOffset 1 width 7.00: "a"
+            chunk 3 (middle anchor) text run 1 at (78.00,0.00) startOffset 0 endOffset 1 width 4.00: "t"
+            chunk 4 (middle anchor) text run 1 at (118.00,0.00) startOffset 0 endOffset 1 width 4.00: "i"
+            chunk 5 (middle anchor) text run 1 at (136.50,10.00) startOffset 0 endOffset 1 width 8.00: "k"
         RenderSVGTSpan {tspan} at (0,0) size 40x18
           RenderSVGInlineText {#text} at (150,10) size 40x18
             chunk 5 (middle anchor) text run 2 at (144.50,10.00) startOffset 0 endOffset 7 width 39.00: " rules!"
@@ -71,10 +71,10 @@ layer at (0,0) size 450x500
         RenderSVGTSpan {tspan} at (0,0) size 132x28
           RenderSVGInlineText {#text} at (0,0) size 132x28
             chunk 1 (end anchor) text run 1 at (-11.00,0.00) startOffset 0 endOffset 1 width 11.00: "B"
-            chunk 2 (end anchor) text run 1 at (33.00,0.00) startOffset 1 endOffset 2 width 7.00: "a"
-            chunk 3 (end anchor) text run 1 at (76.00,0.00) startOffset 2 endOffset 3 width 4.00: "t"
-            chunk 4 (end anchor) text run 1 at (116.00,0.00) startOffset 3 endOffset 4 width 4.00: "i"
-            chunk 5 (end anchor) text run 1 at (113.00,10.00) startOffset 4 endOffset 5 width 8.00: "k"
+            chunk 2 (end anchor) text run 1 at (33.00,0.00) startOffset 0 endOffset 1 width 7.00: "a"
+            chunk 3 (end anchor) text run 1 at (76.00,0.00) startOffset 0 endOffset 1 width 4.00: "t"
+            chunk 4 (end anchor) text run 1 at (116.00,0.00) startOffset 0 endOffset 1 width 4.00: "i"
+            chunk 5 (end anchor) text run 1 at (113.00,10.00) startOffset 0 endOffset 1 width 8.00: "k"
         RenderSVGTSpan {tspan} at (0,0) size 39x18
           RenderSVGInlineText {#text} at (132,10) size 39x18
             chunk 5 (end anchor) text run 2 at (121.00,10.00) startOffset 0 endOffset 7 width 39.00: " rules!"
@@ -82,27 +82,27 @@ layer at (0,0) size 450x500
         RenderSVGTSpan {tspan} at (0,0) size 96x18
           RenderSVGInlineText {#text} at (0,0) size 96x18
             chunk 1 text run 1 at (0.00,0.00) startOffset 0 endOffset 1 width 11.00: "B"
-            chunk 2 text run 1 at (40.00,0.00) startOffset 1 endOffset 2 width 7.00: "a"
-            chunk 3 text run 1 at (80.00,0.00) startOffset 2 endOffset 5 width 16.00: "tik"
+            chunk 2 text run 1 at (40.00,0.00) startOffset 0 endOffset 1 width 7.00: "a"
+            chunk 3 text run 1 at (80.00,0.00) startOffset 0 endOffset 3 width 16.00: "tik"
       RenderSVGText {text} at (-6,-14) size 94x18 contains 3 chunk(s)
         RenderSVGTSpan {tspan} at (0,0) size 94x18
           RenderSVGInlineText {#text} at (0,0) size 94x18
             chunk 1 (middle anchor) text run 1 at (-5.50,0.00) startOffset 0 endOffset 1 width 11.00: "B"
-            chunk 2 (middle anchor) text run 1 at (36.50,0.00) startOffset 1 endOffset 2 width 7.00: "a"
-            chunk 3 (middle anchor) text run 1 at (72.00,0.00) startOffset 2 endOffset 5 width 16.00: "tik"
+            chunk 2 (middle anchor) text run 1 at (36.50,0.00) startOffset 0 endOffset 1 width 7.00: "a"
+            chunk 3 (middle anchor) text run 1 at (72.00,0.00) startOffset 0 endOffset 3 width 16.00: "tik"
       RenderSVGText {text} at (-11,-14) size 91x18 contains 3 chunk(s)
         RenderSVGTSpan {tspan} at (0,0) size 91x18
           RenderSVGInlineText {#text} at (0,0) size 91x18
             chunk 1 (end anchor) text run 1 at (-11.00,0.00) startOffset 0 endOffset 1 width 11.00: "B"
-            chunk 2 (end anchor) text run 1 at (33.00,0.00) startOffset 1 endOffset 2 width 7.00: "a"
-            chunk 3 (end anchor) text run 1 at (64.00,0.00) startOffset 2 endOffset 5 width 16.00: "tik"
+            chunk 2 (end anchor) text run 1 at (33.00,0.00) startOffset 0 endOffset 1 width 7.00: "a"
+            chunk 3 (end anchor) text run 1 at (64.00,0.00) startOffset 0 endOffset 3 width 16.00: "tik"
       RenderSVGText {text} at (0,-14) size 171x28 contains 4 chunk(s)
         RenderSVGTSpan {tspan} at (0,0) size 132x28
           RenderSVGInlineText {#text} at (0,0) size 132x28
             chunk 1 text run 1 at (0.00,0.00) startOffset 0 endOffset 1 width 11.00: "B"
-            chunk 2 text run 1 at (40.00,10.00) startOffset 1 endOffset 2 width 7.00: "a"
-            chunk 3 text run 1 at (80.00,0.00) startOffset 2 endOffset 3 width 4.00: "t"
-            chunk 4 text run 1 at (120.00,10.00) startOffset 3 endOffset 5 width 12.00: "ik"
+            chunk 2 text run 1 at (40.00,10.00) startOffset 0 endOffset 1 width 7.00: "a"
+            chunk 3 text run 1 at (80.00,0.00) startOffset 0 endOffset 1 width 4.00: "t"
+            chunk 4 text run 1 at (120.00,10.00) startOffset 0 endOffset 2 width 12.00: "ik"
         RenderSVGTSpan {tspan} at (0,0) size 39x18
           RenderSVGInlineText {#text} at (132,10) size 39x18
             chunk 4 text run 2 at (132.00,10.00) startOffset 0 endOffset 7 width 39.00: " rules!"
@@ -110,9 +110,9 @@ layer at (0,0) size 450x500
         RenderSVGTSpan {tspan} at (0,0) size 113x28
           RenderSVGInlineText {#text} at (0,0) size 113x28
             chunk 1 (middle anchor) text run 1 at (-5.50,0.00) startOffset 0 endOffset 1 width 11.00: "B"
-            chunk 2 (middle anchor) text run 1 at (36.50,10.00) startOffset 1 endOffset 2 width 7.00: "a"
-            chunk 3 (middle anchor) text run 1 at (78.00,0.00) startOffset 2 endOffset 3 width 4.00: "t"
-            chunk 4 (middle anchor) text run 1 at (94.50,10.00) startOffset 3 endOffset 5 width 12.00: "ik"
+            chunk 2 (middle anchor) text run 1 at (36.50,10.00) startOffset 0 endOffset 1 width 7.00: "a"
+            chunk 3 (middle anchor) text run 1 at (78.00,0.00) startOffset 0 endOffset 1 width 4.00: "t"
+            chunk 4 (middle anchor) text run 1 at (94.50,10.00) startOffset 0 endOffset 2 width 12.00: "ik"
         RenderSVGTSpan {tspan} at (0,0) size 40x18
           RenderSVGInlineText {#text} at (112,10) size 40x18
             chunk 4 (middle anchor) text run 2 at (106.50,10.00) startOffset 0 endOffset 7 width 39.00: " rules!"
@@ -120,9 +120,9 @@ layer at (0,0) size 450x500
         RenderSVGTSpan {tspan} at (0,0) size 92x28
           RenderSVGInlineText {#text} at (0,0) size 92x28
             chunk 1 (end anchor) text run 1 at (-11.00,0.00) startOffset 0 endOffset 1 width 11.00: "B"
-            chunk 2 (end anchor) text run 1 at (33.00,10.00) startOffset 1 endOffset 2 width 7.00: "a"
-            chunk 3 (end anchor) text run 1 at (76.00,0.00) startOffset 2 endOffset 3 width 4.00: "t"
-            chunk 4 (end anchor) text run 1 at (69.00,10.00) startOffset 3 endOffset 5 width 12.00: "ik"
+            chunk 2 (end anchor) text run 1 at (33.00,10.00) startOffset 0 endOffset 1 width 7.00: "a"
+            chunk 3 (end anchor) text run 1 at (76.00,0.00) startOffset 0 endOffset 1 width 4.00: "t"
+            chunk 4 (end anchor) text run 1 at (69.00,10.00) startOffset 0 endOffset 2 width 12.00: "ik"
         RenderSVGTSpan {tspan} at (0,0) size 39x18
           RenderSVGInlineText {#text} at (92,10) size 39x18
             chunk 4 (end anchor) text run 2 at (81.00,10.00) startOffset 0 endOffset 7 width 39.00: " rules!"
diff --git a/LayoutTests/platform/mac/svg/batik/text/textLayout-expected.txt b/LayoutTests/platform/mac/svg/batik/text/textLayout-expected.txt
index ecd7690..1dbc6d5 100644
--- a/LayoutTests/platform/mac/svg/batik/text/textLayout-expected.txt
+++ b/LayoutTests/platform/mac/svg/batik/text/textLayout-expected.txt
@@ -18,11 +18,11 @@ layer at (0,0) size 450x500
           RenderSVGTSpan {tspan} at (0,0) size 111x28
             RenderSVGInlineText {#text} at (0,0) size 111x28
               chunk 1 text run 1 at (40.00,110.00) startOffset 0 endOffset 1 width 9.00: "s"
-              chunk 2 text run 1 at (60.00,110.00) startOffset 1 endOffset 2 width 11.00: "a"
-              chunk 3 text run 1 at (80.00,110.00) startOffset 2 endOffset 3 width 19.00: "m"
-              chunk 4 text run 1 at (105.00,110.00) startOffset 3 endOffset 4 width 12.00: "p"
-              chunk 5 text run 1 at (125.00,110.00) startOffset 4 endOffset 5 width 7.00: "l"
-              chunk 6 text run 1 at (140.00,110.00) startOffset 5 endOffset 6 width 11.00: "e"
+              chunk 2 text run 1 at (60.00,110.00) startOffset 0 endOffset 1 width 11.00: "a"
+              chunk 3 text run 1 at (80.00,110.00) startOffset 0 endOffset 1 width 19.00: "m"
+              chunk 4 text run 1 at (105.00,110.00) startOffset 0 endOffset 1 width 12.00: "p"
+              chunk 5 text run 1 at (125.00,110.00) startOffset 0 endOffset 1 width 7.00: "l"
+              chunk 6 text run 1 at (140.00,110.00) startOffset 0 endOffset 1 width 11.00: "e"
         RenderSVGText {text} at (40,118) size 104x9 contains 1 chunk(s)
           RenderSVGInlineText {#text} at (0,0) size 104x9
             chunk 1 text run 1 at (40.00,125.00) startOffset 0 endOffset 30 width 104.00: "tspan x=\"40,60,80,105,125,140\""
diff --git a/LayoutTests/platform/mac/svg/batik/text/textLayout2-expected.txt b/LayoutTests/platform/mac/svg/batik/text/textLayout2-expected.txt
index a001c7b..6786df9 100644
--- a/LayoutTests/platform/mac/svg/batik/text/textLayout2-expected.txt
+++ b/LayoutTests/platform/mac/svg/batik/text/textLayout2-expected.txt
@@ -61,38 +61,38 @@ layer at (0,0) size 450x500
         RenderSVGInlineText {#text} at (0,0) size 0x0
       RenderSVGText {text} at (0,-68) size 106x123 contains 12 chunk(s)
         RenderSVGTSpan {tspan} at (0,0) size 106x123
-          RenderSVGInlineText {#text} at (0,0) size 106x123
+          RenderSVGInlineText {#text} at (0,50) size 106x123
             chunk 1 text run 1 at (0.00,0.00) startOffset 0 endOffset 1 width 12.00: "T"
-            chunk 2 text run 1 at (10.00,-25.00) startOffset 1 endOffset 2 width 9.00: "e"
-            chunk 3 text run 1 at (25.00,-40.00) startOffset 2 endOffset 3 width 10.00: "x"
-            chunk 4 text run 1 at (50.00,-50.00) startOffset 3 endOffset 4 width 6.00: "t"
-            chunk 5 text run 1 at (75.00,-40.00) startOffset 4 endOffset 5 width 7.00: "-"
-            chunk 6 text run 1 at (90.00,-25.00) startOffset 5 endOffset 6 width 9.00: "c"
-            chunk 7 text run 1 at (100.00,0.00) startOffset 6 endOffset 7 width 6.00: "i"
-            chunk 8 text run 1 at (90.00,25.00) startOffset 7 endOffset 8 width 7.00: "r"
-            chunk 9 text run 1 at (75.00,40.00) startOffset 8 endOffset 9 width 9.00: "c"
-            chunk 10 text run 1 at (50.00,50.00) startOffset 9 endOffset 10 width 6.00: "l"
-            chunk 11 text run 1 at (25.00,40.00) startOffset 10 endOffset 11 width 9.00: "e"
-            chunk 12 text run 1 at (10.00,25.00) startOffset 11 endOffset 12 width 5.00: "."
+            chunk 2 text run 1 at (10.00,-25.00) startOffset 0 endOffset 1 width 9.00: "e"
+            chunk 3 text run 1 at (25.00,-40.00) startOffset 0 endOffset 1 width 10.00: "x"
+            chunk 4 text run 1 at (50.00,-50.00) startOffset 0 endOffset 1 width 6.00: "t"
+            chunk 5 text run 1 at (75.00,-40.00) startOffset 0 endOffset 1 width 7.00: "-"
+            chunk 6 text run 1 at (90.00,-25.00) startOffset 0 endOffset 1 width 9.00: "c"
+            chunk 7 text run 1 at (100.00,0.00) startOffset 0 endOffset 1 width 6.00: "i"
+            chunk 8 text run 1 at (90.00,25.00) startOffset 0 endOffset 1 width 7.00: "r"
+            chunk 9 text run 1 at (75.00,40.00) startOffset 0 endOffset 1 width 9.00: "c"
+            chunk 10 text run 1 at (50.00,50.00) startOffset 0 endOffset 1 width 6.00: "l"
+            chunk 11 text run 1 at (25.00,40.00) startOffset 0 endOffset 1 width 9.00: "e"
+            chunk 12 text run 1 at (10.00,25.00) startOffset 0 endOffset 1 width 5.00: "."
         RenderSVGInlineText {#text} at (0,0) size 0x0
       RenderSVGText {text} at (0,-18) size 90x103 contains 16 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 90x103
           chunk 1 text run 1 at (0.00,0.00) startOffset 0 endOffset 1 width 12.00: "T"
-          chunk 2 text run 1 at (20.00,0.00) startOffset 1 endOffset 2 width 9.00: "e"
-          chunk 3 text run 1 at (40.00,0.00) startOffset 2 endOffset 3 width 10.00: "x"
-          chunk 4 text run 1 at (60.00,0.00) startOffset 3 endOffset 4 width 6.00: "t"
-          chunk 5 text run 1 at (80.00,0.00) startOffset 4 endOffset 5 width 7.00: "-"
-          chunk 6 text run 1 at (80.00,20.00) startOffset 5 endOffset 6 width 6.00: "i"
-          chunk 7 text run 1 at (80.00,40.00) startOffset 6 endOffset 7 width 10.00: "n"
-          chunk 8 text run 1 at (80.00,60.00) startOffset 7 endOffset 8 width 7.00: "-"
-          chunk 9 text run 1 at (80.00,80.00) startOffset 8 endOffset 9 width 9.00: "a"
-          chunk 10 text run 1 at (60.00,80.00) startOffset 9 endOffset 10 width 7.00: "-"
-          chunk 11 text run 1 at (40.00,80.00) startOffset 10 endOffset 11 width 8.00: "s"
-          chunk 12 text run 1 at (20.00,80.00) startOffset 11 endOffset 12 width 10.00: "q"
-          chunk 13 text run 1 at (0.00,80.00) startOffset 12 endOffset 13 width 10.00: "u"
-          chunk 14 text run 1 at (0.00,60.00) startOffset 13 endOffset 14 width 9.00: "a"
-          chunk 15 text run 1 at (0.00,40.00) startOffset 14 endOffset 15 width 7.00: "r"
-          chunk 16 text run 1 at (0.00,20.00) startOffset 15 endOffset 16 width 9.00: "e"
+          chunk 2 text run 1 at (20.00,0.00) startOffset 0 endOffset 1 width 9.00: "e"
+          chunk 3 text run 1 at (40.00,0.00) startOffset 0 endOffset 1 width 10.00: "x"
+          chunk 4 text run 1 at (60.00,0.00) startOffset 0 endOffset 1 width 6.00: "t"
+          chunk 5 text run 1 at (80.00,0.00) startOffset 1 endOffset 2 width 7.00: "-"
+          chunk 6 text run 1 at (80.00,20.00) startOffset 2 endOffset 3 width 6.00: "i"
+          chunk 7 text run 1 at (80.00,40.00) startOffset 3 endOffset 4 width 10.00: "n"
+          chunk 8 text run 1 at (80.00,60.00) startOffset 4 endOffset 5 width 7.00: "-"
+          chunk 9 text run 1 at (80.00,80.00) startOffset 5 endOffset 6 width 9.00: "a"
+          chunk 10 text run 1 at (60.00,80.00) startOffset 6 endOffset 7 width 7.00: "-"
+          chunk 11 text run 1 at (40.00,80.00) startOffset 7 endOffset 8 width 8.00: "s"
+          chunk 12 text run 1 at (20.00,80.00) startOffset 8 endOffset 9 width 10.00: "q"
+          chunk 13 text run 1 at (0.00,80.00) startOffset 9 endOffset 10 width 10.00: "u"
+          chunk 14 text run 1 at (0.00,60.00) startOffset 10 endOffset 11 width 9.00: "a"
+          chunk 15 text run 1 at (0.00,40.00) startOffset 11 endOffset 12 width 7.00: "r"
+          chunk 16 text run 1 at (0.00,20.00) startOffset 12 endOffset 13 width 9.00: "e"
       RenderSVGText {text} at (149,435) size 152x21 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,2) size 63x17
           chunk 1 (middle anchor) text run 1 at (149.00,450.00) startOffset 0 endOffset 10 width 63.00: "Text with "
diff --git a/LayoutTests/platform/mac/svg/batik/text/textOnPathSpaces-expected.txt b/LayoutTests/platform/mac/svg/batik/text/textOnPathSpaces-expected.txt
index 35aadbc..d1d37ad 100644
--- a/LayoutTests/platform/mac/svg/batik/text/textOnPathSpaces-expected.txt
+++ b/LayoutTests/platform/mac/svg/batik/text/textOnPathSpaces-expected.txt
@@ -29,13 +29,13 @@ layer at (0,0) size 450x500
         RenderSVGText {text} at (10,-10) size 107x52 contains 6 chunk(s)
           RenderSVGTextPath {textPath} at (0,0) size 107x52
             RenderSVGTSpan {tspan} at (0,0) size 107x52
-              RenderSVGInlineText {#text} at (0,0) size 107x52
+              RenderSVGInlineText {#text} at (0,14) size 107x52
                 chunk 1 text run 1 at (25.07,20.27) startOffset 0 endOffset 1 width 8.00: "s"
-                chunk 2 text run 1 at (42.24,9.42) startOffset 1 endOffset 2 width 9.00: "a"
-                chunk 3 text run 1 at (62.76,17.75) startOffset 2 endOffset 3 width 16.00: "m"
-                chunk 4 text run 1 at (79.44,32.02) startOffset 3 endOffset 4 width 10.00: "p"
-                chunk 5 text run 1 at (96.50,35.49) startOffset 4 endOffset 5 width 6.00: "l"
-                chunk 6 text run 1 at (109.66,25.79) startOffset 5 endOffset 6 width 9.00: "e"
+                chunk 2 text run 1 at (42.24,9.42) startOffset 0 endOffset 1 width 9.00: "a"
+                chunk 3 text run 1 at (62.76,17.75) startOffset 0 endOffset 1 width 16.00: "m"
+                chunk 4 text run 1 at (79.44,32.02) startOffset 0 endOffset 1 width 10.00: "p"
+                chunk 5 text run 1 at (96.50,35.49) startOffset 0 endOffset 1 width 6.00: "l"
+                chunk 6 text run 1 at (109.66,25.79) startOffset 0 endOffset 1 width 9.00: "e"
           RenderSVGInlineText {#text} at (0,0) size 0x0
         RenderSVGText {text} at (15,50) size 123x13 contains 1 chunk(s)
           RenderSVGInlineText {#text} at (0,0) size 123x13
diff --git a/LayoutTests/platform/mac/svg/batik/text/textPosition-expected.txt b/LayoutTests/platform/mac/svg/batik/text/textPosition-expected.txt
index f873623..87804f1 100644
--- a/LayoutTests/platform/mac/svg/batik/text/textPosition-expected.txt
+++ b/LayoutTests/platform/mac/svg/batik/text/textPosition-expected.txt
@@ -21,10 +21,10 @@ layer at (0,0) size 450x500
       RenderSVGText {text} at (50,118) size 92x27 contains 5 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 92x27
           chunk 1 text run 1 at (50.00,140.00) startOffset 0 endOffset 1 width 16.00: "B"
-          chunk 2 text run 1 at (70.00,140.00) startOffset 1 endOffset 2 width 13.00: "a"
-          chunk 3 text run 1 at (90.00,140.00) startOffset 2 endOffset 3 width 7.00: "t"
-          chunk 4 text run 1 at (110.00,140.00) startOffset 3 endOffset 4 width 5.00: "i"
-          chunk 5 text run 1 at (130.00,140.00) startOffset 4 endOffset 5 width 12.00: "k"
+          chunk 2 text run 1 at (70.00,140.00) startOffset 0 endOffset 1 width 13.00: "a"
+          chunk 3 text run 1 at (90.00,140.00) startOffset 0 endOffset 1 width 7.00: "t"
+          chunk 4 text run 1 at (110.00,140.00) startOffset 0 endOffset 1 width 5.00: "i"
+          chunk 5 text run 1 at (130.00,140.00) startOffset 0 endOffset 1 width 12.00: "k"
       RenderSVGText {text} at (50,151) size 175x11 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 175x11
           chunk 1 text run 1 at (50.00,160.00) startOffset 0 endOffset 35 width 175.00: "<text x=\"50 70 90 110 130\" y=\"140\">"
@@ -53,10 +53,10 @@ layer at (0,0) size 450x500
         RenderSVGTSpan {tspan} at (0,0) size 92x27
           RenderSVGInlineText {#text} at (0,0) size 92x27
             chunk 1 text run 1 at (50.00,260.00) startOffset 0 endOffset 1 width 16.00: "B"
-            chunk 2 text run 1 at (70.00,260.00) startOffset 1 endOffset 2 width 13.00: "a"
-            chunk 3 text run 1 at (90.00,260.00) startOffset 2 endOffset 3 width 7.00: "t"
-            chunk 4 text run 1 at (110.00,260.00) startOffset 3 endOffset 4 width 5.00: "i"
-            chunk 5 text run 1 at (130.00,260.00) startOffset 4 endOffset 5 width 12.00: "k"
+            chunk 2 text run 1 at (70.00,260.00) startOffset 0 endOffset 1 width 13.00: "a"
+            chunk 3 text run 1 at (90.00,260.00) startOffset 0 endOffset 1 width 7.00: "t"
+            chunk 4 text run 1 at (110.00,260.00) startOffset 0 endOffset 1 width 5.00: "i"
+            chunk 5 text run 1 at (130.00,260.00) startOffset 0 endOffset 1 width 12.00: "k"
       RenderSVGText {text} at (50,271) size 184x11 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 184x11
           chunk 1 text run 1 at (50.00,280.00) startOffset 0 endOffset 36 width 184.00: "<tspan x=\"50 70 90 110 130\" y=\"260\">"
@@ -71,10 +71,10 @@ layer at (0,0) size 450x500
         RenderSVGTSpan {tspan} at (0,0) size 92x27
           RenderSVGInlineText {#text} at (0,0) size 92x27
             chunk 1 text run 1 at (50.00,320.00) startOffset 0 endOffset 1 width 16.00: "B"
-            chunk 2 text run 1 at (70.00,320.00) startOffset 1 endOffset 2 width 13.00: "a"
-            chunk 3 text run 1 at (90.00,320.00) startOffset 2 endOffset 3 width 7.00: "t"
-            chunk 4 text run 1 at (110.00,320.00) startOffset 3 endOffset 4 width 5.00: "i"
-            chunk 5 text run 1 at (130.00,320.00) startOffset 4 endOffset 5 width 12.00: "k"
+            chunk 2 text run 1 at (70.00,320.00) startOffset 0 endOffset 1 width 13.00: "a"
+            chunk 3 text run 1 at (90.00,320.00) startOffset 0 endOffset 1 width 7.00: "t"
+            chunk 4 text run 1 at (110.00,320.00) startOffset 0 endOffset 1 width 5.00: "i"
+            chunk 5 text run 1 at (130.00,320.00) startOffset 0 endOffset 1 width 12.00: "k"
       RenderSVGText {text} at (50,331) size 170x22 contains 2 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 129x11
           chunk 1 text run 1 at (50.00,340.00) startOffset 0 endOffset 26 width 129.00: "<tspan x=\"50 60 70 80 90\" "
diff --git a/LayoutTests/platform/mac/svg/batik/text/textPosition2-expected.txt b/LayoutTests/platform/mac/svg/batik/text/textPosition2-expected.txt
index 3b1ac2b..b255fad 100644
--- a/LayoutTests/platform/mac/svg/batik/text/textPosition2-expected.txt
+++ b/LayoutTests/platform/mac/svg/batik/text/textPosition2-expected.txt
@@ -22,10 +22,10 @@ layer at (0,0) size 450x500
       RenderSVGText {text} at (50,118) size 92x26 contains 5 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 92x26
           chunk 1 text run 1 at (50.00,140.00) startOffset 0 endOffset 1 width 16.01: "B"
-          chunk 2 text run 1 at (70.00,140.00) startOffset 1 endOffset 2 width 13.35: "a"
-          chunk 3 text run 1 at (90.00,140.00) startOffset 2 endOffset 3 width 6.67: "t"
-          chunk 4 text run 1 at (110.00,140.00) startOffset 3 endOffset 4 width 5.33: "i"
-          chunk 5 text run 1 at (130.00,140.00) startOffset 4 endOffset 5 width 12.00: "k"
+          chunk 2 text run 1 at (70.00,140.00) startOffset 0 endOffset 1 width 13.35: "a"
+          chunk 3 text run 1 at (90.00,140.00) startOffset 0 endOffset 1 width 6.67: "t"
+          chunk 4 text run 1 at (110.00,140.00) startOffset 0 endOffset 1 width 5.33: "i"
+          chunk 5 text run 1 at (130.00,140.00) startOffset 0 endOffset 1 width 12.00: "k"
       RenderSVGText {text} at (50,151) size 175x11 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 175x11
           chunk 1 text run 1 at (50.00,160.00) startOffset 0 endOffset 35 width 175.00: "<text x=\"50 70 90 110 130\" y=\"140\">"
@@ -54,10 +54,10 @@ layer at (0,0) size 450x500
         RenderSVGTSpan {tspan} at (0,0) size 92x26
           RenderSVGInlineText {#text} at (0,0) size 92x26
             chunk 1 text run 1 at (50.00,260.00) startOffset 0 endOffset 1 width 16.01: "B"
-            chunk 2 text run 1 at (70.00,260.00) startOffset 1 endOffset 2 width 13.35: "a"
-            chunk 3 text run 1 at (90.00,260.00) startOffset 2 endOffset 3 width 6.67: "t"
-            chunk 4 text run 1 at (110.00,260.00) startOffset 3 endOffset 4 width 5.33: "i"
-            chunk 5 text run 1 at (130.00,260.00) startOffset 4 endOffset 5 width 12.00: "k"
+            chunk 2 text run 1 at (70.00,260.00) startOffset 0 endOffset 1 width 13.35: "a"
+            chunk 3 text run 1 at (90.00,260.00) startOffset 0 endOffset 1 width 6.67: "t"
+            chunk 4 text run 1 at (110.00,260.00) startOffset 0 endOffset 1 width 5.33: "i"
+            chunk 5 text run 1 at (130.00,260.00) startOffset 0 endOffset 1 width 12.00: "k"
       RenderSVGText {text} at (50,271) size 184x11 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 184x11
           chunk 1 text run 1 at (50.00,280.00) startOffset 0 endOffset 36 width 184.00: "<tspan x=\"50 70 90 110 130\" y=\"260\">"
@@ -72,10 +72,10 @@ layer at (0,0) size 450x500
         RenderSVGTSpan {tspan} at (0,0) size 92x26
           RenderSVGInlineText {#text} at (0,0) size 92x26
             chunk 1 text run 1 at (50.00,320.00) startOffset 0 endOffset 1 width 16.01: "B"
-            chunk 2 text run 1 at (70.00,320.00) startOffset 1 endOffset 2 width 13.35: "a"
-            chunk 3 text run 1 at (90.00,320.00) startOffset 2 endOffset 3 width 6.67: "t"
-            chunk 4 text run 1 at (110.00,320.00) startOffset 3 endOffset 4 width 5.33: "i"
-            chunk 5 text run 1 at (130.00,320.00) startOffset 4 endOffset 5 width 12.00: "k"
+            chunk 2 text run 1 at (70.00,320.00) startOffset 0 endOffset 1 width 13.35: "a"
+            chunk 3 text run 1 at (90.00,320.00) startOffset 0 endOffset 1 width 6.67: "t"
+            chunk 4 text run 1 at (110.00,320.00) startOffset 0 endOffset 1 width 5.33: "i"
+            chunk 5 text run 1 at (130.00,320.00) startOffset 0 endOffset 1 width 12.00: "k"
       RenderSVGText {text} at (50,331) size 170x22 contains 2 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 129x11
           chunk 1 text run 1 at (50.00,340.00) startOffset 0 endOffset 26 width 129.00: "<tspan x=\"50 60 70 80 90\" "
diff --git a/LayoutTests/platform/mac/svg/custom/text-letter-spacing-expected.txt b/LayoutTests/platform/mac/svg/custom/text-letter-spacing-expected.txt
index b9c5aea..eabac85 100644
--- a/LayoutTests/platform/mac/svg/custom/text-letter-spacing-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/text-letter-spacing-expected.txt
@@ -18,22 +18,22 @@ layer at (0,0) size 800x600
       RenderSVGText {text} at (10,46) size 129x18 contains 7 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 129x18
           chunk 1 text run 1 at (10.00,60.00) startOffset 0 endOffset 1 width 12.00: "A"
-          chunk 2 text run 1 at (30.00,60.00) startOffset 1 endOffset 2 width 11.00: "B"
-          chunk 3 text run 1 at (50.00,60.00) startOffset 2 endOffset 3 width 11.00: "C"
-          chunk 4 text run 1 at (70.00,60.00) startOffset 3 endOffset 4 width 4.00: " "
-          chunk 5 text run 1 at (90.00,60.00) startOffset 4 endOffset 5 width 12.00: "D"
-          chunk 6 text run 1 at (110.00,60.00) startOffset 5 endOffset 6 width 10.00: "E"
-          chunk 7 text run 1 at (130.00,60.00) startOffset 6 endOffset 7 width 9.00: "F"
+          chunk 2 text run 1 at (30.00,60.00) startOffset 0 endOffset 1 width 11.00: "B"
+          chunk 3 text run 1 at (50.00,60.00) startOffset 0 endOffset 1 width 11.00: "C"
+          chunk 4 text run 1 at (70.00,60.00) startOffset 0 endOffset 1 width 4.00: " "
+          chunk 5 text run 1 at (90.00,60.00) startOffset 0 endOffset 1 width 12.00: "D"
+          chunk 6 text run 1 at (110.00,60.00) startOffset 0 endOffset 1 width 10.00: "E"
+          chunk 7 text run 1 at (130.00,60.00) startOffset 0 endOffset 1 width 9.00: "F"
       RenderSVGText {text} at (10,66) size 129x18 contains 7 chunk(s)
         RenderSVGTSpan {tspan} at (0,0) size 51x18
           RenderSVGInlineText {#text} at (0,0) size 51x18
             chunk 1 text run 1 at (10.00,80.00) startOffset 0 endOffset 1 width 12.00: "A"
-            chunk 2 text run 1 at (30.00,80.00) startOffset 1 endOffset 2 width 11.00: "B"
-            chunk 3 text run 1 at (50.00,80.00) startOffset 2 endOffset 3 width 11.00: "C"
+            chunk 2 text run 1 at (30.00,80.00) startOffset 0 endOffset 1 width 11.00: "B"
+            chunk 3 text run 1 at (50.00,80.00) startOffset 0 endOffset 1 width 11.00: "C"
         RenderSVGInlineText {#text} at (60,0) size 4x18
           chunk 4 text run 1 at (70.00,80.00) startOffset 0 endOffset 1 width 4.00: " "
         RenderSVGTSpan {tspan} at (0,0) size 49x18
           RenderSVGInlineText {#text} at (80,0) size 49x18
             chunk 5 text run 1 at (90.00,80.00) startOffset 0 endOffset 1 width 12.00: "D"
-            chunk 6 text run 1 at (110.00,80.00) startOffset 1 endOffset 2 width 10.00: "E"
-            chunk 7 text run 1 at (130.00,80.00) startOffset 2 endOffset 3 width 9.00: "F"
+            chunk 6 text run 1 at (110.00,80.00) startOffset 0 endOffset 1 width 10.00: "E"
+            chunk 7 text run 1 at (130.00,80.00) startOffset 0 endOffset 1 width 9.00: "F"
diff --git a/LayoutTests/platform/mac/svg/custom/text-x-dx-lists-expected.txt b/LayoutTests/platform/mac/svg/custom/text-x-dx-lists-expected.txt
index af62f16..e2facd5 100644
--- a/LayoutTests/platform/mac/svg/custom/text-x-dx-lists-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/text-x-dx-lists-expected.txt
@@ -5,13 +5,13 @@ layer at (0,0) size 800x600
     RenderSVGText {text} at (10,6) size 71x18 contains 3 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 71x18
         chunk 1 text run 1 at (10.00,20.00) startOffset 0 endOffset 1 width 12.00: "A"
-        chunk 2 text run 1 at (50.00,20.00) startOffset 1 endOffset 2 width 11.00: "B"
-        chunk 3 text run 1 at (70.00,20.00) startOffset 2 endOffset 3 width 11.00: "C"
+        chunk 2 text run 1 at (50.00,20.00) startOffset 0 endOffset 1 width 11.00: "B"
+        chunk 3 text run 1 at (70.00,20.00) startOffset 0 endOffset 1 width 11.00: "C"
     RenderSVGText {text} at (10,26) size 71x18 contains 3 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 71x18
         chunk 1 text run 1 at (10.00,40.00) startOffset 0 endOffset 1 width 12.00: "A"
-        chunk 2 text run 1 at (50.00,40.00) startOffset 1 endOffset 2 width 11.00: "B"
-        chunk 3 text run 1 at (70.00,40.00) startOffset 2 endOffset 3 width 11.00: "C"
+        chunk 2 text run 1 at (50.00,40.00) startOffset 0 endOffset 1 width 11.00: "B"
+        chunk 3 text run 1 at (70.00,40.00) startOffset 0 endOffset 1 width 11.00: "C"
     RenderSVGText {text} at (10,46) size 71x18 contains 3 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 12x18
         chunk 1 text run 1 at (10.00,60.00) startOffset 0 endOffset 1 width 12.00: "A"
@@ -32,8 +32,8 @@ layer at (0,0) size 800x600
       RenderSVGText {text} at (15,106) size 71x18 contains 3 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 71x18
           chunk 1 text run 1 at (15.00,120.00) startOffset 0 endOffset 1 width 12.00: "A"
-          chunk 2 text run 1 at (55.00,120.00) startOffset 1 endOffset 2 width 11.00: "B"
-          chunk 3 text run 1 at (75.00,120.00) startOffset 2 endOffset 3 width 11.00: "C"
+          chunk 2 text run 1 at (55.00,120.00) startOffset 0 endOffset 1 width 11.00: "B"
+          chunk 3 text run 1 at (75.00,120.00) startOffset 0 endOffset 1 width 11.00: "C"
       RenderSVGText {text} at (15,126) size 71x18 contains 3 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 12x18
           chunk 1 text run 1 at (15.00,140.00) startOffset 0 endOffset 1 width 12.00: "A"
@@ -45,8 +45,8 @@ layer at (0,0) size 800x600
       RenderSVGText {text} at (15,146) size 71x18 contains 3 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 71x18
           chunk 1 text run 1 at (15.00,160.00) startOffset 0 endOffset 1 width 12.00: "A"
-          chunk 2 text run 1 at (55.00,160.00) startOffset 1 endOffset 2 width 11.00: "B"
-          chunk 3 text run 1 at (75.00,160.00) startOffset 2 endOffset 3 width 11.00: "C"
+          chunk 2 text run 1 at (55.00,160.00) startOffset 0 endOffset 1 width 11.00: "B"
+          chunk 3 text run 1 at (75.00,160.00) startOffset 0 endOffset 1 width 11.00: "C"
       RenderSVGText {text} at (15,166) size 71x18 contains 3 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 12x18
           chunk 1 text run 1 at (15.00,180.00) startOffset 0 endOffset 1 width 12.00: "A"
diff --git a/LayoutTests/platform/mac/svg/custom/text-x-override-in-tspan-child-expected.txt b/LayoutTests/platform/mac/svg/custom/text-x-override-in-tspan-child-expected.txt
index 96308fe..4a5fcce 100644
--- a/LayoutTests/platform/mac/svg/custom/text-x-override-in-tspan-child-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/text-x-override-in-tspan-child-expected.txt
@@ -14,7 +14,7 @@ layer at (0,0) size 800x600
       RenderSVGTSpan {tspan} at (0,0) size 41x18
         RenderSVGInlineText {#text} at (0,0) size 41x18
           chunk 1 text run 1 at (10.00,40.00) startOffset 0 endOffset 1 width 12.00: "A"
-          chunk 2 text run 1 at (40.00,40.00) startOffset 1 endOffset 2 width 11.00: "B"
+          chunk 2 text run 1 at (40.00,40.00) startOffset 0 endOffset 1 width 11.00: "B"
       RenderSVGInlineText {#text} at (60,0) size 11x18
         chunk 3 text run 1 at (70.00,40.00) startOffset 0 endOffset 1 width 11.00: "C"
     RenderSVGContainer {g} at (20,92) size 142x76 [transform={m=((1.00,0.00)(0.00,1.00)) t=(-10.00,0.00)}]
@@ -30,7 +30,7 @@ layer at (0,0) size 800x600
         RenderSVGTSpan {tspan} at (0,0) size 41x18
           RenderSVGInlineText {#text} at (0,0) size 41x18
             chunk 1 text run 1 at (20.00,80.00) startOffset 0 endOffset 1 width 12.00: "A"
-            chunk 2 text run 1 at (50.00,80.00) startOffset 1 endOffset 2 width 11.00: "B"
+            chunk 2 text run 1 at (50.00,80.00) startOffset 0 endOffset 1 width 11.00: "B"
         RenderSVGInlineText {#text} at (60,0) size 11x18
           chunk 3 text run 1 at (80.00,80.00) startOffset 0 endOffset 1 width 11.00: "C"
     RenderSVGContainer {g} at (20,172) size 142x76 [transform={m=((1.00,0.00)(0.00,1.00)) t=(-10.00,0.00)}]
@@ -46,7 +46,7 @@ layer at (0,0) size 800x600
         RenderSVGTSpan {tspan} at (0,0) size 41x18
           RenderSVGInlineText {#text} at (0,0) size 41x18
             chunk 1 text run 1 at (20.00,120.00) startOffset 0 endOffset 1 width 12.00: "A"
-            chunk 2 text run 1 at (50.00,120.00) startOffset 1 endOffset 2 width 11.00: "B"
+            chunk 2 text run 1 at (50.00,120.00) startOffset 0 endOffset 1 width 11.00: "B"
         RenderSVGInlineText {#text} at (60,0) size 11x18
           chunk 3 text run 1 at (80.00,120.00) startOffset 0 endOffset 1 width 11.00: "C"
     RenderSVGContainer {g} at (0,252) size 162x76 [transform={m=((1.00,0.00)(0.00,1.00)) t=(-10.00,0.00)}]
@@ -62,6 +62,6 @@ layer at (0,0) size 800x600
         RenderSVGTSpan {tspan} at (0,0) size 31x18
           RenderSVGInlineText {#text} at (20,0) size 31x18
             chunk 1 text run 1 at (20.00,160.00) startOffset 0 endOffset 1 width 12.00: "A"
-            chunk 2 text run 1 at (40.00,160.00) startOffset 1 endOffset 2 width 11.00: "B"
+            chunk 2 text run 1 at (40.00,160.00) startOffset 0 endOffset 1 width 11.00: "B"
         RenderSVGInlineText {#text} at (0,0) size 11x18
           chunk 3 text run 1 at (0.00,160.00) startOffset 0 endOffset 1 width 11.00: "C"
diff --git a/LayoutTests/platform/mac/svg/text/select-x-list-1-expected.txt b/LayoutTests/platform/mac/svg/text/select-x-list-1-expected.txt
index 0644b41..e18dc19 100644
--- a/LayoutTests/platform/mac/svg/text/select-x-list-1-expected.txt
+++ b/LayoutTests/platform/mac/svg/text/select-x-list-1-expected.txt
@@ -7,7 +7,7 @@ layer at (0,0) size 800x600
     RenderSVGText {text} at (10,1) size 76x11 contains 3 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 76x11
         chunk 1 text run 1 at (10.00,10.00) startOffset 0 endOffset 1 width 6.00: "T"
-        chunk 2 text run 1 at (20.00,10.00) startOffset 1 endOffset 2 width 6.00: "h"
-        chunk 3 text run 1 at (40.00,10.00) startOffset 2 endOffset 14 width 46.00: "is is a test"
+        chunk 2 text run 1 at (20.00,10.00) startOffset 0 endOffset 1 width 6.00: "h"
+        chunk 3 text run 1 at (40.00,10.00) startOffset 0 endOffset 12 width 46.00: "is is a test"
 selection start: position 0 of child 0 {#text} of child 5 {text} of child 0 {svg} of document
 selection end:   position 4 of child 0 {#text} of child 5 {text} of child 0 {svg} of document
diff --git a/LayoutTests/platform/mac/svg/text/select-x-list-2-expected.txt b/LayoutTests/platform/mac/svg/text/select-x-list-2-expected.txt
index 737fdde..d971df7 100644
--- a/LayoutTests/platform/mac/svg/text/select-x-list-2-expected.txt
+++ b/LayoutTests/platform/mac/svg/text/select-x-list-2-expected.txt
@@ -7,7 +7,7 @@ layer at (0,0) size 800x600
     RenderSVGText {text} at (10,1) size 76x11 contains 3 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 76x11
         chunk 1 text run 1 at (10.00,10.00) startOffset 0 endOffset 1 width 6.00: "T"
-        chunk 2 text run 1 at (20.00,10.00) startOffset 1 endOffset 2 width 6.00: "h"
-        chunk 3 text run 1 at (40.00,10.00) startOffset 2 endOffset 14 width 46.00: "is is a test"
+        chunk 2 text run 1 at (20.00,10.00) startOffset 0 endOffset 1 width 6.00: "h"
+        chunk 3 text run 1 at (40.00,10.00) startOffset 0 endOffset 12 width 46.00: "is is a test"
 selection start: position 2 of child 0 {#text} of child 5 {text} of child 0 {svg} of document
 selection end:   position 7 of child 0 {#text} of child 5 {text} of child 0 {svg} of document
diff --git a/LayoutTests/platform/mac/svg/text/select-x-list-3-expected.txt b/LayoutTests/platform/mac/svg/text/select-x-list-3-expected.txt
index 524f1a2..3f460e5 100644
--- a/LayoutTests/platform/mac/svg/text/select-x-list-3-expected.txt
+++ b/LayoutTests/platform/mac/svg/text/select-x-list-3-expected.txt
@@ -7,7 +7,7 @@ layer at (0,0) size 800x600
     RenderSVGText {text} at (10,1) size 76x11 contains 3 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 76x11
         chunk 1 text run 1 at (10.00,10.00) startOffset 0 endOffset 1 width 6.00: "T"
-        chunk 2 text run 1 at (20.00,10.00) startOffset 1 endOffset 2 width 6.00: "h"
-        chunk 3 text run 1 at (40.00,10.00) startOffset 2 endOffset 14 width 46.00: "is is a test"
+        chunk 2 text run 1 at (20.00,10.00) startOffset 0 endOffset 1 width 6.00: "h"
+        chunk 3 text run 1 at (40.00,10.00) startOffset 0 endOffset 12 width 46.00: "is is a test"
 selection start: position 8 of child 0 {#text} of child 5 {text} of child 0 {svg} of document
 selection end:   position 9 of child 0 {#text} of child 5 {text} of child 0 {svg} of document
diff --git a/LayoutTests/platform/mac/svg/text/select-x-list-4-expected.txt b/LayoutTests/platform/mac/svg/text/select-x-list-4-expected.txt
index 2b9d520..57ac7f6 100644
--- a/LayoutTests/platform/mac/svg/text/select-x-list-4-expected.txt
+++ b/LayoutTests/platform/mac/svg/text/select-x-list-4-expected.txt
@@ -7,7 +7,7 @@ layer at (0,0) size 800x600
     RenderSVGText {text} at (10,1) size 76x11 contains 3 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 76x11
         chunk 1 text run 1 at (10.00,10.00) startOffset 0 endOffset 1 width 6.00: "T"
-        chunk 2 text run 1 at (20.00,10.00) startOffset 1 endOffset 2 width 6.00: "h"
-        chunk 3 text run 1 at (40.00,10.00) startOffset 2 endOffset 14 width 46.00: "is is a test"
+        chunk 2 text run 1 at (20.00,10.00) startOffset 0 endOffset 1 width 6.00: "h"
+        chunk 3 text run 1 at (40.00,10.00) startOffset 0 endOffset 12 width 46.00: "is is a test"
 selection start: position 0 of child 0 {#text} of child 5 {text} of child 0 {svg} of document
 selection end:   position 14 of child 0 {#text} of child 5 {text} of child 0 {svg} of document
diff --git a/LayoutTests/platform/mac/svg/text/select-x-list-with-tspans-1-expected.txt b/LayoutTests/platform/mac/svg/text/select-x-list-with-tspans-1-expected.txt
index 5cad6a8..056e959 100644
--- a/LayoutTests/platform/mac/svg/text/select-x-list-with-tspans-1-expected.txt
+++ b/LayoutTests/platform/mac/svg/text/select-x-list-with-tspans-1-expected.txt
@@ -7,7 +7,7 @@ layer at (0,0) size 800x600
     RenderSVGText {text} at (10,1) size 76x11 contains 3 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 16x11
         chunk 1 text run 1 at (10.00,10.00) startOffset 0 endOffset 1 width 6.00: "T"
-        chunk 2 text run 1 at (20.00,10.00) startOffset 1 endOffset 2 width 6.00: "h"
+        chunk 2 text run 1 at (20.00,10.00) startOffset 0 endOffset 1 width 6.00: "h"
       RenderSVGTSpan {tspan} at (0,0) size 2x11
         RenderSVGInlineText {#text} at (30,0) size 2x11
           chunk 3 text run 1 at (40.00,10.00) startOffset 0 endOffset 1 width 2.00: "i"
diff --git a/LayoutTests/platform/mac/svg/text/select-x-list-with-tspans-2-expected.txt b/LayoutTests/platform/mac/svg/text/select-x-list-with-tspans-2-expected.txt
index 58f5e77..5d3519e 100644
--- a/LayoutTests/platform/mac/svg/text/select-x-list-with-tspans-2-expected.txt
+++ b/LayoutTests/platform/mac/svg/text/select-x-list-with-tspans-2-expected.txt
@@ -7,7 +7,7 @@ layer at (0,0) size 800x600
     RenderSVGText {text} at (10,1) size 76x11 contains 3 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 16x11
         chunk 1 text run 1 at (10.00,10.00) startOffset 0 endOffset 1 width 6.00: "T"
-        chunk 2 text run 1 at (20.00,10.00) startOffset 1 endOffset 2 width 6.00: "h"
+        chunk 2 text run 1 at (20.00,10.00) startOffset 0 endOffset 1 width 6.00: "h"
       RenderSVGTSpan {tspan} at (0,0) size 2x11
         RenderSVGInlineText {#text} at (30,0) size 2x11
           chunk 3 text run 1 at (40.00,10.00) startOffset 0 endOffset 1 width 2.00: "i"
diff --git a/LayoutTests/platform/mac/svg/text/select-x-list-with-tspans-3-expected.txt b/LayoutTests/platform/mac/svg/text/select-x-list-with-tspans-3-expected.txt
index 77031b8..5e88bf1 100644
--- a/LayoutTests/platform/mac/svg/text/select-x-list-with-tspans-3-expected.txt
+++ b/LayoutTests/platform/mac/svg/text/select-x-list-with-tspans-3-expected.txt
@@ -7,7 +7,7 @@ layer at (0,0) size 800x600
     RenderSVGText {text} at (10,1) size 76x11 contains 3 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 16x11
         chunk 1 text run 1 at (10.00,10.00) startOffset 0 endOffset 1 width 6.00: "T"
-        chunk 2 text run 1 at (20.00,10.00) startOffset 1 endOffset 2 width 6.00: "h"
+        chunk 2 text run 1 at (20.00,10.00) startOffset 0 endOffset 1 width 6.00: "h"
       RenderSVGTSpan {tspan} at (0,0) size 2x11
         RenderSVGInlineText {#text} at (30,0) size 2x11
           chunk 3 text run 1 at (40.00,10.00) startOffset 0 endOffset 1 width 2.00: "i"
diff --git a/LayoutTests/platform/mac/svg/text/select-x-list-with-tspans-4-expected.txt b/LayoutTests/platform/mac/svg/text/select-x-list-with-tspans-4-expected.txt
index d0d6201..439a3d9 100644
--- a/LayoutTests/platform/mac/svg/text/select-x-list-with-tspans-4-expected.txt
+++ b/LayoutTests/platform/mac/svg/text/select-x-list-with-tspans-4-expected.txt
@@ -7,7 +7,7 @@ layer at (0,0) size 800x600
     RenderSVGText {text} at (10,1) size 76x11 contains 3 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 16x11
         chunk 1 text run 1 at (10.00,10.00) startOffset 0 endOffset 1 width 6.00: "T"
-        chunk 2 text run 1 at (20.00,10.00) startOffset 1 endOffset 2 width 6.00: "h"
+        chunk 2 text run 1 at (20.00,10.00) startOffset 0 endOffset 1 width 6.00: "h"
       RenderSVGTSpan {tspan} at (0,0) size 2x11
         RenderSVGInlineText {#text} at (30,0) size 2x11
           chunk 3 text run 1 at (40.00,10.00) startOffset 0 endOffset 1 width 2.00: "i"
diff --git a/LayoutTests/platform/mac/svg/text/text-text-04-t-expected.txt b/LayoutTests/platform/mac/svg/text/text-text-04-t-expected.txt
index 2b92204..4a95dfd 100644
--- a/LayoutTests/platform/mac/svg/text/text-text-04-t-expected.txt
+++ b/LayoutTests/platform/mac/svg/text/text-text-04-t-expected.txt
@@ -48,9 +48,9 @@ layer at (0,0) size 800x600
         RenderSVGText {text} at (20,-21) size 75x25 contains 4 chunk(s)
           RenderSVGInlineText {#text} at (0,0) size 75x25
             chunk 1 text run 1 at (20.00,0.00) startOffset 0 endOffset 1 width 15.00: "1"
-            chunk 2 text run 1 at (40.00,0.00) startOffset 1 endOffset 2 width 15.00: "2"
-            chunk 3 text run 1 at (60.00,0.00) startOffset 2 endOffset 3 width 15.00: "3"
-            chunk 4 text run 1 at (80.00,0.00) startOffset 3 endOffset 4 width 15.00: "4"
+            chunk 2 text run 1 at (40.00,0.00) startOffset 0 endOffset 1 width 15.00: "2"
+            chunk 3 text run 1 at (60.00,0.00) startOffset 0 endOffset 1 width 15.00: "3"
+            chunk 4 text run 1 at (80.00,0.00) startOffset 0 endOffset 1 width 15.00: "4"
       RenderSVGContainer {g} at (93,165) size 297x42 [transform={m=((1.00,0.00)(0.00,1.00)) t=(130.00,120.00)}]
         RenderSVGText {text} at (-74,-14) size 44x18 contains 1 chunk(s)
           RenderSVGInlineText {#text} at (0,0) size 44x18
@@ -76,9 +76,9 @@ layer at (0,0) size 800x600
         RenderSVGText {text} at (20,-21) size 75x25 contains 4 chunk(s)
           RenderSVGInlineText {#text} at (0,0) size 75x25
             chunk 1 text run 1 at (20.00,0.00) startOffset 0 endOffset 1 width 15.00: "1"
-            chunk 2 text run 1 at (40.00,0.00) startOffset 1 endOffset 2 width 15.00: "2"
-            chunk 3 text run 1 at (60.00,0.00) startOffset 2 endOffset 3 width 15.00: "3"
-            chunk 4 text run 1 at (80.00,0.00) startOffset 3 endOffset 4 width 15.00: "4"
+            chunk 2 text run 1 at (40.00,0.00) startOffset 0 endOffset 1 width 15.00: "2"
+            chunk 3 text run 1 at (60.00,0.00) startOffset 0 endOffset 1 width 15.00: "3"
+            chunk 4 text run 1 at (80.00,0.00) startOffset 0 endOffset 1 width 15.00: "4"
       RenderSVGContainer {g} at (86,231) size 281x43 [transform={m=((1.00,0.00)(0.00,1.00)) t=(130.00,160.00)}]
         RenderSVGText {text} at (-78,-14) size 48x18 contains 1 chunk(s)
           RenderSVGInlineText {#text} at (0,0) size 48x18
@@ -101,8 +101,8 @@ layer at (0,0) size 800x600
         RenderSVGText {text} at (20,-21) size 70x25 contains 3 chunk(s)
           RenderSVGInlineText {#text} at (0,0) size 70x25
             chunk 1 text run 1 at (20.00,0.00) startOffset 0 endOffset 1 width 15.00: "1"
-            chunk 2 text run 1 at (40.00,0.00) startOffset 1 endOffset 2 width 15.00: "2"
-            chunk 3 text run 1 at (60.00,0.00) startOffset 2 endOffset 4 width 30.00: "34"
+            chunk 2 text run 1 at (40.00,0.00) startOffset 0 endOffset 1 width 15.00: "2"
+            chunk 3 text run 1 at (60.00,0.00) startOffset 0 endOffset 2 width 30.00: "34"
       RenderSVGContainer {g} at (121,281) size 196x76 [transform={m=((1.00,0.00)(0.00,1.00)) t=(130.00,200.00)}]
         RenderSVGText {text} at (-57,-14) size 27x18 contains 1 chunk(s)
           RenderSVGInlineText {#text} at (0,0) size 27x18
@@ -183,9 +183,9 @@ layer at (0,0) size 800x600
           RenderSVGText {text} at (20,-31) size 75x45 contains 4 chunk(s)
             RenderSVGInlineText {#text} at (0,0) size 75x45
               chunk 1 text run 1 at (20.00,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-              chunk 2 text run 1 at (40.00,-5.00) startOffset 1 endOffset 2 width 15.00: "2"
-              chunk 3 text run 1 at (60.00,5.00) startOffset 2 endOffset 3 width 15.00: "3"
-              chunk 4 text run 1 at (80.00,10.00) startOffset 3 endOffset 4 width 15.00: "4"
+              chunk 2 text run 1 at (40.00,-5.00) startOffset 0 endOffset 1 width 15.00: "2"
+              chunk 3 text run 1 at (60.00,5.00) startOffset 0 endOffset 1 width 15.00: "3"
+              chunk 4 text run 1 at (80.00,10.00) startOffset 0 endOffset 1 width 15.00: "4"
         RenderSVGContainer {g} at (440,148) size 317x92 [transform={m=((1.00,0.00)(0.00,1.00)) t=(130.00,120.00)}]
           RenderSVGText {text} at (-86,-14) size 56x18 contains 1 chunk(s)
             RenderSVGInlineText {#text} at (0,0) size 56x18
@@ -211,9 +211,9 @@ layer at (0,0) size 800x600
           RenderSVGText {text} at (20,-31) size 75x45 contains 4 chunk(s)
             RenderSVGInlineText {#text} at (0,0) size 75x45
               chunk 1 text run 1 at (20.00,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-              chunk 2 text run 1 at (40.00,-5.00) startOffset 1 endOffset 2 width 15.00: "2"
-              chunk 3 text run 1 at (60.00,5.00) startOffset 2 endOffset 3 width 15.00: "3"
-              chunk 4 text run 1 at (80.00,10.00) startOffset 3 endOffset 4 width 15.00: "4"
+              chunk 2 text run 1 at (40.00,-5.00) startOffset 0 endOffset 1 width 15.00: "2"
+              chunk 3 text run 1 at (60.00,5.00) startOffset 0 endOffset 1 width 15.00: "3"
+              chunk 4 text run 1 at (80.00,10.00) startOffset 0 endOffset 1 width 15.00: "4"
         RenderSVGContainer {g} at (433,215) size 301x67 [transform={m=((1.00,0.00)(0.00,1.00)) t=(130.00,160.00)}]
           RenderSVGText {text} at (-90,-14) size 60x18 contains 1 chunk(s)
             RenderSVGInlineText {#text} at (0,0) size 60x18
@@ -236,8 +236,8 @@ layer at (0,0) size 800x600
           RenderSVGText {text} at (20,-31) size 70x40 contains 3 chunk(s)
             RenderSVGInlineText {#text} at (0,0) size 70x40
               chunk 1 text run 1 at (20.00,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-              chunk 2 text run 1 at (40.00,-5.00) startOffset 1 endOffset 2 width 15.00: "2"
-              chunk 3 text run 1 at (60.00,5.00) startOffset 2 endOffset 4 width 30.00: "34"
+              chunk 2 text run 1 at (40.00,-5.00) startOffset 0 endOffset 1 width 15.00: "2"
+              chunk 3 text run 1 at (60.00,5.00) startOffset 0 endOffset 2 width 30.00: "34"
         RenderSVGContainer {g} at (401,281) size 341x68 [transform={m=((1.00,0.00)(0.00,1.00)) t=(130.00,200.00)}]
           RenderSVGText {text} at (-109,-14) size 79x18 contains 1 chunk(s)
             RenderSVGInlineText {#text} at (0,0) size 79x18
@@ -260,9 +260,9 @@ layer at (0,0) size 800x600
           RenderSVGText {text} at (20,-31) size 75x40 contains 4 chunk(s)
             RenderSVGInlineText {#text} at (0,0) size 75x40
               chunk 1 text run 1 at (20.00,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-              chunk 2 text run 1 at (40.00,-5.00) startOffset 1 endOffset 2 width 15.00: "2"
-              chunk 3 text run 1 at (60.00,5.00) startOffset 2 endOffset 3 width 15.00: "3"
-              chunk 4 text run 1 at (80.00,5.00) startOffset 3 endOffset 4 width 15.00: "4"
+              chunk 2 text run 1 at (40.00,-5.00) startOffset 0 endOffset 1 width 15.00: "2"
+              chunk 3 text run 1 at (60.00,5.00) startOffset 0 endOffset 1 width 15.00: "3"
+              chunk 4 text run 1 at (80.00,5.00) startOffset 0 endOffset 1 width 15.00: "4"
         RenderSVGContainer {g} at (401,348) size 333x76 [transform={m=((1.00,0.00)(0.00,1.00)) t=(130.00,240.00)}]
           RenderSVGText {text} at (-109,-14) size 79x18 contains 1 chunk(s)
             RenderSVGInlineText {#text} at (0,0) size 79x18
@@ -285,8 +285,8 @@ layer at (0,0) size 800x600
           RenderSVGText {text} at (20,-31) size 70x45 contains 3 chunk(s)
             RenderSVGInlineText {#text} at (0,0) size 70x45
               chunk 1 text run 1 at (20.00,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-              chunk 2 text run 1 at (40.00,-5.00) startOffset 1 endOffset 2 width 15.00: "2"
-              chunk 3 text run 1 at (60.00,5.00) startOffset 2 endOffset 4 width 30.00: "34"
+              chunk 2 text run 1 at (40.00,-5.00) startOffset 0 endOffset 1 width 15.00: "2"
+              chunk 3 text run 1 at (60.00,5.00) startOffset 0 endOffset 2 width 30.00: "34"
     RenderSVGText {text} at (10,304) size 284x46 contains 1 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 284x46
         chunk 1 text run 1 at (10.00,340.00) startOffset 0 endOffset 17 width 284.00: "$Revision: 1.13 $"
diff --git a/LayoutTests/platform/mac/svg/text/text-text-05-t-expected.txt b/LayoutTests/platform/mac/svg/text/text-text-05-t-expected.txt
index ce1e60f..97c1b5c 100644
--- a/LayoutTests/platform/mac/svg/text/text-text-05-t-expected.txt
+++ b/LayoutTests/platform/mac/svg/text/text-text-05-t-expected.txt
@@ -76,9 +76,9 @@ layer at (0,0) size 800x600
           RenderSVGText {text} at (10,51) size 45x11 contains 4 chunk(s)
             RenderSVGInlineText {#text} at (0,0) size 45x11
               chunk 1 text run 1 at (10.00,60.00) startOffset 0 endOffset 1 width 15.00: "1"
-              chunk 2 text run 1 at (20.00,60.00) startOffset 1 endOffset 2 width 15.00: "2"
-              chunk 3 text run 1 at (30.00,60.00) startOffset 2 endOffset 3 width 15.00: "3"
-              chunk 4 text run 1 at (40.00,60.00) startOffset 3 endOffset 4 width 15.00: "4"
+              chunk 2 text run 1 at (20.00,60.00) startOffset 0 endOffset 1 width 15.00: "2"
+              chunk 3 text run 1 at (30.00,60.00) startOffset 0 endOffset 1 width 15.00: "3"
+              chunk 4 text run 1 at (40.00,60.00) startOffset 0 endOffset 1 width 15.00: "4"
           RenderSVGContainer {use} at (260,191) size 14x33
             RenderSVGContainer {g} at (260,191) size 14x33 [transform={m=((1.00,0.00)(0.00,1.00)) t=(10.00,90.00)}]
               RenderSVGContainer {g} at (260,191) size 14x33
@@ -92,7 +92,7 @@ layer at (0,0) size 800x600
           RenderSVGText {text} at (10,81) size 95x11 contains 2 chunk(s)
             RenderSVGInlineText {#text} at (0,0) size 95x11
               chunk 1 text run 1 at (10.00,90.00) startOffset 0 endOffset 1 width 15.00: "1"
-              chunk 2 text run 1 at (60.00,90.00) startOffset 1 endOffset 4 width 45.00: "234"
+              chunk 2 text run 1 at (60.00,90.00) startOffset 0 endOffset 3 width 45.00: "234"
           RenderSVGContainer {g} at (243,225) size 107x65 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,120.00)}]
             RenderSVGContainer {use} at (243,225) size 14x32
               RenderSVGContainer {g} at (243,225) size 14x32 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,-10.00)}]
@@ -141,9 +141,9 @@ layer at (0,0) size 800x600
             RenderSVGText {text} at (10,-19) size 45x31 contains 4 chunk(s)
               RenderSVGInlineText {#text} at (0,0) size 45x31
                 chunk 1 text run 1 at (10.00,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-                chunk 2 text run 1 at (20.00,-5.00) startOffset 1 endOffset 2 width 15.00: "2"
-                chunk 3 text run 1 at (30.00,5.00) startOffset 2 endOffset 3 width 15.00: "3"
-                chunk 4 text run 1 at (40.00,10.00) startOffset 3 endOffset 4 width 15.00: "4"
+                chunk 2 text run 1 at (20.00,-5.00) startOffset 0 endOffset 1 width 15.00: "2"
+                chunk 3 text run 1 at (30.00,5.00) startOffset 0 endOffset 1 width 15.00: "3"
+                chunk 4 text run 1 at (40.00,10.00) startOffset 0 endOffset 1 width 15.00: "4"
           RenderSVGContainer {g} at (260,325) size 99x65 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,180.00)}]
             RenderSVGContainer {use} at (260,325) size 14x32
               RenderSVGContainer {g} at (260,325) size 14x32 [transform={m=((1.00,0.00)(0.00,1.00)) t=(10.00,-10.00)}]
@@ -168,7 +168,7 @@ layer at (0,0) size 800x600
             RenderSVGText {text} at (10,-19) size 55x31 contains 2 chunk(s)
               RenderSVGInlineText {#text} at (0,0) size 55x31
                 chunk 1 text run 1 at (10.00,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-                chunk 2 text run 1 at (20.00,-5.00) startOffset 1 endOffset 4 width 45.00: "234"
+                chunk 2 text run 1 at (20.00,-5.00) startOffset 0 endOffset 3 width 45.00: "234"
           RenderSVGContainer {g} at (243,375) size 107x57 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,210.00)}]
             RenderSVGContainer {use} at (243,375) size 14x32
               RenderSVGContainer {g} at (243,375) size 14x32 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,-10.00)}]
@@ -207,9 +207,9 @@ layer at (0,0) size 800x600
             RenderSVGText {text} at (10,-19) size 45x16 contains 4 chunk(s)
               RenderSVGInlineText {#text} at (0,0) size 45x16
                 chunk 1 text run 1 at (10.00,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-                chunk 2 text run 1 at (20.00,-5.00) startOffset 1 endOffset 2 width 15.00: "2"
-                chunk 3 text run 1 at (30.00,-5.00) startOffset 2 endOffset 3 width 15.00: "3"
-                chunk 4 text run 1 at (40.00,-5.00) startOffset 3 endOffset 4 width 15.00: "4"
+                chunk 2 text run 1 at (20.00,-5.00) startOffset 0 endOffset 1 width 15.00: "2"
+                chunk 3 text run 1 at (30.00,-5.00) startOffset 0 endOffset 1 width 15.00: "3"
+                chunk 4 text run 1 at (40.00,-5.00) startOffset 0 endOffset 1 width 15.00: "4"
           RenderSVGContainer {g} at (260,475) size 165x40 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,270.00)}]
             RenderSVGContainer {use} at (260,475) size 14x32
               RenderSVGContainer {g} at (260,475) size 14x32 [transform={m=((1.00,0.00)(0.00,1.00)) t=(10.00,-10.00)}]
@@ -224,7 +224,7 @@ layer at (0,0) size 800x600
             RenderSVGText {text} at (10,-19) size 95x16 contains 2 chunk(s)
               RenderSVGInlineText {#text} at (0,0) size 95x16
                 chunk 1 text run 1 at (10.00,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-                chunk 2 text run 1 at (60.00,-5.00) startOffset 1 endOffset 4 width 45.00: "234"
+                chunk 2 text run 1 at (60.00,-5.00) startOffset 0 endOffset 3 width 45.00: "234"
       RenderSVGContainer {g} at (356,15) size 199x535 [transform={m=((1.00,0.00)(0.00,1.00)) t=(250.00,40.00)}]
         RenderSVGText {text} at (-36,-31) size 72x18 contains 1 chunk(s)
           RenderSVGInlineText {#text} at (0,0) size 72x18
@@ -262,9 +262,9 @@ layer at (0,0) size 800x600
               RenderSVGText {text} at (2,51) size 46x11 contains 4 chunk(s)
                 RenderSVGInlineText {#text} at (0,0) size 46x11
                   chunk 1 (middle anchor) text run 1 at (2.50,60.00) startOffset 0 endOffset 1 width 15.00: "1"
-                  chunk 2 (middle anchor) text run 1 at (12.50,60.00) startOffset 1 endOffset 2 width 15.00: "2"
-                  chunk 3 (middle anchor) text run 1 at (22.50,60.00) startOffset 2 endOffset 3 width 15.00: "3"
-                  chunk 4 (middle anchor) text run 1 at (32.50,60.00) startOffset 3 endOffset 4 width 15.00: "4"
+                  chunk 2 (middle anchor) text run 1 at (12.50,60.00) startOffset 0 endOffset 1 width 15.00: "2"
+                  chunk 3 (middle anchor) text run 1 at (22.50,60.00) startOffset 0 endOffset 1 width 15.00: "3"
+                  chunk 4 (middle anchor) text run 1 at (32.50,60.00) startOffset 0 endOffset 1 width 15.00: "4"
               RenderSVGContainer {g} at (426,191) size 14x33 [transform={m=((1.00,0.00)(0.00,1.00)) t=(10.00,90.00)}]
                 RenderSVGContainer {g} at (426,191) size 14x33
                   RenderPath {line} at (431,191) size 4x26 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#8888FF]}] [data="M0.00,0.00 L0.00,-15.00"]
@@ -276,7 +276,7 @@ layer at (0,0) size 800x600
               RenderSVGText {text} at (2,81) size 81x11 contains 2 chunk(s)
                 RenderSVGInlineText {#text} at (0,0) size 81x11
                   chunk 1 (middle anchor) text run 1 at (2.50,90.00) startOffset 0 endOffset 1 width 15.00: "1"
-                  chunk 2 (middle anchor) text run 1 at (37.50,90.00) startOffset 1 endOffset 4 width 45.00: "234"
+                  chunk 2 (middle anchor) text run 1 at (37.50,90.00) startOffset 0 endOffset 3 width 45.00: "234"
               RenderSVGContainer {g} at (366,225) size 133x65 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,120.00)}]
                 RenderSVGContainer {g} at (410,225) size 14x32 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,-10.00)}]
                   RenderSVGContainer {g} at (410,225) size 14x32
@@ -317,9 +317,9 @@ layer at (0,0) size 800x600
                 RenderSVGText {text} at (2,-19) size 46x31 contains 4 chunk(s)
                   RenderSVGInlineText {#text} at (0,0) size 46x31
                     chunk 1 (middle anchor) text run 1 at (2.50,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-                    chunk 2 (middle anchor) text run 1 at (12.50,-5.00) startOffset 1 endOffset 2 width 15.00: "2"
-                    chunk 3 (middle anchor) text run 1 at (22.50,5.00) startOffset 2 endOffset 3 width 15.00: "3"
-                    chunk 4 (middle anchor) text run 1 at (32.50,10.00) startOffset 3 endOffset 4 width 15.00: "4"
+                    chunk 2 (middle anchor) text run 1 at (12.50,-5.00) startOffset 0 endOffset 1 width 15.00: "2"
+                    chunk 3 (middle anchor) text run 1 at (22.50,5.00) startOffset 0 endOffset 1 width 15.00: "3"
+                    chunk 4 (middle anchor) text run 1 at (32.50,10.00) startOffset 0 endOffset 1 width 15.00: "4"
               RenderSVGContainer {g} at (411,325) size 96x65 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,180.00)}]
                 RenderSVGContainer {g} at (426,325) size 14x32 [transform={m=((1.00,0.00)(0.00,1.00)) t=(10.00,-10.00)}]
                   RenderSVGContainer {g} at (426,325) size 14x32
@@ -338,9 +338,9 @@ layer at (0,0) size 800x600
                     RenderPath {line} at (498,358) size 4x26 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#8888FF]}] [data="M0.00,0.00 L0.00,-15.00"]
                     RenderPath {rect} at (493,376) size 14x14 [fill={[type=SOLID] [color=#8888FF]}] [data="M-4.00,-4.00 L4.00,-4.00 L4.00,4.00 L-4.00,4.00 Z"]
                 RenderSVGText {text} at (-3,-19) size 46x31 contains 2 chunk(s)
-                  RenderSVGInlineText {#text} at (0,0) size 46x31
+                  RenderSVGInlineText {#text} at (5,0) size 46x31
                     chunk 1 (middle anchor) text run 1 at (2.50,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-                    chunk 2 (middle anchor) text run 1 at (-2.50,-5.00) startOffset 1 endOffset 4 width 45.00: "234"
+                    chunk 2 (middle anchor) text run 1 at (-2.50,-5.00) startOffset 0 endOffset 3 width 45.00: "234"
               RenderSVGContainer {g} at (366,375) size 101x57 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,210.00)}]
                 RenderSVGContainer {g} at (410,375) size 14x32 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,-10.00)}]
                   RenderSVGContainer {g} at (410,375) size 14x32
@@ -373,9 +373,9 @@ layer at (0,0) size 800x600
                 RenderSVGText {text} at (2,-19) size 46x16 contains 4 chunk(s)
                   RenderSVGInlineText {#text} at (0,0) size 46x16
                     chunk 1 (middle anchor) text run 1 at (2.50,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-                    chunk 2 (middle anchor) text run 1 at (12.50,-5.00) startOffset 1 endOffset 2 width 15.00: "2"
-                    chunk 3 (middle anchor) text run 1 at (22.50,-5.00) startOffset 2 endOffset 3 width 15.00: "3"
-                    chunk 4 (middle anchor) text run 1 at (32.50,-5.00) startOffset 3 endOffset 4 width 15.00: "4"
+                    chunk 2 (middle anchor) text run 1 at (12.50,-5.00) startOffset 0 endOffset 1 width 15.00: "2"
+                    chunk 3 (middle anchor) text run 1 at (22.50,-5.00) startOffset 0 endOffset 1 width 15.00: "3"
+                    chunk 4 (middle anchor) text run 1 at (32.50,-5.00) startOffset 0 endOffset 1 width 15.00: "4"
               RenderSVGContainer {g} at (420,475) size 135x40 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,270.00)}]
                 RenderSVGContainer {g} at (426,475) size 14x32 [transform={m=((1.00,0.00)(0.00,1.00)) t=(10.00,-10.00)}]
                   RenderSVGContainer {g} at (426,475) size 14x32
@@ -388,7 +388,7 @@ layer at (0,0) size 800x600
                 RenderSVGText {text} at (2,-19) size 81x16 contains 2 chunk(s)
                   RenderSVGInlineText {#text} at (0,0) size 81x16
                     chunk 1 (middle anchor) text run 1 at (2.50,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-                    chunk 2 (middle anchor) text run 1 at (37.50,-5.00) startOffset 1 endOffset 4 width 45.00: "234"
+                    chunk 2 (middle anchor) text run 1 at (37.50,-5.00) startOffset 0 endOffset 3 width 45.00: "234"
       RenderSVGContainer {g} at (483,15) size 207x535 [transform={m=((1.00,0.00)(0.00,1.00)) t=(350.00,40.00)}]
         RenderSVGText {text} at (-36,-31) size 72x18 contains 1 chunk(s)
           RenderSVGInlineText {#text} at (0,0) size 72x18
@@ -426,9 +426,9 @@ layer at (0,0) size 800x600
               RenderSVGText {text} at (-5,51) size 45x11 contains 4 chunk(s)
                 RenderSVGInlineText {#text} at (0,0) size 45x11
                   chunk 1 (end anchor) text run 1 at (-5.00,60.00) startOffset 0 endOffset 1 width 15.00: "1"
-                  chunk 2 (end anchor) text run 1 at (5.00,60.00) startOffset 1 endOffset 2 width 15.00: "2"
-                  chunk 3 (end anchor) text run 1 at (15.00,60.00) startOffset 2 endOffset 3 width 15.00: "3"
-                  chunk 4 (end anchor) text run 1 at (25.00,60.00) startOffset 3 endOffset 4 width 15.00: "4"
+                  chunk 2 (end anchor) text run 1 at (5.00,60.00) startOffset 0 endOffset 1 width 15.00: "2"
+                  chunk 3 (end anchor) text run 1 at (15.00,60.00) startOffset 0 endOffset 1 width 15.00: "3"
+                  chunk 4 (end anchor) text run 1 at (25.00,60.00) startOffset 0 endOffset 1 width 15.00: "4"
               RenderSVGContainer {g} at (593,191) size 14x33 [transform={m=((1.00,0.00)(0.00,1.00)) t=(10.00,90.00)}]
                 RenderSVGContainer {g} at (593,191) size 14x33
                   RenderPath {line} at (598,191) size 4x26 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#8888FF]}] [data="M0.00,0.00 L0.00,-15.00"]
@@ -440,7 +440,7 @@ layer at (0,0) size 800x600
               RenderSVGText {text} at (-5,81) size 65x11 contains 2 chunk(s)
                 RenderSVGInlineText {#text} at (0,0) size 65x11
                   chunk 1 (end anchor) text run 1 at (-5.00,90.00) startOffset 0 endOffset 1 width 15.00: "1"
-                  chunk 2 (end anchor) text run 1 at (15.00,90.00) startOffset 1 endOffset 4 width 45.00: "234"
+                  chunk 2 (end anchor) text run 1 at (15.00,90.00) startOffset 0 endOffset 3 width 45.00: "234"
               RenderSVGContainer {g} at (483,225) size 182x65 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,120.00)}]
                 RenderSVGContainer {g} at (576,225) size 14x32 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,-10.00)}]
                   RenderSVGContainer {g} at (576,225) size 14x32
@@ -481,9 +481,9 @@ layer at (0,0) size 800x600
                 RenderSVGText {text} at (-5,-19) size 45x31 contains 4 chunk(s)
                   RenderSVGInlineText {#text} at (0,0) size 45x31
                     chunk 1 (end anchor) text run 1 at (-5.00,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-                    chunk 2 (end anchor) text run 1 at (5.00,-5.00) startOffset 1 endOffset 2 width 15.00: "2"
-                    chunk 3 (end anchor) text run 1 at (15.00,5.00) startOffset 2 endOffset 3 width 15.00: "3"
-                    chunk 4 (end anchor) text run 1 at (25.00,10.00) startOffset 3 endOffset 4 width 15.00: "4"
+                    chunk 2 (end anchor) text run 1 at (5.00,-5.00) startOffset 0 endOffset 1 width 15.00: "2"
+                    chunk 3 (end anchor) text run 1 at (15.00,5.00) startOffset 0 endOffset 1 width 15.00: "3"
+                    chunk 4 (end anchor) text run 1 at (25.00,10.00) startOffset 0 endOffset 1 width 15.00: "4"
               RenderSVGContainer {g} at (541,325) size 133x65 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,180.00)}]
                 RenderSVGContainer {g} at (593,325) size 14x32 [transform={m=((1.00,0.00)(0.00,1.00)) t=(10.00,-10.00)}]
                   RenderSVGContainer {g} at (593,325) size 14x32
@@ -502,9 +502,9 @@ layer at (0,0) size 800x600
                     RenderPath {line} at (665,358) size 4x26 [stroke={[type=SOLID] [color=#FF0000]}] [fill={[type=SOLID] [color=#8888FF]}] [data="M0.00,0.00 L0.00,-15.00"]
                     RenderPath {rect} at (660,376) size 14x14 [fill={[type=SOLID] [color=#8888FF]}] [data="M-4.00,-4.00 L4.00,-4.00 L4.00,4.00 L-4.00,4.00 Z"]
                 RenderSVGText {text} at (-25,-19) size 45x31 contains 2 chunk(s)
-                  RenderSVGInlineText {#text} at (0,0) size 45x31
+                  RenderSVGInlineText {#text} at (20,0) size 45x31
                     chunk 1 (end anchor) text run 1 at (-5.00,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-                    chunk 2 (end anchor) text run 1 at (-25.00,-5.00) startOffset 1 endOffset 4 width 45.00: "234"
+                    chunk 2 (end anchor) text run 1 at (-25.00,-5.00) startOffset 0 endOffset 3 width 45.00: "234"
               RenderSVGContainer {g} at (483,375) size 132x57 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,210.00)}]
                 RenderSVGContainer {g} at (576,375) size 14x32 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,-10.00)}]
                   RenderSVGContainer {g} at (576,375) size 14x32
@@ -537,9 +537,9 @@ layer at (0,0) size 800x600
                 RenderSVGText {text} at (-5,-19) size 45x16 contains 4 chunk(s)
                   RenderSVGInlineText {#text} at (0,0) size 45x16
                     chunk 1 (end anchor) text run 1 at (-5.00,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-                    chunk 2 (end anchor) text run 1 at (5.00,-5.00) startOffset 1 endOffset 2 width 15.00: "2"
-                    chunk 3 (end anchor) text run 1 at (15.00,-5.00) startOffset 2 endOffset 3 width 15.00: "3"
-                    chunk 4 (end anchor) text run 1 at (25.00,-5.00) startOffset 3 endOffset 4 width 15.00: "4"
+                    chunk 2 (end anchor) text run 1 at (5.00,-5.00) startOffset 0 endOffset 1 width 15.00: "2"
+                    chunk 3 (end anchor) text run 1 at (15.00,-5.00) startOffset 0 endOffset 1 width 15.00: "3"
+                    chunk 4 (end anchor) text run 1 at (25.00,-5.00) startOffset 0 endOffset 1 width 15.00: "4"
               RenderSVGContainer {g} at (575,475) size 115x40 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,270.00)}]
                 RenderSVGContainer {g} at (593,475) size 14x32 [transform={m=((1.00,0.00)(0.00,1.00)) t=(10.00,-10.00)}]
                   RenderSVGContainer {g} at (593,475) size 14x32
@@ -552,7 +552,7 @@ layer at (0,0) size 800x600
                 RenderSVGText {text} at (-5,-19) size 65x16 contains 2 chunk(s)
                   RenderSVGInlineText {#text} at (0,0) size 65x16
                     chunk 1 (end anchor) text run 1 at (-5.00,-10.00) startOffset 0 endOffset 1 width 15.00: "1"
-                    chunk 2 (end anchor) text run 1 at (15.00,-5.00) startOffset 1 endOffset 4 width 45.00: "234"
+                    chunk 2 (end anchor) text run 1 at (15.00,-5.00) startOffset 0 endOffset 3 width 45.00: "234"
     RenderSVGText {text} at (10,314) size 264x46 contains 1 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 264x46
         chunk 1 text run 1 at (10.00,350.00) startOffset 0 endOffset 16 width 264.00: "$Revision: 1.8 $"
diff --git a/LayoutTests/platform/mac/svg/text/text-text-06-t-expected.txt b/LayoutTests/platform/mac/svg/text/text-text-06-t-expected.txt
index 8545080..492fabf 100644
--- a/LayoutTests/platform/mac/svg/text/text-text-06-t-expected.txt
+++ b/LayoutTests/platform/mac/svg/text/text-text-06-t-expected.txt
@@ -53,10 +53,10 @@ layer at (0,0) size 800x600
           RenderSVGText {text} at (10,-9) size 135x11 contains 5 chunk(s)
             RenderSVGInlineText {#text} at (0,0) size 135x11
               chunk 1 text run 1 at (10.00,0.00) startOffset 0 endOffset 2 width 15.00: "fi"
-              chunk 2 text run 1 at (40.00,0.00) startOffset 2 endOffset 3 width 15.00: "1"
-              chunk 3 text run 1 at (70.00,0.00) startOffset 3 endOffset 4 width 15.00: "2"
-              chunk 4 text run 1 at (100.00,0.00) startOffset 4 endOffset 5 width 15.00: "3"
-              chunk 5 text run 1 at (130.00,0.00) startOffset 5 endOffset 6 width 15.00: "4"
+              chunk 2 text run 1 at (40.00,0.00) startOffset 0 endOffset 1 width 15.00: "1"
+              chunk 3 text run 1 at (70.00,0.00) startOffset 0 endOffset 1 width 15.00: "2"
+              chunk 4 text run 1 at (100.00,0.00) startOffset 0 endOffset 1 width 15.00: "3"
+              chunk 5 text run 1 at (130.00,0.00) startOffset 0 endOffset 1 width 15.00: "4"
         RenderSVGContainer {g} at (193,141) size 132x133 [transform={m=((1.00,0.00)(0.00,1.00)) t=(100.00,80.00)}]
           RenderSVGContainer {use} at (193,141) size 14x33
             RenderSVGContainer {g} at (193,141) size 14x33 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,-10.00)}]
@@ -125,10 +125,10 @@ layer at (0,0) size 800x600
           RenderSVGText {text} at (10,-19) size 135x51 contains 5 chunk(s)
             RenderSVGInlineText {#text} at (0,0) size 135x51
               chunk 1 text run 1 at (10.00,-10.00) startOffset 0 endOffset 2 width 15.00: "fi"
-              chunk 2 text run 1 at (40.00,0.00) startOffset 2 endOffset 3 width 15.00: "1"
-              chunk 3 text run 1 at (70.00,10.00) startOffset 3 endOffset 4 width 15.00: "2"
-              chunk 4 text run 1 at (100.00,20.00) startOffset 4 endOffset 5 width 15.00: "3"
-              chunk 5 text run 1 at (130.00,30.00) startOffset 5 endOffset 6 width 15.00: "4"
+              chunk 2 text run 1 at (40.00,0.00) startOffset 0 endOffset 1 width 15.00: "1"
+              chunk 3 text run 1 at (70.00,10.00) startOffset 0 endOffset 1 width 15.00: "2"
+              chunk 4 text run 1 at (100.00,20.00) startOffset 0 endOffset 1 width 15.00: "3"
+              chunk 5 text run 1 at (130.00,30.00) startOffset 0 endOffset 1 width 15.00: "4"
     RenderSVGText {text} at (10,304) size 264x46 contains 1 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 264x46
         chunk 1 text run 1 at (10.00,340.00) startOffset 0 endOffset 16 width 264.00: "$Revision: 1.9 $"
diff --git a/LayoutTests/platform/mac/svg/text/text-text-07-t-expected.txt b/LayoutTests/platform/mac/svg/text/text-text-07-t-expected.txt
index 28d17f8..28f32b3 100644
--- a/LayoutTests/platform/mac/svg/text/text-text-07-t-expected.txt
+++ b/LayoutTests/platform/mac/svg/text/text-text-07-t-expected.txt
@@ -6,30 +6,30 @@ layer at (0,0) size 800x600
       RenderSVGText {text} at (240,29) size 179x180 contains 7 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 179x180
           chunk 1 text run 1 at (240.00,60.00) startOffset 0 endOffset 1 width 31.00: "M"
-          chunk 2 text run 1 at (260.00,80.00) startOffset 1 endOffset 2 width 18.00: "u"
-          chunk 3 text run 1 at (280.00,100.00) startOffset 2 endOffset 3 width 10.00: "l"
-          chunk 4 text run 1 at (300.00,120.00) startOffset 3 endOffset 4 width 10.00: "t"
-          chunk 5 text run 1 at (320.00,140.00) startOffset 4 endOffset 5 width 10.00: "i"
-          chunk 6 text run 1 at (340.00,160.00) startOffset 5 endOffset 6 width 9.00: " "
-          chunk 7 text run 1 at (360.00,180.00) startOffset 6 endOffset 9 width 59.00: "X Y"
+          chunk 2 text run 1 at (260.00,80.00) startOffset 0 endOffset 1 width 18.00: "u"
+          chunk 3 text run 1 at (280.00,100.00) startOffset 0 endOffset 1 width 10.00: "l"
+          chunk 4 text run 1 at (300.00,120.00) startOffset 0 endOffset 1 width 10.00: "t"
+          chunk 5 text run 1 at (320.00,140.00) startOffset 0 endOffset 1 width 10.00: "i"
+          chunk 6 text run 1 at (340.00,160.00) startOffset 0 endOffset 1 width 9.00: " "
+          chunk 7 text run 1 at (360.00,180.00) startOffset 0 endOffset 3 width 59.00: "X Y"
       RenderSVGText {text} at (10,29) size 153x53 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,0) size 153x53
           chunk 1 text run 1 at (10.00,60.00) startOffset 0 endOffset 6 width 136.00: "ROTATE"
       RenderSVGText {text} at (10,165) size 248x144 contains 13 chunk(s)
-        RenderSVGInlineText {#text} at (0,0) size 248x144
+        RenderSVGInlineText {#text} at (0,104) size 248x144
           chunk 1 text run 1 at (10.00,300.00) startOffset 0 endOffset 1 width 23.00: "B"
-          chunk 2 text run 1 at (30.00,290.00) startOffset 1 endOffset 2 width 18.00: "o"
-          chunk 3 text run 1 at (50.00,280.00) startOffset 2 endOffset 3 width 10.00: "t"
-          chunk 4 text run 1 at (70.00,270.00) startOffset 3 endOffset 4 width 18.00: "h"
-          chunk 5 text run 1 at (90.00,260.00) startOffset 4 endOffset 5 width 9.00: " "
-          chunk 6 text run 1 at (110.00,250.00) startOffset 5 endOffset 6 width 21.00: "T"
-          chunk 7 text run 1 at (130.00,240.00) startOffset 6 endOffset 7 width 18.00: "o"
-          chunk 8 text run 1 at (150.00,230.00) startOffset 7 endOffset 8 width 18.00: "g"
-          chunk 9 text run 1 at (170.00,220.00) startOffset 8 endOffset 9 width 16.00: "e"
-          chunk 10 text run 1 at (190.00,210.00) startOffset 9 endOffset 10 width 10.00: "t"
-          chunk 11 text run 1 at (210.00,200.00) startOffset 10 endOffset 11 width 18.00: "h"
-          chunk 12 text run 1 at (230.00,190.00) startOffset 11 endOffset 12 width 16.00: "e"
-          chunk 13 text run 1 at (250.00,180.00) startOffset 12 endOffset 13 width 12.00: "r"
+          chunk 2 text run 1 at (30.00,290.00) startOffset 0 endOffset 1 width 18.00: "o"
+          chunk 3 text run 1 at (50.00,280.00) startOffset 0 endOffset 1 width 10.00: "t"
+          chunk 4 text run 1 at (70.00,270.00) startOffset 0 endOffset 1 width 18.00: "h"
+          chunk 5 text run 1 at (90.00,260.00) startOffset 0 endOffset 1 width 9.00: " "
+          chunk 6 text run 1 at (110.00,250.00) startOffset 0 endOffset 1 width 21.00: "T"
+          chunk 7 text run 1 at (130.00,240.00) startOffset 0 endOffset 1 width 18.00: "o"
+          chunk 8 text run 1 at (150.00,230.00) startOffset 0 endOffset 1 width 18.00: "g"
+          chunk 9 text run 1 at (170.00,220.00) startOffset 0 endOffset 1 width 16.00: "e"
+          chunk 10 text run 1 at (190.00,210.00) startOffset 0 endOffset 1 width 10.00: "t"
+          chunk 11 text run 1 at (210.00,200.00) startOffset 0 endOffset 1 width 18.00: "h"
+          chunk 12 text run 1 at (230.00,190.00) startOffset 0 endOffset 1 width 16.00: "e"
+          chunk 13 text run 1 at (250.00,180.00) startOffset 0 endOffset 1 width 12.00: "r"
     RenderSVGText {text} at (10,304) size 264x46 contains 1 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 264x46
         chunk 1 text run 1 at (10.00,340.00) startOffset 0 endOffset 16 width 264.00: "$Revision: 1.8 $"
diff --git a/LayoutTests/platform/mac/svg/text/text-tspan-01-b-expected.txt b/LayoutTests/platform/mac/svg/text/text-tspan-01-b-expected.txt
index bf9896f..94be883 100644
--- a/LayoutTests/platform/mac/svg/text/text-tspan-01-b-expected.txt
+++ b/LayoutTests/platform/mac/svg/text/text-tspan-01-b-expected.txt
@@ -50,21 +50,21 @@ layer at (0,0) size 800x600
           RenderSVGTSpan {tspan} at (0,0) size 145x17
             RenderSVGInlineText {#text} at (0,0) size 145x17
               chunk 1 text run 1 at (35.00,200.00) startOffset 0 endOffset 1 width 12.00: "C"
-              chunk 2 text run 1 at (53.75,200.00) startOffset 1 endOffset 2 width 9.00: "u"
-              chunk 3 text run 1 at (72.50,200.00) startOffset 2 endOffset 3 width 4.00: "t"
-              chunk 4 text run 1 at (91.25,200.00) startOffset 3 endOffset 4 width 9.00: "e"
-              chunk 5 text run 1 at (110.50,200.00) startOffset 4 endOffset 5 width 4.00: " "
-              chunk 6 text run 1 at (128.75,200.00) startOffset 5 endOffset 6 width 9.00: "a"
-              chunk 7 text run 1 at (147.50,200.00) startOffset 6 endOffset 7 width 9.00: "n"
-              chunk 8 text run 1 at (166.25,200.00) startOffset 7 endOffset 9 width 13.00: "d "
+              chunk 2 text run 1 at (53.75,200.00) startOffset 0 endOffset 1 width 9.00: "u"
+              chunk 3 text run 1 at (72.50,200.00) startOffset 0 endOffset 1 width 4.00: "t"
+              chunk 4 text run 1 at (91.25,200.00) startOffset 0 endOffset 1 width 9.00: "e"
+              chunk 5 text run 1 at (110.50,200.00) startOffset 0 endOffset 1 width 4.00: " "
+              chunk 6 text run 1 at (128.75,200.00) startOffset 0 endOffset 1 width 9.00: "a"
+              chunk 7 text run 1 at (147.50,200.00) startOffset 0 endOffset 1 width 9.00: "n"
+              chunk 8 text run 1 at (166.25,200.00) startOffset 0 endOffset 2 width 13.00: "d "
           RenderSVGInlineText {#text} at (0,0) size 0x0
           RenderSVGTSpan {tspan} at (0,0) size 88x18
             RenderSVGInlineText {#text} at (28,30) size 88x18
               chunk 9 text run 1 at (63.13,230.50) startOffset 0 endOffset 1 width 4.00: "f"
-              chunk 10 text run 1 at (81.88,230.50) startOffset 1 endOffset 2 width 9.00: "u"
-              chunk 11 text run 1 at (100.63,230.50) startOffset 2 endOffset 3 width 8.00: "z"
-              chunk 12 text run 1 at (119.38,230.50) startOffset 3 endOffset 4 width 8.00: "z"
-              chunk 13 text run 1 at (138.13,230.50) startOffset 4 endOffset 6 width 12.00: "y."
+              chunk 10 text run 1 at (81.88,230.50) startOffset 0 endOffset 1 width 9.00: "u"
+              chunk 11 text run 1 at (100.63,230.50) startOffset 0 endOffset 1 width 8.00: "z"
+              chunk 12 text run 1 at (119.38,230.50) startOffset 0 endOffset 1 width 8.00: "z"
+              chunk 13 text run 1 at (138.13,230.50) startOffset 0 endOffset 2 width 12.00: "y."
           RenderSVGInlineText {#text} at (0,0) size 0x0
         RenderPath {rect} at (28,406) size 562x93 [stroke={[type=SOLID] [color=#000000]}] [data="M17.50,244.75 L353.00,244.75 L353.00,298.25 L17.50,298.25 Z"]
         RenderSVGText {text} at (25,244) size 162x17 contains 1 chunk(s)
diff --git a/LayoutTests/platform/qt/svg/text/select-x-list-1-expected.txt b/LayoutTests/platform/qt/svg/text/select-x-list-1-expected.txt
index 78634e8..3e8d4a1 100644
--- a/LayoutTests/platform/qt/svg/text/select-x-list-1-expected.txt
+++ b/LayoutTests/platform/qt/svg/text/select-x-list-1-expected.txt
@@ -7,7 +7,7 @@ layer at (0,0) size 800x600
     RenderSVGText {text} at (10,0) size 76x12 contains 3 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 76x12
         chunk 1 text run 1 at (10.00,10.00) startOffset 0 endOffset 1 width 6.00: "T"
-        chunk 2 text run 1 at (20.00,10.00) startOffset 1 endOffset 2 width 6.00: "h"
-        chunk 3 text run 1 at (40.00,10.00) startOffset 2 endOffset 14 width 46.00: "is is a test"
+        chunk 2 text run 1 at (20.00,10.00) startOffset 0 endOffset 1 width 6.00: "h"
+        chunk 3 text run 1 at (40.00,10.00) startOffset 0 endOffset 12 width 46.00: "is is a test"
 selection start: position 0 of child 0 {#text} of child 5 {text} of child 0 {svg} of document
 selection end:   position 4 of child 0 {#text} of child 5 {text} of child 0 {svg} of document
diff --git a/LayoutTests/platform/qt/svg/text/select-x-list-2-expected.txt b/LayoutTests/platform/qt/svg/text/select-x-list-2-expected.txt
index 7921ed3..f1c002a 100644
--- a/LayoutTests/platform/qt/svg/text/select-x-list-2-expected.txt
+++ b/LayoutTests/platform/qt/svg/text/select-x-list-2-expected.txt
@@ -7,7 +7,7 @@ layer at (0,0) size 800x600
     RenderSVGText {text} at (10,0) size 76x12 contains 3 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 76x12
         chunk 1 text run 1 at (10.00,10.00) startOffset 0 endOffset 1 width 6.00: "T"
-        chunk 2 text run 1 at (20.00,10.00) startOffset 1 endOffset 2 width 6.00: "h"
-        chunk 3 text run 1 at (40.00,10.00) startOffset 2 endOffset 14 width 46.00: "is is a test"
+        chunk 2 text run 1 at (20.00,10.00) startOffset 0 endOffset 1 width 6.00: "h"
+        chunk 3 text run 1 at (40.00,10.00) startOffset 0 endOffset 12 width 46.00: "is is a test"
 selection start: position 2 of child 0 {#text} of child 5 {text} of child 0 {svg} of document
 selection end:   position 7 of child 0 {#text} of child 5 {text} of child 0 {svg} of document
diff --git a/LayoutTests/platform/qt/svg/text/select-x-list-3-expected.txt b/LayoutTests/platform/qt/svg/text/select-x-list-3-expected.txt
index 5bc433c..6cc8669 100644
--- a/LayoutTests/platform/qt/svg/text/select-x-list-3-expected.txt
+++ b/LayoutTests/platform/qt/svg/text/select-x-list-3-expected.txt
@@ -7,7 +7,7 @@ layer at (0,0) size 800x600
     RenderSVGText {text} at (10,0) size 76x12 contains 3 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 76x12
         chunk 1 text run 1 at (10.00,10.00) startOffset 0 endOffset 1 width 6.00: "T"
-        chunk 2 text run 1 at (20.00,10.00) startOffset 1 endOffset 2 width 6.00: "h"
-        chunk 3 text run 1 at (40.00,10.00) startOffset 2 endOffset 14 width 46.00: "is is a test"
+        chunk 2 text run 1 at (20.00,10.00) startOffset 0 endOffset 1 width 6.00: "h"
+        chunk 3 text run 1 at (40.00,10.00) startOffset 0 endOffset 12 width 46.00: "is is a test"
 selection start: position 8 of child 0 {#text} of child 5 {text} of child 0 {svg} of document
 selection end:   position 9 of child 0 {#text} of child 5 {text} of child 0 {svg} of document
diff --git a/LayoutTests/platform/qt/svg/text/select-x-list-4-expected.txt b/LayoutTests/platform/qt/svg/text/select-x-list-4-expected.txt
index 3c27d01..12fa912 100644
--- a/LayoutTests/platform/qt/svg/text/select-x-list-4-expected.txt
+++ b/LayoutTests/platform/qt/svg/text/select-x-list-4-expected.txt
@@ -7,7 +7,7 @@ layer at (0,0) size 800x600
     RenderSVGText {text} at (10,0) size 76x12 contains 3 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 76x12
         chunk 1 text run 1 at (10.00,10.00) startOffset 0 endOffset 1 width 6.00: "T"
-        chunk 2 text run 1 at (20.00,10.00) startOffset 1 endOffset 2 width 6.00: "h"
-        chunk 3 text run 1 at (40.00,10.00) startOffset 2 endOffset 14 width 46.00: "is is a test"
+        chunk 2 text run 1 at (20.00,10.00) startOffset 0 endOffset 1 width 6.00: "h"
+        chunk 3 text run 1 at (40.00,10.00) startOffset 0 endOffset 12 width 46.00: "is is a test"
 selection start: position 0 of child 0 {#text} of child 5 {text} of child 0 {svg} of document
 selection end:   position 14 of child 0 {#text} of child 5 {text} of child 0 {svg} of document
diff --git a/LayoutTests/platform/qt/svg/text/select-x-list-with-tspans-1-expected.txt b/LayoutTests/platform/qt/svg/text/select-x-list-with-tspans-1-expected.txt
index dccfaa3..0895b41 100644
--- a/LayoutTests/platform/qt/svg/text/select-x-list-with-tspans-1-expected.txt
+++ b/LayoutTests/platform/qt/svg/text/select-x-list-with-tspans-1-expected.txt
@@ -7,7 +7,7 @@ layer at (0,0) size 800x600
     RenderSVGText {text} at (10,0) size 76x12 contains 3 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 16x12
         chunk 1 text run 1 at (10.00,10.00) startOffset 0 endOffset 1 width 6.00: "T"
-        chunk 2 text run 1 at (20.00,10.00) startOffset 1 endOffset 2 width 6.00: "h"
+        chunk 2 text run 1 at (20.00,10.00) startOffset 0 endOffset 1 width 6.00: "h"
       RenderSVGTSpan {tspan} at (0,0) size 2x12
         RenderSVGInlineText {#text} at (30,0) size 2x12
           chunk 3 text run 1 at (40.00,10.00) startOffset 0 endOffset 1 width 2.00: "i"
diff --git a/LayoutTests/platform/qt/svg/text/select-x-list-with-tspans-2-expected.txt b/LayoutTests/platform/qt/svg/text/select-x-list-with-tspans-2-expected.txt
index 7125832..9211b61 100644
--- a/LayoutTests/platform/qt/svg/text/select-x-list-with-tspans-2-expected.txt
+++ b/LayoutTests/platform/qt/svg/text/select-x-list-with-tspans-2-expected.txt
@@ -7,7 +7,7 @@ layer at (0,0) size 800x600
     RenderSVGText {text} at (10,0) size 76x12 contains 3 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 16x12
         chunk 1 text run 1 at (10.00,10.00) startOffset 0 endOffset 1 width 6.00: "T"
-        chunk 2 text run 1 at (20.00,10.00) startOffset 1 endOffset 2 width 6.00: "h"
+        chunk 2 text run 1 at (20.00,10.00) startOffset 0 endOffset 1 width 6.00: "h"
       RenderSVGTSpan {tspan} at (0,0) size 2x12
         RenderSVGInlineText {#text} at (30,0) size 2x12
           chunk 3 text run 1 at (40.00,10.00) startOffset 0 endOffset 1 width 2.00: "i"
diff --git a/LayoutTests/platform/qt/svg/text/select-x-list-with-tspans-3-expected.txt b/LayoutTests/platform/qt/svg/text/select-x-list-with-tspans-3-expected.txt
index fa03c1f..71ff9a5 100644
--- a/LayoutTests/platform/qt/svg/text/select-x-list-with-tspans-3-expected.txt
+++ b/LayoutTests/platform/qt/svg/text/select-x-list-with-tspans-3-expected.txt
@@ -7,7 +7,7 @@ layer at (0,0) size 800x600
     RenderSVGText {text} at (10,0) size 76x12 contains 3 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 16x12
         chunk 1 text run 1 at (10.00,10.00) startOffset 0 endOffset 1 width 6.00: "T"
-        chunk 2 text run 1 at (20.00,10.00) startOffset 1 endOffset 2 width 6.00: "h"
+        chunk 2 text run 1 at (20.00,10.00) startOffset 0 endOffset 1 width 6.00: "h"
       RenderSVGTSpan {tspan} at (0,0) size 2x12
         RenderSVGInlineText {#text} at (30,0) size 2x12
           chunk 3 text run 1 at (40.00,10.00) startOffset 0 endOffset 1 width 2.00: "i"
diff --git a/LayoutTests/platform/qt/svg/text/select-x-list-with-tspans-4-expected.txt b/LayoutTests/platform/qt/svg/text/select-x-list-with-tspans-4-expected.txt
index 9a4749e..4daef42 100644
--- a/LayoutTests/platform/qt/svg/text/select-x-list-with-tspans-4-expected.txt
+++ b/LayoutTests/platform/qt/svg/text/select-x-list-with-tspans-4-expected.txt
@@ -7,7 +7,7 @@ layer at (0,0) size 800x600
     RenderSVGText {text} at (10,0) size 76x12 contains 3 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 16x12
         chunk 1 text run 1 at (10.00,10.00) startOffset 0 endOffset 1 width 6.00: "T"
-        chunk 2 text run 1 at (20.00,10.00) startOffset 1 endOffset 2 width 6.00: "h"
+        chunk 2 text run 1 at (20.00,10.00) startOffset 0 endOffset 1 width 6.00: "h"
       RenderSVGTSpan {tspan} at (0,0) size 2x12
         RenderSVGInlineText {#text} at (30,0) size 2x12
           chunk 3 text run 1 at (40.00,10.00) startOffset 0 endOffset 1 width 2.00: "i"
diff --git a/LayoutTests/svg/custom/glyph-transformation-with-hkern-expected.txt b/LayoutTests/svg/custom/glyph-transformation-with-hkern-expected.txt
index 2a740e4..fb940ba 100644
--- a/LayoutTests/svg/custom/glyph-transformation-with-hkern-expected.txt
+++ b/LayoutTests/svg/custom/glyph-transformation-with-hkern-expected.txt
@@ -6,8 +6,8 @@ layer at (0,0) size 800x600
     RenderSVGText {text} at (30,1) size 138x151 contains 6 chunk(s)
       RenderSVGInlineText {#text} at (0,0) size 138x151
         chunk 1 text run 1 at (30.00,30.00) startOffset 0 endOffset 1 width 25.27: "R"
-        chunk 2 text run 1 at (49.54,50.00) startOffset 1 endOffset 2 width 27.23: "O"
-        chunk 3 text run 1 at (68.53,70.00) startOffset 2 endOffset 3 width 21.39: "T"
-        chunk 4 text run 1 at (86.68,90.00) startOffset 3 endOffset 4 width 23.34: "A"
-        chunk 5 text run 1 at (106.75,110.00) startOffset 4 endOffset 5 width 21.39: "T"
-        chunk 6 text run 1 at (130.00,130.00) startOffset 5 endOffset 6 width 23.34: "E"
+        chunk 2 text run 1 at (49.54,50.00) startOffset 0 endOffset 1 width 27.23: "O"
+        chunk 3 text run 1 at (68.53,70.00) startOffset 0 endOffset 1 width 21.39: "T"
+        chunk 4 text run 1 at (86.68,90.00) startOffset 0 endOffset 1 width 23.34: "A"
+        chunk 5 text run 1 at (106.75,110.00) startOffset 0 endOffset 1 width 21.39: "T"
+        chunk 6 text run 1 at (130.00,130.00) startOffset 0 endOffset 1 width 23.34: "E"
diff --git a/WebCore/Android.mk b/WebCore/Android.mk
index cc58bcf..c0c5fba 100644
--- a/WebCore/Android.mk
+++ b/WebCore/Android.mk
@@ -673,7 +673,9 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
 	rendering/RenderSVGText.cpp \
 	rendering/RenderSVGTextPath.cpp \
 	rendering/RenderSVGTransformableContainer.cpp \
-	rendering/RenderSVGViewportContainer.cpp
+	rendering/RenderSVGViewportContainer.cpp \
+	rendering/svg/SVGTextLayoutAttributes.cpp \
+	rendering/svg/SVGTextLayoutBuilder.cpp
 endif
 
 LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
diff --git a/WebCore/CMakeLists.txt b/WebCore/CMakeLists.txt
index 4fb3c0a..afb58ec 100644
--- a/WebCore/CMakeLists.txt
+++ b/WebCore/CMakeLists.txt
@@ -45,6 +45,7 @@ SET(WebCore_INCLUDE_DIRECTORIES
     "${WEBCORE_DIR}/plugins"
     "${WEBCORE_DIR}/rendering"
     "${WEBCORE_DIR}/rendering/style"
+    "${WEBCORE_DIR}/rendering/svg"
     "${WEBCORE_DIR}/storage"
     "${WEBCORE_DIR}/svg"
     "${WEBCORE_DIR}/svg/animation"
@@ -1662,6 +1663,8 @@ IF (ENABLE_SVG)
         rendering/SVGTextQuery.cpp
         rendering/style/SVGRenderStyle.cpp
         rendering/style/SVGRenderStyleDefs.cpp
+        rendering/svg/SVGTextLayoutAttributes.cpp
+        rendering/svg/SVGTextLayoutBuilder.cpp
         svg/ColorDistance.cpp
         svg/SVGAElement.cpp
         svg/SVGAltGlyphElement.cpp
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index adff749..3b73f95 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,53 @@
+2010-09-10  Nikolas Zimmermann  <nzimmermann at rim.com>
+
+        Reviewed by Dirk Schulze.
+
+        SVG text chunk concept needs to be integrated in the InlineBox structure
+        https://bugs.webkit.org/show_bug.cgi?id=45533
+
+        Begin rewriting the SVG text layout code. As first step move the text chunk concept right into the inline box structure.
+        This obsoletes the whole text chunk part concept (see SVGTextChunkLayoutInfo.h for details), and will soon simplify the
+        whole layout code a lot. Previously we hacked around the fact that a single InlineTextBox could contain multiple text chunks
+        For example: <text x="20 30 40">ABC</text> only led to the creation of one InlineTextBox containing three chunks. When
+        painting such an InlineTextBox, we had to do nasty hacks (same for text selection etc.)
+        
+        This is finally fixed by incorporating the knownledge about text chunks into the line layout algorithm.
+        Note, this has no impact on HTML at all, no worries.
+
+        It's even required to do it this way as BiDi reordering shouldn't happen across text chunks.
+        These are only the first bits, and currently slows down text layouting. Follow-up patches will remove the old layout
+        algorithm, and will rely on the stored SVGTextLayoutAttributes in the RenerSVGInlineText renderers (instead of computing again).
+
+        * Android.mk: Add rendering/svg/SVGTextLayoutAttributes.* & rendering/svg/SVGTextLayoutBuilder.* to build.
+        * CMakeLists.txt: Ditto.
+        * GNUmakefile.am: Ditto.
+        * WebCore.gyp/WebCore.gyp: Ditto.
+        * WebCore.gypi: Ditto.
+        * WebCore.pro: Ditto.
+        * WebCore.vcproj/WebCore.vcproj: Ditto.
+        * WebCore.vcproj/WebCoreCommon.vsprops: Ditto. (Recognize new rendering/svg directory.)
+        * WebCore.vcproj/copyForwardingHeaders.cmd: Ditto. (Copy forwarding headers from rendering/svg directory.)
+        * WebCore.xcodeproj/project.pbxproj: Ditto.
+        * rendering/RenderBlockLineLayout.cpp: This is the key of the new concept, take text chunks into account when building the InlineBox structure.
+        (WebCore::RenderBlock::findNextLineBreak): Split midpointState, if we encounter the beginning of a new text chunk.
+        * rendering/RenderObject.h:
+        (WebCore::RenderObject::isSVGInline): New method, which will be used to identify RenderSVGInline objects.
+        * rendering/RenderSVGInline.h:
+        (WebCore::RenderSVGInline::isSVGInline): Return true.
+        * rendering/RenderSVGInlineText.cpp:
+        (WebCore::RenderSVGInlineText::linesBoundingBox): Overriden, to simplify the calculations for SVG.
+        (WebCore::RenderSVGInlineText::characterStartsNewTextChunk): Determines wheter the given position starts a new text chunk.
+        * rendering/RenderSVGInlineText.h:
+        (WebCore::RenderSVGInlineText::storeLayoutAttributes): Stores the layout attributes calculated in the text layout process (will be used everywhere in follow-up patches).
+        * rendering/RenderSVGText.cpp:
+        (WebCore::RenderSVGText::layout): Invoke SVGTextLayoutBuilder before creating the inline box tree, so we can decide which characters start new text chunks.
+        * rendering/RenderText.h: Made linesBoundingBox() virtual so RenderSVGInlineText can override it.
+        * rendering/svg: Added.
+        * rendering/svg/SVGTextLayoutAttributes.cpp: Added. Holds x/y/dx/dy/rotate values and all kerning/ligature information used during layout.
+        * rendering/svg/SVGTextLayoutAttributes.h: Added.
+        * rendering/svg/SVGTextLayoutBuilder.cpp: Added.
+        * rendering/svg/SVGTextLayoutBuilder.h: Added.
+
 2010-09-10  Csaba Osztrogonác  <ossy at webkit.org>
 
         Unreviewed fix after r67085.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index 01d11cf..3e182e1 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -52,6 +52,7 @@ webcore_cppflags += \
 	-I$(srcdir)/WebCore/plugins \
 	-I$(srcdir)/WebCore/rendering \
 	-I$(srcdir)/WebCore/rendering/style \
+	-I$(srcdir)/WebCore/rendering/svg \
 	-I$(srcdir)/WebCore/storage \
 	-I$(srcdir)/WebCore/svg \
 	-I$(srcdir)/WebCore/svg/animation \
@@ -3992,6 +3993,10 @@ webcore_sources += \
 	WebCore/rendering/style/SVGRenderStyle.h \
 	WebCore/rendering/style/SVGRenderStyleDefs.cpp \
 	WebCore/rendering/style/SVGRenderStyleDefs.h \
+	WebCore/rendering/svg/SVGTextLayoutAttributes.cpp \
+	WebCore/rendering/svg/SVGTextLayoutAttributes.h \
+	WebCore/rendering/svg/SVGTextLayoutBuilder.cpp \
+	WebCore/rendering/svg/SVGTextLayoutBuilder.h \
 	WebCore/svg/ColorDistance.cpp \
 	WebCore/svg/ColorDistance.h \
 	WebCore/svg/ElementTimeControl.h \
diff --git a/WebCore/WebCore.gyp/WebCore.gyp b/WebCore/WebCore.gyp/WebCore.gyp
index 7e2e6c2..8377f2a 100644
--- a/WebCore/WebCore.gyp/WebCore.gyp
+++ b/WebCore/WebCore.gyp/WebCore.gyp
@@ -163,6 +163,7 @@
       '../plugins/chromium',
       '../rendering',
       '../rendering/style',
+      '../rendering/svg',
       '../storage',
       '../storage/chromium',
       '../svg',
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index aaef136..7f2b9e4 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -3331,6 +3331,10 @@
             'rendering/style/StyleTransformData.h',
             'rendering/style/StyleVisualData.cpp',
             'rendering/style/StyleVisualData.h',
+            'rendering/svg/SVGTextLayoutAttributes.cpp',
+            'rendering/svg/SVGTextLayoutAttributes.h',
+            'rendering/svg/SVGTextLayoutBuilder.cpp',
+            'rendering/svg/SVGTextLayoutBuilder.h',
             'rendering/AutoTableLayout.cpp',
             'rendering/AutoTableLayout.h',
             'rendering/BidiRun.cpp',
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index a8b66d3..4b6cb87 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -220,6 +220,7 @@ WEBCORE_INCLUDEPATH = \
     $$PWD/plugins \
     $$PWD/rendering \
     $$PWD/rendering/style \
+    $$PWD/rendering/svg \
     $$PWD/storage \
     $$PWD/svg \
     $$PWD/svg/animation \
@@ -1969,6 +1970,8 @@ HEADERS += \
     rendering/style/StyleVisualData.h \
     rendering/style/SVGRenderStyleDefs.h \
     rendering/style/SVGRenderStyle.h \
+    rendering/svg/SVGTextLayoutAttributes.h \
+    rendering/svg/SVGTextLayoutBuilder.h \
     rendering/SVGCharacterData.h \
     rendering/SVGCharacterLayoutInfo.h \
     rendering/SVGImageBufferTools.h \
@@ -2896,7 +2899,8 @@ contains(DEFINES, ENABLE_SVG=1) {
         css/SVGCSSStyleSelector.cpp \
         rendering/style/SVGRenderStyle.cpp \
         rendering/style/SVGRenderStyleDefs.cpp \
-        svg/SVGZoomEvent.cpp \
+        rendering/svg/SVGTextLayoutAttributes.cpp \
+        rendering/svg/SVGTextLayoutBuilder.cpp \
         rendering/PointerEventsHitRules.cpp \
         svg/SVGDocumentExtensions.cpp \
         svg/SVGImageLoader.cpp \
@@ -3042,6 +3046,7 @@ contains(DEFINES, ENABLE_SVG=1) {
         svg/SVGViewSpec.cpp \
         svg/SVGVKernElement.cpp \
         svg/SVGZoomAndPan.cpp \
+        svg/SVGZoomEvent.cpp \
         svg/animation/SMILTime.cpp \
         svg/animation/SMILTimeContainer.cpp \
         svg/animation/SVGSMILElement.cpp \
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index a4adf88..b0204ed 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -33134,6 +33134,26 @@
 					>
 				</File>
 			</Filter>
+			<Filter
+				Name="svg"
+				>
+				<File
+					RelativePath="..\rendering\svg\SVGTextLayoutAttributes.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\rendering\svg\SVGTextLayoutAttributes.h"
+					>
+				</File>
+				<File
+					RelativePath="..\rendering\svg\SVGTextLayoutBuilder.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\rendering\svg\SVGTextLayoutBuilder.h"
+					>
+				</File>
+			</Filter>
 		</Filter>
 		<Filter
 			Name="xml"
diff --git a/WebCore/WebCore.vcproj/WebCoreCommon.vsprops b/WebCore/WebCore.vcproj/WebCoreCommon.vsprops
index 8677c0e..edc8ee1 100644
--- a/WebCore/WebCore.vcproj/WebCoreCommon.vsprops
+++ b/WebCore/WebCore.vcproj/WebCoreCommon.vsprops
@@ -7,7 +7,7 @@
 	>
 	<Tool
 		Name="VCCLCompilerTool"
-		AdditionalIncludeDirectories="&quot;$(ProjectDir)..&quot;;&quot;$(ProjectDir)..\accessibility&quot;;&quot;$(ProjectDir)..\accessibility\win&quot;;&quot;$(ProjectDir)..\bridge&quot;;&quot;$(ProjectDir)..\bridge\c&quot;;&quot;$(ProjectDir)..\bridge\jsc&quot;;&quot;$(ProjectDir)..\css&quot;;&quot;$(ProjectDir)..\editing&quot;;&quot;$(ProjectDir)..\fileapi&quot;;&quot;$(ProjectDir)..\rendering&quot;;&quot;$(ProjectDir)..\rendering\style&quot;;&quot;$(ProjectDir)..\bindings&quot;;&quot;$(ProjectDir)..\bindings\generic&quot;;&quot;$(ProjectDir)..\bindings\js&quot;;&quot;$(ProjectDir)..\bindings\js\specialization&quot;;&quot;$(ProjectDir)..\dom&quot;;&quot;$(ProjectDir)..\dom\default&quot;;&quot;$(ProjectDir)..\history&quot;;&quot;$(ProjectDir)..\html&quot;;&quot;$(ProjectDir)..\html\canvas&quot;;&quot;$(ProjectDir)..\html\parser&quot;;&quot;$(ProjectDir)..\inspector&quot;;&quot;$(ProjectDir)..\loader&quot;;&quot;$(ProjectDir)..\loader\appcache&quot;;&quot;$(ProjectDir)..\loader\archive&quot;;&quot;$(ProjectDir)..\loader\archive\cf&quot;;&quot;$(ProjectDir)..\loader\icon&quot;;&quot;$(ProjectDir)..\mathml&quot;;&quot;$(ProjectDir)..\notifications&quot;;&quot;$(ProjectDir)..\page&quot;;&quot;$(ProjectDir)..\page\animation&quot;;&quot;$(ProjectDir)..\page\win&quot;;&quot;$(ProjectDir)..\platform&quot;;&quot;$(ProjectDir)..\platform\animation&quot;;&quot;$(ProjectDir)..\platform\mock&quot;;&quot;$(ProjectDir)..\platform\sql&quot;;&quot;$(ProjectDir)..\platform\win&quot;;&quot;$(ProjectDir)..\platform\network&quot;;&quot;$(ProjectDir)..\platform\network\win&quot;;&quot;$(ProjectDir)..\platform\cf&quot;;&quot;$(ProjectDir)..\platform\graphics&quot;;&quot;$(ProjectDir)..\platform\graphics\filters&quot;;&quot;$(ProjectDir)..\platform\graphics\opentype&quot;;&quot;$(ProjectDir)..\platform\graphics\transforms&quot;;&quot;$(ProjectDir)..\platform\text&quot;;&quot;$(ProjectDir)..\platform\text\transcoder&quot;;&quot;$(ProjectDir)..\platform\graphics\win&quot;;&quot;$(ProjectDir)..\xml&quot;;&quot;$(WebKitOutputDir)\obj\WebCore\DerivedSources&quot;;&quot;$(ProjectDir)..\plugins&quot;;&quot;$(ProjectDir)..\plugins\win&quot;;&quot;$(ProjectDir)..\svg\animation&quot;;&quot;$(ProjectDir)..\svg\graphics&quot;;&quot;$(ProjectDir)..\svg\graphics\filters&quot;;&quot;$(ProjectDir)..\svg&quot;;&quot;$(ProjectDir)..\wml&quot;;&quot;$(ProjectDir)..\storage&quot;;&quot;$(ProjectDir)..\websockets&quot;;&quot;$(ProjectDir)..\workers&quot;;&quot;$(WebKitOutputDir)\include&quot;;&quot;$(WebKitOutputDir)\include\private&quot;;&quot;$(WebKitOutputDir)\include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\include\private\JavaScriptCore&quot;;&quot;$(ProjectDir)..\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\include\private&quot;;&quot;$(WebKitLibrariesDir)\include\private\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;;&quot;$(WebKitLibrariesDir)\include\sqlite&quot;;&quot;$(WebKitLibrariesDir)\include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\zlib&quot;"
+		AdditionalIncludeDirectories="&quot;$(ProjectDir)..&quot;;&quot;$(ProjectDir)..\accessibility&quot;;&quot;$(ProjectDir)..\accessibility\win&quot;;&quot;$(ProjectDir)..\bridge&quot;;&quot;$(ProjectDir)..\bridge\c&quot;;&quot;$(ProjectDir)..\bridge\jsc&quot;;&quot;$(ProjectDir)..\css&quot;;&quot;$(ProjectDir)..\editing&quot;;&quot;$(ProjectDir)..\fileapi&quot;;&quot;$(ProjectDir)..\rendering&quot;;&quot;$(ProjectDir)..\rendering\style&quot;;&quot;$(ProjectDir)..\rendering\svg&quot;;&quot;$(ProjectDir)..\bindings&quot;;&quot;$(ProjectDir)..\bindings\generic&quot;;&quot;$(ProjectDir)..\bindings\js&quot;;&quot;$(ProjectDir)..\bindings\js\specialization&quot;;&quot;$(ProjectDir)..\dom&quot;;&quot;$(ProjectDir)..\dom\default&quot;;&quot;$(ProjectDir)..\history&quot;;&quot;$(ProjectDir)..\html&quot;;&quot;$(ProjectDir)..\html\canvas&quot;;&quot;$(ProjectDir)..\html\parser&quot;;&quot;$(ProjectDir)..\inspector&quot;;&quot;$(ProjectDir)..\loader&quot;;&quot;$(ProjectDir)..\loader\appcache&quot;;&quot;$(ProjectDir)..\loader\archive&quot;;&quot;$(ProjectDir)..\loader\archive\cf&quot;;&quot;$(ProjectDir)..\loader\icon&quot;;&quot;$(ProjectDir)..\mathml&quot;;&quot;$(ProjectDir)..\notifications&quot;;&quot;$(ProjectDir)..\page&quot;;&quot;$(ProjectDir)..\page\animation&quot;;&quot;$(ProjectDir)..\page\win&quot;;&quot;$(ProjectDir)..\platform&quot;;&quot;$(ProjectDir)..\platform\animation&quot;;&quot;$(ProjectDir)..\platform\mock&quot;;&quot;$(ProjectDir)..\platform\sql&quot;;&quot;$(ProjectDir)..\platform\win&quot;;&quot;$(ProjectDir)..\platform\network&quot;;&quot;$(ProjectDir)..\platform\network\win&quot;;&quot;$(ProjectDir)..\platform\cf&quot;;&quot;$(ProjectDir)..\platform\graphics&quot;;&quot;$(ProjectDir)..\platform\graphics\filters&quot;;&quot;$(ProjectDir)..\platform\graphics\opentype&quot;;&quot;$(ProjectDir)..\platform\graphics\transforms&quot;;&quot;$(ProjectDir)..\platform\text&quot;;&quot;$(ProjectDir)..\platform\text\transcoder&quot;;&quot;$(ProjectDir)..\platform\graphics\win&quot;;&quot;$(ProjectDir)..\xml&quot;;&quot;$(WebKitOutputDir)\obj\WebCore\DerivedSources&quot;;&quot;$(ProjectDir)..\plugins&quot;;&quot;$(ProjectDir)..\plugins\win&quot;;&quot;$(ProjectDir)..\svg\animation&quot;;&quot;$(ProjectDir)..\svg\graphics&quot;;&quot;$(ProjectDir)..\svg\graphics\filters&quot;;&quot;$(ProjectDir)..\svg&quot;;&quot;$(ProjectDir)..\wml&quot;;&quot;$(ProjectDir)..\storage&quot;;&quot;$(ProjectDir)..\websockets&quot;;&quot;$(ProjectDir)..\workers&quot;;&quot;$(WebKitOutputDir)\include&quot;;&quot;$(WebKitOutputDir)\include\private&quot;;&quot;$(WebKitOutputDir)\include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\include\private\JavaScriptCore&quot;;&quot;$(ProjectDir)..\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\include\private&quot;;&quot;$(WebKitLibrariesDir)\include\private\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;;&quot;$(WebKitLibrariesDir)\include\sqlite&quot;;&quot;$(WebKitLibrariesDir)\include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\zlib&quot;"
 		PreprocessorDefinitions="__WIN32__;DISABLE_3D_RENDERING;WEBCORE_CONTEXT_MENUS"
 		UsePrecompiledHeader="2"
 		PrecompiledHeaderThrough="WebCorePrefix.h"
diff --git a/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd b/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd
index 7ad3217..d76cfd6 100755
--- a/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd
+++ b/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd
@@ -57,6 +57,7 @@ xcopy /y /d "%ProjectDir%..\plugins\*.h" "%WebKitOutputDir%\include\WebCore"
 xcopy /y /d "%ProjectDir%..\plugins\win\*.h" "%WebKitOutputDir%\include\WebCore"
 xcopy /y /d "%ProjectDir%..\rendering\*.h" "%WebKitOutputDir%\include\WebCore"
 xcopy /y /d "%ProjectDir%..\rendering\style\*.h" "%WebKitOutputDir%\include\WebCore"
+xcopy /y /d "%ProjectDir%..\rendering\svg\*.h" "%WebKitOutputDir%\include\WebCore"
 xcopy /y /d "%ProjectDir%..\editing\*.h" "%WebKitOutputDir%\include\WebCore"
 xcopy /y /d "%ProjectDir%..\dom\*.h" "%WebKitOutputDir%\include\WebCore"
 xcopy /y /d "%ProjectDir%..\xml\*.h" "%WebKitOutputDir%\include\WebCore"
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 8893d0a..eff1145 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -152,6 +152,10 @@
 		088451160F267B63007F139E /* WMLInputElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 088451140F267B63007F139E /* WMLInputElement.h */; };
 		0885067F11DA045B00182B98 /* PaintInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 0885067D11DA045B00182B98 /* PaintInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0885068011DA045B00182B98 /* PaintPhase.h in Headers */ = {isa = PBXBuildFile; fileRef = 0885067E11DA045B00182B98 /* PaintPhase.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		088C2F7912390081003D65CE /* SVGTextLayoutAttributes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 088C2F7512390080003D65CE /* SVGTextLayoutAttributes.cpp */; };
+		088C2F7A12390081003D65CE /* SVGTextLayoutAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 088C2F7612390080003D65CE /* SVGTextLayoutAttributes.h */; };
+		088C2F7B12390081003D65CE /* SVGTextLayoutBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 088C2F7712390081003D65CE /* SVGTextLayoutBuilder.cpp */; };
+		088C2F7C12390081003D65CE /* SVGTextLayoutBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 088C2F7812390081003D65CE /* SVGTextLayoutBuilder.h */; };
 		088C97120ECB6D92000534BA /* WMLNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CA3AB490E556F2400E9C0C0 /* WMLNames.cpp */; };
 		088C97130ECB6D9D000534BA /* WMLNames.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CA3AB480E556F2400E9C0C0 /* WMLNames.h */; };
 		088C97510ECB6E28000534BA /* WMLAElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C6B99180E52E37300487BB7 /* WMLAElement.cpp */; };
@@ -5985,6 +5989,10 @@
 		088451140F267B63007F139E /* WMLInputElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLInputElement.h; sourceTree = "<group>"; };
 		0885067D11DA045B00182B98 /* PaintInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PaintInfo.h; sourceTree = "<group>"; };
 		0885067E11DA045B00182B98 /* PaintPhase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PaintPhase.h; sourceTree = "<group>"; };
+		088C2F7512390080003D65CE /* SVGTextLayoutAttributes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTextLayoutAttributes.cpp; sourceTree = "<group>"; };
+		088C2F7612390080003D65CE /* SVGTextLayoutAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTextLayoutAttributes.h; sourceTree = "<group>"; };
+		088C2F7712390081003D65CE /* SVGTextLayoutBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTextLayoutBuilder.cpp; sourceTree = "<group>"; };
+		088C2F7812390081003D65CE /* SVGTextLayoutBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTextLayoutBuilder.h; sourceTree = "<group>"; };
 		0893E4650ECB68F400A28563 /* WMLPageState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLPageState.cpp; sourceTree = "<group>"; };
 		0893E4660ECB68F400A28563 /* WMLPageState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLPageState.h; sourceTree = "<group>"; };
 		089582530E857A7E00F82C83 /* ImageLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageLoader.cpp; sourceTree = "<group>"; };
@@ -11419,6 +11427,17 @@
 			tabWidth = 4;
 			usesTabs = 0;
 		};
+		088C2F7412390080003D65CE /* svg */ = {
+			isa = PBXGroup;
+			children = (
+				088C2F7512390080003D65CE /* SVGTextLayoutAttributes.cpp */,
+				088C2F7612390080003D65CE /* SVGTextLayoutAttributes.h */,
+				088C2F7712390081003D65CE /* SVGTextLayoutBuilder.cpp */,
+				088C2F7812390081003D65CE /* SVGTextLayoutBuilder.h */,
+			);
+			path = svg;
+			sourceTree = "<group>";
+		};
 		089C1665FE841158C02AAC07 /* Resources */ = {
 			isa = PBXGroup;
 			children = (
@@ -17164,6 +17183,7 @@
 			isa = PBXGroup;
 			children = (
 				BC8C8FAA0DDCD2F200B592F4 /* style */,
+				088C2F7412390080003D65CE /* svg */,
 				A8CFF04B0A154F09000A4234 /* AutoTableLayout.cpp */,
 				A8CFF0490A154F09000A4234 /* AutoTableLayout.h */,
 				BCE7898A1120E8020060ECE5 /* BidiRun.cpp */,
@@ -20516,6 +20536,8 @@
 				97BC849B12370A4B000C6161 /* HTMLInputStream.h in Headers */,
 				97BC84A512370DC8000C6161 /* TextViewSourceParser.h in Headers */,
 				97BC84B412371180000C6161 /* TextDocument.h in Headers */,
+				088C2F7A12390081003D65CE /* SVGTextLayoutAttributes.h in Headers */,
+				088C2F7C12390081003D65CE /* SVGTextLayoutBuilder.h in Headers */,
 				97205AB0123928CA00B17380 /* FTPDirectoryDocument.h in Headers */,
 				97205AB61239291000B17380 /* ImageDocument.h in Headers */,
 				97205AB81239291000B17380 /* MediaDocument.h in Headers */,
@@ -22995,6 +23017,8 @@
 				97BC84831236FD93000C6161 /* TextDocumentParser.cpp in Sources */,
 				97BC84A412370DC8000C6161 /* TextViewSourceParser.cpp in Sources */,
 				97BC84B312371180000C6161 /* TextDocument.cpp in Sources */,
+				088C2F7912390081003D65CE /* SVGTextLayoutAttributes.cpp in Sources */,
+				088C2F7B12390081003D65CE /* SVGTextLayoutBuilder.cpp in Sources */,
 				97205AAF123928CA00B17380 /* FTPDirectoryDocument.cpp in Sources */,
 				97205AB51239291000B17380 /* ImageDocument.cpp in Sources */,
 				97205AB71239291000B17380 /* MediaDocument.cpp in Sources */,
diff --git a/WebCore/rendering/RenderBlockLineLayout.cpp b/WebCore/rendering/RenderBlockLineLayout.cpp
index d57f420..51ec2e9 100644
--- a/WebCore/rendering/RenderBlockLineLayout.cpp
+++ b/WebCore/rendering/RenderBlockLineLayout.cpp
@@ -41,6 +41,7 @@
 #include <wtf/Vector.h>
 
 #if ENABLE(SVG)
+#include "RenderSVGInlineText.h"
 #include "SVGRootInlineBox.h"
 #endif
 
@@ -1558,6 +1559,10 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool
 
             RenderText* t = toRenderText(o);
 
+#if ENABLE(SVG)
+            bool isSVGText = t->isSVGInlineText();
+#endif
+
             int strlen = t->textLength();
             int len = strlen - pos;
             const UChar* str = t->characters();
@@ -1644,7 +1649,19 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool
                     }
                     continue;
                 }
-                
+ 
+#if ENABLE(SVG)
+                if (isSVGText) {
+                    RenderSVGInlineText* svgInlineText = static_cast<RenderSVGInlineText*>(t);
+                    if (pos > 0) {
+                        if (svgInlineText->characterStartsNewTextChunk(pos)) {
+                            addMidpoint(lineMidpointState, InlineIterator(0, o, pos - 1));
+                            addMidpoint(lineMidpointState, InlineIterator(0, o, pos));
+                        }
+                    }
+                }
+#endif
+
                 bool applyWordSpacing = false;
                 
                 currentCharacterIsWS = currentCharacterIsSpace || (breakNBSP && c == noBreakSpace);
diff --git a/WebCore/rendering/RenderObject.h b/WebCore/rendering/RenderObject.h
index c369db8..be14351 100644
--- a/WebCore/rendering/RenderObject.h
+++ b/WebCore/rendering/RenderObject.h
@@ -316,6 +316,7 @@ public:
     virtual bool isSVGHiddenContainer() const { return false; }
     virtual bool isRenderPath() const { return false; }
     virtual bool isSVGText() const { return false; }
+    virtual bool isSVGInline() const { return false; }
     virtual bool isSVGInlineText() const { return false; }
     virtual bool isSVGImage() const { return false; }
     virtual bool isSVGForeignObject() const { return false; }
diff --git a/WebCore/rendering/RenderSVGInline.h b/WebCore/rendering/RenderSVGInline.h
index fb38f1b..92b6fe7 100644
--- a/WebCore/rendering/RenderSVGInline.h
+++ b/WebCore/rendering/RenderSVGInline.h
@@ -37,6 +37,7 @@ public:
 
     virtual const char* renderName() const { return "RenderSVGInline"; }
     virtual bool requiresLayer() const { return false; }
+    virtual bool isSVGInline() const { return true; }
 
     // Chapter 10.4 of the SVG Specification say that we should use the
     // object bounding box of the parent text element.
diff --git a/WebCore/rendering/RenderSVGInlineText.cpp b/WebCore/rendering/RenderSVGInlineText.cpp
index ba99243..0539d27 100644
--- a/WebCore/rendering/RenderSVGInlineText.cpp
+++ b/WebCore/rendering/RenderSVGInlineText.cpp
@@ -65,6 +65,47 @@ IntRect RenderSVGInlineText::localCaretRect(InlineBox*, int, int*)
     return IntRect();
 }
 
+IntRect RenderSVGInlineText::linesBoundingBox() const
+{
+    IntRect boundingBox;
+    for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox())
+        boundingBox.unite(box->calculateBoundaries());
+    return boundingBox;
+}
+
+bool RenderSVGInlineText::characterStartsNewTextChunk(int position) const
+{
+    ASSERT(m_attributes.xValues().size() == textLength());
+    ASSERT(m_attributes.yValues().size() == textLength());
+    ASSERT(position >= 0);
+    ASSERT(position < static_cast<int>(textLength()));
+
+    int currentPosition = 0;
+    unsigned size = m_attributes.characterDataValues().size();
+    for (unsigned i = 0; i < size; ++i) {
+        const SVGTextLayoutAttributes::CharacterData& data = m_attributes.characterDataValues().at(i);
+
+        // We found the desired character.
+        if (currentPosition == position) {
+            if (isVerticalWritingMode(style()->svgStyle()))
+                return m_attributes.yValues().at(position) != SVGTextLayoutAttributes::emptyValue();
+
+            return m_attributes.xValues().at(position) != SVGTextLayoutAttributes::emptyValue();
+        }
+
+        currentPosition += data.spansCharacters;
+        if (currentPosition > position)
+            break;
+    }
+
+    // The desired position is available in the x/y list, but not in the character data values list.
+    // That means the previous character data described a single glyph, consisting of multiple unicode characters.
+    // The consequence is that the desired character does not define a new absolute x/y position, even if present in the x/y test.
+    // This code is tested by svg/W3C-SVG-1.1/text-text-06-t.svg (and described in detail, why this influences chunk detection).
+    ASSERT(currentPosition > position);
+    return false;
+}
+
 }
 
 #endif // ENABLE(SVG)
diff --git a/WebCore/rendering/RenderSVGInlineText.h b/WebCore/rendering/RenderSVGInlineText.h
index 08b4a47..f606918 100644
--- a/WebCore/rendering/RenderSVGInlineText.h
+++ b/WebCore/rendering/RenderSVGInlineText.h
@@ -26,14 +26,18 @@
 #define RenderSVGInlineText_h
 
 #if ENABLE(SVG)
-
 #include "RenderText.h"
+#include "SVGTextLayoutAttributes.h"
 
 namespace WebCore {
+
 class RenderSVGInlineText : public RenderText {
 public:
     RenderSVGInlineText(Node*, PassRefPtr<StringImpl>);
 
+    bool characterStartsNewTextChunk(int position) const;
+    void storeLayoutAttributes(const SVGTextLayoutAttributes& attributes) { m_attributes = attributes; }
+
 private:
     virtual const char* renderName() const { return "RenderSVGInlineText"; }
 
@@ -47,8 +51,10 @@ private:
     virtual bool isSVGInlineText() const { return true; }
 
     virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0);
-
+    virtual IntRect linesBoundingBox() const;
     virtual InlineTextBox* createTextBox();
+
+    SVGTextLayoutAttributes m_attributes;
 };
 
 }
diff --git a/WebCore/rendering/RenderSVGText.cpp b/WebCore/rendering/RenderSVGText.cpp
index 80b8a91..c20a509 100644
--- a/WebCore/rendering/RenderSVGText.cpp
+++ b/WebCore/rendering/RenderSVGText.cpp
@@ -42,6 +42,7 @@
 #include "SVGRenderSupport.h"
 #include "SVGRootInlineBox.h"
 #include "SVGTextElement.h"
+#include "SVGTextLayoutBuilder.h"
 #include "SVGTransformList.h"
 #include "SVGURIReference.h"
 #include "SimpleFontData.h"
@@ -83,6 +84,9 @@ void RenderSVGText::layout()
         updateCachedBoundariesInParents = true;
     }
 
+    SVGTextLayoutBuilder layoutBuilder;
+    layoutBuilder.buildLayoutAttributesForTextSubtree(this);
+
     // Reduced version of RenderBlock::layoutBlock(), which only takes care of SVG text.
     // All if branches that could cause early exit in RenderBlocks layoutBlock() method are turned into assertions.
     ASSERT(!isInline());
diff --git a/WebCore/rendering/RenderText.h b/WebCore/rendering/RenderText.h
index f46f053..5d289d7 100644
--- a/WebCore/rendering/RenderText.h
+++ b/WebCore/rendering/RenderText.h
@@ -83,7 +83,7 @@ public:
                            int& beginMaxW, int& endMaxW,
                            int& minW, int& maxW, bool& stripFrontSpaces);
 
-    IntRect linesBoundingBox() const;
+    virtual IntRect linesBoundingBox() const;
 
     IntPoint firstRunOrigin() const;
     int firstRunX() const;
diff --git a/WebCore/rendering/svg/SVGTextLayoutAttributes.cpp b/WebCore/rendering/svg/SVGTextLayoutAttributes.cpp
new file mode 100644
index 0000000..3283b35
--- /dev/null
+++ b/WebCore/rendering/svg/SVGTextLayoutAttributes.cpp
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#if ENABLE(SVG)
+#include "SVGTextLayoutAttributes.h"
+
+#include <stdio.h>
+#include <wtf/text/CString.h>
+
+namespace WebCore {
+
+SVGTextLayoutAttributes::SVGTextLayoutAttributes()
+{
+}
+
+void SVGTextLayoutAttributes::fillWithEmptyValues(unsigned length)
+{
+    m_xValues.fill(emptyValue(), length);
+    m_yValues.fill(emptyValue(), length);
+    m_dxValues.fill(emptyValue(), length);
+    m_dyValues.fill(emptyValue(), length);
+    m_rotateValues.fill(emptyValue(), length);
+}
+
+float SVGTextLayoutAttributes::emptyValue()
+{
+    static float s_emptyValue = std::numeric_limits<float>::max() - 1;
+    return s_emptyValue;
+}
+
+static inline void dumpLayoutVector(Vector<float>& values)
+{
+    if (values.isEmpty()) {
+        fprintf(stderr, "empty");
+        return;
+    }
+
+    unsigned size = values.size();
+    for (unsigned i = 0; i < size; ++i) {
+        float value = values.at(i);
+        if (value == SVGTextLayoutAttributes::emptyValue())
+            fprintf(stderr, "x ");
+        else
+            fprintf(stderr, "%lf ", value);
+    }
+}
+
+void SVGTextLayoutAttributes::dump()
+{
+    fprintf(stderr, "x values: ");
+    dumpLayoutVector(m_xValues);
+    fprintf(stderr, "\n");
+
+    fprintf(stderr, "y values: ");
+    dumpLayoutVector(m_yValues);
+    fprintf(stderr, "\n");
+
+    fprintf(stderr, "dx values: ");
+    dumpLayoutVector(m_dxValues);
+    fprintf(stderr, "\n");
+
+    fprintf(stderr, "dy values: ");
+    dumpLayoutVector(m_dyValues);
+    fprintf(stderr, "\n");
+
+    fprintf(stderr, "rotate values: ");
+    dumpLayoutVector(m_rotateValues);
+    fprintf(stderr, "\n");
+
+    fprintf(stderr, "character data values:\n");
+    Vector<CharacterData>::iterator end = m_characterDataValues.end();
+    for (Vector<CharacterData>::iterator it = m_characterDataValues.begin(); it != end; ++it) {
+        CharacterData& data = *it;
+        fprintf(stderr, "| {spansCharacters=%i, glyphName='%s', unicodeString='%s', width=%lf, height=%lf}\n",
+                data.spansCharacters, data.glyphName.utf8().data(), data.unicodeString.utf8().data(), data.width, data.height);
+    }
+    fprintf(stderr, "\n");
+}
+
+}
+
+#endif // ENABLE(SVG)
diff --git a/WebCore/rendering/svg/SVGTextLayoutAttributes.h b/WebCore/rendering/svg/SVGTextLayoutAttributes.h
new file mode 100644
index 0000000..d88b356
--- /dev/null
+++ b/WebCore/rendering/svg/SVGTextLayoutAttributes.h
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SVGTextLayoutAttributes_h
+#define SVGTextLayoutAttributes_h
+
+#if ENABLE(SVG)
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class SVGTextLayoutAttributes {
+public:
+    SVGTextLayoutAttributes();
+
+    void fillWithEmptyValues(unsigned length);
+    void dump();
+
+    Vector<float>& xValues() { return m_xValues; }
+    const Vector<float>& xValues() const { return m_xValues; }
+
+    Vector<float>& yValues() { return m_yValues; }
+    const Vector<float>& yValues() const { return m_yValues; }
+
+    Vector<float>& dxValues() { return m_dxValues; }
+    const Vector<float>& dxValues() const { return m_dxValues; }
+
+    Vector<float>& dyValues() { return m_dyValues; }
+    const Vector<float>& dyValues() const { return m_dyValues; }
+
+    Vector<float>& rotateValues() { return m_rotateValues; }
+    const Vector<float>& rotateValues() const { return m_rotateValues; }
+
+    static float emptyValue();
+
+    struct CharacterData {
+        CharacterData()
+            : spansCharacters(0)
+            , width(0)
+            , height(0)
+        {
+        }
+
+        // When multiple unicode characters map to a single glyph (eg. 'ffi' ligature)
+        // 'spansCharacters' contains the number of characters this glyph spans.
+        int spansCharacters;
+        
+        // The 'glyphName' / 'unicodeString' pair is needed for kerning calculations.
+        String glyphName;
+        String unicodeString;
+
+        // 'width' and 'height' hold the size of this glyph/character.
+        float width;
+        float height;
+    };
+
+    Vector<CharacterData>& characterDataValues() { return m_characterDataValues; }
+    const Vector<CharacterData>& characterDataValues() const { return m_characterDataValues; }
+
+private:
+    Vector<float> m_xValues;
+    Vector<float> m_yValues;
+    Vector<float> m_dxValues;
+    Vector<float> m_dyValues;
+    Vector<float> m_rotateValues;
+    Vector<CharacterData> m_characterDataValues;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif
diff --git a/WebCore/rendering/svg/SVGTextLayoutBuilder.cpp b/WebCore/rendering/svg/SVGTextLayoutBuilder.cpp
new file mode 100644
index 0000000..0b3a752
--- /dev/null
+++ b/WebCore/rendering/svg/SVGTextLayoutBuilder.cpp
@@ -0,0 +1,304 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#if ENABLE(SVG)
+#include "SVGTextLayoutBuilder.h"
+
+#include "RenderSVGInlineText.h"
+#include "RenderSVGText.h"
+#include "SVGTextLayoutUtilities.h"
+#include "SVGTextPositioningElement.h"
+
+// Set to a value > 0 to dump the layout vectors
+#define DUMP_LAYOUT_VECTORS 0
+
+namespace WebCore {
+
+SVGTextLayoutBuilder::SVGTextLayoutBuilder()
+{
+}
+
+void SVGTextLayoutBuilder::buildLayoutAttributesForTextSubtree(RenderSVGText* textRoot)
+{
+    ASSERT(textRoot);
+    m_scopes.clear();
+
+    // Build layout scopes.
+    unsigned atCharacter = 0;
+    buildLayoutScopes(textRoot, atCharacter);
+
+    if (!atCharacter)
+        return;
+
+    // Add outermost scope, after text length is known.
+    LayoutScope scope;
+    buildLayoutScope(scope, textRoot, 0, atCharacter);
+    m_scopes.prepend(scope);
+
+    // Build layout information respecting scope of attribute values.
+    buildLayoutAttributesFromScopes();
+
+    atCharacter = 0;
+    propagateLayoutAttributes(textRoot, atCharacter);
+}
+
+static inline void copyToDestinationVector(Vector<float>& destination, unsigned destinationStartOffset, Vector<float>& source, unsigned sourceStartOffset, unsigned length)
+{
+    ASSERT(destinationStartOffset + length <= destination.size());
+
+    Vector<float>::iterator sourceBegin = source.begin() + sourceStartOffset;
+    std::copy(sourceBegin, sourceBegin + length, destination.begin() + destinationStartOffset);
+}
+
+static inline void copyToDestinationVectorIfSourceRangeIsNotEmpty(Vector<float>& destination, unsigned destinationStartOffset, Vector<float>& source, unsigned sourceStartOffset, unsigned length)
+{
+    bool rangeEmpty = true;
+
+    unsigned size = sourceStartOffset + length;
+    for (unsigned i = sourceStartOffset; i < size; ++i) {
+        if (source.at(i) == SVGTextLayoutAttributes::emptyValue())
+            continue;
+        rangeEmpty = false;
+        break;
+    }
+
+    if (rangeEmpty)
+        return;
+
+    destination.resize(length);
+    copyToDestinationVector(destination, destinationStartOffset, source, sourceStartOffset, length);
+}
+
+void SVGTextLayoutBuilder::propagateLayoutAttributes(RenderObject* start, unsigned& atCharacter)
+{
+    for (RenderObject* child = start->firstChild(); child; child = child->nextSibling()) { 
+        if (!child->isSVGInlineText()) {
+            if (child->isSVGInline())
+                propagateLayoutAttributes(child, atCharacter);
+            continue;
+        }
+
+        RenderSVGInlineText* text = static_cast<RenderSVGInlineText*>(child);
+        unsigned textLength = text->textLength();
+
+        // Build layout attributes for a single RenderSVGInlineText renderer.
+        SVGTextLayoutAttributes attributes;
+
+        // The x value list should always be as large as the text length.
+        // Any values that are empty will be filled in by the actual text layout process later,
+        // as we need to be able to query the x/y position for every character through SVG DOM.
+        attributes.xValues().resize(textLength);
+        copyToDestinationVector(attributes.xValues(), 0, m_attributes.xValues(), atCharacter, textLength);
+
+        // Same for the y value list.
+        attributes.yValues().resize(textLength);
+        copyToDestinationVector(attributes.yValues(), 0, m_attributes.yValues(), atCharacter, textLength);
+
+        // The dx/dy/rotate value lists may be empty.
+        copyToDestinationVectorIfSourceRangeIsNotEmpty(attributes.dxValues(), 0, m_attributes.dxValues(), atCharacter, textLength);
+        copyToDestinationVectorIfSourceRangeIsNotEmpty(attributes.dyValues(), 0, m_attributes.dyValues(), atCharacter, textLength);
+        copyToDestinationVectorIfSourceRangeIsNotEmpty(attributes.rotateValues(), 0, m_attributes.rotateValues(), atCharacter, textLength);
+
+        // Build CharacterData, which will be used to detect ligatures, holds kerning pairs (glyph name, unicode string) and character metrics.
+        measureCharacters(text, attributes);
+
+#if DUMP_LAYOUT_VECTORS > 0
+        fprintf(stderr, "Dumping layout vector for RenderSVGInlineText, renderer=%p, node=%p\n", text, text->node());
+        attributes.dump();
+#endif
+
+        text->storeLayoutAttributes(attributes);
+        atCharacter += text->textLength();
+    }
+}
+
+void SVGTextLayoutBuilder::buildLayoutScopes(RenderObject* start, unsigned& atCharacter)
+{
+    for (RenderObject* child = start->firstChild(); child; child = child->nextSibling()) { 
+        if (child->isSVGInlineText()) {
+            atCharacter += toRenderText(child)->textLength();
+            continue;
+        }
+
+        if (!child->isSVGInline())
+            continue;
+
+        unsigned textContentStart = atCharacter;
+        buildLayoutScopes(child, atCharacter);
+
+        LayoutScope scope;
+        buildLayoutScope(scope, child, textContentStart, atCharacter - textContentStart);
+        m_scopes.append(scope);
+    }
+}
+
+static inline void fillDestinationVectorWithLastSourceValue(Vector<float>& destination, unsigned destinationStartOffset, Vector<float>& source, unsigned length)
+{
+    if (source.isEmpty())
+        return;
+
+    float lastValue = source.last();
+
+    unsigned rotateValuesSize = source.size();
+    for (unsigned i = rotateValuesSize; i < length; ++i) {
+        ASSERT(i + destinationStartOffset < destination.size());
+        destination.at(i + destinationStartOffset) = lastValue;
+    }
+}
+
+void SVGTextLayoutBuilder::buildLayoutAttributesFromScopes()
+{
+    ASSERT(!m_scopes.isEmpty());
+
+    unsigned totalLength = m_scopes.first().textContentLength;
+    if (!totalLength)
+        return;
+
+    m_attributes.fillWithEmptyValues(totalLength);
+
+    // Build final list of x/y/dx/dy/rotate values for each character stores in the <text> subtree.
+    for (unsigned atScope = 0; atScope < m_scopes.size(); ++atScope) {
+        LayoutScope& scope = m_scopes.at(atScope);
+        SVGTextLayoutAttributes& attributes = scope.attributes;
+
+        copyToDestinationVector(m_attributes.xValues(), scope.textContentStart, attributes.xValues(), 0, attributes.xValues().size());
+        copyToDestinationVector(m_attributes.yValues(), scope.textContentStart, attributes.yValues(), 0, attributes.yValues().size());
+        copyToDestinationVector(m_attributes.dxValues(), scope.textContentStart, attributes.dxValues(), 0, attributes.dxValues().size());
+        copyToDestinationVector(m_attributes.dyValues(), scope.textContentStart, attributes.dyValues(), 0, attributes.dyValues().size());
+        copyToDestinationVector(m_attributes.rotateValues(), scope.textContentStart, attributes.rotateValues(), 0, attributes.rotateValues().size());
+
+        // In horizontal (vertical) writing modes, the last y (x) value in the scope is the default y (x) value for all following characters, unless explicitely overriden.
+        if (scope.isVerticalWritingMode)
+            fillDestinationVectorWithLastSourceValue(m_attributes.xValues(), scope.textContentStart, attributes.xValues(), scope.textContentLength);
+        else
+            fillDestinationVectorWithLastSourceValue(m_attributes.yValues(), scope.textContentStart, attributes.yValues(), scope.textContentLength);
+
+        // The last rotation value in the scope is the default rotation for all following character, unless explicitely overriden.
+        fillDestinationVectorWithLastSourceValue(m_attributes.rotateValues(), scope.textContentStart, attributes.rotateValues(), scope.textContentLength);
+    }
+}
+
+void SVGTextLayoutBuilder::measureCharacters(RenderSVGInlineText* text, SVGTextLayoutAttributes& attributes)
+{
+    ASSERT(text);
+    ASSERT(text->style());
+    const Font& font = text->style()->font();
+    const UChar* characters = text->characters();
+    int length = text->textLength();
+
+    TextRun run(0, 0);
+    run.disableSpacing();
+    run.disableRoundingHacks();
+
+    int charsConsumed = 0;
+    for (int position = 0; position < length; position += charsConsumed) {
+        run.setText(characters + position, 1);
+        int extraCharsAvailable = length - position - 1;
+
+        SVGTextLayoutAttributes::CharacterData characterData;
+        characterData.width = font.floatWidth(run, extraCharsAvailable, characterData.spansCharacters, characterData.glyphName);
+        characterData.height = font.height();
+        characterData.unicodeString = String(characters + position, characterData.spansCharacters);
+        attributes.characterDataValues().append(characterData);
+
+        charsConsumed = characterData.spansCharacters;
+    }
+}
+
+static inline void extractFloatValuesFromSVGLengthList(SVGElement* lengthContext, SVGLengthList* list, Vector<float>& floatValues, int textContentLength)
+{
+    ASSERT(lengthContext);
+    ASSERT(list);
+    ASSERT(textContentLength >= 0);
+
+    ExceptionCode ec = 0;
+    int length = list->numberOfItems();
+    if (length > textContentLength)
+        length = textContentLength;
+
+    for (int i = 0; i < length; ++i) {
+        SVGLength length(list->getItem(i, ec));
+        ASSERT(!ec);
+        floatValues.append(length.value(lengthContext));
+    }
+}
+
+static inline void extractFloatValuesFromSVGNumberList(SVGNumberList* list, Vector<float>& floatValues, int textContentLength)
+{
+    ASSERT(list);
+    ASSERT(textContentLength >= 0);
+
+    ExceptionCode ec = 0;
+    int length = list->numberOfItems();
+    if (length > textContentLength)
+        length = textContentLength;
+
+    for (int i = 0; i < length; ++i) {
+        float length(list->getItem(i, ec));
+        ASSERT(!ec);
+        floatValues.append(length);
+    }
+}
+
+static inline SVGTextPositioningElement* svgTextPositioningElementForInlineRenderer(RenderObject* renderer)
+{
+    ASSERT(renderer);
+    ASSERT(renderer->isSVGText() || renderer->isSVGInline());
+
+    Node* node = renderer->node();
+    ASSERT(node);
+    ASSERT(node->isSVGElement());
+
+    if (!node->hasTagName(SVGNames::textTag)
+     && !node->hasTagName(SVGNames::tspanTag)
+#if ENABLE(SVG_FONTS)
+     && !node->hasTagName(SVGNames::altGlyphTag)
+#endif
+     && !node->hasTagName(SVGNames::trefTag))
+        return 0;
+
+    return static_cast<SVGTextPositioningElement*>(node);
+}
+
+void SVGTextLayoutBuilder::buildLayoutScope(LayoutScope& scope, RenderObject* renderer, unsigned textContentStart, unsigned textContentLength)
+{
+    ASSERT(renderer);
+    ASSERT(renderer->style());
+
+    scope.isVerticalWritingMode = isVerticalWritingMode(renderer->style()->svgStyle());
+    scope.textContentStart = textContentStart;
+    scope.textContentLength = textContentLength;
+
+    SVGTextPositioningElement* element = svgTextPositioningElementForInlineRenderer(renderer);
+    if (!element)
+        return;
+
+    SVGTextLayoutAttributes& attributes = scope.attributes;
+    extractFloatValuesFromSVGLengthList(element, element->x(), attributes.xValues(), textContentLength);
+    extractFloatValuesFromSVGLengthList(element, element->y(), attributes.yValues(), textContentLength);
+    extractFloatValuesFromSVGLengthList(element, element->dx(), attributes.dxValues(), textContentLength);
+    extractFloatValuesFromSVGLengthList(element, element->dy(), attributes.dyValues(), textContentLength);
+    extractFloatValuesFromSVGNumberList(element->rotate(), attributes.rotateValues(), textContentLength);
+}
+
+}
+
+#endif // ENABLE(SVG)
diff --git a/WebCore/rendering/svg/SVGTextLayoutBuilder.h b/WebCore/rendering/svg/SVGTextLayoutBuilder.h
new file mode 100644
index 0000000..6df7fa1
--- /dev/null
+++ b/WebCore/rendering/svg/SVGTextLayoutBuilder.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SVGTextLayoutBuilder_h
+#define SVGTextLayoutBuilder_h
+
+#if ENABLE(SVG)
+#include "SVGTextLayoutAttributes.h"
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class RenderObject;
+class RenderSVGInlineText;
+class RenderSVGText;
+
+class SVGTextLayoutBuilder : public Noncopyable {
+public:
+    SVGTextLayoutBuilder();
+    void buildLayoutAttributesForTextSubtree(RenderSVGText*);
+
+private:
+    struct LayoutScope {
+        LayoutScope()
+            : isVerticalWritingMode(false)
+            , textContentStart(0)
+            , textContentLength(0)
+        {
+        }
+
+        bool isVerticalWritingMode;
+        unsigned textContentStart;
+        unsigned textContentLength;
+        SVGTextLayoutAttributes attributes;
+    };
+
+    void buildLayoutScopes(RenderObject*, unsigned& atCharacter);
+    void buildLayoutScope(LayoutScope&, RenderObject*, unsigned textContentStart, unsigned textContentLength);
+    void buildLayoutAttributesFromScopes();
+    void propagateLayoutAttributes(RenderObject*, unsigned& atCharacter);
+    void measureCharacters(RenderSVGInlineText*, SVGTextLayoutAttributes&);
+
+private:
+    Vector<LayoutScope> m_scopes;
+    SVGTextLayoutAttributes m_attributes;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list