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

[Reg 5.15.3 -> 5.15.4] window.scrollTo doesn't work with PDF documents anymore

    XMLWordPrintable

    Details

    • Platform/s:
      Linux/X11

      Description

      1. open simplebrowser Qt example
      2. replace QMenu *BrowserWindow::createHelpMenu() with the following code:
        QMenu *BrowserWindow::createHelpMenu()
        {
            QMenu *helpMenu = new QMenu(tr("&Help"));
            helpMenu->addAction(tr("About &Qt"), qApp, [=]{
                auto webView = currentTab();
                QPoint p (30, 200);
                QAtomicInt test = -1;
                webView->page()->runJavaScript(QString("window.scrollTo(%1, %2);").arg (p.x()).arg(p.y()), [&test] (const QVariant &) {test = 1;});
                while (test == -1) {
                    // Hack: javascript calls are asynchronous - thus we must wait here while exluding mouse events
                        QApplication::processEvents (QEventLoop::ExcludeUserInputEvents);
                }
            });
            return helpMenu;
        }
        
      3. run the application
      4. open a pdf document
      5. run "About Qt" from the Help menu

      5.15.3: It scrolls the PDF document
      5.15.4: it doesn't do anything

      May be related to this change:
      https://code.qt.io/cgit/qt/qtwebengine.git/commit/?h=5.15.4&id=8f56ea6806d9a72d4b705da5f6f90fa5a6873567

      The PDF loading seems to be different:
      5.15.3:

      <embed id="plugin" type="application/x-google-chrome-pdf" src="file:///home/kapinter/Documents/Service%20cloud%20kickoff%2021012021.pdf" stream-url="file:///home/kapinter/Documents/Service%20cloud%20kickoff%2021012021.pdf" headers="" background-color="0xFF525659" top-toolbar-height="56" javascript="block" full-frame="">
      

      5.15.4:

      <embed name="8C44FA78F0EDA95829EEE8D6CEFA6D22" style="position:absolute; left: 0; top: 0;" width="100%" height="100%" src="about:blank" type="application/pdf" internalid="8C44FA78F0EDA95829EEE8D6CEFA6D22">
      

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              qt_webengine_team Qt WebEngine Team
              Reporter:
              karimpinter Karim Pinter (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes