New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 395838 link

Starred by 4 users

Issue metadata

Status: Fixed
Last visit > 30 days ago
Closed: Sep 2016
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Compat

Sign in to add a comment

SVGSVGElement.viewport always returns [0,0,0,0]

Reported by, Jul 21 2014

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36

Example URL:

Steps to reproduce the problem:

What is the expected behavior?
Mountains should appear below the balloon. They do in Firefox. There should also be a radial gradient.

What went wrong?
Mountains and radial gradient do not appear

Does it occur on multiple sites: N/A

Is it a problem with a plugin? No 

Did this work before? Yes From 2004 onward in most browsers that rendered SVG: ASV, Opera, FF, IE9, etc.

Does this work in other browsers? No IE 11 does IE 9 doesn't. Firefox doesn't. Chrome used to display properly.

Chrome version: 36.0.1985.125  Channel: stable
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version: Shockwave Flash 14.0 r0

The example has been used in lots of demos and published books!
Labels: Cr-Blink-SVG

Comment 2 by, Jul 22 2014

Labels: -OS-Windows OS-All
Looks like this has been broken in WebKit/Blink since 2012-01-20 (commit 8f9d4244912f43bb2103b61700cdf4f42c8dd146), when SVGSVGElement.viewport was changed to return an empty rectangle.
Using innerWidth/innerHeight instead (the catch(...)-branch in getDisplaySize) makes the mountains and gradient appear again (and is probably more interoperable - across browser implementations at least.)
Status: Untriaged
I see similar behavior on previous stable channel i.e., 35.0.1916.153 and 34.0.1847.137.

Status: Assigned
@fs/pdr, can you ptal?

Comment 5 by, Jul 23 2014

It'd seem that just removing the property would be the easiest "fix". Gecko for instance does not implement it at all (which I means the innerWidth/Height code-path will be taken in the TC - my FF-nightly seems to render ok.) Don't have IE close by, so can't test what it does (if it exposes the property or not.)

Comment 6 by, Aug 7 2014

Summary: SVGSVGElement.viewport always returns [0,0,0,0] (was: SVG doc that used to work in Chrome no longer does)
I tried (without success) commenting out all but the catch segment of the code but still no success in Chrome. Still works in IE, old Opera, and Firefox just fine. Not sure what the above comment was actually recommending.

var extents = null;
   // try{
   //     var view = document.documentElement.viewport;
   //     extents = {width: view.width,height: view.height};
  //  }
  //  catch(e){
        extents = {width: window.innerWidth, height: window.innerHeight};
 //   }
    return extents;

Both of these pages have now been updated:
with the simplified code. ed at opera showed me that the second one had another bug in the code which stopped it from working. Given that SVGSVGElement.viewport always returns [0,0,0,0]  (was: SVG doc that used to work in Chrome no longer does)  , the user/reporter (in this case, me) now considers this issue closed. 

Comment 9 by, Aug 12 2014

I think we should remove the 'viewport' property from SVGSVGElement until it's implemented correctly. Mozilla argues that SVGSVGElement.viewport isn't speced in enough detail, see

IE11 supports it, seemingly returning whatever the x,y,width,height attributes on the svg root says as long as the values are simple absolute values, but it's buggy on nested <svg> and it doesn't resolve percentages at all (width=100% => viewport.width==0).

Comment 10 by, Feb 6 2015

Attaching a TC that I constructed while trying to figure this out. Maybe it's of use to someone at some point (the behavior is pretty undefined though AFAIK...)
1.7 KB View Download
Project Member

Comment 11 by, Dec 16 2015

The following revision refers to this bug:

commit 9791cf9d8b005fc7cb8b589b099fcc33ba02ce2b
Author: davve <>
Date: Wed Dec 16 11:19:55 2015

Measure SVGSVGElement.viewport

The implementation is trivial but entirely useless and has been since
2012. The attribute is not present at all in Gecko.

It has been removed from the spec:

BUG= 395838 , 415074

Review URL:

Cr-Commit-Position: refs/heads/master@{#365515}


Project Member

Comment 12 by, Jul 8 2016

Labels: Hotlist-OpenBugWithCL
A change has landed for this issue, but it's been open for over 6 months. Please review and close it if applicable. If this issue should remain open, remove the "Hotlist-OpenBugWithCL" label. If no action is taken, it will be archived in 30 days.

For more details visit - Your friendly Sheriffbot

Comment 13 by, Jul 8 2016

Labels: -Hotlist-OpenBugWithCL

Comment 14 by, Jul 8 2016

Owner: ----
Status: Available (was: Assigned)
It is already removed from spec.
And blink always return empty rect. 
Time to deprecate this? 
Status: Assigned (was: Available)
Let me know if I need to do anything differently. I gather not, since the spec has changed?
SVGSVGElement.viewport removed from the spec.

Comment 22 by, Aug 3 2016

@dphilipdailey: It looks like you've fixed up your example already, so you should be fine (at least in that particular example. Extracting the "right" dimensions in a different context may need additional tweaking of course.)
Project Member

Comment 24 by, Sep 12 2016

The following revision refers to this bug:

commit f742a3c284c19b78dbc337b641042a861e66d6b0
Author: shanmuga.m <>
Date: Mon Sep 12 10:26:24 2016

Remove SVGSVGElement.viewport attribute

SVGSVGElement.viewport removed from the spec.

Intent to Remove:!topic/blink-dev/bFqDvZK2LVY

BUG= 395838 

Cr-Commit-Position: refs/heads/master@{#417910}


Status: Fixed (was: Assigned)

Sign in to add a comment