New issue
Advanced search Search tips

Issue 779454 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Oct 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug



Sign in to add a comment

SVG with empty width and height work unexpectedly

Reported by koa...@gmail.com, Oct 30 2017

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64; rv:56.0) Gecko/20100101 Firefox/56.0

Steps to reproduce the problem:
1. Open the index.html

What is the expected behavior?
Both .case-1 and .case-2 should have the same background (a Twitter logo).

What went wrong?
Only case-2 work, which the SVG need to specify a non-empty width and height.

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 62.0.3202.62  Channel: stable
OS Version: Ubuntu 17.10
Flash Version: 

According to MDN, the default value for SVG width and height are "100%". If I specify empty width or height, they becomes the default.

https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/height
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/width
 
index.html
2.3 KB View Download

Comment 1 by f...@opera.com, Oct 30 2017

Status: Available (was: Unconfirmed)
I think this is because we treat "empty" as a valid value (yielding 0) although it should be considered "in error" (and yield the default value.)
Project Member

Comment 2 by bugdroid1@chromium.org, Oct 31 2017

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

commit 3ab9404e62d694b59d905758fb6ad6827889f313
Author: Fredrik Söderquist <fs@opera.com>
Date: Tue Oct 31 17:57:33 2017

The empty string is a not a valid <length> for SVGLength

SVGLength::SetValueAsString was allowing "" to "reset" the value without
signaling an error. Because of how the handling of removeAttribute works
we can't shut down this entirely, but still need to handle the null
string resulting from that.

Convert svg/custom/invalid-length-units.html to testharness.js. (This
test had one item for "" and " ".)

Bug:  779454 
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: I055b77b07d833a252b325df8fc1a908271c86005
Reviewed-on: https://chromium-review.googlesource.com/746707
Reviewed-by: Philip Rogers <pdr@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#512871}
[modify] https://crrev.com/3ab9404e62d694b59d905758fb6ad6827889f313/third_party/WebKit/LayoutTests/external/wpt/svg/types/scripted/SVGLength.html
[delete] https://crrev.com/64946f117cd4f6442f4743202af7ffa5be2fb704/third_party/WebKit/LayoutTests/svg/custom/invalid-length-units-expected.txt
[modify] https://crrev.com/3ab9404e62d694b59d905758fb6ad6827889f313/third_party/WebKit/LayoutTests/svg/custom/invalid-length-units.html
[delete] https://crrev.com/64946f117cd4f6442f4743202af7ffa5be2fb704/third_party/WebKit/LayoutTests/svg/custom/script-tests/invalid-length-units.js
[add] https://crrev.com/3ab9404e62d694b59d905758fb6ad6827889f313/third_party/WebKit/LayoutTests/svg/custom/svg-length-empty-string.html
[modify] https://crrev.com/3ab9404e62d694b59d905758fb6ad6827889f313/third_party/WebKit/Source/core/svg/SVGLength.cpp

Comment 3 by f...@opera.com, Oct 31 2017

Owner: f...@opera.com
Status: Fixed (was: Available)

Sign in to add a comment