Bug 956513 - Have anchored chunk boundaries at both ends of a <textPath>.
authorCameron McCormack <cam@mcc.id.au>
Sun, 05 Jan 2014 20:59:50 +1100
changeset 162173 362eeec1dc9604bb5cf0805e5af1d1daaa616fe6
parent 162172 96440758eb96ae5b10775b2a8b60d5e60b568163
child 162174 794680b9599d01635c6734a00192d9ca099f4793
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
bugs956513
milestone29.0a1
Bug 956513 - Have anchored chunk boundaries at both ends of a <textPath>.
layout/reftests/bugs/956513-1-ref.svg
layout/reftests/bugs/956513-1.svg
layout/reftests/bugs/reftest.list
layout/svg/SVGTextFrame.cpp
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/956513-1-ref.svg
@@ -0,0 +1,10 @@
+<!--
+     Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+  <path id="p" d="M0 100h400"/>
+  <path d="M0 102h400" stroke="blue" stroke-width="1px"/>
+  <circle cx="200" cy="102" r="3" fill="blue"/>
+  <text><textPath font-size="16px" text-anchor="middle" startOffset="50%" xlink:href="#p">Text should be centered on the line.</textPath></text>
+</svg>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/956513-1.svg
@@ -0,0 +1,10 @@
+<!--
+     Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+  <path id="p" d="M0 100h400"/>
+  <path d="M0 102h400" stroke="blue" stroke-width="1px"/>
+  <circle cx="200" cy="102" r="3" fill="blue"/>
+  <text xml:space="preserve"> <textPath font-size="16px" text-anchor="middle" startOffset="50%" xlink:href="#p">Text should be centered on the line.</textPath> </text>
+</svg>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1786,9 +1786,10 @@ fuzzy-if(cocoaWidget,1,40) == 928607-1.h
 == 931464-1.html 931464-1-ref.html
 == 931853.html 931853-ref.html
 == 931853-quirks.html 931853-quirks-ref.html
 fuzzy-if(OSX==10.6,2,30) == 933264-1.html 933264-1-ref.html
 == 936670-1.svg 936670-1-ref.svg
 == 941940-1.html 941940-1-ref.html
 == 942017.html 942017-ref.html
 == 942672-1.html 942672-1-ref.html
+== 956513-1.svg 956513-1-ref.svg
 == 944291-1.html 944291-1-ref.html
--- a/layout/svg/SVGTextFrame.cpp
+++ b/layout/svg/SVGTextFrame.cpp
@@ -4321,16 +4321,17 @@ SVGTextFrame::ResolvePositions(nsIConten
     return aIndex;
   }
 
   if (aContent->Tag() == nsGkAtoms::textPath) {
     // <textPath> elements are as if they are specified with x="0" y="0", but
     // only if they actually have some text content.
     if (HasTextContent(aContent)) {
       mPositions[aIndex].mPosition = gfxPoint();
+      mPositions[aIndex].mStartOfChunk = true;
     }
   } else if (aContent->Tag() != nsGkAtoms::a) {
     // We have a text content element that can have x/y/dx/dy/rotate attributes.
     nsSVGElement* element = static_cast<nsSVGElement*>(aContent);
 
     // Get x, y, dx, dy.
     SVGUserUnitList x, y, dx, dy;
     element->GetAnimatedLengthListValues(&x, &y, &dx, &dy);