Bug 160571

Summary: FILEOPEN: Cropped SVG in .docx file (from winword) is rendered uncropped in Writer
Product: LibreOffice Reporter: Fredrik Stock <fredrik>
Component: WriterAssignee: Not Assigned <libreoffice-bugs>
Status: NEW ---    
Severity: normal CC: buzea.bogdan, miguelangelrv
Priority: medium    
Version: 24.2.2.2 release   
Hardware: All   
OS: All   
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 103152    
Attachments: Sample document from WinWord
PDF export from Writer showing the problem
Screenshot of the document in WinWord

Description Fredrik Stock 2024-04-06 20:14:17 UTC
Description:
When a full-sized SVG image is cropped inside a word document, the original image remains in the docx zip and the cropping is done with <a:srcRect .../> in the document source.

Sometime after 7.6 (problem not present in that version) Writer ignores the cropping and renders the full SVG. The resizing persists, so the vector image is thus smooshed too.

Steps to Reproduce:
1. Winword: Insert an SVG image in a new doc
2. Winword: Crop the SVG, save the document
3. Writer: Open saved document

Actual Results:
The cropped SVG is rendered uncropped. Size transformations are still applied.

Expected Results:
Image should be rendered cropped.


Reproducible: Always


User Profile Reset: Yes

Additional Info:
This does not occur with SVG files added and cropped in Writer.

Diff between the relevant xml nodes of a file from Writer and a file from Winword:

diff --git "a/.\\graphic-winword.xml" "b/.\\graphic-writer.xml"
index 553310a..02081ca 100644
--- "a/.\\graphic-winword.xml"
+++ "b/.\\graphic-writer.xml"
@@ -2,36 +2,32 @@
   <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture">
     <pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture">
       <pic:nvPicPr>
-        <pic:cNvPr id="1554685201" name=""/>
-        <pic:cNvPicPr/>
+        <pic:cNvPr id="1" name="Image1" descr="" title=""></pic:cNvPr>
+        <pic:cNvPicPr>
+          <a:picLocks noChangeAspect="1" noChangeArrowheads="1"/>
+        </pic:cNvPicPr>
       </pic:nvPicPr>
-      <pic:blipFill rotWithShape="1">
+      <pic:blipFill>
         <a:blip r:embed="rId2">
           <a:extLst>
             <a:ext uri="{96DAC541-7B7A-43D3-8B79-37D633B846F1}">
               <asvg:svgBlip xmlns:asvg="http://schemas.microsoft.com/office/drawing/2016/SVG/main" r:embed="rId3"/>
             </a:ext>
           </a:extLst>
         </a:blip>
-        <a:srcRect l="58314"/>
-        <a:stretch/>
+        <a:srcRect l="49787" t="0" r="0" b="0"/>
+        <a:stretch>
+          <a:fillRect/>
+        </a:stretch>
       </pic:blipFill>
       <pic:spPr bwMode="auto">
         <a:xfrm>
           <a:off x="0" y="0"/>
-          <a:ext cx="2319220" cy="3262862"/>
+          <a:ext cx="2901315" cy="3387725"/>
         </a:xfrm>
         <a:prstGeom prst="rect">
           <a:avLst/>
         </a:prstGeom>
-        <a:ln>
-          <a:noFill/>
-        </a:ln>
-        <a:extLst>
-          <a:ext uri="{53640926-AAD7-44D8-BBD7-CCE9431645EC}">
-            <a14:shadowObscured xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main"/>
-          </a:ext>
-        </a:extLst>
       </pic:spPr>
     </pic:pic>
   </a:graphicData>
Comment 1 Fredrik Stock 2024-04-06 20:19:18 UTC
Created attachment 193551 [details]
Sample document from WinWord
Comment 2 Fredrik Stock 2024-04-06 20:21:05 UTC
Created attachment 193552 [details]
PDF export from Writer showing the problem
Comment 3 Fredrik Stock 2024-04-06 20:21:38 UTC
Created attachment 193553 [details]
Screenshot of the document in WinWord
Comment 4 m_a_riosv 2024-04-07 21:17:03 UTC
Reproducible
Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 5ebdcc60701ca5f2d267f92fa69ac06202309c52
CPU threads: 16; OS: Windows 10.0 Build 22631; UI render: Skia/Raster; VCL: win
Locale: es-ES (es_ES); UI: en-US
Calc: CL threaded