PowerToys icon indicating copy to clipboard operation
PowerToys copied to clipboard

Svg thumbnail failed rendering

Open gokcekantarci opened this issue 1 year ago • 1 comments

Summary of the Pull Request

Default value of fill-rule in style is "nonzero". There is a possibility that rendering bugs may occur due to this reason. Therefore, to eliminate these errors, it is checked whether there is a fill-rule in style and if so, it is re-applied.

https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill-rule

PR Checklist

  • [ ] Closes: #28814
  • [ ] Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • [ ] Tests: Added/updated and all pass
  • [ ] Localization: All end user facing strings can be localized
  • [ ] Dev docs: Added/updated
  • [ ] New binaries: Added on the required places
  • [ ] Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

I created some SVG files for testing. The first one is the "fill-rule" attribute is under style. In others it's under "polygon" and "path". When I tested it with version 0.84.1, only the one under style was broken. Therefore, I was able to solve the problem by parsing the svg style of the file and re-applying the "fill-rule" and other attributes there. The reason why I re-applied all the attributes in the style was that if there was such an error in the "fill-rule", I suspected that there might be other attributes as well. When I changed the "stroke color", "clip-rule", "stroke-width", "opacity" attributes, I did not encounter this error. However, I preserved the code this way as similar errors may occur in other attributes in the future.

0.84.1 test files with release

PR test files with PR

Validation Steps Performed

Check with these svg files

Test files.zip

gokcekantarci avatar May 21 '24 11:05 gokcekantarci

Is this ready for review again?

crutkas avatar Sep 18 '24 04:09 crutkas

/azp run

lei9444 avatar Mar 18 '25 09:03 lei9444

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Mar 18 '25 09:03 azure-pipelines[bot]