Issue 118784 - svg problems with viewport, viewBox and preserveAspectRatio
Summary: svg problems with viewport, viewBox and preserveAspectRatio
Status: CLOSED FIXED
Alias: None
Product: Draw
Classification: Application
Component: open-import (show other issues)
Version: recent-trunk
Hardware: PC Windows XP
: P5 (lowest) Normal (vote)
Target Milestone: ---
Assignee: Armin Le Grand
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-14 23:23 UTC by Regina Henschel
Modified: 2012-09-06 03:06 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Draw document with linked svg graphic (10.43 KB, application/x-compressed)
2012-01-14 23:23 UTC, Regina Henschel
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description Regina Henschel 2012-01-14 23:23:36 UTC
Created attachment 77133 [details]
Draw document with linked svg graphic

The attachment contains a svg graphic and a Draw document produced by LibreOffice 3.5, which links this graphic.
Open the Draw document with AOO. It stretches the graphic, but should not.

The Draw document defines a size of 'svg:width="15.006cm" svg:height="4.994cm"' on the draw:frame element which contains the link to the graphic. The svg-graphic itself defines 'width="150mm" height="50mm"'. So the initial viewport should be negotiated to rounded 'width=15cm height=5cm'.
Then the attributes 'viewBox="0 0 100 100" preserveAspectRatio="xMidYMid"' in the graphic should generate a transformation matrix with the same factor for x and y and should keep ratio of the child elements.
The red rectangle is defined with 'width="100" height="100"' and should be rendered as square.

Handling of coordinate systems is described in http://www.w3.org/TR/SVGTiny12/coords.html
Comment 1 Armin Le Grand 2012-01-16 15:21:10 UTC
ALG: Happens as described, taking over.
Comment 2 Armin Le Grand 2012-01-16 15:28:47 UTC
ALG. In principle all these mappings are in place already in SvgSvgNode::decomposeSvgNode when the SVg node is the outmost one. There already was adding a clip primitive when the content was bigger than the SVG initial coordinate system. The SdrObject (Graphic object) which will contain the SVg content creates a mapping to map the Svg content to it's own coodinate system (since the SDrObject is the defining object which also gets manipulated later). What was missing is to add extra geometry data to force the B2DRange of the Svg content to be exactly equal to the Svg initial coordinate system when all content is inside of it.

ALG Added this, looks as expected. Taking some more tests...
Comment 3 Armin Le Grand 2012-01-16 18:25:27 UTC
ALG: Okay, looks good. Adding. Comitted, done.
Comment 4 louqle 2012-09-06 03:06:19 UTC
expected behaivor, no change.