Changes in SvgSvgNode::getSvgStyleAttributes()

Regina Henschel rb.henschel at t-online.de
Mon Jul 14 15:12:05 PDT 2014


Hi Tomaž,

Tomaž Vajngerl schrieb:
> Hi,
>
> On Mon, Jul 14, 2014 at 8:15 PM, Regina Henschel
> <rb.henschel at t-online.de> wrote:
>> Hi all,
>>
>> I see some changes in fdo#78554 which I do not understand. In AOO the method
>> SvgSvgNode::getSvgStyleAttributes() is a simple getter for the member
>> maSvgStyleAttributes.
>>
>> First was a change in commit 1d89cd08ab3566375e30b17f1b17bc240ca907a4. But
>> the commit message does not mention, what problem this change solves. I see
>> no bug report and no test document.
>
> [1] is the test document - it doesn't work correctly in AOO 4.1
> I have "reverse engeneered" what fdo#78554 wants to fix and started
> writing a test, but it is not really finished yet.

Thanks for document. I can see the problem now. Indeed it does not show 
correct in AOO. I think, that the problem is not in SvgSvgNode, but the 
problem is, that the style inheritance is not resolved, when the style 
is defined by a style _element_.

Take this example from http://www.w3.org/TR/SVG/styling.html#StylingWithCSS

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
   "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
      width="10cm" height="5cm" viewBox="0 0 1000 500">
   <defs>
     <style type="text/css"><![CDATA[
       rect {
         fill: red;
         stroke: blue;
         stroke-width: 3
       }
     ]]></style>
   </defs>
   <rect x="200" y="100" width="600" height="300"/>
</svg>

It is shown correctly. The style definition selector fits to the 
element. Now put the rectangle into a group and define the style for the 
group.

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
   "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
      width="10cm" height="5cm" viewBox="0 0 1000 500">
   <defs>
     <style type="text/css"><![CDATA[
       g {
         fill: red;
         stroke: blue;
         stroke-width: 3
       }
     ]]></style>
   </defs>
<g>
   <rect x="200" y="100" width="600" height="300"/>
</g>
</svg>

This makes LO and AOO hang.

On the other hand, the same as style _attribute_ works in both cases.

<?xml version="1.0" encoding="UTF-8" ?>
<svg width="120" height="120" xmlns="http://www.w3.org/2000/svg" 
xmlns:xlink="http://www.w3.org/1999/xlink" 
style="stroke:#ff0000;fill:#00cc00">
    <rect x="10" y="10" width="100" height="100" rx="10" ry="10" 
style="stroke-width: 3;" />
</svg>

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
   "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
      width="10cm" height="5cm" viewBox="0 0 1000 500">
<g style="fill: red; stroke: blue; stroke-width: 3">
   <rect x="200" y="100" width="600" height="300"/>
</g>
</svg>

So it is not inheritance in general and not the fact, that the style is 
on the outer svg-element, but it the problem, that the parent's style 
information is in a style _element_. Therefore the fix should not be a 
change in the method SvgSvgNode::getSvgStyleAttributes().

Kind regards
Regina


>
>> The following changes try to solve a problem which seems to be introduced
>> with the above mentioned commit.
>>
>> I ask, because AOO has no problems with the file attached to fdo#78554. The
>> text is there when opening via File > Open and same when insert via Insert >
>> Picture.
>>
>> Kind regards
>> Regina
>
> [1] http://cgit.freedesktop.org/libreoffice/core/tree/svgio/qa/cppunit/data/RectWithParentStyles.svg
>



More information about the LibreOffice mailing list