diff --git a/layout/reftests/bugs/936670-1-ref.svg b/layout/reftests/bugs/936670-1-ref.svg
new file mode 100644
index 000000000000..76113de85687
--- /dev/null
+++ b/layout/reftests/bugs/936670-1-ref.svg
@@ -0,0 +1,6 @@
+
diff --git a/layout/reftests/bugs/936670-1.svg b/layout/reftests/bugs/936670-1.svg
new file mode 100644
index 000000000000..6a16f77eaf1d
--- /dev/null
+++ b/layout/reftests/bugs/936670-1.svg
@@ -0,0 +1,6 @@
+
diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list
index 12285c78eec9..4820c3bc9a44 100644
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1779,6 +1779,7 @@ fuzzy(1,10000) fuzzy-if(Android&&AndroidVersion>=15,5,10000) == 902330-1.html 90
fuzzy-if(Android,8,400) == 906199-1.html 906199-1-ref.html
== 921716-1.html 921716-1-ref.html
fuzzy-if(cocoaWidget,1,40) == 928607-1.html 928607-1-ref.html
+== 936670-1.svg 936670-1-ref.svg
== 931853.html 931853-ref.html
== 931853-quirks.html 931853-quirks-ref.html
== 931464-1.html 931464-1-ref.html
diff --git a/layout/svg/nsSVGTextFrame2.cpp b/layout/svg/nsSVGTextFrame2.cpp
index 259baf6c6950..ce9f29d738b3 100644
--- a/layout/svg/nsSVGTextFrame2.cpp
+++ b/layout/svg/nsSVGTextFrame2.cpp
@@ -1937,11 +1937,6 @@ TextRenderedRunIterator::Next()
charIndex = mTextElementCharIndex;
- // Get the position and rotation of the character that begins this
- // rendered run.
- pt = Root()->mPositions[mTextElementCharIndex].mPosition;
- rotate = Root()->mPositions[mTextElementCharIndex].mAngle;
-
// Find the end of the rendered run, by looking through the
// nsSVGTextFrame2's positions array until we find one that is recorded
// as a run boundary.
@@ -1983,6 +1978,11 @@ TextRenderedRunIterator::Next()
TrimOffsets(offset, length, trimmedOffsets);
charIndex += offset - untrimmedOffset;
+ // Get the position and rotation of the character that begins this
+ // rendered run.
+ pt = Root()->mPositions[charIndex].mPosition;
+ rotate = Root()->mPositions[charIndex].mAngle;
+
// Determine if we should skip this rendered run.
bool skip = !mFrameIterator.IsWithinSubtree() ||
Root()->mPositions[mTextElementCharIndex].mHidden;