Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-25796

The CSS of the Font Awesome icon theme is evaluated with Velocity for every rendered icon

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • 18.10.0-rc-1
    • 18.0.0-rc-1
    • Icon
    • Unknown

    Description

      Since the upgrade to Font Awesome 7 (XWIKI-15026), the CSS of the Font Awesome icon theme consists of two webjar URLs:

      xwiki.iconset.css = $services.webjars.url('org.webjars:font-awesome', 'css/all.min.css'),$services.webjars.url('org.webjars:font-awesome', 'css/v4-shims.min.css')
      

      The icon renderer evaluates this CSS template for every rendered icon (to register the CSS as a skin extension). The shortcut added in XWIKI-11112 that computes webjar URLs without Velocity only supports a template consisting of a single $services.webjars.url() call, so this template is evaluated with Velocity for each icon: a new Velocity context, a macro namespace, loading the icon theme document, an execution context clone to execute it in the context of that document, and the evaluation with its author's rights.

      On a local profile of Sandbox.WebHome (standard flavor, master, ~60 icons per page), icon rendering takes 21% of the request CPU, almost all of it in this Velocity evaluation. Making the existing shortcut apply (by reducing the template to a single URL) reduced the page load time from 110 to 92 ms (-16%).

      Change

      Support a template consisting of several $services.webjars.url() calls separated by commas in the existing shortcut.

      Attachments

        Issue Links

          Activity

            People

              MichaelHamann Michael Hamann
              MichaelHamann Michael Hamann
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: