[svg] Add current node to render context

A couple of render-time decisions require knowledge of object bounding
boxes, such as gradients (whose default coordinate space is
"objectBoundingBox". This CL adds the current node being rendered to the
render context so that it can be accessed down-stack (for example, when
gradients are being resolved and added to the paint as Skia shaders).

Each node will overload the bounds computation, for now it just returns
empty bounds for all nodes. TBD if we want to cache bounds somewhere,
either inside the node object or in a separate cache.

Bug: skia:10842
Change-Id: I40061ffedcb840e4dd28dba6351421f5b4fc904b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329221
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
diff --git a/modules/svg/include/SkSVGNode.h b/modules/svg/include/SkSVGNode.h
index a2991f1..001b5ca 100644
--- a/modules/svg/include/SkSVGNode.h
+++ b/modules/svg/include/SkSVGNode.h
@@ -15,6 +15,7 @@
 class SkMatrix;
 class SkPaint;
 class SkPath;
+class SkSVGLengthContext;
 class SkSVGRenderContext;
 class SkSVGValue;
 
@@ -72,6 +73,7 @@
     void render(const SkSVGRenderContext&) const;
     bool asPaint(const SkSVGRenderContext&, SkPaint*) const;
     SkPath asPath(const SkSVGRenderContext&) const;
+    SkRect objectBoundingBox(const SkSVGLengthContext&) const;
 
     void setAttribute(SkSVGAttribute, const SkSVGValue&);
     bool setAttribute(const char* attributeName, const char* attributeValue);
@@ -119,6 +121,10 @@
 
     virtual bool hasChildren() const { return false; }
 
+    virtual SkRect onObjectBoundingBox(const SkSVGLengthContext&) const {
+        return SkRect::MakeEmpty();
+    }
+
 private:
     SkSVGTag                    fTag;