1. 26 Nov, 2021 1 commit
    • Robert Knight's avatar
      Add ImageTextLayer class · 41db2a37
      Robert Knight authored
      Implement a class that creates a transparent text layer on top of an
      image containing text. This is useful for supporting annotation in
      documents which are rendered images or canvases that don't have
      browser-accessible text in them, such as VitalSource.
      
      It is the caller's responsibility to determine the location and
      character value of text in the image.
      41db2a37
  2. 25 Nov, 2021 9 commits
  3. 24 Nov, 2021 3 commits
    • Robert Knight's avatar
      Revise `PortProvider._channels` data structure · 82541f3a
      Robert Knight authored
      The `PortProvider._channels` map was used only to keep track of which
      channel requests have been handled for a particular frame. The
      `WeakMap<Window, MessageChannel>` was in fact used as a set rather than
      a map. Only the presence of entries affected behavior, not the stored
      MessageChannel values.
      
      Change the data structure and comments to make its purpose clearer.
      82541f3a
    • Robert Knight's avatar
      Remove a misplaced comment · 20567b07
      Robert Knight authored
      This comment provides general information about how MessagePorts work,
      but isn't directly related to any of the surrounding code.
      
      Of the two comments here, the second one is the most useful information
      to consumers of the PortProvider and PortFinder interfaces, but it is
      well covered by eg. MDN's documentation on MessagePort.
      20567b07
    • Robert Knight's avatar
      Streamline code for responding to port requests · 625bdb9d
      Robert Knight authored
      Rework the code to make the code path for the sidebar-host channel more
      similar to other channels. As a result the `_sendPorts` helper was only
      called in one place and can be inlined where it is called to make the
      overall logic easier to follow.
      625bdb9d
  4. 23 Nov, 2021 16 commits
  5. 22 Nov, 2021 7 commits
  6. 19 Nov, 2021 1 commit
    • Eduardo Sanz García's avatar
      Use `WeakMap` to store `MessageChannel` · 0c0a639b
      Eduardo Sanz García authored
      We use `Window` objects as keys on a map. Windows can be removed.
      `WeakMap` has the characteristic that keys that are claimed by the
      garbage collector are removed from the map. In this way, we are memory
      friendly and don't retain any defunct object.
      0c0a639b
  7. 17 Nov, 2021 3 commits
    • Robert Knight's avatar
      492ab6d5
    • Robert Knight's avatar
      Add test page for PDF-based (aka. fixed-layout) VitalSource books · b1b81da4
      Robert Knight authored
      Create a test page for PDF-based VS books, using content adapted from
      https://bookshelf.vitalsource.com/reader/books/9781938168239/, an
      OpenStax textboot that is available for free [1] in VitalSource.
      
       - Rename vitalsource.mustache => vitalsource-epub.mustache to make the
         distinction with the PDF example clearer.
      
       - Create vitalsource-pdf.mustache which serves as the "container" page
         for a PDF-based VS book. This is a copy of vitalsource-epub.mustache
         with the Prev/Next buttons removed and slight terminology changes
         ("chapter" => "page") to reflect how PDFs are handled in VS
      
       - Revise the descriptive text at the top of the VS PDF and EPUB
         examples to explain the purpose more clearly and relate them to how
         books are presented in the Bookshelf store, where the terms
         "reflowable" and "fixed" are used instead of "EPUB" and "PDF".
      
       - Add a very lightly edited copy of a real content page from a VS book
         in vitalsource-pdf-page.mustache. This is the HTML content from the
         iframe displaying a page in a PDF book in VS. The only changes I have
         made are small block of CSS customizations at the top (see comment)
         and a change to the URL of the rendered PDF page.
      
       - Update the links to the VitalSource test pages on the dev server.
      
      [1] Even though the book is free, you have to add it to your VitalSource
          book library before you can access it. To do that, go to
          https://bookshelf.vitalsource.com and search for the book ID (9781938168239
          in this case), then click "Open Book".
      b1b81da4
    • Eduardo Sanz García's avatar
      Remove `authority` field from discovery message · 974b1de0
      Eduardo Sanz García authored
      Following these two comments:
      * https://github.com/hypothesis/client/pull/3929/files#r750399422
      * https://github.com/hypothesis/client/pull/3929/files#r750414036
      
      I am proposing in this PR to remove the anti-collision field `authority`
      from the message that is send to discover frames. I believe the message
      contains enough information to avoid to be confused by other unrelated
      `postMessage` in the host frame.
      974b1de0