1. 06 Sep, 2021 9 commits
  2. 03 Sep, 2021 1 commit
    • Eduardo Sanz García's avatar
      Move `listener-collection.js` to `src/shared` · c91cbf0e
      Eduardo Sanz García authored
      `src/shared/port-rpc.js` depended on
      `src/annotation/util/listener-collection.js`. Files in the `src/shared`
      folder should not have dependencies on `src/annotation`.
      
      `ListenerCollection` is a very general utility and the placement in
      `src/shared` seems correct.
      
      I took the opportunity to reorder the imports according to our
      conventions.
      c91cbf0e
  3. 02 Sep, 2021 1 commit
  4. 01 Sep, 2021 1 commit
    • Robert Knight's avatar
      Fail anchoring in PDFs if there is no quote selector · 47706128
      Robert Knight authored
      Changes in text rendering across PDF.js versions can render position
      selectors invalid. Therefore any anchoring done with position selectors must
      be checked against the quote, as we do with HTML annotations.
      
      This commit disallows anchoring using only position selectors in PDFs
      and restructures `anchor` control flow using async/await to make it
      easier to follow.
      
      We have been capturing quote selectors with PDF annotations forever, so
      there should be no impact on old annotations.
      47706128
  5. 31 Aug, 2021 7 commits
    • dependabot[bot]'s avatar
      Bump npm-packlist from 2.2.2 to 3.0.0 · 1651c1cc
      dependabot[bot] authored
      Bumps [npm-packlist](https://github.com/npm/npm-packlist) from 2.2.2 to 3.0.0.
      - [Release notes](https://github.com/npm/npm-packlist/releases)
      - [Commits](https://github.com/npm/npm-packlist/compare/v2.2.2...v3.0.0)
      
      ---
      updated-dependencies:
      - dependency-name: npm-packlist
        dependency-type: direct:development
        update-type: version-update:semver-major
      ...
      Signed-off-by: 's avatardependabot[bot] <support@github.com>
      1651c1cc
    • Robert Knight's avatar
      Improve a couple of code comments · 802828af
      Robert Knight authored
      Improve a few code comments and follow the convention of using
      destructing for constructors that take a single `options` argument.
      802828af
    • Robert Knight's avatar
      Move PDFJSConfig typedef to top of file · 0f3a1295
      Robert Knight authored
      Its easier to scan the file if the typedef comes before references to
      it.
      
      I also reworded and fixed a grammar issue in another comment.
      0f3a1295
    • Robert Knight's avatar
      Rewrite `getPageTextContent` to clarify sync vs async behavior · 3a0d6337
      Robert Knight authored
      An important aspect of this function is that although it returns an
      async result, it populates the cache synchronously, so that two racing
      calls to `getPageTextContent` for the same page don't ask PDF.js to
      extract the same text twice. Add comments to make that clear and remove
      the `async` from the outer function.
      
       - Combine the two internal async helpers into one with no arguments.
         This eliminates some untyped parameters.
      
       - Move the documentation about returned text matching text layer from
         an internal comment to the function's JSDoc, since it is something
         callers need to know even if they don't care about the
         implementation.
      3a0d6337
    • 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
  6. 30 Aug, 2021 13 commits
  7. 24 Aug, 2021 1 commit
  8. 23 Aug, 2021 6 commits
  9. 17 Aug, 2021 1 commit