Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-64638

webassembly: clipboard support

    XMLWordPrintable

Details

    • Task
    • Resolution: Done
    • P2: Important
    • 5.13.0
    • None
    • QPA
    • None
    • WebAssembly
    • 070f75d3b0f5313a0f486fe5c811a8e40dd97967 15adc79bbcaa909f43c2da3c61306cc2138567fa 2c6c724949374b17bd3da2938fe8747b480d575a

    Description

      Web clipboard access is restricted to prevent web pages from sniffing its contents. The browser has access during user-initiated copy and paste events. It looks like emscripten does not have any clipboard API. We can however add event listeners using javascript.

      Approximate browser and Qt event flow:

      1. Browser calls the javascript copy event handler
      2. Qt HTML5 platform plugin generates synthetic CTRL-C
      3. Qt event target copes content into internal Qt clipboard
      4. Qt HTML5 platform plugin copies from internal Qt clipboard to the javascript event

      This requires synchronous event handling since we must get to point 4 before returning from the copy handler.

      The clipboard event implementations on different browsers seem to be divergent. See html_clipboard, which tests event handling with a <canvas> element. (testing on Safari, Chrome, and Firefox)

      • Chrome seems to support clipboard events on the document only. The other browsers support clipboard events on the canvas as well.
      • There is interaction between clipboard events and key events. Any preventDefault() on relevant key events will prevent clipboard events from firing. (on the document as well).
      • Key handlers on the canvas element seem to (sometimes) block canvas clipboard events (even if they don't preventDefault), moreso if the key event handler is installed to run in the capturing phase.

      Preliminary conclusion: It might just work. Interaction with emscripten keyboard handlers should be tested next.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            lpotter Lorn Potter
            sorvig Morten Sørvig
            Votes:
            2 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes