1. 14 Sep, 2021 2 commits
    • Robert Knight's avatar
      Use `classList.add` to add tokens to the class list · 0d4b5367
      Robert Knight authored
      This is functionally the same, just a little cleaner.
      0d4b5367
    • Robert Knight's avatar
      Reduce forced reflows when drawing PDF highlights · c8307923
      Robert Knight authored
      The rendering of SVG highlights in PDFs triggered an excessive number of
      style recalculations and forced reflows due to interleaving DOM changes
      with DOM API calls that require current layout information.
      
      This commit makes several changes to reduce reflows:
      
       1. Create all the `<hypothesis-highlight>` elements in the text layer
          before creating any of the associated SVG elements.
      
          This avoids interleaving creating `<hypothesis-highlight>` elements
          with measuring them in order to position the associated SVG
          `<rect>`.
      
       2. Change `drawHighlightsAbovePdfCanvas` to accept a list of highlight
          elements instead of a single element. By assuming all highlights for
          a single annotation are on the same page, we can avoid some repeated
          work and add all the `<rect>` elements to the parent `<svg>` in one
          batch.
      
      These changes only reduce the thrash when creating highlights for a
      single annotation. To eliminate the remaining thrash we'd need to use a
      combination of optimizing DOM updates across multiple `highlightRange`
      calls and/or reducing the work for PDF pages which are rendered but not
      visible on-screen.
      c8307923
  2. 13 Sep, 2021 17 commits
  3. 09 Sep, 2021 2 commits
  4. 08 Sep, 2021 19 commits