Strange Behaviour after importing SVG

Bug #1236074 reported by Laura Dietz
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
New
Undecided
Unassigned

Bug Description

Inkscape version: 0.48.4

Steps to reproduce:

1. create a new Inkscape file
2. add a rectangle, set stroke and width
3. File -> Import, select attached svg
4. resize rectangle

Expected behavior:
- rectangle is resized without further changes to style

Observed behavior:
- rectangle disappears, because opacity is set to 0.

Even after deleting the imported SVG, the rectangle is still invisible. It seems that saving and reloading (with File -> Revert) the svg will make the rectangle visible again and resizing works fine.

Tags: css
Revision history for this message
Laura Dietz (dietz) wrote :
Revision history for this message
su_v (suv-lp) wrote :

The SVG file you are importing contains a stylesheet which defines the opacity for all rects as '0'. When you scale the rectangle with the select tool, it is updated (position, dimension, stroke width), and just imported new global style directive is taken into account (the opacity value of the rect's 'style' attribute stores that value persistently - copied from the stylesheet):

  <…>
  <style
     type="text/css"
     id="style4">svg { background-color: #881C1C; } rect { opacity: 0; }</style>
  <…>

Just curious: what is the origin of that SVG file? Inkscape does not write such internal stylesheets itself, but does apply them when encountered in SVG files (limited CSS support).

Possible bugs encountered with importing such a file might be
1) a perceived inconsistency that only the 'scaling' the selection with the select tool triggers a recalculation of the style information (AFAIU because scaling may require a recalculation of the stroke width) - moving or rotating the existing rectangle does not have the same effect, nor does editing the geometry of the rectangle with the rect tool.
2) the style change based on the imported stylesheet is not recorded in the undo history (undoing the scaling does not revert the style change)
3) no visible information / message for the user which (optionally) warns about possibly unintended style changes based on the stylesheet of the imported file

tags: added: css
Revision history for this message
Laura Dietz (dietz) wrote :

I did not expect that styles embedded in an imported SVG will have effects on other elements of a pre-existing drawing. But your explanation makes sense. CSS is a global set of definitions.

Since Inkscape does not support editing/generation of CSS stylesheets, my preferred behavior would be to apply all CSS styles to the imported node during import, and then dropping the style-sheet completely.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.