New issue
Advanced search Search tips

Issue 697497 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Mar 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Chrome , Mac
Pri: 3
Type: Bug

Blocking:
issue 676655



Sign in to add a comment

[vector icons] Incorrect vector icon generated

Project Member Reported by jasonkliu@chromium.org, Mar 1 2017

Issue description

I tried to convert the following SVG (which was ran through SVGO)

<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M15 12l-5-4v3H2v2h8v3zm2-10.99L7 1c-1.1 0-2 .9-2 2v6h2V5h10v14H7v-4H5v6c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V3c0-1.1-.9-1.99-2-1.99z"/><path fill="none" d="M0 0h24v24H0z"/></svg>

The outputted .icon file was this:
CANVAS_DIMENSIONS, 24,
MOVE_TO, 15, 12,
R_LINE_TO, -5, -4,
R_V_LINE_TO, 3,
H_LINE_TO, 2,
R_V_LINE_TO, 2,
R_H_LINE_TO, 8,
R_V_LINE_TO, 3,
CLOSE,
R_MOVE_TO, 2, -10.99f,
LINE_TO, 7, 1,
R_CUBIC_TO, -1.1f, 0, -2, 0.9f, -2, 2,
R_V_LINE_TO, 6,
R_H_LINE_TO, 2,
V_LINE_TO, 5,
R_H_LINE_TO, 10,
R_V_LINE_TO, 14,
H_LINE_TO, 7,
R_V_LINE_TO, -4,
H_LINE_TO, 5,
R_V_LINE_TO, 6,
R_CUBIC_TO, 0, 1.1f, 0.9f, 2, 2, 2,
R_H_LINE_TO, 10,
R_CUBIC_TO, 1.1f, 0, 2, -0.9f, 2, -2,
V_LINE_TO, 3,
R_CUBIC_TO, 0, -1.1f, -0.9f, -1.99f, -2, -1.99f,
CLOSE,
END

Changing the R_MOVE_TO, 2, -10.99f, line to R_MOVE_TO, 2, -14.99f, fixes the image. 
See attached comparison.



 
icons.png
27.4 KB View Download
Components: -Blink>SVG UI>GFX
Owner: est...@chromium.org
Status: Assigned (was: Untriaged)
I'll have a look. The weird thing is that the svg uses the -10.99 value.

Comment 2 by f...@opera.com, Mar 1 2017

I was about to change the component... but since I'm here. It looks like the "vector icons" renderer is relying on SkPath semantics matching SVG path semantics. They don't. rMoveTo use the "last point", while after a "close" (z/Z) the current point would be the starting point of the subpath (15,12 here it looks like.) You can have a look at third_party/WebKit/Source/core/svg/SVGPathBuilder.cpp for how Blink handles it/does the conversion. Hope that helps.
Status: Started (was: Assigned)
thanks for the pointer
The icon associated with -14.99 LGTM
I have a fix for this, no need to manually adjust the icon.
Project Member

Comment 6 by bugdroid1@chromium.org, Mar 3 2017

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

commit c570b631a9db029a57a73d0b4068d2f625795135
Author: estade <estade@chromium.org>
Date: Fri Mar 03 20:49:00 2017

Vector icons: fix R_MOVE_TO after CLOSE

This might affect some pre-existing vector icons, and in fact
I found many that have a R_MOVE_TO right after a CLOSE. But all
the ones I checked didn't exhibit the bug because the current
subpath already happened to start and finish in the same place.

BUG= 697497 

Review-Url: https://codereview.chromium.org/2732493002
Cr-Commit-Position: refs/heads/master@{#454666}

[modify] https://crrev.com/c570b631a9db029a57a73d0b4068d2f625795135/ui/gfx/BUILD.gn
[modify] https://crrev.com/c570b631a9db029a57a73d0b4068d2f625795135/ui/gfx/paint_vector_icon.cc
[add] https://crrev.com/c570b631a9db029a57a73d0b4068d2f625795135/ui/gfx/paint_vector_icon_unittest.cc

Status: Fixed (was: Started)
Blocking: 701363
Blocking: -701363 676655

Sign in to add a comment