Closed Bug 367204 Opened 13 years ago Closed 12 years ago

Embedded SVG clips based on viewport size


(Core :: SVG, defect)

Windows XP
Not set





(Reporter: martin.thomson, Unassigned)




(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20061204 Firefox/
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20061204 Firefox/

When embedding SVG images in a page, the resulting image clips strangely.  The SVG image clips to a rectangle of the same size as a viewport.  This starts from the 0,0 coordinates that the SVG element inherits from its positioning on the page.

Changing the size of the viewport also changes the size of the SVG image, which makes things worse.

Reproducible: Always

Steps to Reproduce:
1.Create a page containing embedded SVG graphics.
2.Resize the browser window until the viewport is smaller than the SVG graphic.

Actual Results:  
The SVG graphic is clipped to the viewport size, irrespective of any page context.

Expected Results:  
The SVG graphic should be clipped to the size of its containing block, not the viewport size, which is irrelevant for embedded graphics.  If the <svg> element is given a size (either through width/height attributes, CSS or the enclosing block size), that should be the size that the image is constrained to.

I discovered this when drawing SVG overlays on Google Maps.  Google Maps often uses negative coordinates for images as it scrolls around, however, overlaid SVG images do not draw in negative coordinates.  The positive coordinates that they draw to are limited by the size of the viewport.
Shrink the window to demonstrate the bug.
Attachment created.  Observe the difference between Firefox and Opera in rendering this page.

I just found Bug 288276, the solution to which might address this problem.
Assignee: nobody → general
Component: General → SVG
Product: Firefox → Core
QA Contact: general → ian
Version: unspecified → Trunk
Fixed by the fix for bug 294086.
Closed: 12 years ago
Depends on: 294086
Resolution: --- → FIXED
Flags: in-testsuite?
You need to log in before you can comment on or make changes to this bug.