[svg] TextPath support

  - introduce SkSVGTextPath and update the text render logic to
    instantiate new SkSVGTextContexts in onRenderText() overrides
    instead of renderText() root -- this is to observe spec semantics
    [1] requiring <text> and <textPath> to always start a new chunk,
    regardless of their relative nesting.
  - expand SkSVGTextContext to also store PathData when used in the
    scope of a textPath
  - PathData caches SkContourMeasures, for path position lookup
  - update flushChunk() to apply path glyph adjustments [2]:

    * the horizontal glyph position (including relative offset dx),
      adjusted for the glyph center yields a path offset
    * if the offset is outside the path range, the glyph is skipped
    * otherwise the position is determined based on the path matrix
      at the computed offset

   - to support the logic above, the chunk starting position is no
     longer used as a global blob offset but instead is folded into
     individual glyph RSXforms (and the blob always draws at {0,0})

[1] https://www.w3.org/TR/SVG11/text.html#TextLayout
[2] https://www.w3.org/TR/SVG11/text.html#TextpathLayoutRules

Bug: skia:10840
Change-Id: I462eada7c086646afdc1bc84f08ec2368613f1c0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/349397
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
diff --git a/modules/svg/tests/Text.cpp b/modules/svg/tests/Text.cpp
index fc09649..83feda4 100644
--- a/modules/svg/tests/Text.cpp
+++ b/modules/svg/tests/Text.cpp
@@ -7,6 +7,7 @@
 
 #include <vector>
 
+#include "include/utils/SkNoDrawCanvas.h"
 #include "modules/svg/src/SkSVGTextPriv.h"
 #include "tests/Test.h"
 
@@ -153,8 +154,14 @@
         b->setX(tst.xb);
         b->setY(tst.yb);
 
-        SkSVGTextContext tctx(SkSVGPresentationContext(), nullptr);
-        SkSVGLengthContext lctx({0,0});
+        const SkSVGIDMapper mapper;
+        const SkSVGLengthContext lctx({0,0});
+        const SkSVGPresentationContext pctx;
+        SkNoDrawCanvas canvas(0, 0);
+        sk_sp<SkFontMgr> fmgr;
+        const SkSVGRenderContext ctx(&canvas, fmgr, mapper, lctx, pctx, nullptr);
+
+        SkSVGTextContext tctx(ctx);
         SkSVGTextContext::ScopedPosResolver pa(*a, lctx, &tctx, tst.offseta);
         SkSVGTextContext::ScopedPosResolver pb(*b, lctx, &tctx, tst.offsetb);