private @NotNull ExtendableHTMLViewFactory.Extension getSVGImagesExtension() {
      return (elem, view) -> {
        if (!(view instanceof ImageView)) return null;
        String src = (String)view.getElement().getAttributes().getAttribute(HTML.Attribute.SRC);
        if (src != null /*&& src.endsWith(".svg")*/) {
          final Image image;
          try {
            final URL url = new URL(src);
            Dictionary cache = (Dictionary)elem.getDocument().getProperty("imageCache");
            if (cache == null) {
              elem.getDocument().putProperty("imageCache", cache = new Dictionary() {
                private final HashMap myMap = new HashMap();

                @Override
                public int size() {
                  return myMap.size();
                }

                @Override
                public boolean isEmpty() {
                  return size() == 0;
                }

                @Override
                public Enumeration keys() {
                  return Collections.enumeration(myMap.keySet());
                }

                @Override
                public Enumeration elements() {
                  return Collections.enumeration(myMap.values());
                }

                @Override
                public Object get(Object key) {
                  return myMap.get(key);
                }

                @Override
                public Object put(Object key, Object value) {
                  return myMap.put(key, value);
                }

                @Override
                public Object remove(Object key) {
                  return myMap.remove(key);
                }
              });
            }
            image = src.endsWith(".svg")
                    ? SVGLoader.load(url, JBUI.isPixHiDPI((Component)null) ? 2f : 1f)
                    : Toolkit.getDefaultToolkit().createImage(url);
            cache.put(url, image);
            if (src.endsWith(".svg")) {
              return new ImageView(elem) {
                @Override
                public Image getImage() {
                  return image;
                }

                @Override
                public URL getImageURL() {
                  return url;
                }

                @Override
                public void paint(Graphics g, Shape a) {
                  Rectangle bounds = a.getBounds();
                  int width = (int)getPreferredSpan(View.X_AXIS);
                  int height = (int)getPreferredSpan(View.Y_AXIS);
                  @SuppressWarnings("UndesirableClassUsage")
                  BufferedImage buffer = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
                  Graphics2D graphics = buffer.createGraphics();
                  super.paint(graphics, new Rectangle(buffer.getWidth(), buffer.getHeight()));
                  drawImage(g, ImageUtil.ensureHiDPI(image, ScaleContext.create((Component)null)), bounds.x, bounds.y, null);
                }

                @Override
                public float getMaximumSpan(int axis) {
                  return getPreferredSpan(axis);
                }

                @Override
                public float getMinimumSpan(int axis) {
                  return getPreferredSpan(axis);
                }

                @Override
                public float getPreferredSpan(int axis) {
                  return (axis == View.X_AXIS ? image.getWidth(null) : image.getHeight(null)) / JBUIScale.sysScale();
                }
              };
            }
          }
          catch (IOException e) {
            //ignore
          }
        }

        return null;
      };
    }
private @NotNull ExtendableHTMLViewFactory.Extension getSVGImagesExtension()