For now it's a simple file used to check the styling precedence
and overall correctness.
After the css stylling will be fully introduced a more complex file
can be used,
The css styling has to be applied as the first step of the node
updates. Whereas the updateStyle function should be called
as the last step, after all other node updates are made.
The CData block is read if it's inside the style tag.
In a case when the CData block was just after the style
block, the data was still read, although it shouldn't be.
Fixed.
Defs can be defined at the end of the file. In such a case each
node with a defined class attribute has to be marked and checked
at the final stage of processing - the proper style node has to be found
and its style has to be applied.
Css styling supports now targets defined only by tag or only by name
(tag.name was already supported before).
Also proper precedence of a styling is fixed - flags were not set.
The attribute values should be copied from a style node only if they
were set in the destination node using the attributes (in opocity to
a style attribute). A proper copyCssStyleAttr() function is introduced.
A function pointer added as an additional arg in order to make it
possible to use these functions to create a normal nodes and also
nodes defined inside a style tag. These two cases need to be parsed
using different functions: simpleXmlParseAttributes() and
simpleXmlParseW3CAttribute().
Function simpleXmlParseCSSAttribute() used to parse the data inside the style tag.
For now the supported formats are: tag {}, .name {}, tag.name{}
_svgLoaderParserXmlStyle() used to deal with the results of the above - to create
the proper nodes. Will work after create...Node() are changed.
Note:
The geometric attributes are not copied from the node defining the style
to the node using it. The SVG2 standard has to be checked to decide
whether it should be supported.
For now it is assumed that only one style element is defined
in an svg file, although it can be easily changed if needed.
The style node will be used to define the style applied to a node
of a given type or in a case when a class attrib was used.
It's the first step in introducing the css inline style sheets into tvg.
For now the class attribute is set only for SvgNodes (not for grads),
it's not used yet.
This would fail building with Visual Studio 2017, at least downstream in Godot
where we undefine old Windows compilers' non-standard `min`/`max` macros (see
`minmax.h`/`NOMINMAX`).
Change id() to identifier().
error log
```
../src/lib/gl_engine/tvgGlRenderer.cpp:333:19: error: ‘const class tvg::Fill’ has no member named ‘id’
333 | switch (fill->id()) {
```
The reference node doesn't have to be placed inside the defs block,
so when refering to it, it is necessary to search the entire node tree.
In case of invalid svg file this can lead to circular references.
Added prevention against such a sutuation.
Some gcc versions and configurations was giving an error:
error: "comparison of integer expressions of different signedness: 'const SwCoord'
{aka 'const long int'} and 'uint32_t' {aka 'unsigned int'} [-Werror=sign-compare]"
This patch should fix the error