Apache OpenOffice (AOO) Bugzilla – Issue 120334
svg: fill color is rendered wrongly
Last modified: 2017-05-20 11:42:12 UTC
Created attachment 78696 [details] picture with node The attached object "8050 manually reduced.svg" has as first element a path, which should have a white filling, but it is not white in AOO. The attached object "8050 manually reduced without background.svg" is nearly the same, only the first node in the group is removed. Open the files in a browser to see, how they should look. Then insert the pictures into a Draw document. The wrong color is obvious. Both files are valid in W3C validator.
Created attachment 78697 [details] picture without node
Created attachment 78699 [details] File that contains only the failing part The reason is, that the class attribute does not contain a single class, but a list. This is allowed, see http://www.w3.org/TR/SVG10/styling.html#ClassAttribute
ALG: Taking hownership
ALG: Regina, many thanks for finding this, I'll have a look.
ALG: Adapted CssStyle for SvgStyleAttributes to be a vector, not only a single entry. Adapted parser to set more than one entry. Moved some bools out of the way as preparation for changing getParentStyle() to a pair of getParentStyleCount()/getParentStyle(sal_uInt32 nIndex), need to determine closely for each attribute if it is set in this style or not.
ALG: Moved checkForCssStyle from SvgStyleAttributes to SvgNode, list of CSS styles is processed there. Modified to directly return a main StyleSheet, so when CSS are used it will create a modified temporary list used to create the primitives. Added a new proxy mechanuism to SvgStyleAttributes to support a temporary tree structure and use it. Works as expected, testing my set of SVG test files to see if nothing is broken...
"alg" committed SVN revision 1365501 into trunk: #120334# Added support for multiple CSS styles per graphic primitive in SVG
ALG: One more problem with fill rule corrected, looks good. Adding to trunk as revision 1365501. @Regina: Please check this and do some tests (as soon as versions are available from the buildbots or build a current one). Thanks again for finding this.
Created attachment 78723 [details] tab and carriage return delimiter Hi Armin, I'm not sure about the use of skip_char with character ' '. The list is white-space separated. It seems white space contains at least "space" (U+0020), "tab" (U+0009), "line feed" (U+000A) and "carriage return" (U+000D). I'm not sure about page break. See http://www.w3.org/TR/SVG/types.html section <list-of-strings>. I have tried to find a formal definition of the attribute 'class', but have not found it. I have attached a file with tab and CR delimiter instead of blank. The file is valid and shows fine in my Seamonkey. BTW: Such files with multiple classes are generated by Corel Draw 12.
ALG @Regina: Not sure what you mean here. Just tried the new attachment with Firefox and my AOO with the made fix, both show the same. Both show a green rectangle with red border. Please add more info when you think something is going wrong. Thanks!
@Armin: If it is OK with the patch, then it is fine. I have currently no build to test it and therefore thought it might be useful to attach such a file. My question was, whether you have considered other kind of "white-space" than blanks. And obviously you have :) Do you handle tabs, for example, somewhere earlier in the import?
ALG @Regina: If you talk about whitespace in the SVG itself, I do not handle it myself, but implemented a com::sun::star::xml::sax::XDocumentHandler which has a ignorableWhitespace(..) call (see svgdocumenthandler.cxx|hxx in svgio module). The OO's XML import tools do the parsing and call the methods at XDocumentHandler. If you talk about whitespace inside strings, whiteSpaceHandlingDefault/whiteSpaceHandlingPreserve is used (both in svgio module) which handle newline, tab and space as whitespace. They much SVG whitespaces as defined in SVG1.2 somewhere (see http://www.w3.org/TR/SVG/text.html, there 'Xml character data in the instruction, leading to http://www.w3.org/TR/2008/REC-xml-20081126/#syntax, see 2.10). Whitespace can be preserved or not (hence my two methods above and their names) and I do that as defined. HTH!
ALG: @Regina: Here is the recipie used, derived from the definition: https://developer.mozilla.org/en/SVG/Attribute/xml%3Aspace. This was tricky, but needed for exactly supporting the SVG text examples (see all examples in http://www.w3.org/TR/SVG/text.html). Esp tspan with multiple X-Values and text on curve are hard, but all done :-)
Hi Armin, thanks for your explanation. It is much clearer now for me.
Verified in debug build of r1367616. The original file, which I got from Corel Draw 12 is correctly rendered now. But that file gives an error message. Because the reduced files, which are attached to this issue give no errors, I consider this a different bug and open a new issue for it.