[svg] Add light source classes and lighting-color pres attr

https://www.w3.org/TR/SVG11/filters.html#LightSourceDefinitions

The three classes represent light source elements that will eventually
be used for feSpecularLighting and feDiffuseLighting. Currently they are
unused.

Also added the (currently unused) lighting-color presentation attribute.

Bug: skia:10841
Change-Id: Ic7824671662b8cd88cf627affc54173d5e881b7d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359557
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
diff --git a/modules/svg/src/SkSVGAttribute.cpp b/modules/svg/src/SkSVGAttribute.cpp
index 098dc7b..f636adb 100644
--- a/modules/svg/src/SkSVGAttribute.cpp
+++ b/modules/svg/src/SkSVGAttribute.cpp
@@ -40,6 +40,7 @@
     result.fStopOpacity.set(SkSVGNumberType(1));
     result.fFloodColor.set(SkSVGColor(SK_ColorBLACK));
     result.fFloodOpacity.set(SkSVGNumberType(1));
+    result.fLightingColor.set(SkSVGColor(SK_ColorWHITE));
 
     return result;
 }
diff --git a/modules/svg/src/SkSVGDOM.cpp b/modules/svg/src/SkSVGDOM.cpp
index 08fea1f..b026e36 100644
--- a/modules/svg/src/SkSVGDOM.cpp
+++ b/modules/svg/src/SkSVGDOM.cpp
@@ -22,6 +22,7 @@
 #include "modules/svg/include/SkSVGFeDisplacementMap.h"
 #include "modules/svg/include/SkSVGFeFlood.h"
 #include "modules/svg/include/SkSVGFeGaussianBlur.h"
+#include "modules/svg/include/SkSVGFeLightSource.h"
 #include "modules/svg/include/SkSVGFeMorphology.h"
 #include "modules/svg/include/SkSVGFeOffset.h"
 #include "modules/svg/include/SkSVGFeTurbulence.h"
@@ -266,11 +267,14 @@
     { "feBlend"          , []() -> sk_sp<SkSVGNode> { return SkSVGFeBlend::Make();           }},
     { "feColorMatrix"    , []() -> sk_sp<SkSVGNode> { return SkSVGFeColorMatrix::Make();     }},
     { "feComposite"      , []() -> sk_sp<SkSVGNode> { return SkSVGFeComposite::Make();       }},
+    { "feDistantLight"   , []() -> sk_sp<SkSVGNode> { return SkSVGFeDistantLight::Make();    }},
     { "feDisplacementMap", []() -> sk_sp<SkSVGNode> { return SkSVGFeDisplacementMap::Make(); }},
     { "feFlood"          , []() -> sk_sp<SkSVGNode> { return SkSVGFeFlood::Make();           }},
     { "feGaussianBlur"   , []() -> sk_sp<SkSVGNode> { return SkSVGFeGaussianBlur::Make();    }},
     { "feMorphology"     , []() -> sk_sp<SkSVGNode> { return SkSVGFeMorphology::Make();      }},
     { "feOffset"         , []() -> sk_sp<SkSVGNode> { return SkSVGFeOffset::Make();          }},
+    { "fePointLight"     , []() -> sk_sp<SkSVGNode> { return SkSVGFePointLight::Make();      }},
+    { "feSpotLight"      , []() -> sk_sp<SkSVGNode> { return SkSVGFeSpotLight::Make();       }},
     { "feTurbulence"     , []() -> sk_sp<SkSVGNode> { return SkSVGFeTurbulence::Make();      }},
     { "filter"           , []() -> sk_sp<SkSVGNode> { return SkSVGFilter::Make();            }},
     { "g"                , []() -> sk_sp<SkSVGNode> { return SkSVGG::Make();                 }},
diff --git a/modules/svg/src/SkSVGFeLightSource.cpp b/modules/svg/src/SkSVGFeLightSource.cpp
new file mode 100644
index 0000000..f1f74af
--- /dev/null
+++ b/modules/svg/src/SkSVGFeLightSource.cpp
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2021 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "modules/svg/include/SkSVGAttributeParser.h"
+#include "modules/svg/include/SkSVGFeLightSource.h"
+#include "modules/svg/include/SkSVGValue.h"
+
+bool SkSVGFeDistantLight::parseAndSetAttribute(const char* n, const char* v) {
+    return INHERITED::parseAndSetAttribute(n, v) ||
+           this->setAzimuth(SkSVGAttributeParser::parse<SkSVGNumberType>("azimuth", n, v)) ||
+           this->setElevation(SkSVGAttributeParser::parse<SkSVGNumberType>("elevation", n, v));
+}
+
+bool SkSVGFePointLight::parseAndSetAttribute(const char* n, const char* v) {
+    return INHERITED::parseAndSetAttribute(n, v) ||
+           this->setX(SkSVGAttributeParser::parse<SkSVGNumberType>("x", n, v)) ||
+           this->setY(SkSVGAttributeParser::parse<SkSVGNumberType>("y", n, v)) ||
+           this->setZ(SkSVGAttributeParser::parse<SkSVGNumberType>("z", n, v));
+}
+
+bool SkSVGFeSpotLight::parseAndSetAttribute(const char* n, const char* v) {
+    return INHERITED::parseAndSetAttribute(n, v) ||
+           this->setX(SkSVGAttributeParser::parse<SkSVGNumberType>("x", n, v)) ||
+           this->setY(SkSVGAttributeParser::parse<SkSVGNumberType>("y", n, v)) ||
+           this->setZ(SkSVGAttributeParser::parse<SkSVGNumberType>("z", n, v)) ||
+           this->setPointsAtX(SkSVGAttributeParser::parse<SkSVGNumberType>("pointsAtX", n, v)) ||
+           this->setPointsAtY(SkSVGAttributeParser::parse<SkSVGNumberType>("pointsAtY", n, v)) ||
+           this->setPointsAtZ(SkSVGAttributeParser::parse<SkSVGNumberType>("pointsAtZ", n, v)) ||
+           this->setSpecularExponent(
+                   SkSVGAttributeParser::parse<SkSVGNumberType>("specularExponent", n, v)) ||
+           this->setLimitingConeAngle(
+                   SkSVGAttributeParser::parse<SkSVGNumberType>("limitingConeAngle", n, v));
+}
diff --git a/modules/svg/src/SkSVGNode.cpp b/modules/svg/src/SkSVGNode.cpp
index fd2a4e3..ae3aef2 100644
--- a/modules/svg/src/SkSVGNode.cpp
+++ b/modules/svg/src/SkSVGNode.cpp
@@ -20,6 +20,7 @@
     fPresentationAttributes.fStopOpacity.set(SkSVGNumberType(1.0f));
     fPresentationAttributes.fFloodColor.set(SkSVGColor(SK_ColorBLACK));
     fPresentationAttributes.fFloodOpacity.set(SkSVGNumberType(1.0f));
+    fPresentationAttributes.fLightingColor.set(SkSVGColor(SK_ColorWHITE));
 }
 
 SkSVGNode::~SkSVGNode() { }
@@ -103,6 +104,7 @@
            || PARSE_AND_SET("font-size"                  , FontSize)
            || PARSE_AND_SET("font-style"                 , FontStyle)
            || PARSE_AND_SET("font-weight"                , FontWeight)
+           || PARSE_AND_SET("lighting-color"             , LightingColor)
            || PARSE_AND_SET("mask"                       , Mask)
            || PARSE_AND_SET("opacity"                    , Opacity)
            || PARSE_AND_SET("stop-color"                 , StopColor)
diff --git a/modules/svg/src/SkSVGRenderContext.cpp b/modules/svg/src/SkSVGRenderContext.cpp
index 431296e..563f8db 100644
--- a/modules/svg/src/SkSVGRenderContext.cpp
+++ b/modules/svg/src/SkSVGRenderContext.cpp
@@ -254,6 +254,7 @@
     // - stop-opacity
     // - flood-color
     // - flood-opacity
+    // - lighting-color
 }
 
 void SkSVGRenderContext::applyOpacity(SkScalar opacity, uint32_t flags, bool hasFilter) {