1. 31 Aug, 2021 3 commits
    • Robert Knight's avatar
      Add test to cover changes in text rendering between PDF.js versions · f7346842
      Robert Knight authored
      Add tests that simulate the different handling of whitespace-only text
      items between older (< v2.9.359) and newer PDF.js releases and check
      that describing and anchoring selectors works in both cases.
      f7346842
    • Robert Knight's avatar
      Fix incorrect anchoring in new PDF.js releases · 8e288390
      Robert Knight authored
      Fix anchoring of text quotes and positions in PDF.js releases (>=
      2.9.359) that include https://github.com/mozilla/pdf.js/pull/13257.
      
      The client's anchoring relies on the text content of pages extracted via
      PDF.js's text APIs (`PDFPage.getTextContent`) to match the `textContent`
      of the hidden text layer element. In older PDF.js releases acheiving
      this alignment required excluding text items with all-whitespace text,
      because PDF.js did not create elements in the text layer for these. In
      PDF.js releases after https://github.com/mozilla/pdf.js/pull/13257 this
      filtering is no longer needed.
      
      The fix in this commit is to feature-detect whether the active version
      of PDF.js includes this change or not and filter or not filter text
      items accordingly.
      
      Future changes to PDF.js could cause mismatches between the result of
      `PDFPage.getTextContent` and the rendered text layer in other ways, so a
      sanity check has been added which logs a console warning if a mismatch
      is detected.
      8e288390
    • Robert Knight's avatar
      Remove an incorrect `checkQuote` helper which worked by accident · bcc1db6e
      Robert Knight authored
      The `checkQuote` helper's code suggested that it was expected to be
      passed a range. However it was being called with a string. This happened
      to work because the implementation only used the `toString` method,
      which exists in both Range objects and strings.
      bcc1db6e
  2. 30 Aug, 2021 13 commits
  3. 24 Aug, 2021 1 commit
  4. 23 Aug, 2021 6 commits
  5. 17 Aug, 2021 8 commits
  6. 13 Aug, 2021 1 commit
    • Robert Knight's avatar
      Allow for approximate equality in range-util tests · b8e0087a
      Robert Knight authored
      Several tests in range-util-test.js started failing locally after the
      most recent Puppeteer upgrade with actual and expected values differing
      by up to 1.0.
      
      Change the tests to check for approximate equality, which is all that is
      required for this use case.
      b8e0087a
  7. 12 Aug, 2021 8 commits