Options to modify the parsing behavior. More...
#include "donner/svg/parser/SVGParser.h"
Public Member Functions | |
| constexpr | Options () |
| Default options. | |
Public Attributes | |
| bool | disableUserAttributes = false |
| By default, the parser retains user-defined attributes on the parsed tree so the tree stays complete for whole-tree consumers (attribute selectors, export checks) and CSS matchers that key off custom attributes keep working. | |
| bool | enableExperimental = false |
| Enable experimental or incomplete features. | |
| bool | parseAsInlineSVG = false |
| Parse as inlined SVG content. | |
| size_t | maximumInputSize = kDefaultMaximumInputSize |
| Maximum source size accepted by ParseSVG. | |
| size_t | maximumParsedPayloadSize = kDefaultMaximumParsedPayloadSize |
| Maximum estimated bytes retained by parsed lists, stylesheets, and deferred geometry. | |
| size_t | maximumContentProjectionChunks = kDefaultMaximumContentProjectionChunks |
| Maximum direct text/CDATA chunks joined into one text, style, or descriptive element. | |
| size_t | maximumTreeNodes = kDefaultMaximumTreeNodes |
| Maximum XML tree nodes visited while converting either parser entry point. | |
| size_t | maximumTreeDepth = kDefaultMaximumTreeDepth |
| Maximum nested SVG element depth converted from an XML document. | |
Options to modify the parsing behavior.
| bool donner::svg::parser::SVGParser::Options::disableUserAttributes = false |
By default, the parser retains user-defined attributes on the parsed tree so the tree stays complete for whole-tree consumers (attribute selectors, export checks) and CSS matchers that key off custom attributes keep working.
For example:
Both rules match by default. If user attributes are disabled (disableUserAttributes is true), only the first rule matches, because my-custom-attribute is omitted during parsing.
Set this to true only to optimize for performance when custom attributes are known to be irrelevant; whole-tree attribute checks then cannot see them.
| bool donner::svg::parser::SVGParser::Options::enableExperimental = false |
Enable experimental or incomplete features.
When true, element types that declare static constexpr bool IsExperimental = true are parsed as their concrete type; when false, they are treated as unknown elements.
No element type is currently experimental; the SVG animation elements are parsed by default. Text and filters are enabled independently.
| size_t donner::svg::parser::SVGParser::Options::maximumInputSize = kDefaultMaximumInputSize |
Maximum source size accepted by ParseSVG.
For SVGZ input the same limit applies to both the compressed and expanded forms, preventing decompression bombs.
| size_t donner::svg::parser::SVGParser::Options::maximumParsedPayloadSize = kDefaultMaximumParsedPayloadSize |
Maximum estimated bytes retained by parsed lists, stylesheets, and deferred geometry.
This is aggregate across the document, rather than a per-attribute limit.
| bool donner::svg::parser::SVGParser::Options::parseAsInlineSVG = false |
Parse as inlined SVG content.
This will treat the input as a fragment of SVG content, rather than a full SVG document. This is useful for parsing SVG content embedded in HTML or other XML documents.
This enables the following shorthand without the xmlns attribute:
Instead of the full document: