Closed Bug 1437389 Opened 7 years ago Closed 7 years ago

SVG clip-path on root svg element behaves inconsistently

Categories

(Firefox :: Untriaged, defect)

58 Branch
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: persona, Unassigned)

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0 Build ID: 20180209193630 Steps to reproduce: I tried to view an SVG element (standalone or embedded in HTML) with a clip-path="url(#...)". Depending on its content the effective clipping varied. Only some content are causing the clip problem (e.g., adding a rectangle in the document fixes the clip). The problem observed on all tested configurations (Linux 58.0.2 64bits, and 59.0b8 (64-bit)). I'am attaching minimal simplified examples. - firefox-svgcliproot.svg: problematic file, showing a clipped arc instead of the full one (as the clip-path should cover the all viewBox in this example) - firefox-svgcliproot-notroot.svg: working, same file but with the clip-path set on an element inside the svg element (and not directly on the root) - firefox-svgcliproot-withrect.svg: working, same as the first file, but adding a rectangle that covers most of the image, - firefox-svgcliproot-withtinyrect.svg: working, same as the first file, but adding a very small rectangle, - HTML files: to view all of these and/or to show that with <img> or direct embedding, the problem is still there. (related to this issue in our project https://github.com/swcarpentry/lesson-example/issues/171 originally with an SVG exported by open office) Actual results: The document seems to be wrongly clipped: first, it seemed to display nothing but further experiments showed that the clip region maybe have an offset. The behavior depends on the content of the document. Expected results: The clip should behave consistently, and should show the document (all other viewers and browser that were tested showed consistent results). firefox-svgcliproot-notroot.svg and firefox-svgcliproot.svg should probably be displayed in the same manner.
I assume you're setting a viewBox, that affects your children so the co-ordinate system of the root element is different from that of its children. You are assuming that they are the same.
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
To be fair, I don't know the exact expected behavior of the viewBox. (I was not thinking it impacts the coordinate system by itself, and this one has no offset (starts at 0,0)) Indeed, removing the viewBox gives consistent results. I'm attaching the example for the record. However, adding a <rect> in the document changes the behavior (how other elements are clipped) so there still seem to be an inconsistency in the rendering.
(In reply to Rémi E. from comment #2) > However, adding a <rect> in the document changes the behavior (how other > elements are clipped) so there still seem to be an inconsistency in the > rendering. I don't know what you mean with this. I suggest you raise another bug about just this point. Please don't attach zip files in future though, just attach the testcases separately as you did with your final example.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: