Auto-rebaseline for r192701

http://src.chromium.org/viewvc/blink?view=revision&revision=192701

BUG=470326
TBR=fs@opera.com

Review URL: https://codereview.chromium.org/1042573002

git-svn-id: svn://svn.chromium.org/blink/trunk@192706 bbb929c8-8fbe-4397-9dbb-9b2b20218538
diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations
index de7affa2c3..1065ba5 100644
--- a/LayoutTests/TestExpectations
+++ b/LayoutTests/TestExpectations
@@ -48,9 +48,6 @@
 
 crbug.com/469454 [ Mac ] virtual/slimmingpaint/fast/repaint/fixed-element-repaint-after-compositing-update.html [ Pass Failure ]
 
-crbug.com/470326 svg/text/bidi-text-query.svg [ NeedsRebaseline ]
-crbug.com/470326 virtual/slimmingpaint/svg/text/bidi-text-query.svg [ NeedsRebaseline ]
-
 crbug.com/434560 [ Mac Win ] virtual/slimmingpaint/fast/table/td-width-fifty-percent-regression.html [ Pass ImageOnlyFailure ]
 
 crbug.com/456357 [ Debug ] virtual/slimmingpaint/fast/overflow/line-clamp.html [ Crash ]
diff --git a/LayoutTests/platform/android/svg/text/bidi-text-query-expected.png b/LayoutTests/platform/android/svg/text/bidi-text-query-expected.png
new file mode 100644
index 0000000..7e4acc6
--- /dev/null
+++ b/LayoutTests/platform/android/svg/text/bidi-text-query-expected.png
Binary files differ
diff --git a/LayoutTests/platform/android/svg/text/bidi-text-query-expected.txt b/LayoutTests/platform/android/svg/text/bidi-text-query-expected.txt
new file mode 100644
index 0000000..88b8392
--- /dev/null
+++ b/LayoutTests/platform/android/svg/text/bidi-text-query-expected.txt
@@ -0,0 +1,19 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  LayoutSVGRoot {svg} at (16,55) size 213x86
+    LayoutSVGContainer {g} at (16,55) size 213x86
+      LayoutSVGText {text} at (10,33) size 128x22 contains 1 chunk(s)
+        LayoutSVGTSpan {tspan} at (0,0) size 128x21
+          LayoutSVGInlineText {#text} at (0,0) size 128x21
+            chunk 1 text run 1 at (10.00,50.00) startOffset 0 endOffset 17 width 127.20 LTR override: "\x{646}\x{634}\x{627}\x{637} \x{627}\x{644}\x{62A}\x{62F}\x{648}\x{64A}\x{644}\x{60C} W3C"
+      LayoutSVGText {text} at (10,63) size 124x22 contains 1 chunk(s)
+        LayoutSVGTSpan {tspan} at (0,0) size 124x21
+          LayoutSVGInlineText {#text} at (0,0) size 124x21
+            chunk 1 text run 1 at (10.00,80.00) startOffset 0 endOffset 12 width 71.40 RTL: "\x{646}\x{634}\x{627}\x{637} \x{627}\x{644}\x{62A}\x{62F}\x{648}\x{64A}\x{644}"
+            chunk 1 text run 1 at (81.40,80.00) startOffset 0 endOffset 5 width 52.20: "\x{60C} W3C"
+      LayoutSVGContainer {g} at (16,55) size 213x86
+        LayoutSVGRect {svg:rect} at (16,55) size 136x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=10.00] [y=33.20] [width=81.00] [height=21.00]
+        LayoutSVGRect {svg:rect} at (159,55) size 70x36 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=95.80] [y=33.20] [width=41.40] [height=21.00]
+        LayoutSVGRect {svg:rect} at (16,105) size 130x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=10.00] [y=63.20] [width=77.40] [height=21.00]
+        LayoutSVGRect {svg:rect} at (153,105) size 70x36 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=92.20] [y=63.20] [width=41.40] [height=21.00]
diff --git a/LayoutTests/platform/android/virtual/slimmingpaint/svg/text/bidi-text-query-expected.png b/LayoutTests/platform/android/virtual/slimmingpaint/svg/text/bidi-text-query-expected.png
new file mode 100644
index 0000000..7e4acc6
--- /dev/null
+++ b/LayoutTests/platform/android/virtual/slimmingpaint/svg/text/bidi-text-query-expected.png
Binary files differ
diff --git a/LayoutTests/platform/android/virtual/slimmingpaint/svg/text/bidi-text-query-expected.txt b/LayoutTests/platform/android/virtual/slimmingpaint/svg/text/bidi-text-query-expected.txt
new file mode 100644
index 0000000..88b8392
--- /dev/null
+++ b/LayoutTests/platform/android/virtual/slimmingpaint/svg/text/bidi-text-query-expected.txt
@@ -0,0 +1,19 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  LayoutSVGRoot {svg} at (16,55) size 213x86
+    LayoutSVGContainer {g} at (16,55) size 213x86
+      LayoutSVGText {text} at (10,33) size 128x22 contains 1 chunk(s)
+        LayoutSVGTSpan {tspan} at (0,0) size 128x21
+          LayoutSVGInlineText {#text} at (0,0) size 128x21
+            chunk 1 text run 1 at (10.00,50.00) startOffset 0 endOffset 17 width 127.20 LTR override: "\x{646}\x{634}\x{627}\x{637} \x{627}\x{644}\x{62A}\x{62F}\x{648}\x{64A}\x{644}\x{60C} W3C"
+      LayoutSVGText {text} at (10,63) size 124x22 contains 1 chunk(s)
+        LayoutSVGTSpan {tspan} at (0,0) size 124x21
+          LayoutSVGInlineText {#text} at (0,0) size 124x21
+            chunk 1 text run 1 at (10.00,80.00) startOffset 0 endOffset 12 width 71.40 RTL: "\x{646}\x{634}\x{627}\x{637} \x{627}\x{644}\x{62A}\x{62F}\x{648}\x{64A}\x{644}"
+            chunk 1 text run 1 at (81.40,80.00) startOffset 0 endOffset 5 width 52.20: "\x{60C} W3C"
+      LayoutSVGContainer {g} at (16,55) size 213x86
+        LayoutSVGRect {svg:rect} at (16,55) size 136x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=10.00] [y=33.20] [width=81.00] [height=21.00]
+        LayoutSVGRect {svg:rect} at (159,55) size 70x36 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=95.80] [y=33.20] [width=41.40] [height=21.00]
+        LayoutSVGRect {svg:rect} at (16,105) size 130x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=10.00] [y=63.20] [width=77.40] [height=21.00]
+        LayoutSVGRect {svg:rect} at (153,105) size 70x36 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=92.20] [y=63.20] [width=41.40] [height=21.00]
diff --git a/LayoutTests/platform/linux/svg/text/bidi-text-query-expected.png b/LayoutTests/platform/linux/svg/text/bidi-text-query-expected.png
index 7e4acc6..44b7271 100644
--- a/LayoutTests/platform/linux/svg/text/bidi-text-query-expected.png
+++ b/LayoutTests/platform/linux/svg/text/bidi-text-query-expected.png
Binary files differ
diff --git a/LayoutTests/platform/linux/svg/text/bidi-text-query-expected.txt b/LayoutTests/platform/linux/svg/text/bidi-text-query-expected.txt
index 88b8392..8327e55 100644
--- a/LayoutTests/platform/linux/svg/text/bidi-text-query-expected.txt
+++ b/LayoutTests/platform/linux/svg/text/bidi-text-query-expected.txt
@@ -1,8 +1,8 @@
 layer at (0,0) size 800x600
   LayoutView at (0,0) size 800x600
 layer at (0,0) size 800x600
-  LayoutSVGRoot {svg} at (16,55) size 213x86
-    LayoutSVGContainer {g} at (16,55) size 213x86
+  LayoutSVGRoot {svg} at (14,55) size 215x95
+    LayoutSVGContainer {g} at (14,55) size 215x95
       LayoutSVGText {text} at (10,33) size 128x22 contains 1 chunk(s)
         LayoutSVGTSpan {tspan} at (0,0) size 128x21
           LayoutSVGInlineText {#text} at (0,0) size 128x21
@@ -12,8 +12,140 @@
           LayoutSVGInlineText {#text} at (0,0) size 124x21
             chunk 1 text run 1 at (10.00,80.00) startOffset 0 endOffset 12 width 71.40 RTL: "\x{646}\x{634}\x{627}\x{637} \x{627}\x{644}\x{62A}\x{62F}\x{648}\x{64A}\x{644}"
             chunk 1 text run 1 at (81.40,80.00) startOffset 0 endOffset 5 width 52.20: "\x{60C} W3C"
-      LayoutSVGContainer {g} at (16,55) size 213x86
-        LayoutSVGRect {svg:rect} at (16,55) size 136x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=10.00] [y=33.20] [width=81.00] [height=21.00]
-        LayoutSVGRect {svg:rect} at (159,55) size 70x36 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=95.80] [y=33.20] [width=41.40] [height=21.00]
-        LayoutSVGRect {svg:rect} at (16,105) size 130x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=10.00] [y=63.20] [width=77.40] [height=21.00]
-        LayoutSVGRect {svg:rect} at (153,105) size 70x36 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=92.20] [y=63.20] [width=41.40] [height=21.00]
+      LayoutSVGContainer {g} at (14,55) size 215x95
+        LayoutSVGRect {rect} at (16,55) size 17x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=10.00] [y=33.20] [width=9.60] [height=21.00]
+        LayoutSVGText {text} at (13,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (13.60,59.20) startOffset 0 endOffset 1 width 2.40: "0"
+        LayoutSVGRect {rect} at (32,55) size 17x36 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=19.60] [y=33.20] [width=9.60] [height=21.00]
+        LayoutSVGText {text} at (23,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (23.20,59.20) startOffset 0 endOffset 1 width 2.40: "1"
+        LayoutSVGRect {rect} at (48,55) size 7x36 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=29.20] [y=33.20] [width=3.60] [height=21.00]
+        LayoutSVGText {text} at (29,55) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (29.80,59.20) startOffset 0 endOffset 1 width 2.40: "2"
+        LayoutSVGRect {rect} at (54,55) size 19x36 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=32.80] [y=33.20] [width=10.80] [height=21.00]
+        LayoutSVGText {text} at (37,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (37.00,59.20) startOffset 0 endOffset 1 width 2.40: "3"
+        LayoutSVGRect {rect} at (72,55) size 9x36 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=43.60] [y=33.20] [width=4.80] [height=21.00]
+        LayoutSVGText {text} at (44,55) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (44.80,59.20) startOffset 0 endOffset 1 width 2.40: "4"
+        LayoutSVGRect {rect} at (80,55) size 7x36 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=48.40] [y=33.20] [width=3.60] [height=21.00]
+        LayoutSVGText {text} at (49,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (49.00,59.20) startOffset 0 endOffset 1 width 2.40: "5"
+        LayoutSVGRect {rect} at (86,55) size 11x36 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=52.00] [y=33.20] [width=6.00] [height=21.00]
+        LayoutSVGText {text} at (53,55) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (53.80,59.20) startOffset 0 endOffset 1 width 2.40: "6"
+        LayoutSVGRect {rect} at (96,55) size 10x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=58.00] [y=33.20] [width=5.40] [height=21.00]
+        LayoutSVGText {text} at (59,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (59.50,59.20) startOffset 0 endOffset 1 width 2.40: "7"
+        LayoutSVGRect {rect} at (105,55) size 11x36 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=63.40] [y=33.20] [width=6.00] [height=21.00]
+        LayoutSVGText {text} at (65,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (65.20,59.20) startOffset 0 endOffset 1 width 2.40: "8"
+        LayoutSVGRect {rect} at (115,55) size 14x36 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=69.40] [y=33.20] [width=7.80] [height=21.00]
+        LayoutSVGText {text} at (72,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (72.10,59.20) startOffset 0 endOffset 1 width 2.40: "9"
+        LayoutSVGRect {rect} at (128,55) size 8x36 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=77.20] [y=33.20] [width=4.20] [height=21.00]
+        LayoutSVGText {text} at (76,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (76.90,59.20) startOffset 0 endOffset 2 width 4.80: "10"
+        LayoutSVGRect {rect} at (135,55) size 7x36 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=81.40] [y=33.20] [width=3.60] [height=21.00]
+        LayoutSVGText {text} at (80,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (80.80,59.20) startOffset 0 endOffset 2 width 4.80: "11"
+        LayoutSVGRect {rect} at (141,55) size 11x36 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=85.00] [y=33.20] [width=6.00] [height=21.00]
+        LayoutSVGText {text} at (85,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (85.60,59.20) startOffset 0 endOffset 2 width 4.80: "12"
+        LayoutSVGRect {rect} at (151,55) size 9x36 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=91.00] [y=33.20] [width=4.80] [height=21.00]
+        LayoutSVGText {text} at (91,55) size 5x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (91.00,59.20) startOffset 0 endOffset 2 width 4.80: "13"
+        LayoutSVGRect {rect} at (159,55) size 31x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=95.80] [y=33.20] [width=18.00] [height=21.00]
+        LayoutSVGText {text} at (102,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (102.40,59.20) startOffset 0 endOffset 2 width 4.80: "14"
+        LayoutSVGRect {rect} at (189,55) size 18x36 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=113.80] [y=33.20] [width=10.20] [height=21.00]
+        LayoutSVGText {text} at (116,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (116.50,59.20) startOffset 0 endOffset 2 width 4.80: "15"
+        LayoutSVGRect {rect} at (206,55) size 23x36 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=124.00] [y=33.20] [width=13.20] [height=21.00]
+        LayoutSVGText {text} at (128,55) size 5x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (128.20,59.20) startOffset 0 endOffset 2 width 4.80: "16"
+        LayoutSVGRect {rect} at (119,105) size 17x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=71.80] [y=63.20] [width=9.60] [height=21.00]
+        LayoutSVGText {text} at (75,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (75.40,89.20) startOffset 0 endOffset 1 width 2.40: "0"
+        LayoutSVGRect {rect} at (103,105) size 17x36 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=62.20] [y=63.20] [width=9.60] [height=21.00]
+        LayoutSVGText {text} at (65,85) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (65.80,89.20) startOffset 0 endOffset 1 width 2.40: "1"
+        LayoutSVGRect {rect} at (0,0) size 0x0 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=62.20] [y=63.20] [width=0.00] [height=21.00]
+        LayoutSVGText {text} at (61,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (61.00,89.20) startOffset 0 endOffset 1 width 2.40: "2"
+        LayoutSVGRect {rect} at (88,105) size 18x36 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=53.20] [y=63.20] [width=10.20] [height=21.00]
+        LayoutSVGText {text} at (57,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (57.10,89.20) startOffset 0 endOffset 1 width 2.40: "3"
+        LayoutSVGRect {rect} at (80,105) size 9x36 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=48.40] [y=63.20] [width=4.80] [height=21.00]
+        LayoutSVGText {text} at (49,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (49.60,89.20) startOffset 0 endOffset 1 width 2.40: "4"
+        LayoutSVGRect {rect} at (74,105) size 7x36 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=44.80] [y=63.20] [width=3.60] [height=21.00]
+        LayoutSVGText {text} at (45,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (45.40,89.20) startOffset 0 endOffset 1 width 2.40: "5"
+        LayoutSVGRect {rect} at (59,105) size 16x36 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=35.80] [y=63.20] [width=9.00] [height=21.00]
+        LayoutSVGText {text} at (39,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (39.10,89.20) startOffset 0 endOffset 1 width 2.40: "6"
+        LayoutSVGRect {rect} at (47,105) size 13x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=28.60] [y=63.20] [width=7.20] [height=21.00]
+        LayoutSVGText {text} at (30,85) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (31.00,89.20) startOffset 0 endOffset 1 width 2.40: "7"
+        LayoutSVGRect {rect} at (0,0) size 0x0 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=28.60] [y=63.20] [width=0.00] [height=21.00]
+        LayoutSVGText {text} at (27,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (27.40,89.20) startOffset 0 endOffset 1 width 2.40: "8"
+        LayoutSVGRect {rect} at (38,105) size 14x36 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=23.20] [y=63.20] [width=7.80] [height=21.00]
+        LayoutSVGText {text} at (25,85) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (25.90,89.20) startOffset 0 endOffset 1 width 2.40: "9"
+        LayoutSVGRect {rect} at (19,105) size 20x36 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=11.80] [y=63.20] [width=11.40] [height=21.00]
+        LayoutSVGText {text} at (15,85) size 5x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (15.10,89.20) startOffset 0 endOffset 2 width 4.80: "10"
+        LayoutSVGRect {rect} at (16,105) size 4x36 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=10.00] [y=63.20] [width=1.80] [height=21.00]
+        LayoutSVGText {text} at (8,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (8.50,89.20) startOffset 0 endOffset 2 width 4.80: "11"
+        LayoutSVGRect {rect} at (135,105) size 11x36 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=81.40] [y=63.20] [width=6.00] [height=21.00]
+        LayoutSVGText {text} at (81,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (82.00,89.20) startOffset 0 endOffset 2 width 4.80: "12"
+        LayoutSVGRect {rect} at (145,105) size 9x36 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=87.40] [y=63.20] [width=4.80] [height=21.00]
+        LayoutSVGText {text} at (87,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (87.40,89.20) startOffset 0 endOffset 2 width 4.80: "13"
+        LayoutSVGRect {rect} at (153,105) size 31x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=92.20] [y=63.20] [width=18.00] [height=21.00]
+        LayoutSVGText {text} at (98,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (98.80,89.20) startOffset 0 endOffset 2 width 4.80: "14"
+        LayoutSVGRect {rect} at (183,105) size 18x36 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=110.20] [y=63.20] [width=10.20] [height=21.00]
+        LayoutSVGText {text} at (112,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (112.90,89.20) startOffset 0 endOffset 2 width 4.80: "15"
+        LayoutSVGRect {rect} at (200,105) size 23x36 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=120.40] [y=63.20] [width=13.20] [height=21.00]
+        LayoutSVGText {text} at (124,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (124.60,89.20) startOffset 0 endOffset 2 width 4.80: "16"
diff --git a/LayoutTests/platform/linux/virtual/slimmingpaint/svg/text/bidi-text-query-expected.png b/LayoutTests/platform/linux/virtual/slimmingpaint/svg/text/bidi-text-query-expected.png
new file mode 100644
index 0000000..44b7271
--- /dev/null
+++ b/LayoutTests/platform/linux/virtual/slimmingpaint/svg/text/bidi-text-query-expected.png
Binary files differ
diff --git a/LayoutTests/platform/linux/virtual/slimmingpaint/svg/text/bidi-text-query-expected.txt b/LayoutTests/platform/linux/virtual/slimmingpaint/svg/text/bidi-text-query-expected.txt
new file mode 100644
index 0000000..8327e55
--- /dev/null
+++ b/LayoutTests/platform/linux/virtual/slimmingpaint/svg/text/bidi-text-query-expected.txt
@@ -0,0 +1,151 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  LayoutSVGRoot {svg} at (14,55) size 215x95
+    LayoutSVGContainer {g} at (14,55) size 215x95
+      LayoutSVGText {text} at (10,33) size 128x22 contains 1 chunk(s)
+        LayoutSVGTSpan {tspan} at (0,0) size 128x21
+          LayoutSVGInlineText {#text} at (0,0) size 128x21
+            chunk 1 text run 1 at (10.00,50.00) startOffset 0 endOffset 17 width 127.20 LTR override: "\x{646}\x{634}\x{627}\x{637} \x{627}\x{644}\x{62A}\x{62F}\x{648}\x{64A}\x{644}\x{60C} W3C"
+      LayoutSVGText {text} at (10,63) size 124x22 contains 1 chunk(s)
+        LayoutSVGTSpan {tspan} at (0,0) size 124x21
+          LayoutSVGInlineText {#text} at (0,0) size 124x21
+            chunk 1 text run 1 at (10.00,80.00) startOffset 0 endOffset 12 width 71.40 RTL: "\x{646}\x{634}\x{627}\x{637} \x{627}\x{644}\x{62A}\x{62F}\x{648}\x{64A}\x{644}"
+            chunk 1 text run 1 at (81.40,80.00) startOffset 0 endOffset 5 width 52.20: "\x{60C} W3C"
+      LayoutSVGContainer {g} at (14,55) size 215x95
+        LayoutSVGRect {rect} at (16,55) size 17x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=10.00] [y=33.20] [width=9.60] [height=21.00]
+        LayoutSVGText {text} at (13,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (13.60,59.20) startOffset 0 endOffset 1 width 2.40: "0"
+        LayoutSVGRect {rect} at (32,55) size 17x36 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=19.60] [y=33.20] [width=9.60] [height=21.00]
+        LayoutSVGText {text} at (23,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (23.20,59.20) startOffset 0 endOffset 1 width 2.40: "1"
+        LayoutSVGRect {rect} at (48,55) size 7x36 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=29.20] [y=33.20] [width=3.60] [height=21.00]
+        LayoutSVGText {text} at (29,55) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (29.80,59.20) startOffset 0 endOffset 1 width 2.40: "2"
+        LayoutSVGRect {rect} at (54,55) size 19x36 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=32.80] [y=33.20] [width=10.80] [height=21.00]
+        LayoutSVGText {text} at (37,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (37.00,59.20) startOffset 0 endOffset 1 width 2.40: "3"
+        LayoutSVGRect {rect} at (72,55) size 9x36 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=43.60] [y=33.20] [width=4.80] [height=21.00]
+        LayoutSVGText {text} at (44,55) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (44.80,59.20) startOffset 0 endOffset 1 width 2.40: "4"
+        LayoutSVGRect {rect} at (80,55) size 7x36 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=48.40] [y=33.20] [width=3.60] [height=21.00]
+        LayoutSVGText {text} at (49,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (49.00,59.20) startOffset 0 endOffset 1 width 2.40: "5"
+        LayoutSVGRect {rect} at (86,55) size 11x36 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=52.00] [y=33.20] [width=6.00] [height=21.00]
+        LayoutSVGText {text} at (53,55) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (53.80,59.20) startOffset 0 endOffset 1 width 2.40: "6"
+        LayoutSVGRect {rect} at (96,55) size 10x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=58.00] [y=33.20] [width=5.40] [height=21.00]
+        LayoutSVGText {text} at (59,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (59.50,59.20) startOffset 0 endOffset 1 width 2.40: "7"
+        LayoutSVGRect {rect} at (105,55) size 11x36 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=63.40] [y=33.20] [width=6.00] [height=21.00]
+        LayoutSVGText {text} at (65,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (65.20,59.20) startOffset 0 endOffset 1 width 2.40: "8"
+        LayoutSVGRect {rect} at (115,55) size 14x36 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=69.40] [y=33.20] [width=7.80] [height=21.00]
+        LayoutSVGText {text} at (72,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (72.10,59.20) startOffset 0 endOffset 1 width 2.40: "9"
+        LayoutSVGRect {rect} at (128,55) size 8x36 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=77.20] [y=33.20] [width=4.20] [height=21.00]
+        LayoutSVGText {text} at (76,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (76.90,59.20) startOffset 0 endOffset 2 width 4.80: "10"
+        LayoutSVGRect {rect} at (135,55) size 7x36 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=81.40] [y=33.20] [width=3.60] [height=21.00]
+        LayoutSVGText {text} at (80,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (80.80,59.20) startOffset 0 endOffset 2 width 4.80: "11"
+        LayoutSVGRect {rect} at (141,55) size 11x36 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=85.00] [y=33.20] [width=6.00] [height=21.00]
+        LayoutSVGText {text} at (85,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (85.60,59.20) startOffset 0 endOffset 2 width 4.80: "12"
+        LayoutSVGRect {rect} at (151,55) size 9x36 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=91.00] [y=33.20] [width=4.80] [height=21.00]
+        LayoutSVGText {text} at (91,55) size 5x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (91.00,59.20) startOffset 0 endOffset 2 width 4.80: "13"
+        LayoutSVGRect {rect} at (159,55) size 31x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=95.80] [y=33.20] [width=18.00] [height=21.00]
+        LayoutSVGText {text} at (102,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (102.40,59.20) startOffset 0 endOffset 2 width 4.80: "14"
+        LayoutSVGRect {rect} at (189,55) size 18x36 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=113.80] [y=33.20] [width=10.20] [height=21.00]
+        LayoutSVGText {text} at (116,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (116.50,59.20) startOffset 0 endOffset 2 width 4.80: "15"
+        LayoutSVGRect {rect} at (206,55) size 23x36 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=124.00] [y=33.20] [width=13.20] [height=21.00]
+        LayoutSVGText {text} at (128,55) size 5x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (128.20,59.20) startOffset 0 endOffset 2 width 4.80: "16"
+        LayoutSVGRect {rect} at (119,105) size 17x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=71.80] [y=63.20] [width=9.60] [height=21.00]
+        LayoutSVGText {text} at (75,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (75.40,89.20) startOffset 0 endOffset 1 width 2.40: "0"
+        LayoutSVGRect {rect} at (103,105) size 17x36 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=62.20] [y=63.20] [width=9.60] [height=21.00]
+        LayoutSVGText {text} at (65,85) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (65.80,89.20) startOffset 0 endOffset 1 width 2.40: "1"
+        LayoutSVGRect {rect} at (0,0) size 0x0 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=62.20] [y=63.20] [width=0.00] [height=21.00]
+        LayoutSVGText {text} at (61,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (61.00,89.20) startOffset 0 endOffset 1 width 2.40: "2"
+        LayoutSVGRect {rect} at (88,105) size 18x36 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=53.20] [y=63.20] [width=10.20] [height=21.00]
+        LayoutSVGText {text} at (57,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (57.10,89.20) startOffset 0 endOffset 1 width 2.40: "3"
+        LayoutSVGRect {rect} at (80,105) size 9x36 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=48.40] [y=63.20] [width=4.80] [height=21.00]
+        LayoutSVGText {text} at (49,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (49.60,89.20) startOffset 0 endOffset 1 width 2.40: "4"
+        LayoutSVGRect {rect} at (74,105) size 7x36 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=44.80] [y=63.20] [width=3.60] [height=21.00]
+        LayoutSVGText {text} at (45,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (45.40,89.20) startOffset 0 endOffset 1 width 2.40: "5"
+        LayoutSVGRect {rect} at (59,105) size 16x36 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=35.80] [y=63.20] [width=9.00] [height=21.00]
+        LayoutSVGText {text} at (39,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (39.10,89.20) startOffset 0 endOffset 1 width 2.40: "6"
+        LayoutSVGRect {rect} at (47,105) size 13x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=28.60] [y=63.20] [width=7.20] [height=21.00]
+        LayoutSVGText {text} at (30,85) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (31.00,89.20) startOffset 0 endOffset 1 width 2.40: "7"
+        LayoutSVGRect {rect} at (0,0) size 0x0 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=28.60] [y=63.20] [width=0.00] [height=21.00]
+        LayoutSVGText {text} at (27,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (27.40,89.20) startOffset 0 endOffset 1 width 2.40: "8"
+        LayoutSVGRect {rect} at (38,105) size 14x36 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=23.20] [y=63.20] [width=7.80] [height=21.00]
+        LayoutSVGText {text} at (25,85) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (25.90,89.20) startOffset 0 endOffset 1 width 2.40: "9"
+        LayoutSVGRect {rect} at (19,105) size 20x36 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=11.80] [y=63.20] [width=11.40] [height=21.00]
+        LayoutSVGText {text} at (15,85) size 5x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (15.10,89.20) startOffset 0 endOffset 2 width 4.80: "10"
+        LayoutSVGRect {rect} at (16,105) size 4x36 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=10.00] [y=63.20] [width=1.80] [height=21.00]
+        LayoutSVGText {text} at (8,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (8.50,89.20) startOffset 0 endOffset 2 width 4.80: "11"
+        LayoutSVGRect {rect} at (135,105) size 11x36 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=81.40] [y=63.20] [width=6.00] [height=21.00]
+        LayoutSVGText {text} at (81,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (82.00,89.20) startOffset 0 endOffset 2 width 4.80: "12"
+        LayoutSVGRect {rect} at (145,105) size 9x36 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=87.40] [y=63.20] [width=4.80] [height=21.00]
+        LayoutSVGText {text} at (87,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (87.40,89.20) startOffset 0 endOffset 2 width 4.80: "13"
+        LayoutSVGRect {rect} at (153,105) size 31x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=92.20] [y=63.20] [width=18.00] [height=21.00]
+        LayoutSVGText {text} at (98,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (98.80,89.20) startOffset 0 endOffset 2 width 4.80: "14"
+        LayoutSVGRect {rect} at (183,105) size 18x36 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=110.20] [y=63.20] [width=10.20] [height=21.00]
+        LayoutSVGText {text} at (112,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (112.90,89.20) startOffset 0 endOffset 2 width 4.80: "15"
+        LayoutSVGRect {rect} at (200,105) size 23x36 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=120.40] [y=63.20] [width=13.20] [height=21.00]
+        LayoutSVGText {text} at (124,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (124.60,89.20) startOffset 0 endOffset 2 width 4.80: "16"
diff --git a/LayoutTests/platform/mac/svg/text/bidi-text-query-expected.png b/LayoutTests/platform/mac/svg/text/bidi-text-query-expected.png
index 1351448..a142472 100644
--- a/LayoutTests/platform/mac/svg/text/bidi-text-query-expected.png
+++ b/LayoutTests/platform/mac/svg/text/bidi-text-query-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/svg/text/bidi-text-query-expected.txt b/LayoutTests/platform/mac/svg/text/bidi-text-query-expected.txt
new file mode 100644
index 0000000..ea0e5ef
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/text/bidi-text-query-expected.txt
@@ -0,0 +1,151 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  LayoutSVGRoot {svg} at (14,56) size 214x93
+    LayoutSVGContainer {g} at (14,56) size 214x93
+      LayoutSVGText {text} at (10,33) size 127x21 contains 1 chunk(s)
+        LayoutSVGTSpan {tspan} at (0,0) size 127x20
+          LayoutSVGInlineText {#text} at (0,0) size 127x20
+            chunk 1 text run 1 at (10.00,50.00) startOffset 0 endOffset 17 width 126.54 LTR override: "\x{646}\x{634}\x{627}\x{637} \x{627}\x{644}\x{62A}\x{62F}\x{648}\x{64A}\x{644}\x{60C} W3C"
+      LayoutSVGText {text} at (10,63) size 124x21 contains 1 chunk(s)
+        LayoutSVGTSpan {tspan} at (0,0) size 124x20
+          LayoutSVGInlineText {#text} at (0,0) size 124x20
+            chunk 1 text run 1 at (10.00,80.00) startOffset 0 endOffset 12 width 72.76 RTL: "\x{646}\x{634}\x{627}\x{637} \x{627}\x{644}\x{62A}\x{62F}\x{648}\x{64A}\x{644}"
+            chunk 1 text run 1 at (82.76,80.00) startOffset 0 endOffset 5 width 50.74: "\x{60C} W3C"
+      LayoutSVGContainer {g} at (14,56) size 214x93
+        LayoutSVGRect {rect} at (16,56) size 17x34 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=10.00] [y=33.80] [width=9.47] [height=19.80]
+        LayoutSVGText {text} at (13,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (13.62,58.60) startOffset 0 endOffset 1 width 2.22: "0"
+        LayoutSVGRect {rect} at (32,56) size 17x34 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=19.47] [y=33.80] [width=9.55] [height=19.80]
+        LayoutSVGText {text} at (23,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (23.13,58.60) startOffset 0 endOffset 1 width 2.22: "1"
+        LayoutSVGRect {rect} at (48,56) size 7x34 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=29.02] [y=33.80] [width=3.73] [height=19.80]
+        LayoutSVGText {text} at (29,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (29.77,58.60) startOffset 0 endOffset 1 width 2.22: "2"
+        LayoutSVGRect {rect} at (54,56) size 19x34 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=32.75] [y=33.80] [width=10.87] [height=19.80]
+        LayoutSVGText {text} at (37,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (37.07,58.60) startOffset 0 endOffset 1 width 2.22: "3"
+        LayoutSVGRect {rect} at (72,56) size 10x34 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=43.62] [y=33.80] [width=5.00] [height=19.80]
+        LayoutSVGText {text} at (45,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (45.01,58.60) startOffset 0 endOffset 1 width 2.22: "4"
+        LayoutSVGRect {rect} at (81,56) size 7x34 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=48.62] [y=33.80] [width=3.73] [height=19.80]
+        LayoutSVGText {text} at (49,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (49.37,58.60) startOffset 0 endOffset 1 width 2.22: "5"
+        LayoutSVGRect {rect} at (87,56) size 11x34 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=52.35] [y=33.80] [width=6.06] [height=19.80]
+        LayoutSVGText {text} at (54,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (54.27,58.60) startOffset 0 endOffset 1 width 2.22: "6"
+        LayoutSVGRect {rect} at (97,56) size 10x34 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=58.41] [y=33.80] [width=5.41] [height=19.80]
+        LayoutSVGText {text} at (60,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (60.01,58.60) startOffset 0 endOffset 1 width 2.22: "7"
+        LayoutSVGRect {rect} at (106,56) size 11x34 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=63.82] [y=33.80] [width=6.07] [height=19.80]
+        LayoutSVGText {text} at (65,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (65.75,58.60) startOffset 0 endOffset 1 width 2.22: "8"
+        LayoutSVGRect {rect} at (116,56) size 14x34 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=69.90] [y=33.80] [width=7.78] [height=19.80]
+        LayoutSVGText {text} at (72,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (72.68,58.60) startOffset 0 endOffset 1 width 2.22: "9"
+        LayoutSVGRect {rect} at (129,56) size 8x34 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=77.68] [y=33.80] [width=4.39] [height=19.80]
+        LayoutSVGText {text} at (77,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (77.65,58.60) startOffset 0 endOffset 2 width 4.44: "10"
+        LayoutSVGRect {rect} at (136,56) size 7x34 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=82.07] [y=33.80] [width=3.73] [height=19.80]
+        LayoutSVGText {text} at (81,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (81.71,58.60) startOffset 0 endOffset 2 width 4.44: "11"
+        LayoutSVGRect {rect} at (142,56) size 11x34 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=85.80] [y=33.80] [width=5.74] [height=19.80]
+        LayoutSVGText {text} at (86,55) size 5x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (86.44,58.60) startOffset 0 endOffset 2 width 4.44: "12"
+        LayoutSVGRect {rect} at (152,56) size 9x34 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=91.54] [y=33.80] [width=5.00] [height=19.80]
+        LayoutSVGText {text} at (91,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (91.81,58.60) startOffset 0 endOffset 2 width 4.44: "13"
+        LayoutSVGRect {rect} at (160,56) size 30x34 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=96.54] [y=33.80] [width=16.99] [height=19.80]
+        LayoutSVGText {text} at (102,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (102.81,58.60) startOffset 0 endOffset 2 width 4.44: "14"
+        LayoutSVGRect {rect} at (189,56) size 17x34 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=113.53] [y=33.80] [width=10.01] [height=19.80]
+        LayoutSVGText {text} at (116,55) size 5x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (116.31,58.60) startOffset 0 endOffset 2 width 4.44: "15"
+        LayoutSVGRect {rect} at (205,56) size 23x34 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=123.54] [y=33.80] [width=13.00] [height=19.80]
+        LayoutSVGText {text} at (127,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (127.81,58.60) startOffset 0 endOffset 2 width 4.44: "16"
+        LayoutSVGRect {rect} at (122,106) size 16x34 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=73.29] [y=63.80] [width=9.47] [height=19.80]
+        LayoutSVGText {text} at (76,85) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (76.91,88.60) startOffset 0 endOffset 1 width 2.22: "0"
+        LayoutSVGRect {rect} at (105,106) size 18x34 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=63.58] [y=63.80] [width=9.71] [height=19.80]
+        LayoutSVGText {text} at (67,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (67.32,88.60) startOffset 0 endOffset 1 width 2.22: "1"
+        LayoutSVGRect {rect} at (0,0) size 0x0 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=63.58] [y=63.80] [width=0.00] [height=19.80]
+        LayoutSVGText {text} at (62,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (62.47,88.60) startOffset 0 endOffset 1 width 2.22: "2"
+        LayoutSVGRect {rect} at (90,106) size 18x34 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=54.21] [y=63.80] [width=10.47] [height=19.80]
+        LayoutSVGText {text} at (58,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (58.33,88.60) startOffset 0 endOffset 1 width 2.22: "3"
+        LayoutSVGRect {rect} at (82,106) size 9x34 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=49.21] [y=63.80] [width=5.00] [height=19.80]
+        LayoutSVGText {text} at (50,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (50.60,88.60) startOffset 0 endOffset 1 width 2.22: "4"
+        LayoutSVGRect {rect} at (75,106) size 8x34 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=45.48] [y=63.80] [width=3.73] [height=19.80]
+        LayoutSVGText {text} at (46,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (46.23,88.60) startOffset 0 endOffset 1 width 2.22: "5"
+        LayoutSVGRect {rect} at (60,106) size 16x34 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=36.37] [y=63.80] [width=9.11] [height=19.80]
+        LayoutSVGText {text} at (39,85) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (39.81,88.60) startOffset 0 endOffset 1 width 2.22: "6"
+        LayoutSVGRect {rect} at (48,106) size 13x34 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=28.91] [y=63.80] [width=7.45] [height=19.80]
+        LayoutSVGText {text} at (31,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (31.53,88.60) startOffset 0 endOffset 1 width 2.22: "7"
+        LayoutSVGRect {rect} at (0,0) size 0x0 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=28.91] [y=63.80] [width=0.00] [height=19.80]
+        LayoutSVGText {text} at (27,85) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (27.80,88.60) startOffset 0 endOffset 1 width 2.22: "8"
+        LayoutSVGRect {rect} at (39,106) size 14x34 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=23.51] [y=63.80] [width=7.78] [height=19.80]
+        LayoutSVGText {text} at (26,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (26.29,88.60) startOffset 0 endOffset 1 width 2.22: "9"
+        LayoutSVGRect {rect} at (20,106) size 20x34 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=12.02] [y=63.80] [width=11.49] [height=19.80]
+        LayoutSVGText {text} at (15,85) size 5x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (15.54,88.60) startOffset 0 endOffset 2 width 4.44: "10"
+        LayoutSVGRect {rect} at (16,106) size 5x34 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=10.00] [y=63.80] [width=2.02] [height=19.80]
+        LayoutSVGText {text} at (8,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (8.79,88.60) startOffset 0 endOffset 2 width 4.44: "11"
+        LayoutSVGRect {rect} at (137,106) size 11x34 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=82.76] [y=63.80] [width=5.74] [height=19.80]
+        LayoutSVGText {text} at (83,85) size 5x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (83.40,88.60) startOffset 0 endOffset 2 width 4.44: "12"
+        LayoutSVGRect {rect} at (147,106) size 9x34 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=88.50] [y=63.80] [width=5.00] [height=19.80]
+        LayoutSVGText {text} at (88,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (88.77,88.60) startOffset 0 endOffset 2 width 4.44: "13"
+        LayoutSVGRect {rect} at (155,106) size 30x34 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=93.50] [y=63.80] [width=16.99] [height=19.80]
+        LayoutSVGText {text} at (99,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (99.77,88.60) startOffset 0 endOffset 2 width 4.44: "14"
+        LayoutSVGRect {rect} at (184,106) size 17x34 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=110.49] [y=63.80] [width=10.01] [height=19.80]
+        LayoutSVGText {text} at (113,85) size 5x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (113.27,88.60) startOffset 0 endOffset 2 width 4.44: "15"
+        LayoutSVGRect {rect} at (200,106) size 23x34 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=120.50] [y=63.80] [width=13.00] [height=19.80]
+        LayoutSVGText {text} at (124,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (124.77,88.60) startOffset 0 endOffset 2 width 4.44: "16"
diff --git a/LayoutTests/platform/mac/virtual/slimmingpaint/svg/text/bidi-text-query-expected.png b/LayoutTests/platform/mac/virtual/slimmingpaint/svg/text/bidi-text-query-expected.png
new file mode 100644
index 0000000..a142472
--- /dev/null
+++ b/LayoutTests/platform/mac/virtual/slimmingpaint/svg/text/bidi-text-query-expected.png
Binary files differ
diff --git a/LayoutTests/platform/mac/virtual/slimmingpaint/svg/text/bidi-text-query-expected.txt b/LayoutTests/platform/mac/virtual/slimmingpaint/svg/text/bidi-text-query-expected.txt
new file mode 100644
index 0000000..ea0e5ef
--- /dev/null
+++ b/LayoutTests/platform/mac/virtual/slimmingpaint/svg/text/bidi-text-query-expected.txt
@@ -0,0 +1,151 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  LayoutSVGRoot {svg} at (14,56) size 214x93
+    LayoutSVGContainer {g} at (14,56) size 214x93
+      LayoutSVGText {text} at (10,33) size 127x21 contains 1 chunk(s)
+        LayoutSVGTSpan {tspan} at (0,0) size 127x20
+          LayoutSVGInlineText {#text} at (0,0) size 127x20
+            chunk 1 text run 1 at (10.00,50.00) startOffset 0 endOffset 17 width 126.54 LTR override: "\x{646}\x{634}\x{627}\x{637} \x{627}\x{644}\x{62A}\x{62F}\x{648}\x{64A}\x{644}\x{60C} W3C"
+      LayoutSVGText {text} at (10,63) size 124x21 contains 1 chunk(s)
+        LayoutSVGTSpan {tspan} at (0,0) size 124x20
+          LayoutSVGInlineText {#text} at (0,0) size 124x20
+            chunk 1 text run 1 at (10.00,80.00) startOffset 0 endOffset 12 width 72.76 RTL: "\x{646}\x{634}\x{627}\x{637} \x{627}\x{644}\x{62A}\x{62F}\x{648}\x{64A}\x{644}"
+            chunk 1 text run 1 at (82.76,80.00) startOffset 0 endOffset 5 width 50.74: "\x{60C} W3C"
+      LayoutSVGContainer {g} at (14,56) size 214x93
+        LayoutSVGRect {rect} at (16,56) size 17x34 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=10.00] [y=33.80] [width=9.47] [height=19.80]
+        LayoutSVGText {text} at (13,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (13.62,58.60) startOffset 0 endOffset 1 width 2.22: "0"
+        LayoutSVGRect {rect} at (32,56) size 17x34 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=19.47] [y=33.80] [width=9.55] [height=19.80]
+        LayoutSVGText {text} at (23,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (23.13,58.60) startOffset 0 endOffset 1 width 2.22: "1"
+        LayoutSVGRect {rect} at (48,56) size 7x34 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=29.02] [y=33.80] [width=3.73] [height=19.80]
+        LayoutSVGText {text} at (29,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (29.77,58.60) startOffset 0 endOffset 1 width 2.22: "2"
+        LayoutSVGRect {rect} at (54,56) size 19x34 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=32.75] [y=33.80] [width=10.87] [height=19.80]
+        LayoutSVGText {text} at (37,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (37.07,58.60) startOffset 0 endOffset 1 width 2.22: "3"
+        LayoutSVGRect {rect} at (72,56) size 10x34 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=43.62] [y=33.80] [width=5.00] [height=19.80]
+        LayoutSVGText {text} at (45,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (45.01,58.60) startOffset 0 endOffset 1 width 2.22: "4"
+        LayoutSVGRect {rect} at (81,56) size 7x34 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=48.62] [y=33.80] [width=3.73] [height=19.80]
+        LayoutSVGText {text} at (49,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (49.37,58.60) startOffset 0 endOffset 1 width 2.22: "5"
+        LayoutSVGRect {rect} at (87,56) size 11x34 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=52.35] [y=33.80] [width=6.06] [height=19.80]
+        LayoutSVGText {text} at (54,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (54.27,58.60) startOffset 0 endOffset 1 width 2.22: "6"
+        LayoutSVGRect {rect} at (97,56) size 10x34 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=58.41] [y=33.80] [width=5.41] [height=19.80]
+        LayoutSVGText {text} at (60,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (60.01,58.60) startOffset 0 endOffset 1 width 2.22: "7"
+        LayoutSVGRect {rect} at (106,56) size 11x34 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=63.82] [y=33.80] [width=6.07] [height=19.80]
+        LayoutSVGText {text} at (65,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (65.75,58.60) startOffset 0 endOffset 1 width 2.22: "8"
+        LayoutSVGRect {rect} at (116,56) size 14x34 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=69.90] [y=33.80] [width=7.78] [height=19.80]
+        LayoutSVGText {text} at (72,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (72.68,58.60) startOffset 0 endOffset 1 width 2.22: "9"
+        LayoutSVGRect {rect} at (129,56) size 8x34 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=77.68] [y=33.80] [width=4.39] [height=19.80]
+        LayoutSVGText {text} at (77,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (77.65,58.60) startOffset 0 endOffset 2 width 4.44: "10"
+        LayoutSVGRect {rect} at (136,56) size 7x34 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=82.07] [y=33.80] [width=3.73] [height=19.80]
+        LayoutSVGText {text} at (81,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (81.71,58.60) startOffset 0 endOffset 2 width 4.44: "11"
+        LayoutSVGRect {rect} at (142,56) size 11x34 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=85.80] [y=33.80] [width=5.74] [height=19.80]
+        LayoutSVGText {text} at (86,55) size 5x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (86.44,58.60) startOffset 0 endOffset 2 width 4.44: "12"
+        LayoutSVGRect {rect} at (152,56) size 9x34 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=91.54] [y=33.80] [width=5.00] [height=19.80]
+        LayoutSVGText {text} at (91,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (91.81,58.60) startOffset 0 endOffset 2 width 4.44: "13"
+        LayoutSVGRect {rect} at (160,56) size 30x34 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=96.54] [y=33.80] [width=16.99] [height=19.80]
+        LayoutSVGText {text} at (102,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (102.81,58.60) startOffset 0 endOffset 2 width 4.44: "14"
+        LayoutSVGRect {rect} at (189,56) size 17x34 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=113.53] [y=33.80] [width=10.01] [height=19.80]
+        LayoutSVGText {text} at (116,55) size 5x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (116.31,58.60) startOffset 0 endOffset 2 width 4.44: "15"
+        LayoutSVGRect {rect} at (205,56) size 23x34 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=123.54] [y=33.80] [width=13.00] [height=19.80]
+        LayoutSVGText {text} at (127,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (127.81,58.60) startOffset 0 endOffset 2 width 4.44: "16"
+        LayoutSVGRect {rect} at (122,106) size 16x34 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=73.29] [y=63.80] [width=9.47] [height=19.80]
+        LayoutSVGText {text} at (76,85) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (76.91,88.60) startOffset 0 endOffset 1 width 2.22: "0"
+        LayoutSVGRect {rect} at (105,106) size 18x34 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=63.58] [y=63.80] [width=9.71] [height=19.80]
+        LayoutSVGText {text} at (67,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (67.32,88.60) startOffset 0 endOffset 1 width 2.22: "1"
+        LayoutSVGRect {rect} at (0,0) size 0x0 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=63.58] [y=63.80] [width=0.00] [height=19.80]
+        LayoutSVGText {text} at (62,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (62.47,88.60) startOffset 0 endOffset 1 width 2.22: "2"
+        LayoutSVGRect {rect} at (90,106) size 18x34 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=54.21] [y=63.80] [width=10.47] [height=19.80]
+        LayoutSVGText {text} at (58,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (58.33,88.60) startOffset 0 endOffset 1 width 2.22: "3"
+        LayoutSVGRect {rect} at (82,106) size 9x34 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=49.21] [y=63.80] [width=5.00] [height=19.80]
+        LayoutSVGText {text} at (50,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (50.60,88.60) startOffset 0 endOffset 1 width 2.22: "4"
+        LayoutSVGRect {rect} at (75,106) size 8x34 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=45.48] [y=63.80] [width=3.73] [height=19.80]
+        LayoutSVGText {text} at (46,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (46.23,88.60) startOffset 0 endOffset 1 width 2.22: "5"
+        LayoutSVGRect {rect} at (60,106) size 16x34 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=36.37] [y=63.80] [width=9.11] [height=19.80]
+        LayoutSVGText {text} at (39,85) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (39.81,88.60) startOffset 0 endOffset 1 width 2.22: "6"
+        LayoutSVGRect {rect} at (48,106) size 13x34 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=28.91] [y=63.80] [width=7.45] [height=19.80]
+        LayoutSVGText {text} at (31,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (31.53,88.60) startOffset 0 endOffset 1 width 2.22: "7"
+        LayoutSVGRect {rect} at (0,0) size 0x0 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=28.91] [y=63.80] [width=0.00] [height=19.80]
+        LayoutSVGText {text} at (27,85) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (27.80,88.60) startOffset 0 endOffset 1 width 2.22: "8"
+        LayoutSVGRect {rect} at (39,106) size 14x34 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=23.51] [y=63.80] [width=7.78] [height=19.80]
+        LayoutSVGText {text} at (26,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (26.29,88.60) startOffset 0 endOffset 1 width 2.22: "9"
+        LayoutSVGRect {rect} at (20,106) size 20x34 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=12.02] [y=63.80] [width=11.49] [height=19.80]
+        LayoutSVGText {text} at (15,85) size 5x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (15.54,88.60) startOffset 0 endOffset 2 width 4.44: "10"
+        LayoutSVGRect {rect} at (16,106) size 5x34 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=10.00] [y=63.80] [width=2.02] [height=19.80]
+        LayoutSVGText {text} at (8,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (8.79,88.60) startOffset 0 endOffset 2 width 4.44: "11"
+        LayoutSVGRect {rect} at (137,106) size 11x34 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=82.76] [y=63.80] [width=5.74] [height=19.80]
+        LayoutSVGText {text} at (83,85) size 5x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (83.40,88.60) startOffset 0 endOffset 2 width 4.44: "12"
+        LayoutSVGRect {rect} at (147,106) size 9x34 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=88.50] [y=63.80] [width=5.00] [height=19.80]
+        LayoutSVGText {text} at (88,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (88.77,88.60) startOffset 0 endOffset 2 width 4.44: "13"
+        LayoutSVGRect {rect} at (155,106) size 30x34 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=93.50] [y=63.80] [width=16.99] [height=19.80]
+        LayoutSVGText {text} at (99,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (99.77,88.60) startOffset 0 endOffset 2 width 4.44: "14"
+        LayoutSVGRect {rect} at (184,106) size 17x34 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=110.49] [y=63.80] [width=10.01] [height=19.80]
+        LayoutSVGText {text} at (113,85) size 5x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (113.27,88.60) startOffset 0 endOffset 2 width 4.44: "15"
+        LayoutSVGRect {rect} at (200,106) size 23x34 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=120.50] [y=63.80] [width=13.00] [height=19.80]
+        LayoutSVGText {text} at (124,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (124.77,88.60) startOffset 0 endOffset 2 width 4.44: "16"
diff --git a/LayoutTests/platform/win-xp/svg/text/bidi-text-query-expected.png b/LayoutTests/platform/win-xp/svg/text/bidi-text-query-expected.png
index 98e92fe..5439a84 100644
--- a/LayoutTests/platform/win-xp/svg/text/bidi-text-query-expected.png
+++ b/LayoutTests/platform/win-xp/svg/text/bidi-text-query-expected.png
Binary files differ
diff --git a/LayoutTests/platform/win-xp/svg/text/bidi-text-query-expected.txt b/LayoutTests/platform/win-xp/svg/text/bidi-text-query-expected.txt
index 88b8392..8327e55 100644
--- a/LayoutTests/platform/win-xp/svg/text/bidi-text-query-expected.txt
+++ b/LayoutTests/platform/win-xp/svg/text/bidi-text-query-expected.txt
@@ -1,8 +1,8 @@
 layer at (0,0) size 800x600
   LayoutView at (0,0) size 800x600
 layer at (0,0) size 800x600
-  LayoutSVGRoot {svg} at (16,55) size 213x86
-    LayoutSVGContainer {g} at (16,55) size 213x86
+  LayoutSVGRoot {svg} at (14,55) size 215x95
+    LayoutSVGContainer {g} at (14,55) size 215x95
       LayoutSVGText {text} at (10,33) size 128x22 contains 1 chunk(s)
         LayoutSVGTSpan {tspan} at (0,0) size 128x21
           LayoutSVGInlineText {#text} at (0,0) size 128x21
@@ -12,8 +12,140 @@
           LayoutSVGInlineText {#text} at (0,0) size 124x21
             chunk 1 text run 1 at (10.00,80.00) startOffset 0 endOffset 12 width 71.40 RTL: "\x{646}\x{634}\x{627}\x{637} \x{627}\x{644}\x{62A}\x{62F}\x{648}\x{64A}\x{644}"
             chunk 1 text run 1 at (81.40,80.00) startOffset 0 endOffset 5 width 52.20: "\x{60C} W3C"
-      LayoutSVGContainer {g} at (16,55) size 213x86
-        LayoutSVGRect {svg:rect} at (16,55) size 136x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=10.00] [y=33.20] [width=81.00] [height=21.00]
-        LayoutSVGRect {svg:rect} at (159,55) size 70x36 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=95.80] [y=33.20] [width=41.40] [height=21.00]
-        LayoutSVGRect {svg:rect} at (16,105) size 130x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=10.00] [y=63.20] [width=77.40] [height=21.00]
-        LayoutSVGRect {svg:rect} at (153,105) size 70x36 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=92.20] [y=63.20] [width=41.40] [height=21.00]
+      LayoutSVGContainer {g} at (14,55) size 215x95
+        LayoutSVGRect {rect} at (16,55) size 17x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=10.00] [y=33.20] [width=9.60] [height=21.00]
+        LayoutSVGText {text} at (13,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (13.60,59.20) startOffset 0 endOffset 1 width 2.40: "0"
+        LayoutSVGRect {rect} at (32,55) size 17x36 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=19.60] [y=33.20] [width=9.60] [height=21.00]
+        LayoutSVGText {text} at (23,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (23.20,59.20) startOffset 0 endOffset 1 width 2.40: "1"
+        LayoutSVGRect {rect} at (48,55) size 7x36 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=29.20] [y=33.20] [width=3.60] [height=21.00]
+        LayoutSVGText {text} at (29,55) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (29.80,59.20) startOffset 0 endOffset 1 width 2.40: "2"
+        LayoutSVGRect {rect} at (54,55) size 19x36 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=32.80] [y=33.20] [width=10.80] [height=21.00]
+        LayoutSVGText {text} at (37,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (37.00,59.20) startOffset 0 endOffset 1 width 2.40: "3"
+        LayoutSVGRect {rect} at (72,55) size 9x36 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=43.60] [y=33.20] [width=4.80] [height=21.00]
+        LayoutSVGText {text} at (44,55) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (44.80,59.20) startOffset 0 endOffset 1 width 2.40: "4"
+        LayoutSVGRect {rect} at (80,55) size 7x36 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=48.40] [y=33.20] [width=3.60] [height=21.00]
+        LayoutSVGText {text} at (49,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (49.00,59.20) startOffset 0 endOffset 1 width 2.40: "5"
+        LayoutSVGRect {rect} at (86,55) size 11x36 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=52.00] [y=33.20] [width=6.00] [height=21.00]
+        LayoutSVGText {text} at (53,55) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (53.80,59.20) startOffset 0 endOffset 1 width 2.40: "6"
+        LayoutSVGRect {rect} at (96,55) size 10x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=58.00] [y=33.20] [width=5.40] [height=21.00]
+        LayoutSVGText {text} at (59,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (59.50,59.20) startOffset 0 endOffset 1 width 2.40: "7"
+        LayoutSVGRect {rect} at (105,55) size 11x36 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=63.40] [y=33.20] [width=6.00] [height=21.00]
+        LayoutSVGText {text} at (65,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (65.20,59.20) startOffset 0 endOffset 1 width 2.40: "8"
+        LayoutSVGRect {rect} at (115,55) size 14x36 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=69.40] [y=33.20] [width=7.80] [height=21.00]
+        LayoutSVGText {text} at (72,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (72.10,59.20) startOffset 0 endOffset 1 width 2.40: "9"
+        LayoutSVGRect {rect} at (128,55) size 8x36 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=77.20] [y=33.20] [width=4.20] [height=21.00]
+        LayoutSVGText {text} at (76,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (76.90,59.20) startOffset 0 endOffset 2 width 4.80: "10"
+        LayoutSVGRect {rect} at (135,55) size 7x36 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=81.40] [y=33.20] [width=3.60] [height=21.00]
+        LayoutSVGText {text} at (80,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (80.80,59.20) startOffset 0 endOffset 2 width 4.80: "11"
+        LayoutSVGRect {rect} at (141,55) size 11x36 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=85.00] [y=33.20] [width=6.00] [height=21.00]
+        LayoutSVGText {text} at (85,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (85.60,59.20) startOffset 0 endOffset 2 width 4.80: "12"
+        LayoutSVGRect {rect} at (151,55) size 9x36 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=91.00] [y=33.20] [width=4.80] [height=21.00]
+        LayoutSVGText {text} at (91,55) size 5x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (91.00,59.20) startOffset 0 endOffset 2 width 4.80: "13"
+        LayoutSVGRect {rect} at (159,55) size 31x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=95.80] [y=33.20] [width=18.00] [height=21.00]
+        LayoutSVGText {text} at (102,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (102.40,59.20) startOffset 0 endOffset 2 width 4.80: "14"
+        LayoutSVGRect {rect} at (189,55) size 18x36 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=113.80] [y=33.20] [width=10.20] [height=21.00]
+        LayoutSVGText {text} at (116,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (116.50,59.20) startOffset 0 endOffset 2 width 4.80: "15"
+        LayoutSVGRect {rect} at (206,55) size 23x36 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=124.00] [y=33.20] [width=13.20] [height=21.00]
+        LayoutSVGText {text} at (128,55) size 5x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (128.20,59.20) startOffset 0 endOffset 2 width 4.80: "16"
+        LayoutSVGRect {rect} at (119,105) size 17x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=71.80] [y=63.20] [width=9.60] [height=21.00]
+        LayoutSVGText {text} at (75,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (75.40,89.20) startOffset 0 endOffset 1 width 2.40: "0"
+        LayoutSVGRect {rect} at (103,105) size 17x36 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=62.20] [y=63.20] [width=9.60] [height=21.00]
+        LayoutSVGText {text} at (65,85) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (65.80,89.20) startOffset 0 endOffset 1 width 2.40: "1"
+        LayoutSVGRect {rect} at (0,0) size 0x0 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=62.20] [y=63.20] [width=0.00] [height=21.00]
+        LayoutSVGText {text} at (61,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (61.00,89.20) startOffset 0 endOffset 1 width 2.40: "2"
+        LayoutSVGRect {rect} at (88,105) size 18x36 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=53.20] [y=63.20] [width=10.20] [height=21.00]
+        LayoutSVGText {text} at (57,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (57.10,89.20) startOffset 0 endOffset 1 width 2.40: "3"
+        LayoutSVGRect {rect} at (80,105) size 9x36 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=48.40] [y=63.20] [width=4.80] [height=21.00]
+        LayoutSVGText {text} at (49,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (49.60,89.20) startOffset 0 endOffset 1 width 2.40: "4"
+        LayoutSVGRect {rect} at (74,105) size 7x36 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=44.80] [y=63.20] [width=3.60] [height=21.00]
+        LayoutSVGText {text} at (45,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (45.40,89.20) startOffset 0 endOffset 1 width 2.40: "5"
+        LayoutSVGRect {rect} at (59,105) size 16x36 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=35.80] [y=63.20] [width=9.00] [height=21.00]
+        LayoutSVGText {text} at (39,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (39.10,89.20) startOffset 0 endOffset 1 width 2.40: "6"
+        LayoutSVGRect {rect} at (47,105) size 13x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=28.60] [y=63.20] [width=7.20] [height=21.00]
+        LayoutSVGText {text} at (30,85) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (31.00,89.20) startOffset 0 endOffset 1 width 2.40: "7"
+        LayoutSVGRect {rect} at (0,0) size 0x0 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=28.60] [y=63.20] [width=0.00] [height=21.00]
+        LayoutSVGText {text} at (27,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (27.40,89.20) startOffset 0 endOffset 1 width 2.40: "8"
+        LayoutSVGRect {rect} at (38,105) size 14x36 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=23.20] [y=63.20] [width=7.80] [height=21.00]
+        LayoutSVGText {text} at (25,85) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (25.90,89.20) startOffset 0 endOffset 1 width 2.40: "9"
+        LayoutSVGRect {rect} at (19,105) size 20x36 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=11.80] [y=63.20] [width=11.40] [height=21.00]
+        LayoutSVGText {text} at (15,85) size 5x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (15.10,89.20) startOffset 0 endOffset 2 width 4.80: "10"
+        LayoutSVGRect {rect} at (16,105) size 4x36 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=10.00] [y=63.20] [width=1.80] [height=21.00]
+        LayoutSVGText {text} at (8,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (8.50,89.20) startOffset 0 endOffset 2 width 4.80: "11"
+        LayoutSVGRect {rect} at (135,105) size 11x36 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=81.40] [y=63.20] [width=6.00] [height=21.00]
+        LayoutSVGText {text} at (81,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (82.00,89.20) startOffset 0 endOffset 2 width 4.80: "12"
+        LayoutSVGRect {rect} at (145,105) size 9x36 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=87.40] [y=63.20] [width=4.80] [height=21.00]
+        LayoutSVGText {text} at (87,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (87.40,89.20) startOffset 0 endOffset 2 width 4.80: "13"
+        LayoutSVGRect {rect} at (153,105) size 31x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=92.20] [y=63.20] [width=18.00] [height=21.00]
+        LayoutSVGText {text} at (98,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (98.80,89.20) startOffset 0 endOffset 2 width 4.80: "14"
+        LayoutSVGRect {rect} at (183,105) size 18x36 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=110.20] [y=63.20] [width=10.20] [height=21.00]
+        LayoutSVGText {text} at (112,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (112.90,89.20) startOffset 0 endOffset 2 width 4.80: "15"
+        LayoutSVGRect {rect} at (200,105) size 23x36 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=120.40] [y=63.20] [width=13.20] [height=21.00]
+        LayoutSVGText {text} at (124,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (124.60,89.20) startOffset 0 endOffset 2 width 4.80: "16"
diff --git a/LayoutTests/platform/win-xp/virtual/slimmingpaint/svg/text/bidi-text-query-expected.png b/LayoutTests/platform/win-xp/virtual/slimmingpaint/svg/text/bidi-text-query-expected.png
new file mode 100644
index 0000000..5439a84
--- /dev/null
+++ b/LayoutTests/platform/win-xp/virtual/slimmingpaint/svg/text/bidi-text-query-expected.png
Binary files differ
diff --git a/LayoutTests/platform/win-xp/virtual/slimmingpaint/svg/text/bidi-text-query-expected.txt b/LayoutTests/platform/win-xp/virtual/slimmingpaint/svg/text/bidi-text-query-expected.txt
new file mode 100644
index 0000000..8327e55
--- /dev/null
+++ b/LayoutTests/platform/win-xp/virtual/slimmingpaint/svg/text/bidi-text-query-expected.txt
@@ -0,0 +1,151 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  LayoutSVGRoot {svg} at (14,55) size 215x95
+    LayoutSVGContainer {g} at (14,55) size 215x95
+      LayoutSVGText {text} at (10,33) size 128x22 contains 1 chunk(s)
+        LayoutSVGTSpan {tspan} at (0,0) size 128x21
+          LayoutSVGInlineText {#text} at (0,0) size 128x21
+            chunk 1 text run 1 at (10.00,50.00) startOffset 0 endOffset 17 width 127.20 LTR override: "\x{646}\x{634}\x{627}\x{637} \x{627}\x{644}\x{62A}\x{62F}\x{648}\x{64A}\x{644}\x{60C} W3C"
+      LayoutSVGText {text} at (10,63) size 124x22 contains 1 chunk(s)
+        LayoutSVGTSpan {tspan} at (0,0) size 124x21
+          LayoutSVGInlineText {#text} at (0,0) size 124x21
+            chunk 1 text run 1 at (10.00,80.00) startOffset 0 endOffset 12 width 71.40 RTL: "\x{646}\x{634}\x{627}\x{637} \x{627}\x{644}\x{62A}\x{62F}\x{648}\x{64A}\x{644}"
+            chunk 1 text run 1 at (81.40,80.00) startOffset 0 endOffset 5 width 52.20: "\x{60C} W3C"
+      LayoutSVGContainer {g} at (14,55) size 215x95
+        LayoutSVGRect {rect} at (16,55) size 17x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=10.00] [y=33.20] [width=9.60] [height=21.00]
+        LayoutSVGText {text} at (13,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (13.60,59.20) startOffset 0 endOffset 1 width 2.40: "0"
+        LayoutSVGRect {rect} at (32,55) size 17x36 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=19.60] [y=33.20] [width=9.60] [height=21.00]
+        LayoutSVGText {text} at (23,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (23.20,59.20) startOffset 0 endOffset 1 width 2.40: "1"
+        LayoutSVGRect {rect} at (48,55) size 7x36 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=29.20] [y=33.20] [width=3.60] [height=21.00]
+        LayoutSVGText {text} at (29,55) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (29.80,59.20) startOffset 0 endOffset 1 width 2.40: "2"
+        LayoutSVGRect {rect} at (54,55) size 19x36 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=32.80] [y=33.20] [width=10.80] [height=21.00]
+        LayoutSVGText {text} at (37,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (37.00,59.20) startOffset 0 endOffset 1 width 2.40: "3"
+        LayoutSVGRect {rect} at (72,55) size 9x36 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=43.60] [y=33.20] [width=4.80] [height=21.00]
+        LayoutSVGText {text} at (44,55) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (44.80,59.20) startOffset 0 endOffset 1 width 2.40: "4"
+        LayoutSVGRect {rect} at (80,55) size 7x36 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=48.40] [y=33.20] [width=3.60] [height=21.00]
+        LayoutSVGText {text} at (49,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (49.00,59.20) startOffset 0 endOffset 1 width 2.40: "5"
+        LayoutSVGRect {rect} at (86,55) size 11x36 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=52.00] [y=33.20] [width=6.00] [height=21.00]
+        LayoutSVGText {text} at (53,55) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (53.80,59.20) startOffset 0 endOffset 1 width 2.40: "6"
+        LayoutSVGRect {rect} at (96,55) size 10x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=58.00] [y=33.20] [width=5.40] [height=21.00]
+        LayoutSVGText {text} at (59,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (59.50,59.20) startOffset 0 endOffset 1 width 2.40: "7"
+        LayoutSVGRect {rect} at (105,55) size 11x36 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=63.40] [y=33.20] [width=6.00] [height=21.00]
+        LayoutSVGText {text} at (65,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (65.20,59.20) startOffset 0 endOffset 1 width 2.40: "8"
+        LayoutSVGRect {rect} at (115,55) size 14x36 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=69.40] [y=33.20] [width=7.80] [height=21.00]
+        LayoutSVGText {text} at (72,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (72.10,59.20) startOffset 0 endOffset 1 width 2.40: "9"
+        LayoutSVGRect {rect} at (128,55) size 8x36 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=77.20] [y=33.20] [width=4.20] [height=21.00]
+        LayoutSVGText {text} at (76,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (76.90,59.20) startOffset 0 endOffset 2 width 4.80: "10"
+        LayoutSVGRect {rect} at (135,55) size 7x36 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=81.40] [y=33.20] [width=3.60] [height=21.00]
+        LayoutSVGText {text} at (80,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (80.80,59.20) startOffset 0 endOffset 2 width 4.80: "11"
+        LayoutSVGRect {rect} at (141,55) size 11x36 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=85.00] [y=33.20] [width=6.00] [height=21.00]
+        LayoutSVGText {text} at (85,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (85.60,59.20) startOffset 0 endOffset 2 width 4.80: "12"
+        LayoutSVGRect {rect} at (151,55) size 9x36 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=91.00] [y=33.20] [width=4.80] [height=21.00]
+        LayoutSVGText {text} at (91,55) size 5x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (91.00,59.20) startOffset 0 endOffset 2 width 4.80: "13"
+        LayoutSVGRect {rect} at (159,55) size 31x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=95.80] [y=33.20] [width=18.00] [height=21.00]
+        LayoutSVGText {text} at (102,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (102.40,59.20) startOffset 0 endOffset 2 width 4.80: "14"
+        LayoutSVGRect {rect} at (189,55) size 18x36 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=113.80] [y=33.20] [width=10.20] [height=21.00]
+        LayoutSVGText {text} at (116,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (116.50,59.20) startOffset 0 endOffset 2 width 4.80: "15"
+        LayoutSVGRect {rect} at (206,55) size 23x36 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=124.00] [y=33.20] [width=13.20] [height=21.00]
+        LayoutSVGText {text} at (128,55) size 5x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (128.20,59.20) startOffset 0 endOffset 2 width 4.80: "16"
+        LayoutSVGRect {rect} at (119,105) size 17x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=71.80] [y=63.20] [width=9.60] [height=21.00]
+        LayoutSVGText {text} at (75,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (75.40,89.20) startOffset 0 endOffset 1 width 2.40: "0"
+        LayoutSVGRect {rect} at (103,105) size 17x36 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=62.20] [y=63.20] [width=9.60] [height=21.00]
+        LayoutSVGText {text} at (65,85) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (65.80,89.20) startOffset 0 endOffset 1 width 2.40: "1"
+        LayoutSVGRect {rect} at (0,0) size 0x0 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=62.20] [y=63.20] [width=0.00] [height=21.00]
+        LayoutSVGText {text} at (61,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (61.00,89.20) startOffset 0 endOffset 1 width 2.40: "2"
+        LayoutSVGRect {rect} at (88,105) size 18x36 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=53.20] [y=63.20] [width=10.20] [height=21.00]
+        LayoutSVGText {text} at (57,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (57.10,89.20) startOffset 0 endOffset 1 width 2.40: "3"
+        LayoutSVGRect {rect} at (80,105) size 9x36 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=48.40] [y=63.20] [width=4.80] [height=21.00]
+        LayoutSVGText {text} at (49,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (49.60,89.20) startOffset 0 endOffset 1 width 2.40: "4"
+        LayoutSVGRect {rect} at (74,105) size 7x36 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=44.80] [y=63.20] [width=3.60] [height=21.00]
+        LayoutSVGText {text} at (45,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (45.40,89.20) startOffset 0 endOffset 1 width 2.40: "5"
+        LayoutSVGRect {rect} at (59,105) size 16x36 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=35.80] [y=63.20] [width=9.00] [height=21.00]
+        LayoutSVGText {text} at (39,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (39.10,89.20) startOffset 0 endOffset 1 width 2.40: "6"
+        LayoutSVGRect {rect} at (47,105) size 13x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=28.60] [y=63.20] [width=7.20] [height=21.00]
+        LayoutSVGText {text} at (30,85) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (31.00,89.20) startOffset 0 endOffset 1 width 2.40: "7"
+        LayoutSVGRect {rect} at (0,0) size 0x0 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=28.60] [y=63.20] [width=0.00] [height=21.00]
+        LayoutSVGText {text} at (27,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (27.40,89.20) startOffset 0 endOffset 1 width 2.40: "8"
+        LayoutSVGRect {rect} at (38,105) size 14x36 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=23.20] [y=63.20] [width=7.80] [height=21.00]
+        LayoutSVGText {text} at (25,85) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (25.90,89.20) startOffset 0 endOffset 1 width 2.40: "9"
+        LayoutSVGRect {rect} at (19,105) size 20x36 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=11.80] [y=63.20] [width=11.40] [height=21.00]
+        LayoutSVGText {text} at (15,85) size 5x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (15.10,89.20) startOffset 0 endOffset 2 width 4.80: "10"
+        LayoutSVGRect {rect} at (16,105) size 4x36 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=10.00] [y=63.20] [width=1.80] [height=21.00]
+        LayoutSVGText {text} at (8,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (8.50,89.20) startOffset 0 endOffset 2 width 4.80: "11"
+        LayoutSVGRect {rect} at (135,105) size 11x36 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=81.40] [y=63.20] [width=6.00] [height=21.00]
+        LayoutSVGText {text} at (81,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (82.00,89.20) startOffset 0 endOffset 2 width 4.80: "12"
+        LayoutSVGRect {rect} at (145,105) size 9x36 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=87.40] [y=63.20] [width=4.80] [height=21.00]
+        LayoutSVGText {text} at (87,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (87.40,89.20) startOffset 0 endOffset 2 width 4.80: "13"
+        LayoutSVGRect {rect} at (153,105) size 31x36 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=92.20] [y=63.20] [width=18.00] [height=21.00]
+        LayoutSVGText {text} at (98,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (98.80,89.20) startOffset 0 endOffset 2 width 4.80: "14"
+        LayoutSVGRect {rect} at (183,105) size 18x36 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=110.20] [y=63.20] [width=10.20] [height=21.00]
+        LayoutSVGText {text} at (112,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (112.90,89.20) startOffset 0 endOffset 2 width 4.80: "15"
+        LayoutSVGRect {rect} at (200,105) size 23x36 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=120.40] [y=63.20] [width=13.20] [height=21.00]
+        LayoutSVGText {text} at (124,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (124.60,89.20) startOffset 0 endOffset 2 width 4.80: "16"
diff --git a/LayoutTests/platform/win/svg/text/bidi-text-query-expected.png b/LayoutTests/platform/win/svg/text/bidi-text-query-expected.png
index 230e770..ebedb85 100644
--- a/LayoutTests/platform/win/svg/text/bidi-text-query-expected.png
+++ b/LayoutTests/platform/win/svg/text/bidi-text-query-expected.png
Binary files differ
diff --git a/LayoutTests/platform/win/svg/text/bidi-text-query-expected.txt b/LayoutTests/platform/win/svg/text/bidi-text-query-expected.txt
new file mode 100644
index 0000000..bb959b3
--- /dev/null
+++ b/LayoutTests/platform/win/svg/text/bidi-text-query-expected.txt
@@ -0,0 +1,151 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  LayoutSVGRoot {svg} at (14,56) size 214x93
+    LayoutSVGContainer {g} at (14,56) size 214x93
+      LayoutSVGText {text} at (10,33) size 127x21 contains 1 chunk(s)
+        LayoutSVGTSpan {tspan} at (0,0) size 127x20
+          LayoutSVGInlineText {#text} at (0,0) size 127x20
+            chunk 1 text run 1 at (10.00,50.00) startOffset 0 endOffset 17 width 126.54 LTR override: "\x{646}\x{634}\x{627}\x{637} \x{627}\x{644}\x{62A}\x{62F}\x{648}\x{64A}\x{644}\x{60C} W3C"
+      LayoutSVGText {text} at (10,63) size 124x21 contains 1 chunk(s)
+        LayoutSVGTSpan {tspan} at (0,0) size 124x20
+          LayoutSVGInlineText {#text} at (0,0) size 124x20
+            chunk 1 text run 1 at (10.00,80.00) startOffset 0 endOffset 12 width 72.76 RTL: "\x{646}\x{634}\x{627}\x{637} \x{627}\x{644}\x{62A}\x{62F}\x{648}\x{64A}\x{644}"
+            chunk 1 text run 1 at (82.76,80.00) startOffset 0 endOffset 5 width 50.74: "\x{60C} W3C"
+      LayoutSVGContainer {g} at (14,56) size 214x93
+        LayoutSVGRect {rect} at (16,56) size 17x34 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=10.00] [y=33.80] [width=9.47] [height=19.80]
+        LayoutSVGText {text} at (13,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (13.53,58.60) startOffset 0 endOffset 1 width 2.40: "0"
+        LayoutSVGRect {rect} at (32,56) size 17x34 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=19.47] [y=33.80] [width=9.55] [height=19.80]
+        LayoutSVGText {text} at (23,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (23.04,58.60) startOffset 0 endOffset 1 width 2.40: "1"
+        LayoutSVGRect {rect} at (48,56) size 7x34 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=29.02] [y=33.80] [width=3.73] [height=19.80]
+        LayoutSVGText {text} at (29,55) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (29.68,58.60) startOffset 0 endOffset 1 width 2.40: "2"
+        LayoutSVGRect {rect} at (54,56) size 19x34 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=32.75] [y=33.80] [width=10.87] [height=19.80]
+        LayoutSVGText {text} at (36,55) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (36.98,58.60) startOffset 0 endOffset 1 width 2.40: "3"
+        LayoutSVGRect {rect} at (72,56) size 10x34 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=43.62] [y=33.80] [width=5.00] [height=19.80]
+        LayoutSVGText {text} at (44,55) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (44.92,58.60) startOffset 0 endOffset 1 width 2.40: "4"
+        LayoutSVGRect {rect} at (81,56) size 7x34 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=48.62] [y=33.80] [width=3.73] [height=19.80]
+        LayoutSVGText {text} at (49,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (49.28,58.60) startOffset 0 endOffset 1 width 2.40: "5"
+        LayoutSVGRect {rect} at (87,56) size 11x34 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=52.35] [y=33.80] [width=6.06] [height=19.80]
+        LayoutSVGText {text} at (54,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (54.18,58.60) startOffset 0 endOffset 1 width 2.40: "6"
+        LayoutSVGRect {rect} at (97,56) size 10x34 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=58.41] [y=33.80] [width=5.41] [height=19.80]
+        LayoutSVGText {text} at (59,55) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (59.92,58.60) startOffset 0 endOffset 1 width 2.40: "7"
+        LayoutSVGRect {rect} at (106,56) size 11x34 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=63.82] [y=33.80] [width=6.07] [height=19.80]
+        LayoutSVGText {text} at (65,55) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (65.66,58.60) startOffset 0 endOffset 1 width 2.40: "8"
+        LayoutSVGRect {rect} at (116,56) size 14x34 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=69.90] [y=33.80] [width=7.78] [height=19.80]
+        LayoutSVGText {text} at (72,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (72.59,58.60) startOffset 0 endOffset 1 width 2.40: "9"
+        LayoutSVGRect {rect} at (129,56) size 8x34 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=77.68] [y=33.80] [width=4.39] [height=19.80]
+        LayoutSVGText {text} at (77,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (77.47,58.60) startOffset 0 endOffset 2 width 4.80: "10"
+        LayoutSVGRect {rect} at (136,56) size 7x34 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=82.07] [y=33.80] [width=3.73] [height=19.80]
+        LayoutSVGText {text} at (81,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (81.53,58.60) startOffset 0 endOffset 2 width 4.80: "11"
+        LayoutSVGRect {rect} at (142,56) size 11x34 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=85.80] [y=33.80] [width=5.74] [height=19.80]
+        LayoutSVGText {text} at (86,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (86.27,58.60) startOffset 0 endOffset 2 width 4.80: "12"
+        LayoutSVGRect {rect} at (152,56) size 9x34 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=91.54] [y=33.80] [width=5.00] [height=19.80]
+        LayoutSVGText {text} at (91,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (91.64,58.60) startOffset 0 endOffset 2 width 4.80: "13"
+        LayoutSVGRect {rect} at (160,56) size 30x34 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=96.54] [y=33.80] [width=16.99] [height=19.80]
+        LayoutSVGText {text} at (102,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (102.63,58.60) startOffset 0 endOffset 2 width 4.80: "14"
+        LayoutSVGRect {rect} at (189,56) size 17x34 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=113.53] [y=33.80] [width=10.01] [height=19.80]
+        LayoutSVGText {text} at (116,55) size 5x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (116.13,58.60) startOffset 0 endOffset 2 width 4.80: "15"
+        LayoutSVGRect {rect} at (205,56) size 23x34 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=123.54] [y=33.80] [width=13.00] [height=19.80]
+        LayoutSVGText {text} at (127,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (127.64,58.60) startOffset 0 endOffset 2 width 4.80: "16"
+        LayoutSVGRect {rect} at (122,106) size 16x34 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=73.29] [y=63.80] [width=9.47] [height=19.80]
+        LayoutSVGText {text} at (76,85) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (76.82,88.60) startOffset 0 endOffset 1 width 2.40: "0"
+        LayoutSVGRect {rect} at (105,106) size 18x34 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=63.58] [y=63.80] [width=9.71] [height=19.80]
+        LayoutSVGText {text} at (67,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (67.23,88.60) startOffset 0 endOffset 1 width 2.40: "1"
+        LayoutSVGRect {rect} at (0,0) size 0x0 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=63.58] [y=63.80] [width=0.00] [height=19.80]
+        LayoutSVGText {text} at (62,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (62.38,88.60) startOffset 0 endOffset 1 width 2.40: "2"
+        LayoutSVGRect {rect} at (90,106) size 18x34 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=54.21] [y=63.80] [width=10.47] [height=19.80]
+        LayoutSVGText {text} at (58,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (58.24,88.60) startOffset 0 endOffset 1 width 2.40: "3"
+        LayoutSVGRect {rect} at (82,106) size 9x34 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=49.21] [y=63.80] [width=5.00] [height=19.80]
+        LayoutSVGText {text} at (50,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (50.51,88.60) startOffset 0 endOffset 1 width 2.40: "4"
+        LayoutSVGRect {rect} at (75,106) size 8x34 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=45.48] [y=63.80] [width=3.73] [height=19.80]
+        LayoutSVGText {text} at (46,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (46.14,88.60) startOffset 0 endOffset 1 width 2.40: "5"
+        LayoutSVGRect {rect} at (60,106) size 16x34 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=36.37] [y=63.80] [width=9.11] [height=19.80]
+        LayoutSVGText {text} at (39,85) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (39.72,88.60) startOffset 0 endOffset 1 width 2.40: "6"
+        LayoutSVGRect {rect} at (48,106) size 13x34 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=28.91] [y=63.80] [width=7.45] [height=19.80]
+        LayoutSVGText {text} at (31,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (31.44,88.60) startOffset 0 endOffset 1 width 2.40: "7"
+        LayoutSVGRect {rect} at (0,0) size 0x0 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=28.91] [y=63.80] [width=0.00] [height=19.80]
+        LayoutSVGText {text} at (27,85) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (27.71,88.60) startOffset 0 endOffset 1 width 2.40: "8"
+        LayoutSVGRect {rect} at (39,106) size 14x34 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=23.51] [y=63.80] [width=7.78] [height=19.80]
+        LayoutSVGText {text} at (26,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (26.20,88.60) startOffset 0 endOffset 1 width 2.40: "9"
+        LayoutSVGRect {rect} at (20,106) size 20x34 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=12.02] [y=63.80] [width=11.49] [height=19.80]
+        LayoutSVGText {text} at (15,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (15.37,88.60) startOffset 0 endOffset 2 width 4.80: "10"
+        LayoutSVGRect {rect} at (16,106) size 5x34 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=10.00] [y=63.80] [width=2.02] [height=19.80]
+        LayoutSVGText {text} at (8,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (8.61,88.60) startOffset 0 endOffset 2 width 4.80: "11"
+        LayoutSVGRect {rect} at (137,106) size 11x34 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=82.76] [y=63.80] [width=5.74] [height=19.80]
+        LayoutSVGText {text} at (83,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (83.23,88.60) startOffset 0 endOffset 2 width 4.80: "12"
+        LayoutSVGRect {rect} at (147,106) size 9x34 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=88.50] [y=63.80] [width=5.00] [height=19.80]
+        LayoutSVGText {text} at (88,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (88.60,88.60) startOffset 0 endOffset 2 width 4.80: "13"
+        LayoutSVGRect {rect} at (155,106) size 30x34 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=93.50] [y=63.80] [width=16.99] [height=19.80]
+        LayoutSVGText {text} at (99,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (99.59,88.60) startOffset 0 endOffset 2 width 4.80: "14"
+        LayoutSVGRect {rect} at (184,106) size 17x34 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=110.49] [y=63.80] [width=10.01] [height=19.80]
+        LayoutSVGText {text} at (113,85) size 5x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (113.09,88.60) startOffset 0 endOffset 2 width 4.80: "15"
+        LayoutSVGRect {rect} at (200,106) size 23x34 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=120.50] [y=63.80] [width=13.00] [height=19.80]
+        LayoutSVGText {text} at (124,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (124.60,88.60) startOffset 0 endOffset 2 width 4.80: "16"
diff --git a/LayoutTests/platform/win/virtual/slimmingpaint/svg/text/bidi-text-query-expected.png b/LayoutTests/platform/win/virtual/slimmingpaint/svg/text/bidi-text-query-expected.png
new file mode 100644
index 0000000..ebedb85
--- /dev/null
+++ b/LayoutTests/platform/win/virtual/slimmingpaint/svg/text/bidi-text-query-expected.png
Binary files differ
diff --git a/LayoutTests/platform/win/virtual/slimmingpaint/svg/text/bidi-text-query-expected.txt b/LayoutTests/platform/win/virtual/slimmingpaint/svg/text/bidi-text-query-expected.txt
new file mode 100644
index 0000000..bb959b3
--- /dev/null
+++ b/LayoutTests/platform/win/virtual/slimmingpaint/svg/text/bidi-text-query-expected.txt
@@ -0,0 +1,151 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  LayoutSVGRoot {svg} at (14,56) size 214x93
+    LayoutSVGContainer {g} at (14,56) size 214x93
+      LayoutSVGText {text} at (10,33) size 127x21 contains 1 chunk(s)
+        LayoutSVGTSpan {tspan} at (0,0) size 127x20
+          LayoutSVGInlineText {#text} at (0,0) size 127x20
+            chunk 1 text run 1 at (10.00,50.00) startOffset 0 endOffset 17 width 126.54 LTR override: "\x{646}\x{634}\x{627}\x{637} \x{627}\x{644}\x{62A}\x{62F}\x{648}\x{64A}\x{644}\x{60C} W3C"
+      LayoutSVGText {text} at (10,63) size 124x21 contains 1 chunk(s)
+        LayoutSVGTSpan {tspan} at (0,0) size 124x20
+          LayoutSVGInlineText {#text} at (0,0) size 124x20
+            chunk 1 text run 1 at (10.00,80.00) startOffset 0 endOffset 12 width 72.76 RTL: "\x{646}\x{634}\x{627}\x{637} \x{627}\x{644}\x{62A}\x{62F}\x{648}\x{64A}\x{644}"
+            chunk 1 text run 1 at (82.76,80.00) startOffset 0 endOffset 5 width 50.74: "\x{60C} W3C"
+      LayoutSVGContainer {g} at (14,56) size 214x93
+        LayoutSVGRect {rect} at (16,56) size 17x34 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=10.00] [y=33.80] [width=9.47] [height=19.80]
+        LayoutSVGText {text} at (13,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (13.53,58.60) startOffset 0 endOffset 1 width 2.40: "0"
+        LayoutSVGRect {rect} at (32,56) size 17x34 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=19.47] [y=33.80] [width=9.55] [height=19.80]
+        LayoutSVGText {text} at (23,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (23.04,58.60) startOffset 0 endOffset 1 width 2.40: "1"
+        LayoutSVGRect {rect} at (48,56) size 7x34 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=29.02] [y=33.80] [width=3.73] [height=19.80]
+        LayoutSVGText {text} at (29,55) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (29.68,58.60) startOffset 0 endOffset 1 width 2.40: "2"
+        LayoutSVGRect {rect} at (54,56) size 19x34 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=32.75] [y=33.80] [width=10.87] [height=19.80]
+        LayoutSVGText {text} at (36,55) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (36.98,58.60) startOffset 0 endOffset 1 width 2.40: "3"
+        LayoutSVGRect {rect} at (72,56) size 10x34 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=43.62] [y=33.80] [width=5.00] [height=19.80]
+        LayoutSVGText {text} at (44,55) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (44.92,58.60) startOffset 0 endOffset 1 width 2.40: "4"
+        LayoutSVGRect {rect} at (81,56) size 7x34 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=48.62] [y=33.80] [width=3.73] [height=19.80]
+        LayoutSVGText {text} at (49,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (49.28,58.60) startOffset 0 endOffset 1 width 2.40: "5"
+        LayoutSVGRect {rect} at (87,56) size 11x34 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=52.35] [y=33.80] [width=6.06] [height=19.80]
+        LayoutSVGText {text} at (54,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (54.18,58.60) startOffset 0 endOffset 1 width 2.40: "6"
+        LayoutSVGRect {rect} at (97,56) size 10x34 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=58.41] [y=33.80] [width=5.41] [height=19.80]
+        LayoutSVGText {text} at (59,55) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (59.92,58.60) startOffset 0 endOffset 1 width 2.40: "7"
+        LayoutSVGRect {rect} at (106,56) size 11x34 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=63.82] [y=33.80] [width=6.07] [height=19.80]
+        LayoutSVGText {text} at (65,55) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (65.66,58.60) startOffset 0 endOffset 1 width 2.40: "8"
+        LayoutSVGRect {rect} at (116,56) size 14x34 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=69.90] [y=33.80] [width=7.78] [height=19.80]
+        LayoutSVGText {text} at (72,55) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (72.59,58.60) startOffset 0 endOffset 1 width 2.40: "9"
+        LayoutSVGRect {rect} at (129,56) size 8x34 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=77.68] [y=33.80] [width=4.39] [height=19.80]
+        LayoutSVGText {text} at (77,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (77.47,58.60) startOffset 0 endOffset 2 width 4.80: "10"
+        LayoutSVGRect {rect} at (136,56) size 7x34 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=82.07] [y=33.80] [width=3.73] [height=19.80]
+        LayoutSVGText {text} at (81,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (81.53,58.60) startOffset 0 endOffset 2 width 4.80: "11"
+        LayoutSVGRect {rect} at (142,56) size 11x34 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=85.80] [y=33.80] [width=5.74] [height=19.80]
+        LayoutSVGText {text} at (86,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (86.27,58.60) startOffset 0 endOffset 2 width 4.80: "12"
+        LayoutSVGRect {rect} at (152,56) size 9x34 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=91.54] [y=33.80] [width=5.00] [height=19.80]
+        LayoutSVGText {text} at (91,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (91.64,58.60) startOffset 0 endOffset 2 width 4.80: "13"
+        LayoutSVGRect {rect} at (160,56) size 30x34 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=96.54] [y=33.80] [width=16.99] [height=19.80]
+        LayoutSVGText {text} at (102,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (102.63,58.60) startOffset 0 endOffset 2 width 4.80: "14"
+        LayoutSVGRect {rect} at (189,56) size 17x34 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=113.53] [y=33.80] [width=10.01] [height=19.80]
+        LayoutSVGText {text} at (116,55) size 5x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (116.13,58.60) startOffset 0 endOffset 2 width 4.80: "15"
+        LayoutSVGRect {rect} at (205,56) size 23x34 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=123.54] [y=33.80] [width=13.00] [height=19.80]
+        LayoutSVGText {text} at (127,55) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (127.64,58.60) startOffset 0 endOffset 2 width 4.80: "16"
+        LayoutSVGRect {rect} at (122,106) size 16x34 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=73.29] [y=63.80] [width=9.47] [height=19.80]
+        LayoutSVGText {text} at (76,85) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (76.82,88.60) startOffset 0 endOffset 1 width 2.40: "0"
+        LayoutSVGRect {rect} at (105,106) size 18x34 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=63.58] [y=63.80] [width=9.71] [height=19.80]
+        LayoutSVGText {text} at (67,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (67.23,88.60) startOffset 0 endOffset 1 width 2.40: "1"
+        LayoutSVGRect {rect} at (0,0) size 0x0 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=63.58] [y=63.80] [width=0.00] [height=19.80]
+        LayoutSVGText {text} at (62,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (62.38,88.60) startOffset 0 endOffset 1 width 2.40: "2"
+        LayoutSVGRect {rect} at (90,106) size 18x34 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=54.21] [y=63.80] [width=10.47] [height=19.80]
+        LayoutSVGText {text} at (58,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (58.24,88.60) startOffset 0 endOffset 1 width 2.40: "3"
+        LayoutSVGRect {rect} at (82,106) size 9x34 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=49.21] [y=63.80] [width=5.00] [height=19.80]
+        LayoutSVGText {text} at (50,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (50.51,88.60) startOffset 0 endOffset 1 width 2.40: "4"
+        LayoutSVGRect {rect} at (75,106) size 8x34 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=45.48] [y=63.80] [width=3.73] [height=19.80]
+        LayoutSVGText {text} at (46,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (46.14,88.60) startOffset 0 endOffset 1 width 2.40: "5"
+        LayoutSVGRect {rect} at (60,106) size 16x34 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=36.37] [y=63.80] [width=9.11] [height=19.80]
+        LayoutSVGText {text} at (39,85) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (39.72,88.60) startOffset 0 endOffset 1 width 2.40: "6"
+        LayoutSVGRect {rect} at (48,106) size 13x34 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=28.91] [y=63.80] [width=7.45] [height=19.80]
+        LayoutSVGText {text} at (31,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (31.44,88.60) startOffset 0 endOffset 1 width 2.40: "7"
+        LayoutSVGRect {rect} at (0,0) size 0x0 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=28.91] [y=63.80] [width=0.00] [height=19.80]
+        LayoutSVGText {text} at (27,85) size 4x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (27.71,88.60) startOffset 0 endOffset 1 width 2.40: "8"
+        LayoutSVGRect {rect} at (39,106) size 14x34 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=23.51] [y=63.80] [width=7.78] [height=19.80]
+        LayoutSVGText {text} at (26,85) size 3x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 3x5
+            chunk 1 (middle anchor) text run 1 at (26.20,88.60) startOffset 0 endOffset 1 width 2.40: "9"
+        LayoutSVGRect {rect} at (20,106) size 20x34 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=12.02] [y=63.80] [width=11.49] [height=19.80]
+        LayoutSVGText {text} at (15,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (15.37,88.60) startOffset 0 endOffset 2 width 4.80: "10"
+        LayoutSVGRect {rect} at (16,106) size 5x34 [fill={[type=SOLID] [color=#0000FF] [opacity=0.40]}] [x=10.00] [y=63.80] [width=2.02] [height=19.80]
+        LayoutSVGText {text} at (8,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (8.61,88.60) startOffset 0 endOffset 2 width 4.80: "11"
+        LayoutSVGRect {rect} at (137,106) size 11x34 [fill={[type=SOLID] [color=#4B0082] [opacity=0.40]}] [x=82.76] [y=63.80] [width=5.74] [height=19.80]
+        LayoutSVGText {text} at (83,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (83.23,88.60) startOffset 0 endOffset 2 width 4.80: "12"
+        LayoutSVGRect {rect} at (147,106) size 9x34 [fill={[type=SOLID] [color=#EE82EE] [opacity=0.40]}] [x=88.50] [y=63.80] [width=5.00] [height=19.80]
+        LayoutSVGText {text} at (88,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (88.60,88.60) startOffset 0 endOffset 2 width 4.80: "13"
+        LayoutSVGRect {rect} at (155,106) size 30x34 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=93.50] [y=63.80] [width=16.99] [height=19.80]
+        LayoutSVGText {text} at (99,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (99.59,88.60) startOffset 0 endOffset 2 width 4.80: "14"
+        LayoutSVGRect {rect} at (184,106) size 17x34 [fill={[type=SOLID] [color=#FFA500] [opacity=0.40]}] [x=110.49] [y=63.80] [width=10.01] [height=19.80]
+        LayoutSVGText {text} at (113,85) size 5x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (113.09,88.60) startOffset 0 endOffset 2 width 4.80: "15"
+        LayoutSVGRect {rect} at (200,106) size 23x34 [fill={[type=SOLID] [color=#FFFF00] [opacity=0.40]}] [x=120.50] [y=63.80] [width=13.00] [height=19.80]
+        LayoutSVGText {text} at (124,85) size 6x5 contains 1 chunk(s)
+          LayoutSVGInlineText {#text} at (0,0) size 5x5
+            chunk 1 (middle anchor) text run 1 at (124.60,88.60) startOffset 0 endOffset 2 width 4.80: "16"
diff --git a/LayoutTests/svg/text/bidi-text-query-expected.txt b/LayoutTests/svg/text/bidi-text-query-expected.txt
deleted file mode 100644
index bed0f33..0000000
--- a/LayoutTests/svg/text/bidi-text-query-expected.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-layer at (0,0) size 800x600
-  LayoutView at (0,0) size 800x600
-layer at (0,0) size 800x600
-  LayoutSVGRoot {svg} at (16,56) size 212x84
-    LayoutSVGContainer {g} at (16,56) size 212x84
-      LayoutSVGText {text} at (10,33) size 127x21 contains 1 chunk(s)
-        LayoutSVGTSpan {tspan} at (0,0) size 127x20
-          LayoutSVGInlineText {#text} at (0,0) size 127x20
-            chunk 1 text run 1 at (10.00,50.00) startOffset 0 endOffset 17 width 126.54 LTR override: "\x{646}\x{634}\x{627}\x{637} \x{627}\x{644}\x{62A}\x{62F}\x{648}\x{64A}\x{644}\x{60C} W3C"
-      LayoutSVGText {text} at (10,63) size 124x21 contains 1 chunk(s)
-        LayoutSVGTSpan {tspan} at (0,0) size 124x20
-          LayoutSVGInlineText {#text} at (0,0) size 124x20
-            chunk 1 text run 1 at (10.00,80.00) startOffset 0 endOffset 12 width 72.76 RTL: "\x{646}\x{634}\x{627}\x{637} \x{627}\x{644}\x{62A}\x{62F}\x{648}\x{64A}\x{644}"
-            chunk 1 text run 1 at (82.76,80.00) startOffset 0 endOffset 5 width 50.74: "\x{60C} W3C"
-      LayoutSVGContainer {g} at (16,56) size 212x84
-        LayoutSVGRect {svg:rect} at (16,56) size 137x34 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=10.00] [y=33.80] [width=81.54] [height=19.80]
-        LayoutSVGRect {svg:rect} at (160,56) size 68x34 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=96.54] [y=33.80] [width=40.00] [height=19.80]
-        LayoutSVGRect {svg:rect} at (16,106) size 132x34 [fill={[type=SOLID] [color=#FF0000] [opacity=0.40]}] [x=10.00] [y=63.80] [width=78.50] [height=19.80]
-        LayoutSVGRect {svg:rect} at (155,106) size 68x34 [fill={[type=SOLID] [color=#008000] [opacity=0.40]}] [x=93.50] [y=63.80] [width=40.00] [height=19.80]