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

Issue 604093 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug-Regression



Sign in to add a comment

Embedded SVGs are not rendering without specified width/height set on the root SVG element

Reported by jimmyam...@gmail.com, Apr 16 2016

Issue description

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

Example URL:
http://www.moproseries-k.com/

Steps to reproduce the problem:
1. Embed SVG directly into HTML
2. Set height/width to inner SVG elements (path, circle, etc)
3. Remove any height/width from root SVG element

What is the expected behavior?
The root SVG element should inherit the height/width of its inner elements (path, circle, etc), as it does in Chrome 49 and other browsers.

What went wrong?
SVG height/width values are set to 0x0 even when inner elements (path, circle, etc) have width/height values that are set.

Does it occur on multiple sites: Yes

Is it a problem with a plugin? No 

Did this work before? N/A 

Does this work in other browsers? Yes 

Chrome version: 50.0.2661.75  Channel: stable
OS Version: 10.0
Flash Version: Shockwave Flash 21.0 r0
 
We are facing same issue from yesterday. SVGs without height and width do not render.
Components: -Blink Blink>SVG

Comment 3 by f...@opera.com, Apr 18 2016

Labels: -OS-Windows OS-All
Owner: davve@opera.com
Status: Assigned (was: Unconfirmed)
You are probably looking for a change made after 374908 (known good), but no later than 374911 (first known bad).
CHANGELOG URL:
  https://chromium.googlesource.com/chromium/src/+log/af3389f58656798babbd93f458b5d2ca356e72a8..cf9216ca4e606990b24cd829e6284c8c4cb64d67

Suspecting a0ec285a1629a9d7a3c62517d4c62106a02fbf70.

Comment 4 by davve@opera.com, Apr 18 2016

Status: Started (was: Assigned)

Comment 5 by davve@opera.com, Apr 18 2016

Labels: -Type-Bug Type-Bug-Regression
From what I gather, the problem is related to state invalidation of the width/height attributes when attributes are removed or set to invalid values.

In the patch that causes this issue <crrev.com/374909> the value zero, previously ignored and treated as no width/height, are now respected as zero. In combination with the pre-existing state invalidation bug, if a page sets a value to zero and then removes the attribute, the zero value is left around and causes the image to shrink to 0x0.

The workaround in this case is to either use some other mechanism to hide the SVG than to set width/height attributes to zero (or invalid values), or to explicitly set the width/height attributes to 100% after/instead of removing them.

fs tells me that  crbug.com/474523  might be the underlying issue that was unfortunately uncovered.

inline-svg-remove-height.html
758 bytes View Download
Project Member

Comment 6 by bugdroid1@chromium.org, Apr 19 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/6cd726f3f3ed5d5fecfe725bb3c85dc2cac39e85

commit 6cd726f3f3ed5d5fecfe725bb3c85dc2cac39e85
Author: fs <fs@opera.com>
Date: Tue Apr 19 18:23:18 2016

Improve default value handling for SVGSVGElement.width/height

When a length attribute is either removed or set to an invalid value,
it would get set to '0'. It should however be set to the initial value
specified for the attribute (possibly presentation attribute) in
question.

The test svg/custom/disallow-non-lengths-in-attrs.html is tweaked to
accommodate for this.

BUG= 604093 

Review URL: https://codereview.chromium.org/1901673003

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

[add] https://crrev.com/6cd726f3f3ed5d5fecfe725bb3c85dc2cac39e85/third_party/WebKit/LayoutTests/svg/custom/attribute-default-value-after-removal-expected.html
[add] https://crrev.com/6cd726f3f3ed5d5fecfe725bb3c85dc2cac39e85/third_party/WebKit/LayoutTests/svg/custom/attribute-default-value-after-removal.html
[modify] https://crrev.com/6cd726f3f3ed5d5fecfe725bb3c85dc2cac39e85/third_party/WebKit/LayoutTests/svg/custom/disallow-non-lengths-in-attrs-expected.txt
[modify] https://crrev.com/6cd726f3f3ed5d5fecfe725bb3c85dc2cac39e85/third_party/WebKit/LayoutTests/svg/custom/disallow-non-lengths-in-attrs.html
[modify] https://crrev.com/6cd726f3f3ed5d5fecfe725bb3c85dc2cac39e85/third_party/WebKit/Source/core/svg/SVGSVGElement.cpp

Comment 7 by f...@opera.com, Apr 20 2016

Cc: davve@opera.com
Owner: f...@opera.com

Comment 8 by f...@opera.com, Apr 25 2016

Labels: Merge-Request-51

Comment 9 by tin...@google.com, Apr 25 2016

Labels: -Merge-Request-51 Merge-Approved-51 Hotlist-Merge-Approved
Your change meets the bar and is auto-approved for M51 (branch: 2704)
Project Member

Comment 10 by bugdroid1@chromium.org, Apr 25 2016

Labels: -merge-approved-51 merge-merged-2704
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/20a1e339aeac762f323b93575c6cbad86f88cfbb

commit 20a1e339aeac762f323b93575c6cbad86f88cfbb
Author: Fredrik Söderquist <fs@opera.com>
Date: Mon Apr 25 08:27:38 2016

Improve default value handling for SVGSVGElement.width/height

When a length attribute is either removed or set to an invalid value,
it would get set to '0'. It should however be set to the initial value
specified for the attribute (possibly presentation attribute) in
question.

The test svg/custom/disallow-non-lengths-in-attrs.html is tweaked to
accommodate for this.

BUG= 604093 

Review URL: https://codereview.chromium.org/1901673003

Cr-Commit-Position: refs/heads/master@{#388250}
(cherry picked from commit 6cd726f3f3ed5d5fecfe725bb3c85dc2cac39e85)

Review URL: https://codereview.chromium.org/1918753002 .

Cr-Commit-Position: refs/branch-heads/2704@{#210}
Cr-Branched-From: 6e53600def8f60d8c632fadc70d7c1939ccea347-refs/heads/master@{#386251}

[add] https://crrev.com/20a1e339aeac762f323b93575c6cbad86f88cfbb/third_party/WebKit/LayoutTests/svg/custom/attribute-default-value-after-removal-expected.html
[add] https://crrev.com/20a1e339aeac762f323b93575c6cbad86f88cfbb/third_party/WebKit/LayoutTests/svg/custom/attribute-default-value-after-removal.html
[modify] https://crrev.com/20a1e339aeac762f323b93575c6cbad86f88cfbb/third_party/WebKit/LayoutTests/svg/custom/disallow-non-lengths-in-attrs-expected.txt
[modify] https://crrev.com/20a1e339aeac762f323b93575c6cbad86f88cfbb/third_party/WebKit/LayoutTests/svg/custom/disallow-non-lengths-in-attrs.html
[modify] https://crrev.com/20a1e339aeac762f323b93575c6cbad86f88cfbb/third_party/WebKit/Source/core/svg/SVGSVGElement.cpp

Comment 11 by f...@opera.com, Apr 25 2016

Status: Fixed (was: Started)

Sign in to add a comment