Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated: Will Safari get an updated SVG engine in 2023? #18

Open
AmoebeLabs opened this issue Oct 21, 2020 · 0 comments
Open

Updated: Will Safari get an updated SVG engine in 2023? #18

AmoebeLabs opened this issue Oct 21, 2020 · 0 comments
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@AmoebeLabs
Copy link
Owner

AmoebeLabs commented Oct 21, 2020

Great News (2023)

Big things are underway for the SVG engine in Safari that should solve ALL problems!

Januari 19, 2023: Status of the new SVG engine in WebKit

Since late 2019, Igalia has been working on a new SVG engine, dubbed Layer-Based SVG Engine (LBSE), that will unify the HTML/SVG rendering pipelines in WebCore. This will resolve long-standing design issues of the “legacy” SVG engine and unlock a bunch of new exciting possibilities for Web developers to get creative with SVG. Hardware-accelerated compositing, driven by CSS transform animations, 3D perspective transformations for arbitrary SVG elements, CSS z-index support for all SVG graphics elements, and proper coverage rectangle computations and repaints are just a few highlights of the capabilities the future SVG engine will offer.

In this article, an overview is given about the problems that LBSE aims to solve, and the importance of a performant, well-integrated SVG engine especially for the embedded market. Finally, the current upstreaming status is summarized including an outlook for the year 2023.

If this change lands in Safari (maybe 17.x at the end of this year??), this means:

  • the SVG rendering engine should conform to standards, ie be compatible to chromium based browsers
  • full support for the foreignObject (that bug is from 2012!) object, so I can mix HTML with SVG, which would open a lot of possibilities for the Swiss Army Knife card.
  • hardware acceleration, ie possibly good performance for filters/shadows!

Safari svg problems, workarounds and solutions

Known foreignObject bug

Rendering icons. must calculate position on client window

2020.10.22. Discord via Bram Kragten.
Icons are async loaded. This might be the problem with Safari: a not loaded icon can't be calculated.
Testing shows that after the third render, the icon path can be queried for the path.

Possible Solution:

  • draw the icon with zero height/width and visibility = hidden.
  • wait until the icon is loaded (how????), or check with every render if the icon is loaded
  • draw the icon as intended as an svg path in a viewbox 0 0 24 24.

This should mean that svg stacking is working, scaling is working, and that the icon is not in front anymore of a slider or anything else that should be in front of the icon!!!!

Icon not rendering if no other objects around

Could it be possible to simply use this: https://www.sitepoint.com/how-to-translate-from-dom-to-svg-coordinates-and-back-again/ to get the Safari client coordiantes. Already used for clicks in slider, so use also for this stuff to place icon not on svg coordinates, but xlated to client coords?? Or are these the whole screen, and not the card size coordinates????

use other object, circle or rect behind icon. change color and icon is rendered.

Getting fontsize. NOw using 12

const fontSize = window.getComputedStyle(el).fontSize

See previous solution for foreignObject. This could also solve this issue I assume

Animation handling

If an animation is stopped/removed on for example an icon, Safari remembers the current position of the icon, where other browsers reset the icon position to the start.

@AmoebeLabs AmoebeLabs added the bug Something isn't working label Oct 21, 2020
@AmoebeLabs AmoebeLabs self-assigned this Oct 21, 2020
@AmoebeLabs AmoebeLabs pinned this issue Oct 21, 2020
@AmoebeLabs AmoebeLabs changed the title All famous Safari bugs, workarounds and solutions while working with svg's! All famous Safari svg bugs, workarounds and solutions! Oct 21, 2020
@AmoebeLabs AmoebeLabs added the documentation Improvements or additions to documentation label Oct 21, 2020
@AmoebeLabs AmoebeLabs unpinned this issue Jun 10, 2022
@AmoebeLabs AmoebeLabs pinned this issue May 3, 2023
@AmoebeLabs AmoebeLabs changed the title All famous Safari svg bugs, workarounds and solutions! Updated @2023: All famous Safari svg bugs, workarounds and solutions! May 3, 2023
@AmoebeLabs AmoebeLabs changed the title Updated @2023: All famous Safari svg bugs, workarounds and solutions! Updated: Will Safari get an updated SVG engine in 2023? May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant