summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.clang-format4
-rw-r--r--CHROMIUM_VERSION4
-rw-r--r--CMakeLists.txt3
-rw-r--r--cmake/FindGPerf.cmake3
-rw-r--r--cmake/FindGn.cmake3
-rw-r--r--cmake/FindNinja.cmake3
-rw-r--r--cmake/FindNodejs.cmake3
-rw-r--r--cmake/FindPkgConfigHost.cmake3
-rw-r--r--cmake/FindSnappy.cmake3
-rw-r--r--cmake/Functions.cmake24
-rw-r--r--cmake/Gn.cmake5
-rw-r--r--coin/module_config.yaml6
-rw-r--r--coin/qt-installer-package-config.json8
-rw-r--r--conanfile.py17
-rw-r--r--configure.cmake7
-rw-r--r--dependencies.yaml8
-rw-r--r--examples/CMakeLists.txt3
-rw-r--r--examples/pdf/CMakeLists.txt3
-rw-r--r--examples/pdf/multipage/CMakeLists.txt14
-rw-r--r--examples/pdf/multipage/doc/src/multipage.qdoc1
-rw-r--r--examples/pdf/multipage/main.cpp10
-rw-r--r--examples/pdf/multipage/multipage.pro4
-rw-r--r--examples/pdf/multipage/pdfapplication.cpp16
-rw-r--r--examples/pdf/multipage/pdfapplication.h24
-rw-r--r--examples/pdf/multipage/resources/macos/Info.plist29
-rw-r--r--examples/pdf/multipage/resources/multipage.icnsbin0 -> 117648 bytes
-rw-r--r--examples/pdf/multipage/viewer.qml13
-rw-r--r--examples/pdf/pdfviewer/CMakeLists.txt3
-rw-r--r--examples/pdf/pdfviewer/main.cpp27
-rw-r--r--examples/pdf/pdfviewer/viewer.qml2
-rw-r--r--examples/pdfwidgets/pdfviewer/CMakeLists.txt3
-rw-r--r--examples/pdfwidgets/pdfviewer/doc/src/pdfviewer.qdoc1
-rw-r--r--examples/pdfwidgets/pdfviewer/main.cpp17
-rw-r--r--examples/pdfwidgets/pdfviewer/mainwindow.cpp23
-rw-r--r--examples/pdfwidgets/pdfviewer/mainwindow.h2
-rw-r--r--examples/webenginequick/CMakeLists.txt3
-rw-r--r--examples/webenginequick/customdialogs/CMakeLists.txt3
-rw-r--r--examples/webenginequick/customtouchhandle/CMakeLists.txt3
-rw-r--r--examples/webenginequick/lifecycle/CMakeLists.txt3
-rw-r--r--examples/webenginequick/minimal/CMakeLists.txt3
-rw-r--r--examples/webenginequick/quicknanobrowser/ApplicationRoot.qml2
-rw-r--r--examples/webenginequick/quicknanobrowser/BrowserDialog.qml2
-rw-r--r--examples/webenginequick/quicknanobrowser/BrowserWindow.qml5
-rw-r--r--examples/webenginequick/quicknanobrowser/CMakeLists.txt8
-rw-r--r--examples/webenginequick/quicknanobrowser/DownloadView.qml2
-rw-r--r--examples/webenginequick/quicknanobrowser/FindBar.qml2
-rw-r--r--examples/webenginequick/quicknanobrowser/FullScreenNotification.qml2
-rw-r--r--examples/webenginequick/quicknanobrowser/main.cpp46
-rw-r--r--examples/webenginequick/quicknanobrowser/quicknanobrowser.pro4
-rw-r--r--examples/webenginequick/quicknanobrowser/utils.h14
-rw-r--r--examples/webenginequick/recipebrowser/CMakeLists.txt3
-rw-r--r--examples/webenginequick/webengineaction/CMakeLists.txt3
-rw-r--r--examples/webenginewidgets/CMakeLists.txt3
-rw-r--r--examples/webenginewidgets/contentmanipulation/CMakeLists.txt3
-rw-r--r--examples/webenginewidgets/cookiebrowser/CMakeLists.txt3
-rw-r--r--examples/webenginewidgets/html2pdf/CMakeLists.txt3
-rw-r--r--examples/webenginewidgets/maps/CMakeLists.txt3
-rw-r--r--examples/webenginewidgets/markdowneditor/CMakeLists.txt3
-rw-r--r--examples/webenginewidgets/minimal/CMakeLists.txt3
-rw-r--r--examples/webenginewidgets/notifications/CMakeLists.txt3
-rw-r--r--examples/webenginewidgets/printme/CMakeLists.txt3
-rw-r--r--examples/webenginewidgets/simplebrowser/CMakeLists.txt3
-rw-r--r--examples/webenginewidgets/simplebrowser/webview.cpp6
-rw-r--r--examples/webenginewidgets/simplebrowser/webview.h4
-rw-r--r--examples/webenginewidgets/spellchecker/CMakeLists.txt3
-rw-r--r--examples/webenginewidgets/stylesheetbrowser/CMakeLists.txt3
-rw-r--r--examples/webenginewidgets/videoplayer/CMakeLists.txt3
-rw-r--r--examples/webenginewidgets/webui/CMakeLists.txt3
-rw-r--r--qt_cmdline.cmake3
m---------src/3rdparty0
-rw-r--r--src/CMakeLists.txt20
-rw-r--r--src/core/CMakeLists.txt25
-rw-r--r--src/core/accessibility_tree_formatter_qt.cpp9
-rw-r--r--src/core/api/CMakeLists.txt3
-rw-r--r--src/core/api/Qt6WebEngineCoreMacros.cmake3
-rw-r--r--src/core/api/configure.cmake5
-rw-r--r--src/core/api/qt_cmdline.cmake3
-rw-r--r--src/core/api/qwebenginefilesystemaccessrequest.cpp26
-rw-r--r--src/core/api/qwebenginefilesystemaccessrequest.h23
-rw-r--r--src/core/api/qwebenginepage.cpp6
-rw-r--r--src/core/api/qwebenginepage_p.h4
-rw-r--r--src/core/api/qwebengineprofile.cpp35
-rw-r--r--src/core/api/qwebengineprofile.h3
-rw-r--r--src/core/api/qwebengineurlrequestinfo.cpp30
-rw-r--r--src/core/api/qwebengineurlrequestinfo.h1
-rw-r--r--src/core/api/qwebengineurlrequestinfo_p.h6
-rw-r--r--src/core/autofill_client_qt.cpp48
-rw-r--r--src/core/autofill_client_qt.h42
-rw-r--r--src/core/autofill_popup_controller.cpp42
-rw-r--r--src/core/autofill_popup_controller.h40
-rw-r--r--src/core/autofill_popup_controller_p.h40
-rw-r--r--src/core/browser_accessibility_manager_qt.cpp20
-rw-r--r--src/core/browser_accessibility_manager_qt.h3
-rw-r--r--src/core/browser_accessibility_qt.cpp13
-rw-r--r--src/core/browser_main_parts_qt.cpp60
-rw-r--r--src/core/browser_main_parts_qt.h4
-rw-r--r--src/core/chromium_overrides.cpp11
-rw-r--r--src/core/clipboard_util_win.cpp29
-rw-r--r--src/core/common/extensions/extensions_client_qt.cpp2
-rw-r--r--src/core/common/extensions/extensions_client_qt.h2
-rw-r--r--src/core/common/qt_messages.cpp3
-rw-r--r--src/core/common/qt_messages.h3
-rw-r--r--src/core/compositor/display_skia_output_device.cpp27
-rw-r--r--src/core/compositor/display_skia_output_device.h16
-rw-r--r--src/core/configure/BUILD.root.gn.in92
-rw-r--r--src/core/content_browser_client_qt.cpp157
-rw-r--r--src/core/content_browser_client_qt.h16
-rw-r--r--src/core/content_client_qt.cpp53
-rw-r--r--src/core/content_main_delegate_qt.cpp21
-rw-r--r--src/core/custom_handlers/protocol_handler_registry_factory.cpp2
-rw-r--r--src/core/custom_handlers/register_protocol_handler_request_controller_impl.cpp2
-rw-r--r--src/core/custom_handlers/register_protocol_handler_request_controller_impl.h8
-rw-r--r--src/core/desktop_screen_qt.cpp13
-rw-r--r--src/core/desktop_screen_qt.h2
-rw-r--r--src/core/devtools_frontend_qt.cpp9
-rw-r--r--src/core/devtools_frontend_qt.h2
-rw-r--r--src/core/doc/snippets/qtwebenginecore_build_snippet.qdoc5
-rw-r--r--src/core/doc/src/qtwebengine-deploying.qdoc7
-rw-r--r--src/core/doc/src/qtwebengine-platform-notes.qdoc6
-rw-r--r--src/core/doc/src/qtwebenginecore-index.qdoc5
-rw-r--r--src/core/doc/src/qtwebenginecore-module.qdoc5
-rw-r--r--src/core/doc/src/qwebenginehistory_lgpl.qdoc22
-rw-r--r--src/core/doc/src/qwebenginepage_lgpl.qdoc26
-rw-r--r--src/core/doc/src/qwebenginesettings_lgpl.qdoc25
-rw-r--r--src/core/download_manager_delegate_qt.cpp7
-rw-r--r--src/core/extensions/component_extension_resource_manager_qt.cpp2
-rw-r--r--src/core/extensions/extension_host_delegate_qt.cpp6
-rw-r--r--src/core/extensions/extension_host_delegate_qt.h4
-rw-r--r--src/core/extensions/extension_system_qt.cpp21
-rw-r--r--src/core/extensions/extension_system_qt.h4
-rw-r--r--src/core/extensions/extension_web_contents_observer_qt.cpp25
-rw-r--r--src/core/extensions/extension_web_contents_observer_qt.h1
-rw-r--r--src/core/extensions/extensions_api_client_qt.cpp13
-rw-r--r--src/core/extensions/extensions_browser_client_qt.cpp4
-rw-r--r--src/core/extensions/pdf_iframe_navigation_throttle_qt.cpp3
-rw-r--r--src/core/extensions/pdf_web_contents_helper_client_qt.h27
-rw-r--r--src/core/file_picker_controller.cpp10
-rw-r--r--src/core/file_system_access/file_system_access_permission_context_qt.cpp3
-rw-r--r--src/core/file_system_access/file_system_access_permission_request_manager_qt.cpp8
-rw-r--r--src/core/file_system_access/file_system_access_permission_request_manager_qt.h2
-rw-r--r--src/core/find_text_helper.cpp2
-rw-r--r--src/core/media_capture_devices_dispatcher.cpp8
-rw-r--r--src/core/native_web_keyboard_event_qt.cpp21
-rw-r--r--src/core/net/client_cert_override.cpp20
-rw-r--r--src/core/net/cookie_monster_delegate_qt.cpp2
-rw-r--r--src/core/net/cookie_monster_delegate_qt.h5
-rw-r--r--src/core/net/custom_url_loader_factory.cpp38
-rw-r--r--src/core/net/plugin_response_interceptor_url_loader_throttle.cpp57
-rw-r--r--src/core/net/proxying_restricted_cookie_manager_qt.cpp15
-rw-r--r--src/core/net/proxying_restricted_cookie_manager_qt.h4
-rw-r--r--src/core/net/proxying_url_loader_factory_qt.cpp28
-rw-r--r--src/core/net/qrc_url_scheme_handler.cpp5
-rw-r--r--src/core/net/system_network_context_manager.cpp51
-rw-r--r--src/core/net/webui_controller_factory_qt.cpp8
-rw-r--r--src/core/ozone/gl_context_qt.cpp8
-rw-r--r--src/core/ozone/gl_surface_egl_qt.cpp27
-rw-r--r--src/core/ozone/gl_surface_glx_qt.cpp13
-rw-r--r--src/core/ozone/gl_surface_qt.cpp34
-rw-r--r--src/core/ozone/gl_surface_qt.h4
-rw-r--r--src/core/ozone/gl_surface_wgl_qt.cpp8
-rw-r--r--src/core/ozone/gl_surface_wgl_qt.h6
-rw-r--r--src/core/ozone/ozone_platform_qt.cpp5
-rw-r--r--src/core/ozone/ozone_platform_qt.h8
-rw-r--r--src/core/permission_manager_qt.cpp21
-rw-r--r--src/core/permission_manager_qt.h5
-rw-r--r--src/core/pref_service_adapter.cpp23
-rw-r--r--src/core/printing/pdf_stream_delegate_qt.cpp91
-rw-r--r--src/core/printing/pdf_stream_delegate_qt.h23
-rw-r--r--src/core/printing/pdf_web_contents_helper_client_qt.cpp56
-rw-r--r--src/core/printing/pdf_web_contents_helper_client_qt.h27
-rw-r--r--src/core/printing/print_view_manager_base_qt.cpp135
-rw-r--r--src/core/printing/print_view_manager_base_qt.h9
-rw-r--r--src/core/printing/print_view_manager_qt.cpp1
-rw-r--r--src/core/process_main.cpp12
-rw-r--r--src/core/profile_adapter.cpp12
-rw-r--r--src/core/profile_adapter.h4
-rw-r--r--src/core/profile_io_data_qt.cpp4
-rw-r--r--src/core/profile_qt.cpp33
-rw-r--r--src/core/profile_qt.h3
-rw-r--r--src/core/render_widget_host_view_qt.cpp56
-rw-r--r--src/core/render_widget_host_view_qt.h9
-rw-r--r--src/core/render_widget_host_view_qt_delegate.h1
-rw-r--r--src/core/render_widget_host_view_qt_delegate_client.cpp3
-rw-r--r--src/core/render_widget_host_view_qt_delegate_item.cpp7
-rw-r--r--src/core/render_widget_host_view_qt_delegate_item.h1
-rw-r--r--src/core/renderer/content_renderer_client_qt.cpp146
-rw-r--r--src/core/renderer/content_renderer_client_qt.h6
-rw-r--r--src/core/renderer/extensions/extensions_renderer_client_qt.cpp3
-rw-r--r--src/core/renderer/extensions/extensions_renderer_client_qt.h5
-rw-r--r--src/core/renderer/pepper/pepper_renderer_host_factory_qt.cpp33
-rw-r--r--src/core/renderer_host/user_resource_controller_host.cpp2
-rw-r--r--src/core/resource_bundle_qt.cpp6
-rw-r--r--src/core/tools/CMakeLists.txt3
-rw-r--r--src/core/tools/main.cpp7
-rw-r--r--src/core/touch_handle_drawable_qt.cpp9
-rw-r--r--src/core/type_conversion.cpp6
-rw-r--r--src/core/type_conversion.h9
-rw-r--r--src/core/web_contents_adapter.cpp51
-rw-r--r--src/core/web_contents_delegate_qt.cpp19
-rw-r--r--src/core/web_contents_delegate_qt.h1
-rw-r--r--src/core/web_contents_view_qt.h4
-rw-r--r--src/core/web_engine_context.cpp22
-rw-r--r--src/core/web_engine_library_info.cpp190
-rw-r--r--src/core/web_engine_library_info.h2
-rw-r--r--src/core/web_engine_settings.cpp1
-rw-r--r--src/gn/CMakeLists.txt3
-rw-r--r--src/host/CMakeLists.txt3
-rw-r--r--src/ninja/CMakeLists.txt3
-rw-r--r--src/pdf/CMakeLists.txt3
-rw-r--r--src/pdf/configure.cmake3
-rw-r--r--src/pdf/doc/qtpdf.qdocconf6
-rw-r--r--src/pdf/doc/snippets/multipageview.qml3
-rw-r--r--src/pdf/doc/snippets/qtpdf_build_snippet.qdoc5
-rw-r--r--src/pdf/doc/src/qtpdf-index.qdoc5
-rw-r--r--src/pdf/doc/src/qtpdf-module.qdoc5
-rw-r--r--src/pdf/plugins/imageformats/pdf/CMakeLists.txt3
-rw-r--r--src/pdf/qpdfbookmarkmodel.cpp13
-rw-r--r--src/pdf/qpdfbookmarkmodel.h3
-rw-r--r--src/pdf/qpdfdocument.cpp14
-rw-r--r--src/pdf/qpdfdocument.h2
-rw-r--r--src/pdf/qpdfdocumentrenderoptions.h8
-rw-r--r--src/pdf/qpdfdocumentrenderoptions.qdoc8
-rw-r--r--src/pdf/qpdflink.cpp3
-rw-r--r--src/pdf/qpdflink.h4
-rw-r--r--src/pdf/qpdflinkmodel.cpp22
-rw-r--r--src/pdf/qpdflinkmodel_p.h2
-rw-r--r--src/pdf/qpdfsearchmodel.cpp6
-rw-r--r--src/pdf/qpdfsearchmodel.h2
-rw-r--r--src/pdfquick/CMakeLists.txt3
-rw-r--r--src/pdfquick/PdfMultiPageView.qml17
-rw-r--r--src/pdfquick/PdfPageView.qml14
-rw-r--r--src/pdfquick/PdfScrollablePageView.qml19
-rw-r--r--src/pdfquick/qquickpdfpageimage.cpp2
-rw-r--r--src/pdfquick/qquickpdfpagenavigator.cpp2
-rw-r--r--src/pdfquick/qquickpdfselection.cpp15
-rw-r--r--src/pdfwidgets/CMakeLists.txt3
-rw-r--r--src/process/CMakeLists.txt3
-rw-r--r--src/process/main.cpp2
-rw-r--r--src/webenginequick/CMakeLists.txt3
-rw-r--r--src/webenginequick/api/qquickwebengineprofile.cpp43
-rw-r--r--src/webenginequick/api/qquickwebengineprofile.h5
-rw-r--r--src/webenginequick/api/qquickwebenginesingleton.cpp3
-rw-r--r--src/webenginequick/configure.cmake3
-rw-r--r--src/webenginequick/doc/snippets/qtwebengine_build_snippet.qdoc5
-rw-r--r--src/webenginequick/doc/src/qtwebengine-module.qdoc5
-rw-r--r--src/webenginequick/doc/src/qtwebengine-qmlmodule.qdoc5
-rw-r--r--src/webenginequick/doc/src/webengineview_lgpl.qdoc25
-rw-r--r--src/webenginequick/ui/AutofillPopup.qml40
-rw-r--r--src/webenginequick/ui/CMakeLists.txt3
-rw-r--r--src/webenginewidgets/CMakeLists.txt5
-rw-r--r--src/webenginewidgets/api/qwebengineview.cpp16
-rw-r--r--src/webenginewidgets/api/qwebengineview_p.h3
-rw-r--r--src/webenginewidgets/doc/snippets/qtwebenginewidgets_build_snippet.qdoc5
-rw-r--r--src/webenginewidgets/doc/src/qtwebenginewidgets-index.qdoc5
-rw-r--r--src/webenginewidgets/doc/src/qtwebenginewidgets-module.qdoc5
-rw-r--r--src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc26
-rw-r--r--src/webenginewidgets/plugins/qwebengineview/CMakeLists.txt3
-rw-r--r--src/webenginewidgets/ui/autofillpopupwidget.cpp40
-rw-r--r--src/webenginewidgets/ui/autofillpopupwidget_p.h40
-rw-r--r--src/webenginewidgets/ui/touchhandlewidget.cpp59
-rw-r--r--src/webenginewidgets/ui/touchhandlewidget_p.h50
-rw-r--r--tests/auto/CMakeLists.txt3
-rw-r--r--tests/auto/cmake/CMakeLists.txt3
-rw-r--r--tests/auto/core/CMakeLists.txt3
-rw-r--r--tests/auto/core/certificateerror/CMakeLists.txt3
-rw-r--r--tests/auto/core/devtools/CMakeLists.txt3
-rw-r--r--tests/auto/core/origins/CMakeLists.txt3
-rw-r--r--tests/auto/core/origins/resources/mixedSchemes.html2
-rw-r--r--tests/auto/core/qwebengineclientcertificatestore/CMakeLists.txt3
-rw-r--r--tests/auto/core/qwebenginecookiestore/CMakeLists.txt3
-rw-r--r--tests/auto/core/qwebenginesettings/CMakeLists.txt3
-rw-r--r--tests/auto/core/qwebengineurlrequestinterceptor/CMakeLists.txt3
-rw-r--r--tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp38
-rw-r--r--tests/auto/httpserver/CMakeLists.txt3
-rw-r--r--tests/auto/httpserver/httpserver.cmake3
-rw-r--r--tests/auto/pdf/CMakeLists.txt3
-rw-r--r--tests/auto/pdf/qpdfbookmarkmodel/CMakeLists.txt5
-rw-r--r--tests/auto/pdf/qpdfdocument/CMakeLists.txt5
-rw-r--r--tests/auto/pdf/qpdfdocument/tst_qpdfdocument.cpp2
-rw-r--r--tests/auto/pdf/qpdfpagerenderer/CMakeLists.txt5
-rw-r--r--tests/auto/pdf/qpdfsearchmodel/CMakeLists.txt5
-rw-r--r--tests/auto/pdfquick/CMakeLists.txt1
-rw-r--r--tests/auto/pdfquick/multipageview/BLACKLIST3
-rw-r--r--tests/auto/pdfquick/multipageview/CMakeLists.txt30
-rw-r--r--tests/auto/pdfquick/multipageview/data/bookmarksAndLinks.pdf317
-rw-r--r--tests/auto/pdfquick/multipageview/data/multiPageView.qml8
-rw-r--r--tests/auto/pdfquick/multipageview/data/multiPageViewWithFeedback.qml18
-rw-r--r--tests/auto/pdfquick/multipageview/data/pdf-sample.protected.pdfbin0 -> 9138 bytes
-rw-r--r--tests/auto/pdfquick/multipageview/data/qpdfwriter.pdfbin0 -> 33645 bytes
-rw-r--r--tests/auto/pdfquick/multipageview/tst_multipageview.cpp357
-rw-r--r--tests/auto/pdfquick/shared/util.cpp110
-rw-r--r--tests/auto/pdfquick/shared/util.h58
-rw-r--r--tests/auto/quick/CMakeLists.txt8
-rw-r--r--tests/auto/quick/dialogs/CMakeLists.txt3
-rw-r--r--tests/auto/quick/inspectorserver/CMakeLists.txt3
-rw-r--r--tests/auto/quick/inspectorserver/tst_inspectorserver.cpp4
-rw-r--r--tests/auto/quick/publicapi/CMakeLists.txt3
-rw-r--r--tests/auto/quick/publicapi/tst_publicapi.cpp2
-rw-r--r--tests/auto/quick/qmltests/BLACKLIST6
-rw-r--r--tests/auto/quick/qmltests/CMakeLists.txt3
-rw-r--r--tests/auto/quick/qmltests/data/TestWebEngineView.qml2
-rw-r--r--tests/auto/quick/qmltests/data/tst_datalist.qml29
-rw-r--r--tests/auto/quick/qmltests/data/tst_newViewRequest.qml2
-rw-r--r--tests/auto/quick/qmltests/data/tst_runJavaScript.qml3
-rw-r--r--tests/auto/quick/qmltests/data/tst_viewSource.qml2
-rw-r--r--tests/auto/quick/qquickwebenginedefaultsurfaceformat/CMakeLists.txt3
-rw-r--r--tests/auto/quick/qquickwebengineview/CMakeLists.txt3
-rw-r--r--tests/auto/quick/qquickwebengineviewgraphics/CMakeLists.txt3
-rw-r--r--tests/auto/quick/qtbug-70248/CMakeLists.txt3
-rw-r--r--tests/auto/quick/uidelegates/CMakeLists.txt3
-rw-r--r--tests/auto/util/CMakeLists.txt3
-rw-r--r--tests/auto/util/util.cmake3
-rw-r--r--tests/auto/widgets/CMakeLists.txt3
-rw-r--r--tests/auto/widgets/accessibility/CMakeLists.txt3
-rw-r--r--tests/auto/widgets/accessibility/tst_accessibility.cpp6
-rw-r--r--tests/auto/widgets/defaultsurfaceformat/CMakeLists.txt3
-rw-r--r--tests/auto/widgets/favicon/CMakeLists.txt3
-rw-r--r--tests/auto/widgets/loadsignals/CMakeLists.txt3
-rw-r--r--tests/auto/widgets/loadsignals/tst_loadsignals.cpp2
-rw-r--r--tests/auto/widgets/offscreen/CMakeLists.txt3
-rw-r--r--tests/auto/widgets/printing/CMakeLists.txt6
-rw-r--r--tests/auto/widgets/proxy/CMakeLists.txt3
-rw-r--r--tests/auto/widgets/proxypac/CMakeLists.txt25
-rw-r--r--tests/auto/widgets/proxypac/proxy.pac2
-rw-r--r--tests/auto/widgets/proxypac/tst_proxypac.cpp14
-rw-r--r--tests/auto/widgets/qwebenginedownloadrequest/CMakeLists.txt3
-rw-r--r--tests/auto/widgets/qwebenginehistory/CMakeLists.txt3
-rw-r--r--tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp4
-rw-r--r--tests/auto/widgets/qwebenginepage/CMakeLists.txt3
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp49
-rw-r--r--tests/auto/widgets/qwebengineprofile/CMakeLists.txt3
-rw-r--r--tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp61
-rw-r--r--tests/auto/widgets/qwebenginescript/CMakeLists.txt3
-rw-r--r--tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp2
-rw-r--r--tests/auto/widgets/qwebengineview/BLACKLIST3
-rw-r--r--tests/auto/widgets/qwebengineview/CMakeLists.txt3
-rw-r--r--tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp75
-rw-r--r--tests/auto/widgets/schemes/CMakeLists.txt3
-rw-r--r--tests/auto/widgets/shutdown/CMakeLists.txt3
-rw-r--r--tests/auto/widgets/spellchecking/CMakeLists.txt3
-rw-r--r--tests/auto/widgets/touchinput/CMakeLists.txt3
-rw-r--r--tests/manual/quick/touchbrowser/CMakeLists.txt5
-rw-r--r--tests/manual/widgets/inputmethods/CMakeLists.txt5
-rw-r--r--tests/manual/widgets/webgl/CMakeLists.txt5
-rwxr-xr-xtools/scripts/take_snapshot.py35
-rw-r--r--tools/scripts/version_resolver.py4
346 files changed, 3692 insertions, 1487 deletions
diff --git a/.clang-format b/.clang-format
index 0d61b137a..232a5c6e4 100644
--- a/.clang-format
+++ b/.clang-format
@@ -1,7 +1,5 @@
# Copyright (C) 2016 Olivier Goffart <ogoffart@woboq.com>
-#
-# You may use this file under the terms of the 3-clause BSD license.
-# See the file LICENSE from this package for details.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
# This is the clang-format configuration style to be used by Qt,
# based on the rules from https://wiki.qt.io/Qt_Coding_Style and
diff --git a/CHROMIUM_VERSION b/CHROMIUM_VERSION
index 2ec45229b..57dd9c61f 100644
--- a/CHROMIUM_VERSION
+++ b/CHROMIUM_VERSION
@@ -1,3 +1,3 @@
-Based on Chromium version: 94.0.4606.126
-Patched with security patches up to Chromium version: 99.0.4844.84
+Based on Chromium version: 102.0.5005.177
+Patched with security patches up to Chromium version: 104.0.5112.102
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c04b9bf46..b25edfa00 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# Require the Qt (not WebEngine) minimum supported CMake version.
# Another WebEngine-specific version check will be done in configure.cmake
# and reported in the configure summary.
diff --git a/cmake/FindGPerf.cmake b/cmake/FindGPerf.cmake
index 85b55f1b8..e42b8a372 100644
--- a/cmake/FindGPerf.cmake
+++ b/cmake/FindGPerf.cmake
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
find_program(GPerf_EXECUTABLE NAMES gperf)
include(FindPackageHandleStandardArgs)
diff --git a/cmake/FindGn.cmake b/cmake/FindGn.cmake
index 6bef6009e..3f25bb585 100644
--- a/cmake/FindGn.cmake
+++ b/cmake/FindGn.cmake
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
if(NOT DEFINED WEBENGINE_ROOT_BUILD_DIR)
set(WEBENGINE_ROOT_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR})
endif()
diff --git a/cmake/FindNinja.cmake b/cmake/FindNinja.cmake
index 720e73266..9b1e718c0 100644
--- a/cmake/FindNinja.cmake
+++ b/cmake/FindNinja.cmake
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
if (NOT DEFINED WEBENGINE_ROOT_BUILD_DIR)
set(WEBENGINE_ROOT_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR})
endif()
diff --git a/cmake/FindNodejs.cmake b/cmake/FindNodejs.cmake
index 0e5efe4a3..0aeef5ab3 100644
--- a/cmake/FindNodejs.cmake
+++ b/cmake/FindNodejs.cmake
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
find_program(Nodejs_EXECUTABLE NAMES node nodejs)
if(Nodejs_EXECUTABLE)
diff --git a/cmake/FindPkgConfigHost.cmake b/cmake/FindPkgConfigHost.cmake
index de0216384..a7f9ab0ae 100644
--- a/cmake/FindPkgConfigHost.cmake
+++ b/cmake/FindPkgConfigHost.cmake
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# this is just simply pkg config wrapper to pass executable path to gn
if(CMAKE_CROSSCOMPILING)
diff --git a/cmake/FindSnappy.cmake b/cmake/FindSnappy.cmake
index 1470c55a9..e1c7d231b 100644
--- a/cmake/FindSnappy.cmake
+++ b/cmake/FindSnappy.cmake
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
if(TARGET Snappy::Snappy)
set(Snappy_FOUND TRUE)
diff --git a/cmake/Functions.cmake b/cmake/Functions.cmake
index e66aa0694..e2ccdd9f1 100644
--- a/cmake/Functions.cmake
+++ b/cmake/Functions.cmake
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
function(assertTargets)
qt_parse_all_arguments(arg "add_check_for_support"
"" "" "MODULES;TARGETS" "${ARGN}"
@@ -300,7 +303,7 @@ function(get_install_config result)
set(${result} "Release" PARENT_SCOPE)
elseif("RelWithDebInfo" IN_LIST CMAKE_CONFIGURATION_TYPES)
set(${result} "RelWithDebInfo" PARENT_SCOPE)
- elseif("Debug" IN_LIST CMAKE_CONFIGURATION_TYPE)
+ elseif("Debug" IN_LIST CMAKE_CONFIGURATION_TYPES)
set(${result} "Debug" PARENT_SCOPE)
else()
# assume MinSizeRel ?
@@ -430,7 +433,13 @@ function(add_linker_options target buildDir completeStatic)
set(libs_rsp "${buildDir}/${ninjaTarget}_libs.rsp")
set_target_properties(${cmakeTarget} PROPERTIES STATIC_LIBRARY_OPTIONS "@${objects_rsp}")
if(LINUX)
+ get_gn_arch(cpu ${TEST_architecture_arch})
+ if(CMAKE_CROSSCOMPILING AND cpu STREQUAL "arm" AND ${config} STREQUAL "Debug")
+ target_link_options(${cmakeTarget} PRIVATE "LINKER:--long-plt")
+ endif()
target_link_options(${cmakeTarget} PRIVATE "$<$<CONFIG:${config}>:@${objects_rsp}>")
+ # Chromium is meant for linking with gc-sections, which seems to not always get applied otherwise
+ target_link_options(${cmakeTarget} PRIVATE "-Wl,--gc-sections")
if(NOT completeStatic)
target_link_libraries(${cmakeTarget} PRIVATE
"$<1:-Wl,--start-group $<$<CONFIG:${config}>:@${archives_rsp}> -Wl,--end-group>"
@@ -440,7 +449,6 @@ function(add_linker_options target buildDir completeStatic)
target_link_libraries(${cmakeTarget} PRIVATE
"$<1:-Wl,--no-fatal-warnings $<$<CONFIG:${config}>:@${libs_rsp}> -Wl,--no-fatal-warnings>"
)
-
endif()
if(MACOS)
target_link_options(${cmakeTarget} PRIVATE "$<$<CONFIG:${config}>:@${objects_rsp}>")
@@ -451,6 +459,7 @@ function(add_linker_options target buildDir completeStatic)
endif()
if(WIN32)
get_copy_of_response_file(objects_rsp ${target} objects)
+ target_link_options(${cmakeTarget} PRIVATE /DELAYLOAD:mf.dll /DELAYLOAD:mfplat.dll /DELAYLOAD:mfreadwrite.dll)
target_link_options(${cmakeTarget} PRIVATE "$<$<CONFIG:${config}>:@${objects_rsp}>")
if(NOT completeStatic)
get_copy_of_response_file(archives_rsp ${target} archives)
@@ -622,6 +631,8 @@ function(get_gn_arch result arch)
set(${result} "mipsel" PARENT_SCOPE)
elseif(arch STREQUAL "mipsel64")
set(${result} "mips64el" PARENT_SCOPE)
+ elseif(arch STREQUAL "riscv64")
+ set(${result} "riscv64" PARENT_SCOPE)
else()
message(DEBUG "Unsupported architecture: ${arch}")
endif()
@@ -641,8 +652,12 @@ function(get_v8_arch result targetArch hostArch)
set(${result} "mipsel" PARENT_SCOPE)
elseif(hostArch STREQUAL "mipsel64")
set(${result} "mipsel" PARENT_SCOPE)
+ elseif(hostArch STREQUAL "riscv64")
+ set(${result} "riscv64" PARENT_SCOPE)
+ elseif(hostArch IN_LIST list32)
+ set(${result} "${hostArch}" PARENT_SCOPE)
else()
- message(DEBUG "Unsupported architecture: ${hostArch}")
+ message(FATAL_ERROR "Unsupported architecture: ${hostArch}")
endif()
else()
# assume 64bit target which matches 64bit host
@@ -791,7 +806,6 @@ macro(append_build_type_setup)
is_shared=true
use_sysroot=false
forbid_non_component_debug_builds=false
- enable_debugallocation=false
treat_warnings_as_errors=false
use_allocator_shim=false
use_allocator="none"
@@ -834,7 +848,7 @@ macro(append_build_type_setup)
#TODO: refactor to not check for IOS here
if(NOT QT_FEATURE_webengine_full_debug_info AND NOT IOS)
- list(APPEND gnArgArg blink_symbol_level=0 remove_v8base_debug_symbols=true)
+ list(APPEND gnArgArg blink_symbol_level=0 v8_symbol_level=0)
endif()
extend_gn_list(gnArgArg ARGS use_jumbo_build CONDITION QT_FEATURE_webengine_jumbo_build)
diff --git a/cmake/Gn.cmake b/cmake/Gn.cmake
index 99f4dae38..41dccc11b 100644
--- a/cmake/Gn.cmake
+++ b/cmake/Gn.cmake
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
# This is gn wrapper script and it assables final BUILD.gn based on:
# gn_config_target.cmake gn_config_c.cmake gn_config_cxx.cmake
@@ -65,7 +68,7 @@ execute_process(
RESULT_VARIABLE gnResult
OUTPUT_VARIABLE gnOutput
ERROR_VARIABLE gnError
- TIMEOUT 300
+ TIMEOUT 600
)
if(NOT gnResult EQUAL 0)
diff --git a/coin/module_config.yaml b/coin/module_config.yaml
index 01da49996..f1d69a277 100644
--- a/coin/module_config.yaml
+++ b/coin/module_config.yaml
@@ -4,6 +4,12 @@ accept_configuration:
property: features
not_contains_value: Disable
+machine_type:
+ Build:
+ cores: 8
+ Test:
+ cores: 4
+
instructions:
Build:
- type: EnvironmentVariable
diff --git a/coin/qt-installer-package-config.json b/coin/qt-installer-package-config.json
index d556d245f..b3fa3a3a4 100644
--- a/coin/qt-installer-package-config.json
+++ b/coin/qt-installer-package-config.json
@@ -6,7 +6,7 @@
"**/include/*QtPdf*/**/*",
"**/lib/cmake/Qt*Gui/*Pdf*",
"**/lib/cmake/Qt*Pdf*/*",
- "**/lib/cmake/Qt*Qml/QmlPlugins/*pdf*",
+ "**/lib/cmake/Qt*Qml/QmlPlugins/*Pdf*",
"**/lib/metatypes/*pdf*",
"**/lib/pkgconfig/*Pdf*",
"**/lib/*Pdf*",
@@ -15,8 +15,10 @@
"**/mkspecs/modules/qt_lib_pdf*",
"**/mkspecs/modules/qt_plugin_qpdf.pri",
"**/modules/Pdf*",
- "**/plugins/imageformats/*",
- "**/qml/QtQuick/**/*"
+ "**/plugins/imageformats/**/*",
+ "**/qml/QtQuick/**/*",
+ "**/qml/QtQuick/Pdf/**/.rcc/*",
+ "**/qml/QtQuick/Pdf/**/.rcc/qmlcache/*"
]
}
}
diff --git a/conanfile.py b/conanfile.py
index a1547a7b9..137285c08 100644
--- a/conanfile.py
+++ b/conanfile.py
@@ -70,3 +70,20 @@ class QtWebEngine(ConanFile):
def get_qt_leaf_module_default_options(self) -> Dict[str, Any]:
"""Implements abstractmethod from qt-conan-common.QtLeafModule"""
return self._shared.convert_qt_features_to_default_conan_options(_qtwebengine_features)
+
+ def package_env_info(self) -> Dict[str, Any]:
+ """Implements abstractmethod from qt-conan-common.QtLeafModule"""
+ # this will be called only after a successful build
+ _f = lambda p: True
+ if tools.os_info.is_windows:
+ ptrn = "**/QtWebEngineProcess.exe"
+ elif tools.os_info.is_macos:
+ ptrn = "**/QtWebEngineProcess.app/**/QtWebEngineProcess"
+ _f = lambda p: not any(".dSYM" in item for item in p.parts)
+ else:
+ ptrn = "**/QtWebEngineProcess"
+ ret = [str(p) for p in Path(self.package_folder).rglob(ptrn) if p.is_file() and _f(p)]
+ if len(ret) != 1:
+ print("Expected to find one 'QtWebEngineProcess'. Found: {0}".format(ret))
+ return {"QTWEBENGINEPROCESS_PATH": ret.pop() if ret else ""}
+
diff --git a/configure.cmake b/configure.cmake
index 6a0a213e5..9c177115d 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
if(QT_CONFIGURE_RUNNING)
function(assertTargets)
endfunction()
@@ -561,8 +564,8 @@ if(WIN32)
message("-- Windows 10 SDK version: ${windowsSdkVersion}")
add_check_for_support(
MODULES QtWebEngine QtPdf
- CONDITION sdkMinor GREATER_EQUAL 19041
- MESSAGE "Build requires Windows 10 SDK at least version 10.0.19041.0"
+ CONDITION sdkMinor GREATER_EQUAL 20348
+ MESSAGE "Build requires Windows 10 SDK at least version 10.0.20348.0"
)
endif()
diff --git a/dependencies.yaml b/dependencies.yaml
index 347b32951..f9f8bb9c7 100644
--- a/dependencies.yaml
+++ b/dependencies.yaml
@@ -1,13 +1,13 @@
dependencies:
../qtdeclarative:
- ref: 34e40275acd87e2d6cbcb28d5288074184cbe98f
+ ref: 1df17b067c1412823066955d67895a9a5e63af99
required: true
../qtpositioning:
- ref: 6dc09d7d021f315a04fc0ff1218048f848ed2022
+ ref: 05eff25b1e4a413d7b167b8327973ea266867c78
required: false
../qttools:
- ref: 182928c6a7a961019183538baeac9b037984b769
+ ref: 4b600512329ab595b5971ee79ee104db956f6129
required: false
../qtwebchannel:
- ref: 77e312be37835588f9f806d07b0847de8e350c87
+ ref: 27afaa14b9328dd773e876b8e32ec97c8f362213
required: false
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index ccad90e11..2d3ccab7e 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.16)
qt_examples_build_begin(EXTERNAL_BUILD)
diff --git a/examples/pdf/CMakeLists.txt b/examples/pdf/CMakeLists.txt
index 265d2ab8f..f1d45d477 100644
--- a/examples/pdf/CMakeLists.txt
+++ b/examples/pdf/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
qt_internal_add_example(pdfviewer)
qt_internal_add_example(multipage)
if(NOT TARGET Qt::Svg)
diff --git a/examples/pdf/multipage/CMakeLists.txt b/examples/pdf/multipage/CMakeLists.txt
index 66f4fc7b8..25cc726ed 100644
--- a/examples/pdf/multipage/CMakeLists.txt
+++ b/examples/pdf/multipage/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.16)
project(multipage LANGUAGES CXX)
@@ -13,8 +16,19 @@ find_package(Qt6 REQUIRED COMPONENTS Gui Qml)
qt_add_executable(multipage
main.cpp
+ pdfapplication.h
+ pdfapplication.cpp
)
+if (APPLE AND NOT IOS)
+ set(MACOSX_BUNDLE_ICON_FILE multipage.icns)
+ set(app_icon_macos "${CMAKE_CURRENT_SOURCE_DIR}/resources/multipage.icns")
+ set_source_files_properties(${app_icon_macos} PROPERTIES
+ MACOSX_PACKAGE_LOCATION "Resources")
+ target_sources(multipage PRIVATE ${app_icon_macos})
+ set(MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/resources/macos/Info.plist")
+endif()
+
set_target_properties(multipage PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
diff --git a/examples/pdf/multipage/doc/src/multipage.qdoc b/examples/pdf/multipage/doc/src/multipage.qdoc
index 7ab4984bc..b4963c508 100644
--- a/examples/pdf/multipage/doc/src/multipage.qdoc
+++ b/examples/pdf/multipage/doc/src/multipage.qdoc
@@ -3,6 +3,7 @@
/*!
\example multipage
+ \meta installpath pdf
\ingroup qtpdf-examples
\title PDF Multipage Viewer Example
diff --git a/examples/pdf/multipage/main.cpp b/examples/pdf/multipage/main.cpp
index f5b246ac4..9f9272d69 100644
--- a/examples/pdf/multipage/main.cpp
+++ b/examples/pdf/multipage/main.cpp
@@ -1,7 +1,7 @@
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-#include <QGuiApplication>
+#include "pdfapplication.h"
#include <QQmlApplicationEngine>
int main(int argc, char* argv[])
@@ -9,17 +9,17 @@ int main(int argc, char* argv[])
QCoreApplication::setApplicationName("Qt Quick Multi-page PDF Viewer Example");
QCoreApplication::setOrganizationName("QtProject");
QCoreApplication::setApplicationVersion(QT_VERSION_STR);
- QGuiApplication app(argc, argv);
+ PdfApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:///pdfviewer/viewer.qml")));
+ app.setFileOpener(engine.rootObjects().constFirst());
if (app.arguments().count() > 1) {
QUrl toLoad = QUrl::fromUserInput(app.arguments().at(1));
- engine.rootObjects().first()->setProperty("source", toLoad);
+ engine.rootObjects().constFirst()->setProperty("source", toLoad);
} else {
- engine.rootObjects().first()->setProperty("source", QStringLiteral("resources/test.pdf"));
+ engine.rootObjects().constFirst()->setProperty("source", QStringLiteral("resources/test.pdf"));
}
-
return app.exec();
}
diff --git a/examples/pdf/multipage/multipage.pro b/examples/pdf/multipage/multipage.pro
index bd08ba0de..c12651335 100644
--- a/examples/pdf/multipage/multipage.pro
+++ b/examples/pdf/multipage/multipage.pro
@@ -2,7 +2,7 @@ TEMPLATE = app
QT += qml quick pdf svg
-SOURCES += main.cpp
+SOURCES += main.cpp pdfapplication.cpp
RESOURCES += \
viewer.qrc
@@ -12,3 +12,5 @@ EXAMPLE_FILES = \
target.path = $$[QT_INSTALL_EXAMPLES]/pdf/multipage
INSTALLS += target
+macos:QMAKE_INFO_PLIST = resources/macos/Info.plist
+macos:ICON = resources/multipage.icns
diff --git a/examples/pdf/multipage/pdfapplication.cpp b/examples/pdf/multipage/pdfapplication.cpp
new file mode 100644
index 000000000..d8e7c6486
--- /dev/null
+++ b/examples/pdf/multipage/pdfapplication.cpp
@@ -0,0 +1,16 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include "pdfapplication.h"
+#include <QFileOpenEvent>
+
+PdfApplication::PdfApplication(int &argc, char **argv)
+ : QGuiApplication(argc, argv) { }
+
+bool PdfApplication::event(QEvent *e) {
+ if (e->type() == QEvent::FileOpen) {
+ QFileOpenEvent *foEvent = static_cast<QFileOpenEvent *>(e);
+ m_fileOpener->setProperty("source", foEvent->url());
+ }
+ return QGuiApplication::event(e);
+}
diff --git a/examples/pdf/multipage/pdfapplication.h b/examples/pdf/multipage/pdfapplication.h
new file mode 100644
index 000000000..06c998e1c
--- /dev/null
+++ b/examples/pdf/multipage/pdfapplication.h
@@ -0,0 +1,24 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#ifndef PDFAPPLICATION_H
+#define PDFAPPLICATION_H
+
+#include <QGuiApplication>
+#include <QObject>
+
+class PdfApplication : public QGuiApplication
+{
+public:
+ PdfApplication(int &argc, char **argv);
+ void setFileOpener(QObject *opener) {
+ m_fileOpener = opener;
+ }
+
+protected:
+ bool event(QEvent *e) override;
+
+ QObject *m_fileOpener;
+};
+
+#endif // PDFAPPLICATION_H
diff --git a/examples/pdf/multipage/resources/macos/Info.plist b/examples/pdf/multipage/resources/macos/Info.plist
new file mode 100644
index 000000000..512becda0
--- /dev/null
+++ b/examples/pdf/multipage/resources/macos/Info.plist
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
+<plist version="0.1">
+<dict>
+ <key>CFBundleIconFile</key>
+ <string>multipage</string>
+ <key>CFBundleIdentifier</key>
+ <string>org.qt-project.multipage</string>
+ <key>CFBundleDisplayName</key>
+ <string>Multi-page PDF Viewer</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleExecutable</key>
+ <string>multipage</string>
+ <key>CFBundleDocumentTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleTypeRole</key>
+ <string>Viewer</string>
+ <key>CFBundleTypeName</key>
+ <string>pdf</string>
+ <key>LSItemContentTypes</key>
+ <array>
+ <string>com.adobe.pdf</string>
+ </array>
+ </dict>
+ </array>
+</dict>
+</plist>
diff --git a/examples/pdf/multipage/resources/multipage.icns b/examples/pdf/multipage/resources/multipage.icns
new file mode 100644
index 000000000..2e3756903
--- /dev/null
+++ b/examples/pdf/multipage/resources/multipage.icns
Binary files differ
diff --git a/examples/pdf/multipage/viewer.qml b/examples/pdf/multipage/viewer.qml
index 56e7188f6..fcf326869 100644
--- a/examples/pdf/multipage/viewer.qml
+++ b/examples/pdf/multipage/viewer.qml
@@ -194,6 +194,19 @@ ApplicationWindow {
onCurrentPageChanged: currentPageSB.value = view.currentPage + 1
}
+ DropArea {
+ anchors.fill: parent
+ keys: ["text/uri-list"]
+ onEntered: (drag) => {
+ drag.accepted = (drag.proposedAction === Qt.MoveAction || drag.proposedAction === Qt.CopyAction) &&
+ drag.hasUrls && drag.urls[0].endsWith("pdf")
+ }
+ onDropped: (drop) => {
+ doc.source = drop.urls[0]
+ drop.acceptProposedAction()
+ }
+ }
+
Drawer {
id: sidebar
edge: Qt.LeftEdge
diff --git a/examples/pdf/pdfviewer/CMakeLists.txt b/examples/pdf/pdfviewer/CMakeLists.txt
index 179734dc4..b664fb6f2 100644
--- a/examples/pdf/pdfviewer/CMakeLists.txt
+++ b/examples/pdf/pdfviewer/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.16)
project(pdfviewer LANGUAGES CXX)
diff --git a/examples/pdf/pdfviewer/main.cpp b/examples/pdf/pdfviewer/main.cpp
index da940dd3f..bed0e5860 100644
--- a/examples/pdf/pdfviewer/main.cpp
+++ b/examples/pdf/pdfviewer/main.cpp
@@ -1,9 +1,13 @@
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-#include <QGuiApplication>
#include <QQmlApplicationEngine>
+#include <QGuiApplication>
+
+#include <QCommandLineParser>
+#include <QCommandLineOption>
+
int main(int argc, char* argv[])
{
QCoreApplication::setApplicationName("Qt Quick PDF Viewer Example");
@@ -11,14 +15,23 @@ int main(int argc, char* argv[])
QCoreApplication::setApplicationVersion(QT_VERSION_STR);
QGuiApplication app(argc, argv);
+ QCommandLineParser parser;
+ parser.addHelpOption();
+ parser.addVersionOption();
+ parser.addPositionalArgument("file", "The file to open.");
+ parser.process(app);
+
QQmlApplicationEngine engine;
+
+ QUrl toLoad = QUrl("qrc:/pdfviewer/resources/test.pdf");
+ if (!parser.positionalArguments().isEmpty())
+ toLoad = QUrl::fromLocalFile(parser.positionalArguments().constFirst());
+
+ engine.setInitialProperties({{"source", toLoad}});
+
engine.load(QUrl(QStringLiteral("qrc:///pdfviewer/viewer.qml")));
- if (app.arguments().count() > 1) {
- QUrl toLoad = QUrl::fromUserInput(app.arguments().at(1));
- engine.rootObjects().first()->setProperty("source", toLoad);
- } else {
- engine.rootObjects().first()->setProperty("source", QStringLiteral("resources/test.pdf"));
- }
+ if (engine.rootObjects().isEmpty())
+ return -1;
return app.exec();
}
diff --git a/examples/pdf/pdfviewer/viewer.qml b/examples/pdf/pdfviewer/viewer.qml
index 9f78c1404..a62035166 100644
--- a/examples/pdf/pdfviewer/viewer.qml
+++ b/examples/pdf/pdfviewer/viewer.qml
@@ -13,7 +13,7 @@ ApplicationWindow {
color: "lightgrey"
title: document.title
visible: true
- property string source // for main.cpp
+ required property url source // for main.cpp
property real scaleStep: Math.sqrt(2)
header: ToolBar {
diff --git a/examples/pdfwidgets/pdfviewer/CMakeLists.txt b/examples/pdfwidgets/pdfviewer/CMakeLists.txt
index e1d2fb580..901509f62 100644
--- a/examples/pdfwidgets/pdfviewer/CMakeLists.txt
+++ b/examples/pdfwidgets/pdfviewer/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.16)
project(pdfviewer LANGUAGES CXX)
diff --git a/examples/pdfwidgets/pdfviewer/doc/src/pdfviewer.qdoc b/examples/pdfwidgets/pdfviewer/doc/src/pdfviewer.qdoc
index 64b453be9..8a60e06d6 100644
--- a/examples/pdfwidgets/pdfviewer/doc/src/pdfviewer.qdoc
+++ b/examples/pdfwidgets/pdfviewer/doc/src/pdfviewer.qdoc
@@ -3,6 +3,7 @@
/*!
\example pdfviewer
+ \meta installpath pdfwidgets
\ingroup qtpdf-examples
\title PDF Viewer Example
diff --git a/examples/pdfwidgets/pdfviewer/main.cpp b/examples/pdfwidgets/pdfviewer/main.cpp
index 7df5fe253..6b890e0ac 100644
--- a/examples/pdfwidgets/pdfviewer/main.cpp
+++ b/examples/pdfwidgets/pdfviewer/main.cpp
@@ -3,16 +3,27 @@
#include "mainwindow.h"
#include <QApplication>
+#include <QCommandLineParser>
+#include <QCommandLineOption>
#include <QUrl>
int main(int argc, char *argv[])
{
+ QCoreApplication::setApplicationName("Qt PDF Viewer");
+ QCoreApplication::setOrganizationName("QtProject");
+
QApplication a(argc, argv);
+
+ QCommandLineParser parser;
+ parser.addHelpOption();
+ parser.addVersionOption();
+ parser.addPositionalArgument("file", "The file to open.");
+ parser.process(a);
+
MainWindow w;
- QStringList args = a.arguments();
w.show();
- if (args.length() > 1)
- w.open(QUrl::fromLocalFile(args[1]));
+ if (!parser.positionalArguments().isEmpty())
+ w.open(QUrl::fromLocalFile(parser.positionalArguments().constFirst()));
return a.exec();
}
diff --git a/examples/pdfwidgets/pdfviewer/mainwindow.cpp b/examples/pdfwidgets/pdfviewer/mainwindow.cpp
index 2358b6b4a..02caffa48 100644
--- a/examples/pdfwidgets/pdfviewer/mainwindow.cpp
+++ b/examples/pdfwidgets/pdfviewer/mainwindow.cpp
@@ -12,6 +12,7 @@
#include <QPdfBookmarkModel>
#include <QPdfDocument>
#include <QPdfPageNavigator>
+#include <QStandardPaths>
#include <QtMath>
const qreal zoomMultiplier = qSqrt(2.0);
@@ -45,7 +46,7 @@ MainWindow::MainWindow(QWidget *parent)
bookmarkModel->setDocument(m_document);
ui->bookmarkView->setModel(bookmarkModel);
- connect(ui->bookmarkView, SIGNAL(activated(QModelIndex)), this, SLOT(bookmarkSelected(QModelIndex)));
+ connect(ui->bookmarkView, &QAbstractItemView::activated, this, &MainWindow::bookmarkSelected);
ui->tabWidget->setTabEnabled(1, false); // disable 'Pages' tab for now
@@ -69,8 +70,9 @@ void MainWindow::open(const QUrl &docLocation)
pageSelected(0);
m_pageSelector->setMaximum(m_document->pageCount() - 1);
} else {
- qCDebug(lcExample) << docLocation << "is not a valid local file";
- QMessageBox::critical(this, tr("Failed to open"), tr("%1 is not a valid local file").arg(docLocation.toString()));
+ const QString message = tr("%1 is not a valid local file").arg(docLocation.toString());
+ qCDebug(lcExample).noquote() << message;
+ QMessageBox::critical(this, tr("Failed to open"), message);
}
qCDebug(lcExample) << docLocation;
}
@@ -93,9 +95,18 @@ void MainWindow::pageSelected(int page)
void MainWindow::on_actionOpen_triggered()
{
- QUrl toOpen = QFileDialog::getOpenFileUrl(this, tr("Choose a PDF"), QUrl(), "Portable Documents (*.pdf)");
- if (toOpen.isValid())
- open(toOpen);
+ if (m_fileDialog == nullptr) {
+ m_fileDialog = new QFileDialog(this, tr("Choose a PDF"),
+ QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation));
+ m_fileDialog->setAcceptMode(QFileDialog::AcceptOpen);
+ m_fileDialog->setMimeTypeFilters({"application/pdf"});
+ }
+
+ if (m_fileDialog->exec() == QDialog::Accepted) {
+ const QUrl toOpen = m_fileDialog->selectedUrls().constFirst();
+ if (toOpen.isValid())
+ open(toOpen);
+ }
}
void MainWindow::on_actionQuit_triggered()
diff --git a/examples/pdfwidgets/pdfviewer/mainwindow.h b/examples/pdfwidgets/pdfviewer/mainwindow.h
index 74349b5e5..958e11061 100644
--- a/examples/pdfwidgets/pdfviewer/mainwindow.h
+++ b/examples/pdfwidgets/pdfviewer/mainwindow.h
@@ -14,6 +14,7 @@ namespace Ui {
class MainWindow;
}
+class QFileDialog;
class QPdfDocument;
class QPdfView;
class QSpinBox;
@@ -53,6 +54,7 @@ private:
Ui::MainWindow *ui;
ZoomSelector *m_zoomSelector;
QSpinBox *m_pageSelector;
+ QFileDialog *m_fileDialog = nullptr;
QPdfDocument *m_document;
};
diff --git a/examples/webenginequick/CMakeLists.txt b/examples/webenginequick/CMakeLists.txt
index dc42b3dfe..14d2f5b51 100644
--- a/examples/webenginequick/CMakeLists.txt
+++ b/examples/webenginequick/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
qt_internal_add_example(customdialogs)
qt_internal_add_example(customtouchhandle)
qt_internal_add_example(lifecycle)
diff --git a/examples/webenginequick/customdialogs/CMakeLists.txt b/examples/webenginequick/customdialogs/CMakeLists.txt
index b1899fd66..7908bec62 100644
--- a/examples/webenginequick/customdialogs/CMakeLists.txt
+++ b/examples/webenginequick/customdialogs/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.16)
project(customdialogs LANGUAGES CXX)
diff --git a/examples/webenginequick/customtouchhandle/CMakeLists.txt b/examples/webenginequick/customtouchhandle/CMakeLists.txt
index 3ec47e8bd..e84e97524 100644
--- a/examples/webenginequick/customtouchhandle/CMakeLists.txt
+++ b/examples/webenginequick/customtouchhandle/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.16)
project(customtouchhandle LANGUAGES CXX)
diff --git a/examples/webenginequick/lifecycle/CMakeLists.txt b/examples/webenginequick/lifecycle/CMakeLists.txt
index 556b50706..1aea57c73 100644
--- a/examples/webenginequick/lifecycle/CMakeLists.txt
+++ b/examples/webenginequick/lifecycle/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.16)
project(lifecycle LANGUAGES CXX)
diff --git a/examples/webenginequick/minimal/CMakeLists.txt b/examples/webenginequick/minimal/CMakeLists.txt
index e0cb66733..f4715bb97 100644
--- a/examples/webenginequick/minimal/CMakeLists.txt
+++ b/examples/webenginequick/minimal/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.16)
project(minimal LANGUAGES CXX)
diff --git a/examples/webenginequick/quicknanobrowser/ApplicationRoot.qml b/examples/webenginequick/quicknanobrowser/ApplicationRoot.qml
index 9a40fab15..55c414409 100644
--- a/examples/webenginequick/quicknanobrowser/ApplicationRoot.qml
+++ b/examples/webenginequick/quicknanobrowser/ApplicationRoot.qml
@@ -1,4 +1,4 @@
-// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick
diff --git a/examples/webenginequick/quicknanobrowser/BrowserDialog.qml b/examples/webenginequick/quicknanobrowser/BrowserDialog.qml
index a19ab62bf..c155c3f35 100644
--- a/examples/webenginequick/quicknanobrowser/BrowserDialog.qml
+++ b/examples/webenginequick/quicknanobrowser/BrowserDialog.qml
@@ -1,4 +1,4 @@
-// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick
diff --git a/examples/webenginequick/quicknanobrowser/BrowserWindow.qml b/examples/webenginequick/quicknanobrowser/BrowserWindow.qml
index 3fa481787..7c2a21cd5 100644
--- a/examples/webenginequick/quicknanobrowser/BrowserWindow.qml
+++ b/examples/webenginequick/quicknanobrowser/BrowserWindow.qml
@@ -1,4 +1,4 @@
-// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import Qt.labs.settings
@@ -8,6 +8,7 @@ import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Window
import QtWebEngine
+import BrowserUtils
ApplicationWindow {
id: browserWindow
@@ -272,7 +273,7 @@ ApplicationWindow {
when: currentWebView
value: currentWebView.url
}
- onAccepted: currentWebView.url = utils.fromUserInput(text)
+ onAccepted: currentWebView.url = Utils.fromUserInput(text)
selectByMouse: true
}
ToolButton {
diff --git a/examples/webenginequick/quicknanobrowser/CMakeLists.txt b/examples/webenginequick/quicknanobrowser/CMakeLists.txt
index cdccc26be..a9ec7d90f 100644
--- a/examples/webenginequick/quicknanobrowser/CMakeLists.txt
+++ b/examples/webenginequick/quicknanobrowser/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.16)
project(quicknanobrowser LANGUAGES CXX)
@@ -29,6 +32,11 @@ target_link_libraries(quicknanobrowser PUBLIC
Qt::WebEngineQuick
)
+qt_add_qml_module(quicknanobrowser
+ URI BrowserUtils
+ VERSION 1.0
+)
+
# Resources:
set(resources_resource_files
"ApplicationRoot.qml"
diff --git a/examples/webenginequick/quicknanobrowser/DownloadView.qml b/examples/webenginequick/quicknanobrowser/DownloadView.qml
index 124ae4e9d..e16647cdb 100644
--- a/examples/webenginequick/quicknanobrowser/DownloadView.qml
+++ b/examples/webenginequick/quicknanobrowser/DownloadView.qml
@@ -1,4 +1,4 @@
-// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick
diff --git a/examples/webenginequick/quicknanobrowser/FindBar.qml b/examples/webenginequick/quicknanobrowser/FindBar.qml
index 34713479f..4d130a22b 100644
--- a/examples/webenginequick/quicknanobrowser/FindBar.qml
+++ b/examples/webenginequick/quicknanobrowser/FindBar.qml
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Qt Company Ltd.
+// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick
diff --git a/examples/webenginequick/quicknanobrowser/FullScreenNotification.qml b/examples/webenginequick/quicknanobrowser/FullScreenNotification.qml
index e0f3da411..779406432 100644
--- a/examples/webenginequick/quicknanobrowser/FullScreenNotification.qml
+++ b/examples/webenginequick/quicknanobrowser/FullScreenNotification.qml
@@ -1,4 +1,4 @@
-// Copyright (C) 2015 The Qt Company Ltd.
+// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick
diff --git a/examples/webenginequick/quicknanobrowser/main.cpp b/examples/webenginequick/quicknanobrowser/main.cpp
index bdb31644f..519cfd089 100644
--- a/examples/webenginequick/quicknanobrowser/main.cpp
+++ b/examples/webenginequick/quicknanobrowser/main.cpp
@@ -1,43 +1,51 @@
-// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "utils.h"
-#include <QtGui/QGuiApplication>
+#include <QtWebEngineQuick/qtwebenginequickglobal.h>
+
#include <QtQml/QQmlApplicationEngine>
#include <QtQml/QQmlContext>
-#include <QtWebEngineQuick/qtwebenginequickglobal.h>
-static QUrl startupUrl()
+#include <QtGui/QGuiApplication>
+
+#include <QtCore/QCommandLineParser>
+#include <QtCore/QCommandLineOption>
+
+static QUrl startupUrl(const QCommandLineParser &parser)
{
- QUrl ret;
- QStringList args(qApp->arguments());
- args.takeFirst();
- for (const QString &arg : qAsConst(args)) {
- if (arg.startsWith(QLatin1Char('-')))
- continue;
- ret = Utils::fromUserInput(arg);
- if (ret.isValid())
- return ret;
+ if (!parser.positionalArguments().isEmpty()) {
+ const QUrl url = Utils::fromUserInput(parser.positionalArguments().constFirst());
+ if (url.isValid())
+ return url;
}
return QUrl(QStringLiteral("https://www.qt.io"));
}
int main(int argc, char **argv)
{
- QCoreApplication::setOrganizationName("QtExamples");
+ QCoreApplication::setApplicationName("Quick Nano Browser");
+ QCoreApplication::setOrganizationName("QtProject");
+
QtWebEngineQuick::initialize();
QGuiApplication app(argc, argv);
+ QCommandLineParser parser;
+ parser.addHelpOption();
+ parser.addVersionOption();
+ parser.addPositionalArgument("url", "The URL to open.");
+ parser.process(app);
+
QQmlApplicationEngine appEngine;
- Utils utils;
- appEngine.rootContext()->setContextProperty("utils", &utils);
appEngine.load(QUrl("qrc:/ApplicationRoot.qml"));
- if (!appEngine.rootObjects().isEmpty())
- QMetaObject::invokeMethod(appEngine.rootObjects().first(), "load", Q_ARG(QVariant, startupUrl()));
- else
+ if (appEngine.rootObjects().isEmpty())
qFatal("Failed to load sources");
+ const QUrl url = startupUrl(parser);
+ QMetaObject::invokeMethod(appEngine.rootObjects().constFirst(),
+ "load", Q_ARG(QVariant, url));
+
return app.exec();
}
diff --git a/examples/webenginequick/quicknanobrowser/quicknanobrowser.pro b/examples/webenginequick/quicknanobrowser/quicknanobrowser.pro
index 3a014fe20..e4c0cdfd1 100644
--- a/examples/webenginequick/quicknanobrowser/quicknanobrowser.pro
+++ b/examples/webenginequick/quicknanobrowser/quicknanobrowser.pro
@@ -10,6 +10,10 @@ RESOURCES += resources.qrc
QT += qml quick webenginequick
+CONFIG += qmltypes
+QML_IMPORT_NAME = BrowserUtils
+QML_IMPORT_MAJOR_VERSION = 1
+
qtHaveModule(widgets) {
QT += widgets # QApplication is required to get native styling with QtQuickControls
}
diff --git a/examples/webenginequick/quicknanobrowser/utils.h b/examples/webenginequick/quicknanobrowser/utils.h
index 0c57ab19b..6c11e75fb 100644
--- a/examples/webenginequick/quicknanobrowser/utils.h
+++ b/examples/webenginequick/quicknanobrowser/utils.h
@@ -1,18 +1,24 @@
-// Copyright (C) 2016 The Qt Company Ltd.
+// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
#ifndef UTILS_H
#define UTILS_H
+#include <QtQml/qqml.h>
+
#include <QtCore/QFileInfo>
#include <QtCore/QUrl>
-class Utils : public QObject {
+class Utils : public QObject
+{
Q_OBJECT
+ QML_ELEMENT
+ QML_SINGLETON
public:
- Q_INVOKABLE static QUrl fromUserInput(const QString& userInput);
+ Q_INVOKABLE static QUrl fromUserInput(const QString &userInput);
};
-inline QUrl Utils::fromUserInput(const QString& userInput)
+inline QUrl Utils::fromUserInput(const QString &userInput)
{
QFileInfo fileInfo(userInput);
if (fileInfo.exists())
diff --git a/examples/webenginequick/recipebrowser/CMakeLists.txt b/examples/webenginequick/recipebrowser/CMakeLists.txt
index 57a73b4aa..12aa7c1d3 100644
--- a/examples/webenginequick/recipebrowser/CMakeLists.txt
+++ b/examples/webenginequick/recipebrowser/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.16)
project(recipebrowser LANGUAGES CXX)
diff --git a/examples/webenginequick/webengineaction/CMakeLists.txt b/examples/webenginequick/webengineaction/CMakeLists.txt
index 1d6ae3fe5..e019bccf0 100644
--- a/examples/webenginequick/webengineaction/CMakeLists.txt
+++ b/examples/webenginequick/webengineaction/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.16)
project(webengineaction LANGUAGES CXX)
diff --git a/examples/webenginewidgets/CMakeLists.txt b/examples/webenginewidgets/CMakeLists.txt
index d9b12607f..ef4708ec7 100644
--- a/examples/webenginewidgets/CMakeLists.txt
+++ b/examples/webenginewidgets/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
qt_internal_add_example(minimal)
qt_internal_add_example(contentmanipulation)
qt_internal_add_example(cookiebrowser)
diff --git a/examples/webenginewidgets/contentmanipulation/CMakeLists.txt b/examples/webenginewidgets/contentmanipulation/CMakeLists.txt
index b53274507..7edf62044 100644
--- a/examples/webenginewidgets/contentmanipulation/CMakeLists.txt
+++ b/examples/webenginewidgets/contentmanipulation/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.16)
project(contentmanipulation LANGUAGES CXX)
diff --git a/examples/webenginewidgets/cookiebrowser/CMakeLists.txt b/examples/webenginewidgets/cookiebrowser/CMakeLists.txt
index c5c6b41d3..e606e848d 100644
--- a/examples/webenginewidgets/cookiebrowser/CMakeLists.txt
+++ b/examples/webenginewidgets/cookiebrowser/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.16)
project(cookiebrowser LANGUAGES CXX)
diff --git a/examples/webenginewidgets/html2pdf/CMakeLists.txt b/examples/webenginewidgets/html2pdf/CMakeLists.txt
index 7e3758d1a..034b89102 100644
--- a/examples/webenginewidgets/html2pdf/CMakeLists.txt
+++ b/examples/webenginewidgets/html2pdf/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.16)
project(html2pdf LANGUAGES CXX)
diff --git a/examples/webenginewidgets/maps/CMakeLists.txt b/examples/webenginewidgets/maps/CMakeLists.txt
index 62eb04e42..f6e6b94ea 100644
--- a/examples/webenginewidgets/maps/CMakeLists.txt
+++ b/examples/webenginewidgets/maps/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.16)
project(maps LANGUAGES CXX)
diff --git a/examples/webenginewidgets/markdowneditor/CMakeLists.txt b/examples/webenginewidgets/markdowneditor/CMakeLists.txt
index c1a0974a0..808c69521 100644
--- a/examples/webenginewidgets/markdowneditor/CMakeLists.txt
+++ b/examples/webenginewidgets/markdowneditor/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.16)
project(markdowneditor LANGUAGES CXX)
diff --git a/examples/webenginewidgets/minimal/CMakeLists.txt b/examples/webenginewidgets/minimal/CMakeLists.txt
index 7c1cac1d8..68642c638 100644
--- a/examples/webenginewidgets/minimal/CMakeLists.txt
+++ b/examples/webenginewidgets/minimal/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.16)
project(minimal LANGUAGES CXX)
diff --git a/examples/webenginewidgets/notifications/CMakeLists.txt b/examples/webenginewidgets/notifications/CMakeLists.txt
index 17d4f343b..688d06eb2 100644
--- a/examples/webenginewidgets/notifications/CMakeLists.txt
+++ b/examples/webenginewidgets/notifications/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.16)
project(notifications LANGUAGES CXX)
diff --git a/examples/webenginewidgets/printme/CMakeLists.txt b/examples/webenginewidgets/printme/CMakeLists.txt
index 2c38103c1..013ba48ca 100644
--- a/examples/webenginewidgets/printme/CMakeLists.txt
+++ b/examples/webenginewidgets/printme/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.16)
project(printme LANGUAGES CXX)
diff --git a/examples/webenginewidgets/simplebrowser/CMakeLists.txt b/examples/webenginewidgets/simplebrowser/CMakeLists.txt
index f23bce709..2dd4fd57a 100644
--- a/examples/webenginewidgets/simplebrowser/CMakeLists.txt
+++ b/examples/webenginewidgets/simplebrowser/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.16)
project(simplebrowser LANGUAGES CXX)
diff --git a/examples/webenginewidgets/simplebrowser/webview.cpp b/examples/webenginewidgets/simplebrowser/webview.cpp
index f882db670..16a58ce6c 100644
--- a/examples/webenginewidgets/simplebrowser/webview.cpp
+++ b/examples/webenginewidgets/simplebrowser/webview.cpp
@@ -97,8 +97,10 @@ void WebView::setPage(WebPage *page)
&WebView::handleProxyAuthenticationRequired);
disconnect(oldPage, &QWebEnginePage::registerProtocolHandlerRequested, this,
&WebView::handleRegisterProtocolHandlerRequested);
+#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
disconnect(oldPage, &QWebEnginePage::fileSystemAccessRequested, this,
&WebView::handleFileSystemAccessRequested);
+#endif
}
createWebActionTrigger(page,QWebEnginePage::Forward);
createWebActionTrigger(page,QWebEnginePage::Back);
@@ -114,8 +116,10 @@ void WebView::setPage(WebPage *page)
&WebView::handleProxyAuthenticationRequired);
connect(page, &QWebEnginePage::registerProtocolHandlerRequested, this,
&WebView::handleRegisterProtocolHandlerRequested);
+#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
connect(page, &QWebEnginePage::fileSystemAccessRequested, this,
&WebView::handleFileSystemAccessRequested);
+#endif
}
int WebView::loadProgress() const
@@ -305,6 +309,7 @@ void WebView::handleRegisterProtocolHandlerRequested(
}
//! [registerProtocolHandlerRequested]
+#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
void WebView::handleFileSystemAccessRequested(QWebEngineFileSystemAccessRequest request)
{
QString accessType;
@@ -332,3 +337,4 @@ void WebView::handleFileSystemAccessRequested(QWebEngineFileSystemAccessRequest
else
request.reject();
}
+#endif // QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
diff --git a/examples/webenginewidgets/simplebrowser/webview.h b/examples/webenginewidgets/simplebrowser/webview.h
index 1ba2e74df..63f82c3c9 100644
--- a/examples/webenginewidgets/simplebrowser/webview.h
+++ b/examples/webenginewidgets/simplebrowser/webview.h
@@ -7,7 +7,9 @@
#include <QIcon>
#include <QWebEngineView>
#include <QWebEngineCertificateError>
+#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
#include <QWebEngineFileSystemAccessRequest>
+#endif
#include <QWebEnginePage>
#include <QWebEngineRegisterProtocolHandlerRequest>
@@ -41,7 +43,9 @@ private slots:
void handleProxyAuthenticationRequired(const QUrl &requestUrl, QAuthenticator *auth,
const QString &proxyHost);
void handleRegisterProtocolHandlerRequested(QWebEngineRegisterProtocolHandlerRequest request);
+#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
void handleFileSystemAccessRequested(QWebEngineFileSystemAccessRequest request);
+#endif
private:
void createWebActionTrigger(QWebEnginePage *page, QWebEnginePage::WebAction);
diff --git a/examples/webenginewidgets/spellchecker/CMakeLists.txt b/examples/webenginewidgets/spellchecker/CMakeLists.txt
index d76881c65..74cb626e1 100644
--- a/examples/webenginewidgets/spellchecker/CMakeLists.txt
+++ b/examples/webenginewidgets/spellchecker/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.16)
project(spellchecker LANGUAGES CXX)
diff --git a/examples/webenginewidgets/stylesheetbrowser/CMakeLists.txt b/examples/webenginewidgets/stylesheetbrowser/CMakeLists.txt
index 55bd6715e..56ecd51f3 100644
--- a/examples/webenginewidgets/stylesheetbrowser/CMakeLists.txt
+++ b/examples/webenginewidgets/stylesheetbrowser/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.16)
project(stylesheetbrowser LANGUAGES CXX)
diff --git a/examples/webenginewidgets/videoplayer/CMakeLists.txt b/examples/webenginewidgets/videoplayer/CMakeLists.txt
index 4e3e3cc2c..87ec9b086 100644
--- a/examples/webenginewidgets/videoplayer/CMakeLists.txt
+++ b/examples/webenginewidgets/videoplayer/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.16)
project(videoplayer LANGUAGES CXX)
diff --git a/examples/webenginewidgets/webui/CMakeLists.txt b/examples/webenginewidgets/webui/CMakeLists.txt
index e736a2cde..8f6e95045 100644
--- a/examples/webenginewidgets/webui/CMakeLists.txt
+++ b/examples/webenginewidgets/webui/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.16)
project(webui LANGUAGES CXX)
diff --git a/qt_cmdline.cmake b/qt_cmdline.cmake
index 568580c63..f89692711 100644
--- a/qt_cmdline.cmake
+++ b/qt_cmdline.cmake
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
qt_commandline_option(build-qtpdf TYPE boolean NAME qtpdf-build)
qt_commandline_option(webengine-developer-build TYPE boolean)
diff --git a/src/3rdparty b/src/3rdparty
-Subproject 185dfeb21f478a8503f424570eff01177a46721
+Subproject 1dc53de694e05a192d4757835f66e0797b7d29b
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e7600542e..771446ece 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
##
# MAIN CONFIGURE
##
@@ -191,5 +194,22 @@ if((LINUX OR MACOS) AND INSTALL_GN)
CONFIGURATIONS ${installConfig}
RUNTIME DESTINATION "${INSTALL_LIBEXECDIR}"
)
+ if(NOT QT_WILL_INSTALL)
+ add_custom_target(copy-gn ALL DEPENDS
+ ${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/gn
+ )
+ if(Gn_FOUND)
+ set(copyDep ${Gn_EXECUTABLE})
+ else()
+ set(copyDep gn)
+ endif()
+ add_custom_command(
+ OUTPUT ${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/gn
+ COMMAND ${CMAKE_COMMAND} -E copy ${installDir}/bin/gn
+ ${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}
+ DEPENDS ${copyDep}
+ USES_TERMINAL
+ )
+ endif()
endif()
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 904baf7d2..c0a2441d3 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.19)
find_package(Ninja 1.7.2 REQUIRED)
@@ -222,6 +225,8 @@ foreach(arch ${archs})
extend_gn_target(${buildGn} CONDITION QT_FEATURE_webengine_printing_and_pdf
SOURCES
printing/pdfium_document_wrapper_qt.cpp printing/pdfium_document_wrapper_qt.h
+ printing/pdf_web_contents_helper_client_qt.cpp printing/pdf_web_contents_helper_client_qt.h
+ printing/pdf_stream_delegate_qt.cpp printing/pdf_stream_delegate_qt.h
printing/print_view_manager_base_qt.cpp printing/print_view_manager_base_qt.h
printing/print_view_manager_qt.cpp printing/print_view_manager_qt.h
printing/printer_worker.cpp printing/printer_worker.h
@@ -252,7 +257,6 @@ foreach(arch ${archs})
extensions/extensions_browser_client_qt.cpp extensions/extensions_browser_client_qt.h
extensions/messaging_delegate_qt.cpp extensions/messaging_delegate_qt.h
extensions/mime_handler_view_guest_delegate_qt.cpp extensions/mime_handler_view_guest_delegate_qt.h
- extensions/pdf_iframe_navigation_throttle_qt.cpp extensions/pdf_iframe_navigation_throttle_qt.h
extensions/plugin_service_filter_qt.cpp extensions/plugin_service_filter_qt.h
net/plugin_response_interceptor_url_loader_throttle.cpp net/plugin_response_interceptor_url_loader_throttle.h
renderer/extensions/extensions_dispatcher_delegate_qt.cpp renderer/extensions/extensions_dispatcher_delegate_qt.h
@@ -261,6 +265,11 @@ foreach(arch ${archs})
renderer/extensions/resource_request_policy_qt.cpp renderer/extensions/resource_request_policy_qt.h
)
+ extend_gn_target(${buildGn} CONDITION QT_FEATURE_webengine_extensions AND QT_FEATURE_webengine_printing_and_pdf
+ SOURCES
+ extensions/pdf_iframe_navigation_throttle_qt.cpp extensions/pdf_iframe_navigation_throttle_qt.h
+ )
+
extend_gn_target(${buildGn} CONDITION WIN32
SOURCES
clipboard_util_win.cpp
@@ -280,16 +289,22 @@ foreach(arch ${archs})
list(APPEND gnArgArg
qtwebengine_target="${buildDir}/${config}/${arch}:QtWebEngineCore"
+ enable_background_contents=false
+ enable_background_mode=false
enable_ipc_fuzzer=false
+ enable_js_type_check=false
enable_media_remoting=false
enable_message_center=false
enable_nacl=false
+ enable_one_click_signin=false
+ enable_oop_printing=false
enable_remoting=false
enable_reporting=false
enable_resource_allowlist_generation=false
enable_swiftshader=false
enable_swiftshader_vulkan=false
angle_enable_swiftshader=false
+ dawn_use_swiftshader=false
enable_web_speech=false
enable_widevine=true
fatal_linker_warnings=false
@@ -299,10 +314,10 @@ foreach(arch ${archs})
toolkit_views=false
chrome_pgo_phase=0
optimize_webui=false
- enable_js_type_check=false
v8_use_external_startup_data=false
strip_absolute_paths_from_debug_symbols=false
- enable_oop_printing=false
+ devtools_fast_bundle=false
+ devtools_skip_typecheck=false
)
extend_gn_list(gnArgArg
@@ -352,6 +367,10 @@ foreach(arch ${archs})
ARGS use_browser_spellchecker
CONDITION QT_FEATURE_webengine_native_spellchecker
)
+ extend_gn_list(gnArgArg
+ ARGS use_embedded_config
+ CONDITION QT_FEATURE_webengine_embedded_build
+ )
if(LINUX)
list(APPEND gnArgArg
diff --git a/src/core/accessibility_tree_formatter_qt.cpp b/src/core/accessibility_tree_formatter_qt.cpp
index 0f642b947..6167bc73b 100644
--- a/src/core/accessibility_tree_formatter_qt.cpp
+++ b/src/core/accessibility_tree_formatter_qt.cpp
@@ -7,10 +7,10 @@
#include "base/strings/stringprintf.h"
#include "base/values.h"
-#include "content/browser/accessibility/accessibility_event_recorder.h"
#include "content/browser/accessibility/accessibility_tree_formatter_blink.h"
#include "content/browser/accessibility/browser_accessibility.h"
#include "content/public/browser/ax_inspect_factory.h"
+#include "ui/accessibility/platform/inspect/ax_event_recorder.h"
#include "browser_accessibility_qt.h"
@@ -150,9 +150,8 @@ std::string AccessibilityTreeFormatterQt::ProcessTreeForOutput(const base::Dicti
const base::ListValue *states_value = nullptr;
if (node.GetList("states", &states_value)) {
for (const auto &state : states_value->GetList()) {
- std::string state_value;
- if (state.GetAsString(&state_value))
- WriteAttribute(false, state_value, &line);
+ if (auto *state_value = state.GetIfString())
+ WriteAttribute(false, *state_value, &line);
}
}
@@ -214,7 +213,7 @@ std::unique_ptr<ui::AXEventRecorder> AXInspectFactory::CreateRecorder(ui::AXApiT
{
switch (type) {
case ui::AXApiType::kQt:
- return std::make_unique<AccessibilityEventRecorder>(manager);
+ return std::make_unique<ui::AXEventRecorder>();
default:
NOTREACHED() << "Unsupported inspect type " << type;
}
diff --git a/src/core/api/CMakeLists.txt b/src/core/api/CMakeLists.txt
index 2d493c04c..0ee286031 100644
--- a/src/core/api/CMakeLists.txt
+++ b/src/core/api/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
find_package(Qt6 ${PROJECT_VERSION} REQUIRED COMPONENTS Gui Network Quick)
find_package(Qt6 ${PROJECT_VERSION} QUIET OPTIONAL_COMPONENTS WebChannel Positioning)
diff --git a/src/core/api/Qt6WebEngineCoreMacros.cmake b/src/core/api/Qt6WebEngineCoreMacros.cmake
index efb34882b..7e23f377e 100644
--- a/src/core/api/Qt6WebEngineCoreMacros.cmake
+++ b/src/core/api/Qt6WebEngineCoreMacros.cmake
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
function(qt6_add_webengine_dictionary)
set(options)
set(oneValueArgs TARGET SOURCE OUTPUT_DIRECTORY)
diff --git a/src/core/api/configure.cmake b/src/core/api/configure.cmake
index 09f674435..4e54ad2a9 100644
--- a/src/core/api/configure.cmake
+++ b/src/core/api/configure.cmake
@@ -1,7 +1,10 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
#### Libraries
if(NOT QT_CONFIGURE_RUNNING)
- find_package(GLIB2 COMPONENTS gio)
+ find_package(GLIB2 COMPONENTS GIO)
find_package(GSSAPI)
find_package(PkgConfig)
if(PkgConfig_FOUND)
diff --git a/src/core/api/qt_cmdline.cmake b/src/core/api/qt_cmdline.cmake
index 42dd6b240..fe7092b8c 100644
--- a/src/core/api/qt_cmdline.cmake
+++ b/src/core/api/qt_cmdline.cmake
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
qt_commandline_option(webengine-embedded-build TYPE boolean)
qt_commandline_option(webengine-pepper-plugins TYPE boolean)
qt_commandline_option(webengine-printing-and-pdf TYPE boolean)
diff --git a/src/core/api/qwebenginefilesystemaccessrequest.cpp b/src/core/api/qwebenginefilesystemaccessrequest.cpp
index 68bf05a68..6527e1766 100644
--- a/src/core/api/qwebenginefilesystemaccessrequest.cpp
+++ b/src/core/api/qwebenginefilesystemaccessrequest.cpp
@@ -31,34 +31,20 @@ QWebEngineFileSystemAccessRequest::QWebEngineFileSystemAccessRequest(
const QWebEngineFileSystemAccessRequest &other) = default;
QWebEngineFileSystemAccessRequest &QWebEngineFileSystemAccessRequest::operator=(
const QWebEngineFileSystemAccessRequest &other) = default;
-QWebEngineFileSystemAccessRequest::QWebEngineFileSystemAccessRequest(
- QWebEngineFileSystemAccessRequest &&other) = default;
-QWebEngineFileSystemAccessRequest &
-QWebEngineFileSystemAccessRequest::operator=(QWebEngineFileSystemAccessRequest &&other) = default;
QWebEngineFileSystemAccessRequest::~QWebEngineFileSystemAccessRequest() = default;
-/*! \fn bool QWebEngineFileSystemAccessRequest::operator==(const QWebEngineFileSystemAccessRequest &that) const
- Returns \c true if \a that points to the same object as this request.
+/*! \fn bool QWebEngineFileSystemAccessRequest::operator==(const QWebEngineFileSystemAccessRequest &lhs, const QWebEngineFileSystemAccessRequest &rhs)
+ Returns \c true if \a lhs and \a rhs both point to the same request.
*/
-bool QWebEngineFileSystemAccessRequest::operator==(
- const QWebEngineFileSystemAccessRequest &that) const
-{
- return d_ptr == that.d_ptr;
-}
-/*! \fn bool QWebEngineFileSystemAccessRequest::operator!=(const QWebEngineFileSystemAccessRequest &that) const
- Returns \c true if \a that points to a different object than this request.
+/*! \fn bool QWebEngineFileSystemAccessRequest::operator!=(const QWebEngineFileSystemAccessRequest &lhs, const QWebEngineFileSystemAccessRequest &rhs)
+ Returns \c true if \a lhs and \a rhs point to different requests.
*/
-bool QWebEngineFileSystemAccessRequest::operator!=(
- const QWebEngineFileSystemAccessRequest &that) const
-{
- return d_ptr != that.d_ptr;
-}
/*! \internal */
QWebEngineFileSystemAccessRequest::QWebEngineFileSystemAccessRequest(
- QSharedPointer<QtWebEngineCore::FileSystemAccessPermissionRequestController> controller)
- : d_ptr(controller)
+ std::shared_ptr<QtWebEngineCore::FileSystemAccessPermissionRequestController> controller)
+ : d_ptr(std::move(controller))
{
}
diff --git a/src/core/api/qwebenginefilesystemaccessrequest.h b/src/core/api/qwebenginefilesystemaccessrequest.h
index ade737652..37b1e1861 100644
--- a/src/core/api/qwebenginefilesystemaccessrequest.h
+++ b/src/core/api/qwebenginefilesystemaccessrequest.h
@@ -5,9 +5,8 @@
#define QWEBENGINEFILESYSTEMACCESSREQUEST_H
#include <QtWebEngineCore/qtwebenginecoreglobal.h>
-
-#include <QtCore/qsharedpointer.h>
#include <QtCore/qurl.h>
+#include <memory>
namespace QtWebEngineCore {
class FileSystemAccessPermissionRequestController;
@@ -27,10 +26,12 @@ class Q_WEBENGINECORE_EXPORT QWebEngineFileSystemAccessRequest
public:
QWebEngineFileSystemAccessRequest(const QWebEngineFileSystemAccessRequest &other);
QWebEngineFileSystemAccessRequest &operator=(const QWebEngineFileSystemAccessRequest &other);
- QWebEngineFileSystemAccessRequest(QWebEngineFileSystemAccessRequest &&other);
- QWebEngineFileSystemAccessRequest &operator=(QWebEngineFileSystemAccessRequest &&other);
+ QWebEngineFileSystemAccessRequest(QWebEngineFileSystemAccessRequest &&other) noexcept = default;
+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QWebEngineFileSystemAccessRequest)
~QWebEngineFileSystemAccessRequest();
+ void swap(QWebEngineFileSystemAccessRequest &other) noexcept { d_ptr.swap(other.d_ptr); }
+
enum HandleType { File, Directory };
Q_ENUM(HandleType)
@@ -45,17 +46,23 @@ public:
HandleType handleType() const;
AccessFlags accessFlags() const;
- bool operator==(const QWebEngineFileSystemAccessRequest &that) const;
- bool operator!=(const QWebEngineFileSystemAccessRequest &that) const;
+ inline friend bool operator==(const QWebEngineFileSystemAccessRequest &lhs,
+ const QWebEngineFileSystemAccessRequest &rhs) noexcept
+ { return lhs.d_ptr == rhs.d_ptr; }
+ inline friend bool operator!=(const QWebEngineFileSystemAccessRequest &lhs,
+ const QWebEngineFileSystemAccessRequest &rhs) noexcept
+ { return lhs.d_ptr != rhs.d_ptr; }
private:
QWebEngineFileSystemAccessRequest(
- QSharedPointer<QtWebEngineCore::FileSystemAccessPermissionRequestController>);
+ std::shared_ptr<QtWebEngineCore::FileSystemAccessPermissionRequestController>);
friend QtWebEngineCore::FileSystemAccessPermissionRequestManagerQt;
- QSharedPointer<QtWebEngineCore::FileSystemAccessPermissionRequestController> d_ptr;
+ std::shared_ptr<QtWebEngineCore::FileSystemAccessPermissionRequestController> d_ptr;
};
+Q_DECLARE_SHARED(QWebEngineFileSystemAccessRequest)
+
Q_DECLARE_OPERATORS_FOR_FLAGS(QWebEngineFileSystemAccessRequest::AccessFlags)
QT_END_NAMESPACE
diff --git a/src/core/api/qwebenginepage.cpp b/src/core/api/qwebenginepage.cpp
index 3b83a0b97..2b94c7ab8 100644
--- a/src/core/api/qwebenginepage.cpp
+++ b/src/core/api/qwebenginepage.cpp
@@ -1658,6 +1658,12 @@ void QWebEnginePagePrivate::printRequested()
view->printRequested();
}
+QtWebEngineCore::TouchHandleDrawableDelegate *
+QWebEnginePagePrivate::createTouchHandleDelegate(const QMap<int, QImage> &images)
+{
+ return view->createTouchHandleDelegate(images);
+}
+
void QWebEnginePagePrivate::lifecycleStateChanged(LifecycleState state)
{
Q_Q(QWebEnginePage);
diff --git a/src/core/api/qwebenginepage_p.h b/src/core/api/qwebenginepage_p.h
index 8bdf6de5c..fa5ee135d 100644
--- a/src/core/api/qwebenginepage_p.h
+++ b/src/core/api/qwebenginepage_p.h
@@ -77,6 +77,8 @@ public:
virtual void showAutofillPopup(QtWebEngineCore::AutofillPopupController *controller,
const QRect &bounds, bool autoselectFirstSuggestion) = 0;
virtual void hideAutofillPopup() = 0;
+ virtual QtWebEngineCore::TouchHandleDrawableDelegate *
+ createTouchHandleDelegate(const QMap<int, QImage> &) = 0;
};
class Q_WEBENGINECORE_PRIVATE_EXPORT QWebEnginePagePrivate : public QtWebEngineCore::WebContentsAdapterClient
@@ -157,7 +159,7 @@ public:
void setToolTip(const QString &toolTipText) override;
void printRequested() override;
QtWebEngineCore::TouchHandleDrawableDelegate *
- createTouchHandleDelegate(const QMap<int, QImage> &) override { return nullptr; }
+ createTouchHandleDelegate(const QMap<int, QImage> &) override;
void showTouchSelectionMenu(QtWebEngineCore::TouchSelectionMenuController *, const QRect &, const QSize &) override { }
void hideTouchSelectionMenu() override { }
const QObject *holdingQObject() const override;
diff --git a/src/core/api/qwebengineprofile.cpp b/src/core/api/qwebengineprofile.cpp
index 4eacc8dc7..8c3dc8f3d 100644
--- a/src/core/api/qwebengineprofile.cpp
+++ b/src/core/api/qwebengineprofile.cpp
@@ -390,6 +390,41 @@ void QWebEngineProfile::setDownloadPath(const QString &path)
}
/*!
+ \since 6.5
+
+ The address used to create subscriptions for a push messaging service.
+
+ \note By default, the endpoint is an empty URL and push messaging is disabled.
+
+ \sa setPushServiceEndpoint()
+*/
+QUrl QWebEngineProfile::pushServiceEndpoint() const
+{
+ const Q_D(QWebEngineProfile);
+ return d->profileAdapter()->pushServiceEndpoint();
+}
+
+/*!
+ \since 6.5
+
+ Enables push messaging feature by setting \a endpoint to a valid address used as a
+ push messaging service endpoint. Subscription requests for the push service will be
+ sent to the concatenation of \a endpoint and a subscription ID (which is provided
+ by the browser engine).
+
+ \note Default endpoint used by Google Chrome browser is \c {https://fcm.googleapis.com/fcm/send/}
+
+ If set back to the default empty URL, push messaging is disabled.
+
+ \sa pushServiceEndpoint()
+*/
+void QWebEngineProfile::setPushServiceEndpoint(const QUrl &endpoint)
+{
+ Q_D(QWebEngineProfile);
+ d->profileAdapter()->setPushServiceEndpoint(endpoint);
+}
+
+/*!
Returns the path used for caches.
By default, this is below StandardPaths::CacheLocation in a QtWebengine/StorageName specific
diff --git a/src/core/api/qwebengineprofile.h b/src/core/api/qwebengineprofile.h
index c29202973..cd711727b 100644
--- a/src/core/api/qwebengineprofile.h
+++ b/src/core/api/qwebengineprofile.h
@@ -98,6 +98,9 @@ public:
QString downloadPath() const;
void setDownloadPath(const QString &path);
+ QUrl pushServiceEndpoint() const;
+ void setPushServiceEndpoint(const QUrl &endpoint);
+
void setNotificationPresenter(std::function<void(std::unique_ptr<QWebEngineNotification>)> notificationPresenter);
QWebEngineClientCertificateStore *clientCertificateStore();
diff --git a/src/core/api/qwebengineurlrequestinfo.cpp b/src/core/api/qwebengineurlrequestinfo.cpp
index e330a16d9..31a2963f2 100644
--- a/src/core/api/qwebengineurlrequestinfo.cpp
+++ b/src/core/api/qwebengineurlrequestinfo.cpp
@@ -69,10 +69,10 @@ ASSERT_ENUMS_MATCH(QtWebEngineCore::WebContentsAdapterClient::RedirectNavigation
execution of this function is finished.
*/
-QWebEngineUrlRequestInfoPrivate::QWebEngineUrlRequestInfoPrivate(QWebEngineUrlRequestInfo::ResourceType resource,
- QWebEngineUrlRequestInfo::NavigationType navigation,
- const QUrl &u, const QUrl &fpu, const QUrl &i,
- const QByteArray &m)
+QWebEngineUrlRequestInfoPrivate::QWebEngineUrlRequestInfoPrivate(
+ QWebEngineUrlRequestInfo::ResourceType resource,
+ QWebEngineUrlRequestInfo::NavigationType navigation, const QUrl &u, const QUrl &fpu,
+ const QUrl &i, const QByteArray &m, const QHash<QByteArray, QByteArray> &h)
: resourceType(resource)
, navigationType(navigation)
, shouldBlockRequest(false)
@@ -82,6 +82,7 @@ QWebEngineUrlRequestInfoPrivate::QWebEngineUrlRequestInfoPrivate(QWebEngineUrlRe
, initiator(i)
, method(m)
, changed(false)
+ , extraHeaders(h)
{}
/*!
@@ -275,7 +276,28 @@ void QWebEngineUrlRequestInfo::block(bool shouldBlock)
void QWebEngineUrlRequestInfo::setHttpHeader(const QByteArray &name, const QByteArray &value)
{
d_ptr->changed = true;
+
+ // Headers are case insentive, so we need to compare manually
+ for (auto it = d_ptr->extraHeaders.begin(); it != d_ptr->extraHeaders.end(); ++it) {
+ if (it.key().compare(name, Qt::CaseInsensitive) == 0) {
+ d_ptr->extraHeaders.erase(it);
+ break;
+ }
+ }
+
d_ptr->extraHeaders.insert(name, value);
}
+/*!
+ Returns the request headers.
+ \since 6.5
+ \note Not all headers are visible at this stage as Chromium will add
+ security and proxy headers at a later stage.
+*/
+
+QHash<QByteArray, QByteArray> QWebEngineUrlRequestInfo::httpHeaders() const
+{
+ return d_ptr->extraHeaders;
+}
+
QT_END_NAMESPACE
diff --git a/src/core/api/qwebengineurlrequestinfo.h b/src/core/api/qwebengineurlrequestinfo.h
index 125e5373c..c1696c9c2 100644
--- a/src/core/api/qwebengineurlrequestinfo.h
+++ b/src/core/api/qwebengineurlrequestinfo.h
@@ -72,6 +72,7 @@ public:
void block(bool shouldBlock);
void redirect(const QUrl &url);
void setHttpHeader(const QByteArray &name, const QByteArray &value);
+ QHash<QByteArray, QByteArray> httpHeaders() const;
private:
friend class QtWebEngineCore::ContentBrowserClientQt;
diff --git a/src/core/api/qwebengineurlrequestinfo_p.h b/src/core/api/qwebengineurlrequestinfo_p.h
index ec9cdda69..08faf8323 100644
--- a/src/core/api/qwebengineurlrequestinfo_p.h
+++ b/src/core/api/qwebengineurlrequestinfo_p.h
@@ -34,8 +34,10 @@ class QWebEngineUrlRequestInfoPrivate
Q_DECLARE_PUBLIC(QWebEngineUrlRequestInfo)
public:
QWebEngineUrlRequestInfoPrivate(QWebEngineUrlRequestInfo::ResourceType resource,
- QWebEngineUrlRequestInfo::NavigationType navigation, const QUrl &u, const QUrl &fpu,
- const QUrl &i, const QByteArray &m);
+ QWebEngineUrlRequestInfo::NavigationType navigation,
+ const QUrl &u, const QUrl &fpu, const QUrl &i,
+ const QByteArray &m,
+ const QHash<QByteArray, QByteArray> &h = {});
QWebEngineUrlRequestInfo::ResourceType resourceType;
QWebEngineUrlRequestInfo::NavigationType navigationType;
diff --git a/src/core/autofill_client_qt.cpp b/src/core/autofill_client_qt.cpp
index b599560d1..fb3f726ae 100644
--- a/src/core/autofill_client_qt.cpp
+++ b/src/core/autofill_client_qt.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2022 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "autofill_client_qt.h"
@@ -55,7 +19,8 @@
namespace QtWebEngineCore {
AutofillClientQt::AutofillClientQt(content::WebContents *webContents)
- : content::WebContentsObserver(webContents)
+ : content::WebContentsUserData<AutofillClientQt>(*webContents)
+ , content::WebContentsObserver(webContents)
, m_popupController(new AutofillPopupController(new AutofillPopupControllerPrivate))
{
}
@@ -143,6 +108,11 @@ bool AutofillClientQt::IsAutocompleteEnabled()
return autofill::prefs::IsAutocompleteEnabled(GetPrefs());
}
+bool AutofillClientQt::IsPasswordManagerEnabled()
+{
+ return false;
+}
+
void AutofillClientQt::PropagateAutofillPredictions(content::RenderFrameHost *,
const std::vector<autofill::FormStructure *> &)
{
diff --git a/src/core/autofill_client_qt.h b/src/core/autofill_client_qt.h
index 762ff1109..967c4b227 100644
--- a/src/core/autofill_client_qt.h
+++ b/src/core/autofill_client_qt.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2022 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
//
// W A R N I N G
@@ -89,9 +53,11 @@ public:
void UpdatePopup(const std::vector<autofill::Suggestion> &, autofill::PopupType) override;
void HideAutofillPopup(autofill::PopupHidingReason reason) override;
bool IsAutocompleteEnabled() override;
+ bool IsPasswordManagerEnabled() override;
void PropagateAutofillPredictions(content::RenderFrameHost *,
const std::vector<autofill::FormStructure *> &) override;
+
private:
explicit AutofillClientQt(content::WebContents *webContents);
diff --git a/src/core/autofill_popup_controller.cpp b/src/core/autofill_popup_controller.cpp
index e42f5a4f6..260b1ca8a 100644
--- a/src/core/autofill_popup_controller.cpp
+++ b/src/core/autofill_popup_controller.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2022 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "autofill_popup_controller.h"
#include "autofill_popup_controller_p.h"
@@ -62,7 +26,7 @@ void AutofillPopupController::setCurrentIndex(const QModelIndex &index)
if (m_currentIndex.isValid()) {
const autofill::Suggestion &suggestion = d->suggestions[m_currentIndex.row()];
- d->delegate->DidSelectSuggestion(suggestion.value, suggestion.frontend_id);
+ d->delegate->DidSelectSuggestion(suggestion.value, suggestion.frontend_id, suggestion.backend_id);
}
Q_EMIT currentIndexChanged(index);
diff --git a/src/core/autofill_popup_controller.h b/src/core/autofill_popup_controller.h
index 5432123f1..586149b95 100644
--- a/src/core/autofill_popup_controller.h
+++ b/src/core/autofill_popup_controller.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2022 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef AUTOFILL_POPUP_CONTROLLER_H
#define AUTOFILL_POPUP_CONTROLLER_H
diff --git a/src/core/autofill_popup_controller_p.h b/src/core/autofill_popup_controller_p.h
index 880eec86e..886fe4dcd 100644
--- a/src/core/autofill_popup_controller_p.h
+++ b/src/core/autofill_popup_controller_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2022 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef AUTOFILL_POPUP_CONTROLLER_P_H
#define AUTOFILL_POPUP_CONTROLLER_P_H
diff --git a/src/core/browser_accessibility_manager_qt.cpp b/src/core/browser_accessibility_manager_qt.cpp
index 01ec3fa58..7c16d54a0 100644
--- a/src/core/browser_accessibility_manager_qt.cpp
+++ b/src/core/browser_accessibility_manager_qt.cpp
@@ -2,10 +2,16 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "browser_accessibility_manager_qt.h"
+#include "qtwebenginecoreglobal_p.h"
#include "content/browser/accessibility/browser_accessibility.h"
#include "ui/accessibility/ax_enums.mojom.h"
+#if QT_CONFIG(webengine_extensions)
+#include "content/browser/renderer_host/render_frame_host_impl.h"
+#include "content/public/browser/web_contents.h"
+#endif // QT_CONFIG(webengine_extensions)
+
#include "browser_accessibility_qt.h"
#include "render_widget_host_view_qt.h"
@@ -24,6 +30,17 @@ BrowserAccessibilityManager *BrowserAccessibilityManager::Create(
Q_ASSERT(delegate);
QtWebEngineCore::WebContentsAccessibilityQt *access = nullptr;
access = static_cast<QtWebEngineCore::WebContentsAccessibilityQt *>(delegate->AccessibilityGetWebContentsAccessibility());
+
+#if QT_CONFIG(webengine_extensions)
+ // Accessibility is not supported for guest views.
+ if (!access) {
+ Q_ASSERT(content::WebContents::FromRenderFrameHost(
+ static_cast<content::RenderFrameHostImpl *>(delegate))
+ ->GetOuterWebContents());
+ return nullptr;
+ }
+#endif // QT_CONFIG(webengine_extensions)
+
return new BrowserAccessibilityManagerQt(access, initialTree, delegate);
#else
return nullptr;
@@ -72,7 +89,8 @@ QAccessibleInterface *BrowserAccessibilityManagerQt::rootParentAccessible()
}
void BrowserAccessibilityManagerQt::FireBlinkEvent(ax::mojom::Event event_type,
- BrowserAccessibility* node)
+ BrowserAccessibility *node,
+ int action_request_id)
{
auto *iface = toQAccessibleInterface(node);
diff --git a/src/core/browser_accessibility_manager_qt.h b/src/core/browser_accessibility_manager_qt.h
index 188d9f81b..6cd3c84de 100644
--- a/src/core/browser_accessibility_manager_qt.h
+++ b/src/core/browser_accessibility_manager_qt.h
@@ -27,7 +27,8 @@ public:
BrowserAccessibilityDelegate *delegate);
~BrowserAccessibilityManagerQt() override;
void FireBlinkEvent(ax::mojom::Event event_type,
- BrowserAccessibility* node) override;
+ BrowserAccessibility *node,
+ int action_request_id) override;
void FireGeneratedEvent(ui::AXEventGenerator::Event event_type,
BrowserAccessibility* node) override;
diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp
index da0fd559b..35d5b49d4 100644
--- a/src/core/browser_accessibility_qt.cpp
+++ b/src/core/browser_accessibility_qt.cpp
@@ -148,12 +148,12 @@ BrowserAccessibilityQt::~BrowserAccessibilityQt()
BrowserAccessibilityInterface::BrowserAccessibilityInterface(BrowserAccessibilityQt *chromiumInterface)
: q(chromiumInterface)
{
- Q_ASSERT(parent());
- Q_ASSERT(parent()->object());
- m_object = new QObject(parent()->object());
- QString name = toQt(q->GetAuthorUniqueId());
- if (!name.isEmpty())
- m_object->setObjectName(name);
+ if (parent() && parent()->object()) {
+ m_object = new QObject(parent()->object());
+ QString name = toQt(q->GetAuthorUniqueId());
+ if (!name.isEmpty())
+ m_object->setObjectName(name);
+ }
m_id = QAccessible::registerAccessibleInterface(this);
}
@@ -292,6 +292,7 @@ QRect BrowserAccessibilityInterface::rect() const
if (!q->manager()) // needed implicitly by GetScreenBoundsRect()
return QRect();
gfx::Rect bounds = q->GetUnclippedScreenBoundsRect();
+ bounds = gfx::ScaleToRoundedRect(bounds, 1.f / q->manager()->device_scale_factor()); // FIXME: check
return QRect(bounds.x(), bounds.y(), bounds.width(), bounds.height());
}
diff --git a/src/core/browser_main_parts_qt.cpp b/src/core/browser_main_parts_qt.cpp
index b135e55cc..a39a1ee3b 100644
--- a/src/core/browser_main_parts_qt.cpp
+++ b/src/core/browser_main_parts_qt.cpp
@@ -5,6 +5,7 @@
#include "api/qwebenginemessagepumpscheduler_p.h"
+#include "base/message_loop/message_pump.h"
#include "base/message_loop/message_pump_for_ui.h"
#include "base/process/process.h"
#include "base/task/current_thread.h"
@@ -26,31 +27,38 @@
#include "content/public/common/content_features.h"
#include "content/public/common/result_codes.h"
#include "extensions/buildflags/buildflags.h"
+#include "ppapi/buildflags/buildflags.h"
+#include "select_file_dialog_factory_qt.h"
+#include "services/service_manager/public/cpp/connector.h"
+#include "services/service_manager/public/cpp/service.h"
+#include "type_conversion.h"
+#include "ui/display/screen.h"
+
#if BUILDFLAG(ENABLE_EXTENSIONS)
-#include "content/public/browser/plugin_service.h"
#include "extensions/common/constants.h"
#include "extensions/common/extensions_client.h"
#include "extensions/extensions_browser_client_qt.h"
#include "extensions/extension_system_factory_qt.h"
-#include "extensions/plugin_service_filter_qt.h"
#include "common/extensions/extensions_client_qt.h"
-#endif //BUILDFLAG(ENABLE_EXTENSIONS)
-#include "select_file_dialog_factory_qt.h"
-#include "services/service_manager/public/cpp/connector.h"
-#include "services/service_manager/public/cpp/service.h"
-#include "ui/display/screen.h"
+#endif // BUILDFLAG(ENABLE_EXTENSIONS)
+
+#if BUILDFLAG(ENABLE_PLUGINS)
+#include "content/public/browser/plugin_service.h"
+#include "extensions/plugin_service_filter_qt.h"
+#endif // BUILDFLAG(ENABLE_PLUGINS)
#include "web_engine_context.h"
#include "web_usb_detector_qt.h"
#include <QtGui/qtgui-config.h>
+#include <QStandardPaths>
#if QT_CONFIG(opengl)
#include "ui/gl/gl_context.h"
#include <QOpenGLContext>
#endif
-#if defined(OS_MAC)
+#if BUILDFLAG(IS_MAC)
#include "base/message_loop/message_pump_mac.h"
#include "services/device/public/cpp/geolocation/geolocation_manager.h"
#include "ui/base/idle/idle.h"
@@ -62,6 +70,10 @@
#include "desktop_screen_qt.h"
#endif
+#if defined(Q_OS_LINUX)
+#include "components/os_crypt/key_storage_config_linux.h"
+#include "components/os_crypt/os_crypt.h"
+#endif
namespace QtWebEngineCore {
@@ -111,9 +123,14 @@ public:
m_scheduler.scheduleWork();
}
- void ScheduleDelayedWork(const base::TimeTicks &delayed_work_time) override
+ void ScheduleDelayedWork(const Delegate::NextWorkInfo &next_work_info) override
{
// NOTE: This method may called from any thread at any time.
+ ScheduleDelayedWork(next_work_info.delayed_run_time);
+ }
+
+ void ScheduleDelayedWork(const base::TimeTicks &delayed_work_time)
+ {
ensureDelegate();
m_scheduler.scheduleDelayedWork(GetTimeIntervalMilliseconds(delayed_work_time));
}
@@ -191,7 +208,7 @@ private:
QWebEngineMessagePumpScheduler m_scheduler;
};
-#if defined(OS_MAC)
+#if BUILDFLAG(IS_MAC)
class FakeGeolocationManager : public device::GeolocationManager
{
public:
@@ -206,7 +223,7 @@ public:
return device::LocationSystemPermissionStatus::kDenied;
}
};
-#endif // defined(OS_MAC)
+#endif // BUILDFLAG(IS_MAC)
std::unique_ptr<base::MessagePump> messagePumpFactory()
{
@@ -215,7 +232,7 @@ std::unique_ptr<base::MessagePump> messagePumpFactory()
madePrimaryPump = true;
return std::make_unique<MessagePumpForUIQt>();
}
-#if defined(OS_MAC)
+#if BUILDFLAG(IS_MAC)
return base::MessagePumpMac::Create();
#else
return std::make_unique<base::MessagePumpForUI>();
@@ -232,7 +249,7 @@ int BrowserMainPartsQt::PreEarlyInitialization()
void BrowserMainPartsQt::PreCreateMainMessageLoop()
{
-#if defined(OS_MAC)
+#if BUILDFLAG(IS_MAC)
m_geolocationManager = std::make_unique<FakeGeolocationManager>();
#endif
}
@@ -241,6 +258,15 @@ void BrowserMainPartsQt::PostCreateMainMessageLoop()
{
if (!device_event_log::IsInitialized())
device_event_log::Initialize(0 /* default max entries */);
+
+#if defined(Q_OS_LINUX)
+ std::unique_ptr<os_crypt::Config> config = std::make_unique<os_crypt::Config>();
+ config->product_name = "Qt WebEngine";
+ config->main_thread_runner = content::GetUIThreadTaskRunner({});
+ config->should_use_preference = false;
+ config->user_data_path = toFilePath(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
+ OSCrypt::SetConfig(std::move(config));
+#endif
}
int BrowserMainPartsQt::PreMainMessageLoopRun()
@@ -251,10 +277,12 @@ int BrowserMainPartsQt::PreMainMessageLoopRun()
extensions::ExtensionsClient::Set(new extensions::ExtensionsClientQt());
extensions::ExtensionsBrowserClient::Set(new extensions::ExtensionsBrowserClientQt());
extensions::ExtensionSystemFactoryQt::GetInstance();
+#endif // BUILDFLAG(ENABLE_EXTENSIONS)
+#if BUILDFLAG(ENABLE_PLUGINS)
content::PluginService *plugin_service = content::PluginService::GetInstance();
plugin_service->SetFilter(extensions::PluginServiceFilterQt::GetInstance());
-#endif //ENABLE_EXTENSIONS
+#endif // BUILDFLAG(ENABLE_PLUGINS)
if (base::FeatureList::IsEnabled(features::kWebUsb)) {
m_webUsbDetector.reset(new WebUsbDetectorQt());
@@ -279,7 +307,7 @@ void BrowserMainPartsQt::PostMainMessageLoopRun()
int BrowserMainPartsQt::PreCreateThreads()
{
-#if defined(OS_MAC)
+#if BUILDFLAG(IS_MAC)
ui::InitIdleMonitor();
#endif
@@ -307,7 +335,7 @@ void BrowserMainPartsQt::PostCreateThreads()
base::BindOnce(&QtWebEngineCore::CreatePoliciesAndDecorators));
}
-#if defined(OS_MAC)
+#if BUILDFLAG(IS_MAC)
device::GeolocationManager *BrowserMainPartsQt::GetGeolocationManager()
{
return m_geolocationManager.get();
diff --git a/src/core/browser_main_parts_qt.h b/src/core/browser_main_parts_qt.h
index 7e21240cb..6828552b7 100644
--- a/src/core/browser_main_parts_qt.h
+++ b/src/core/browser_main_parts_qt.h
@@ -42,14 +42,14 @@ public:
int PreCreateThreads() override;
void PostCreateThreads() override;
-#if defined(OS_MAC)
+#if BUILDFLAG(IS_MAC)
device::GeolocationManager *GetGeolocationManager();
#endif
private:
std::unique_ptr<performance_manager::PerformanceManagerLifetime> performance_manager_lifetime_;
std::unique_ptr<WebUsbDetectorQt> m_webUsbDetector;
-#if defined(OS_MAC)
+#if BUILDFLAG(IS_MAC)
std::unique_ptr<device::GeolocationManager> m_geolocationManager;
#endif
};
diff --git a/src/core/chromium_overrides.cpp b/src/core/chromium_overrides.cpp
index 9fced7915..3a183d0d8 100644
--- a/src/core/chromium_overrides.cpp
+++ b/src/core/chromium_overrides.cpp
@@ -6,9 +6,12 @@
#include "qtwebenginecoreglobal_p.h"
#include "web_contents_view_qt.h"
#include "web_engine_library_info.h"
+
#include "base/values.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/font_list.h"
+#include "extensions/buildflags/buildflags.h"
+#include "extensions/common/constants.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/base/dragdrop/os_exchange_data_provider_factory.h"
@@ -39,7 +42,7 @@ WebContentsView* CreateWebContentsView(WebContentsImpl *web_contents,
return rv;
}
-#if defined(OS_MAC)
+#if defined(Q_OS_DARWIN)
#if defined(QT_MAC_FRAMEWORK_BUILD)
base::FilePath getSandboxPath()
{
@@ -95,6 +98,12 @@ std::unique_ptr<ui::OSExchangeDataProvider> ui::OSExchangeDataProviderFactory::C
return nullptr;
}
+#if !BUILDFLAG(ENABLE_EXTENSIONS)
+namespace extensions {
+ const char kExtensionScheme[] = "chrome-extension";
+}
+#endif
+
#if !QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions)
namespace extensions {
ExtensionFunction::ResponseAction WebrtcLoggingPrivateSetMetaDataFunction::Run()
diff --git a/src/core/clipboard_util_win.cpp b/src/core/clipboard_util_win.cpp
index ae615b3b6..601e44180 100644
--- a/src/core/clipboard_util_win.cpp
+++ b/src/core/clipboard_util_win.cpp
@@ -1,31 +1,6 @@
-/*
- * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
+// Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE.Chromium file.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <string>
diff --git a/src/core/common/extensions/extensions_client_qt.cpp b/src/core/common/extensions/extensions_client_qt.cpp
index f621bfb8a..30d1836ca 100644
--- a/src/core/common/extensions/extensions_client_qt.cpp
+++ b/src/core/common/extensions/extensions_client_qt.cpp
@@ -117,7 +117,7 @@ const GURL &ExtensionsClientQt::GetWebstoreUpdateURL() const
// Returns a flag indicating whether or not a given URL is a valid
// extension blacklist URL.
-bool ExtensionsClientQt::IsBlacklistUpdateURL(const GURL &url) const
+bool ExtensionsClientQt::IsBlocklistUpdateURL(const GURL &url) const
{
return true;
}
diff --git a/src/core/common/extensions/extensions_client_qt.h b/src/core/common/extensions/extensions_client_qt.h
index 32a752d95..b0069db22 100644
--- a/src/core/common/extensions/extensions_client_qt.h
+++ b/src/core/common/extensions/extensions_client_qt.h
@@ -72,7 +72,7 @@ public:
// Returns a flag indicating whether or not a given URL is a valid
// extension blacklist URL.
- bool IsBlacklistUpdateURL(const GURL &url) const override;
+ bool IsBlocklistUpdateURL(const GURL &url) const override;
// Returns the set of file paths corresponding to any images within an
// extension's contents that may be displayed directly within the browser UI
diff --git a/src/core/common/qt_messages.cpp b/src/core/common/qt_messages.cpp
index 2f087d21f..bc3a1560d 100644
--- a/src/core/common/qt_messages.cpp
+++ b/src/core/common/qt_messages.cpp
@@ -1,6 +1,5 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE.Chromium file.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
// Get basic type definitions.
#define IPC_MESSAGE_IMPL
diff --git a/src/core/common/qt_messages.h b/src/core/common/qt_messages.h
index 940019c16..17adcbb0d 100644
--- a/src/core/common/qt_messages.h
+++ b/src/core/common/qt_messages.h
@@ -1,6 +1,5 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE.Chromium file.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
// Multiply-included file, no traditional include guard.
diff --git a/src/core/compositor/display_skia_output_device.cpp b/src/core/compositor/display_skia_output_device.cpp
index 246a846fa..ee693ed81 100644
--- a/src/core/compositor/display_skia_output_device.cpp
+++ b/src/core/compositor/display_skia_output_device.cpp
@@ -17,13 +17,11 @@ public:
: m_parent(parent)
, m_shape(m_parent->m_shape)
{
- auto formatIndex = static_cast<int>(m_shape.format);
- const auto &colorType = m_parent->capabilities_.sk_color_types[formatIndex];
- DCHECK(colorType != kUnknown_SkColorType)
- << "SkColorType is invalid for format: " << formatIndex;
+ const auto &colorType = m_shape.characterization.colorType();
+ DCHECK(colorType != kUnknown_SkColorType);
m_texture = m_parent->m_contextState->gr_context()->createBackendTexture(
- m_shape.sizeInPixels.width(), m_shape.sizeInPixels.height(), colorType,
+ m_shape.characterization.width(), m_shape.characterization.height(), colorType,
GrMipMapped::kNo, GrRenderable::kYes);
DCHECK(m_texture.isValid());
@@ -37,7 +35,7 @@ public:
NOTREACHED();
#endif
} else {
- auto info = SkImageInfo::Make(m_shape.sizeInPixels.width(), m_shape.sizeInPixels.height(),
+ auto info = SkImageInfo::Make(m_shape.characterization.width(), m_shape.characterization.height(),
colorType, kUnpremul_SkAlphaType);
m_estimatedSize = info.computeMinByteSize();
}
@@ -118,13 +116,12 @@ void DisplaySkiaOutputDevice::SetFrameSinkId(const viz::FrameSinkId &id)
bind(id);
}
-bool DisplaySkiaOutputDevice::Reshape(const gfx::Size& sizeInPixels,
- float devicePixelRatio,
- const gfx::ColorSpace& colorSpace,
- gfx::BufferFormat format,
+bool DisplaySkiaOutputDevice::Reshape(const SkSurfaceCharacterization &characterization,
+ const gfx::ColorSpace &colorSpace,
+ float device_scale_factor,
gfx::OverlayTransform transform)
{
- m_shape = Shape{sizeInPixels, devicePixelRatio, colorSpace, format};
+ m_shape = Shape{characterization, device_scale_factor, colorSpace};
DCHECK_EQ(transform, gfx::OVERLAY_TRANSFORM_NONE);
return true;
}
@@ -157,10 +154,8 @@ void DisplaySkiaOutputDevice::DiscardBackbuffer()
{
}
-SkSurface *DisplaySkiaOutputDevice::BeginPaint(bool allocate_frame_buffer,
- std::vector<GrBackendSemaphore> *)
+SkSurface *DisplaySkiaOutputDevice::BeginPaint(std::vector<GrBackendSemaphore> *)
{
- Q_UNUSED(allocate_frame_buffer); // FIXME?
if (!m_backBuffer || m_backBuffer->shape() != m_shape)
m_backBuffer = std::make_unique<Buffer>(this);
return m_backBuffer->surface();
@@ -203,7 +198,7 @@ int DisplaySkiaOutputDevice::textureId()
QSize DisplaySkiaOutputDevice::size()
{
- return m_frontBuffer ? toQt(m_frontBuffer->shape().sizeInPixels) : QSize();
+ return m_frontBuffer ? toQt(m_frontBuffer->shape().characterization.dimensions()) : QSize();
}
bool DisplaySkiaOutputDevice::hasAlphaChannel()
@@ -224,7 +219,7 @@ void DisplaySkiaOutputDevice::SwapBuffersFinished()
}
FinishSwapBuffers(gfx::SwapCompletionResult(gfx::SwapResult::SWAP_ACK),
- gfx::Size(m_shape.sizeInPixels.width(), m_shape.sizeInPixels.height()),
+ gfx::Size(m_shape.characterization.width(), m_shape.characterization.height()),
std::move(m_frame));
}
diff --git a/src/core/compositor/display_skia_output_device.h b/src/core/compositor/display_skia_output_device.h
index efb665ddb..943d37214 100644
--- a/src/core/compositor/display_skia_output_device.h
+++ b/src/core/compositor/display_skia_output_device.h
@@ -25,17 +25,15 @@ public:
// Overridden from SkiaOutputDevice.
void SetFrameSinkId(const viz::FrameSinkId &frame_sink_id) override;
- bool Reshape(const gfx::Size& size,
- float devicePixelRatio,
+ bool Reshape(const SkSurfaceCharacterization &characterization,
const gfx::ColorSpace& colorSpace,
- gfx::BufferFormat format,
+ float device_scale_factor,
gfx::OverlayTransform transform) override;
void SwapBuffers(BufferPresentedCallback feedback,
viz::OutputSurfaceFrame frame) override;
void EnsureBackbuffer() override;
void DiscardBackbuffer() override;
- SkSurface *BeginPaint(bool allocate_frame_buffer,
- std::vector<GrBackendSemaphore> *semaphores) override;
+ SkSurface *BeginPaint(std::vector<GrBackendSemaphore> *semaphores) override;
void EndPaint() override;
// Overridden from Compositor.
@@ -49,17 +47,15 @@ public:
private:
struct Shape
{
- gfx::Size sizeInPixels;
+ SkSurfaceCharacterization characterization;
float devicePixelRatio;
gfx::ColorSpace colorSpace;
- gfx::BufferFormat format;
bool operator==(const Shape &that) const
{
- return (sizeInPixels == that.sizeInPixels &&
+ return (characterization == that.characterization &&
devicePixelRatio == that.devicePixelRatio &&
- colorSpace == that.colorSpace &&
- format == that.format);
+ colorSpace == that.colorSpace);
}
bool operator!=(const Shape &that) const { return !(*this == that); }
};
diff --git a/src/core/configure/BUILD.root.gn.in b/src/core/configure/BUILD.root.gn.in
index de490ffc1..550bd17e0 100644
--- a/src/core/configure/BUILD.root.gn.in
+++ b/src/core/configure/BUILD.root.gn.in
@@ -78,6 +78,14 @@ config("QtWebEngineCore_config") {
]
}
+declare_args() {
+ use_embedded_config = false
+}
+
+config("embedded_config") {
+ defines = [ "QTWEBENGINE_EMBEDDED_SWITCHES=1" ]
+}
+
config("cpp17_config") {
# static initialized constexpr expressions must be compiled always as c++14 or always as c++17
# and our qtwebengine core sources use them as c++17
@@ -110,12 +118,14 @@ shared_library("QtWebEngineCore") {
"//components/cdm/renderer",
"//components/error_page/common",
"//components/favicon/content",
+ "//components/gcm_driver",
"//components/history/content/browser",
"//components/keyed_service/content",
"//components/navigation_interception",
"//components/network_hints/browser",
"//components/network_hints/common:mojo_bindings",
"//components/network_hints/renderer",
+ "//components/signin/public/base",
"//components/visitedlink/browser",
"//components/visitedlink/renderer",
"//components/web_cache/browser",
@@ -151,8 +161,12 @@ shared_library("QtWebEngineCore") {
}
if (is_win) {
+ configs += [ "//build/config/compiler:rtti" ]
data_deps = [ ":QtWebEngineCoreSandbox" ]
}
+ if (use_embedded_config) {
+ configs += [ ":embedded_config" ]
+ }
sources = [
@GN_HEADERS@,
@@ -185,10 +199,9 @@ source_set("qtwebengine_spellcheck_sources") {
"//chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h",
"//chrome/browser/spellchecker/spellcheck_service.cc",
"//chrome/browser/spellchecker/spellcheck_service.h",
- "//components/language/core/browser/pref_names.cc",
- "//components/language/core/browser/pref_names.h",
]
deps = [
+ "//components/language/core/browser",
"//components/spellcheck/browser",
"//components/spellcheck/renderer",
"//third_party/blink/public:blink",
@@ -211,14 +224,17 @@ source_set("qtwebengine_sources") {
"//build:branding_buildflags",
"//chrome/browser:dev_ui_browser_resources_grit",
"//chrome/browser/resources/net_internals:resources",
- "//chrome/browser/resources/quota_internals:resources",
+ "//chrome/browser/signin:identity_manager_provider",
"//chrome/common:buildflags",
+ "//chrome/common:version_header",
"//chromeos/components/chromebox_for_meetings/buildflags",
"//components/custom_handlers",
"//components/nacl/common:buildflags",
"//components/performance_manager",
"//components/plugins/renderer/",
+ "//content/browser/resources/quota:resources",
"//extensions/buildflags:buildflags",
+ "//pdf:buildflags",
"//printing/buildflags:buildflags",
"//qtwebengine/common:mojo_bindings",
"//rlz/buildflags:buildflags",
@@ -229,13 +245,47 @@ source_set("qtwebengine_sources") {
"//chrome/browser/accessibility/accessibility_ui.h",
"//chrome/browser/devtools/devtools_eye_dropper.cc",
"//chrome/browser/devtools/devtools_eye_dropper.h",
+ "//chrome/browser/gcm/gcm_product_util.cc",
+ "//chrome/browser/gcm/gcm_product_util.h",
+ "//chrome/browser/gcm/gcm_profile_service_factory.cc",
+ "//chrome/browser/gcm/gcm_profile_service_factory.h",
+ "//chrome/browser/gcm/instance_id/instance_id_profile_service_factory.cc",
+ "//chrome/browser/gcm/instance_id/instance_id_profile_service_factory.h",
"//chrome/browser/media/webrtc/desktop_media_list.h",
"//chrome/browser/net/chrome_mojo_proxy_resolver_factory.cc",
"//chrome/browser/net/chrome_mojo_proxy_resolver_factory.h",
"//chrome/browser/prefs/chrome_command_line_pref_store.cc",
"//chrome/browser/prefs/chrome_command_line_pref_store.h",
+ "//chrome/browser/profiles/incognito_helpers.cc",
+ "//chrome/browser/profiles/incognito_helpers.h",
"//chrome/browser/profiles/profile.cc",
"//chrome/browser/profiles/profile.h",
+ "//chrome/browser/push_messaging/push_messaging_app_identifier.cc",
+ "//chrome/browser/push_messaging/push_messaging_app_identifier.h",
+ "//chrome/browser/push_messaging/push_messaging_constants.cc",
+ "//chrome/browser/push_messaging/push_messaging_constants.h",
+ "//chrome/browser/push_messaging/push_messaging_features.cc",
+ "//chrome/browser/push_messaging/push_messaging_features.h",
+ "//chrome/browser/push_messaging/push_messaging_notification_manager.cc",
+ "//chrome/browser/push_messaging/push_messaging_notification_manager.h",
+ "//chrome/browser/push_messaging/push_messaging_refresher.cc",
+ "//chrome/browser/push_messaging/push_messaging_refresher.h",
+ "//chrome/browser/push_messaging/push_messaging_service_factory.cc",
+ "//chrome/browser/push_messaging/push_messaging_service_factory.h",
+ "//chrome/browser/push_messaging/push_messaging_service_impl.cc",
+ "//chrome/browser/push_messaging/push_messaging_service_impl.h",
+ "//chrome/browser/push_messaging/push_messaging_utils.cc",
+ "//chrome/browser/push_messaging/push_messaging_utils.h",
+ "//chrome/browser/signin/chrome_signin_client.cc",
+ "//chrome/browser/signin/chrome_signin_client.h",
+ "//chrome/browser/signin/chrome_signin_client_factory.cc",
+ "//chrome/browser/signin/chrome_signin_client_factory.h",
+ "//chrome/browser/signin/force_signin_verifier.cc",
+ "//chrome/browser/signin/force_signin_verifier.h",
+ "//chrome/browser/signin/identity_manager_factory.cc",
+ "//chrome/browser/signin/identity_manager_factory.h",
+ "//chrome/browser/signin/signin_util.cc",
+ "//chrome/browser/signin/signin_util.h",
"//chrome/browser/tab_contents/form_interaction_tab_helper.cc",
"//chrome/browser/tab_contents/form_interaction_tab_helper.h",
"//chrome/browser/tab_contents/web_contents_collection.cc",
@@ -248,14 +298,6 @@ source_set("qtwebengine_sources") {
"//chrome/browser/ui/webui/devtools_ui_data_source.h",
"//chrome/browser/ui/webui/net_internals/net_internals_ui.cc",
"//chrome/browser/ui/webui/net_internals/net_internals_ui.h",
- "//chrome/browser/ui/webui/quota_internals/quota_internals_handler.cc",
- "//chrome/browser/ui/webui/quota_internals/quota_internals_handler.h",
- "//chrome/browser/ui/webui/quota_internals/quota_internals_proxy.cc",
- "//chrome/browser/ui/webui/quota_internals/quota_internals_proxy.h",
- "//chrome/browser/ui/webui/quota_internals/quota_internals_types.cc",
- "//chrome/browser/ui/webui/quota_internals/quota_internals_types.h",
- "//chrome/browser/ui/webui/quota_internals/quota_internals_ui.cc",
- "//chrome/browser/ui/webui/quota_internals/quota_internals_ui.h",
"//chrome/browser/ui/webui/user_actions/user_actions_ui.cc",
"//chrome/browser/ui/webui/user_actions/user_actions_ui.h",
"//chrome/browser/ui/webui/user_actions/user_actions_ui_handler.cc",
@@ -277,7 +319,6 @@ source_set("qtwebengine_sources") {
"//chrome/app:generated_resources",
"//chrome/browser/extensions/api:api_registration",
"//chrome/browser/resources:component_extension_resources_grit",
- "//chrome/common/extensions/api",
"//chrome/common/extensions/api:api",
"//chrome/common/extensions/api:extensions_features",
"//components/crx_file",
@@ -309,9 +350,6 @@ source_set("qtwebengine_sources") {
"//chrome/common/extensions/permissions/chrome_permission_message_rules.h",
]
} else {
- deps += [
- "//extensions/common:common_constants",
- ]
sources += [
"//extensions/common/url_pattern.cc",
"//extensions/common/url_pattern.h",
@@ -335,15 +373,6 @@ source_set("qtwebengine_sources") {
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.cc",
"//chrome/renderer/pepper/pepper_shared_memory_message_filter.h",
]
- if (enable_pdf) {
- sources += [
- "//chrome/renderer/pepper/pepper_flash_font_file_host.cc",
- "//chrome/renderer/pepper/pepper_flash_font_file_host.h",
- ]
- if (is_linux) {
- deps += [ "//pdf:font_table_linux" ]
- }
- }
}
if (enable_basic_printing || enable_print_preview) {
sources += [
@@ -360,10 +389,9 @@ source_set("qtwebengine_sources") {
if (enable_pdf) {
deps += [
"//pdf",
- "//pdf:buildflags",
- "//pdf:pdf_ppapi",
"//chrome/browser/resources/pdf:resources",
"//components/pdf/browser",
+ "//components/pdf/browser:interceptors",
"//components/pdf/common",
"//components/pdf/renderer",
"//components/printing/browser",
@@ -452,17 +480,16 @@ repack("qtwebengine_repack_resources") {
"$root_gen_dir/chrome/common_resources.pak",
"$root_gen_dir/chrome/dev_ui_browser_resources.pak",
"$root_gen_dir/chrome/net_internals_resources.pak",
- "$root_gen_dir/chrome/quota_internals_resources.pak",
"$root_gen_dir/components/components_resources.pak",
"$root_gen_dir/components/dev_ui_components_resources.pak",
"$root_gen_dir/content/browser/resources/media/media_internals_resources.pak",
"$root_gen_dir/content/browser/tracing/tracing_resources.pak",
"$root_gen_dir/content/content_resources.pak",
"$root_gen_dir/content/dev_ui_content_resources.pak",
+ "$root_gen_dir/content/quota_internals_resources.pak",
"$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
"$root_gen_dir/net/net_resources.pak",
"$root_gen_dir/third_party/blink/public/resources/blink_resources.pak",
- "$root_gen_dir/ui/resources/webui_resources.pak",
"$root_gen_dir/ui/resources/webui_generated_resources.pak",
]
output = "$root_out_dir/qtwebengine_resources.pak"
@@ -470,18 +497,17 @@ repack("qtwebengine_repack_resources") {
"//qtwebengine/browser:qt_webengine_resources",
"//chrome/browser:dev_ui_browser_resources_grit",
"//chrome/browser/resources/net_internals:resources",
- "//chrome/browser/resources/quota_internals:resources",
"//chrome/common:resources_grit",
"//components/resources:components_resources_grit",
"//components/resources:dev_ui_components_resources_grit",
"//content/browser/resources/media:resources",
"//content/browser/tracing:resources",
- "//content:content_resources_grit",
+ "//content:content_resources",
+ "//content/browser/resources/quota:resources",
"//content:dev_ui_content_resources_grit",
"//mojo/public/js:resources",
"//net:net_resources_grit",
"//third_party/blink/public:resources_grit",
- "//ui/resources:webui_resources_grd_grit",
"//ui/resources:webui_generated_resources_grd",
]
if (enable_extensions) {
@@ -587,9 +613,9 @@ repack("qtwebengine_repack_resources_devtools") {
}
chrome_repack_locales("qtwebengine_repack_locales_pack") {
- input_locales = locales
+ input_locales = platform_pak_locales
output_dir = "$root_out_dir/qtwebengine_locales"
- output_locales = locales
+ output_locales = platform_pak_locales
}
if (enable_extensions) {
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index 72bd34d5d..a1868715c 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -11,7 +11,6 @@
#include "components/error_page/common/error.h"
#include "components/error_page/common/localized_error.h"
#include "components/navigation_interception/intercept_navigation_throttle.h"
-#include "components/navigation_interception/navigation_params.h"
#include "components/network_hints/browser/simple_network_hints_handler_impl.h"
#include "components/performance_manager/embedder/performance_manager_lifetime.h"
#include "components/performance_manager/embedder/performance_manager_registry.h"
@@ -23,10 +22,12 @@
#include "content/public/browser/client_certificate_delegate.h"
#include "content/public/browser/file_url_loader.h"
#include "content/public/browser/media_observer.h"
+#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/shared_cors_origin_access_list.h"
+#include "content/public/browser/url_loader_request_interceptor.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_user_data.h"
#include "content/public/browser/web_ui_url_loader_factory.h"
@@ -35,9 +36,11 @@
#include "content/public/common/user_agent.h"
#include "extensions/buildflags/buildflags.h"
#include "mojo/public/cpp/bindings/self_owned_associated_receiver.h"
+#include "pdf/buildflags.h"
#include "net/ssl/client_cert_identity.h"
#include "net/ssl/client_cert_store.h"
#include "net/ssl/ssl_private_key.h"
+#include "printing/buildflags/buildflags.h"
#include "services/device/public/cpp/geolocation/geolocation_manager.h"
#include "services/network/network_service.h"
#include "services/network/public/cpp/web_sandbox_flags.h"
@@ -96,7 +99,11 @@
#if QT_CONFIG(webengine_spellchecker)
#include "chrome/browser/spellchecker/spell_check_host_chrome_impl.h"
+#include "chrome/browser/spellchecker/spellcheck_factory.h"
+#include "chrome/browser/spellchecker/spellcheck_service.h"
+#include "components/spellcheck/browser/pref_names.h"
#include "components/spellcheck/common/spellcheck.mojom.h"
+#include "components/spellcheck/common/spellcheck_features.h"
#endif
#if QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions)
@@ -116,7 +123,7 @@
#include "extensions/browser/extension_protocols.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_util.h"
-#include "extensions/browser/guest_view/extensions_guest_view_message_filter.h"
+#include "extensions/browser/guest_view/extensions_guest_view.h"
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h"
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
#include "extensions/browser/process_map.h"
@@ -126,7 +133,6 @@
#include "extensions/common/manifest_handlers/mime_types_handler.h"
#include "extensions/extension_web_contents_observer_qt.h"
#include "extensions/extensions_browser_client_qt.h"
-#include "extensions/pdf_iframe_navigation_throttle_qt.h"
#include "net/plugin_response_interceptor_url_loader_throttle.h"
#endif
@@ -136,9 +142,20 @@
#endif
#if BUILDFLAG(ENABLE_PRINTING) && BUILDFLAG(ENABLE_PRINT_PREVIEW)
+#include "printing/pdf_stream_delegate_qt.h"
#include "printing/print_view_manager_qt.h"
#endif
+#if BUILDFLAG(ENABLE_PDF)
+#include "components/pdf/browser/pdf_navigation_throttle.h"
+#include "components/pdf/browser/pdf_url_loader_request_interceptor.h"
+#include "components/pdf/browser/pdf_web_contents_helper.h"
+#endif
+
+#if BUILDFLAG(ENABLE_PDF) && BUILDFLAG(ENABLE_EXTENSIONS)
+#include "extensions/pdf_iframe_navigation_throttle_qt.h"
+#endif
+
#include <QGuiApplication>
#include <QStandardPaths>
#include <qpa/qplatformnativeinterface.h>
@@ -211,6 +228,10 @@ void ContentBrowserClientQt::RenderProcessWillLaunch(content::RenderProcessHost
const int id = host->GetID();
Profile *profile = Profile::FromBrowserContext(host->GetBrowserContext());
+ if (spellcheck::UseBrowserSpellChecker() && !profile->GetPrefs()->GetBoolean(spellcheck::prefs::kSpellCheckEnable))
+ SpellcheckServiceFactory::GetForContext(profile)->InitForRenderer(host);
+
+
#if QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions)
WebRtcLoggingController::AttachToRenderProcessHost(host, WebEngineContext::current()->webRtcLogUploader());
#endif
@@ -227,7 +248,6 @@ void ContentBrowserClientQt::RenderProcessWillLaunch(content::RenderProcessHost
host->AddFilter(new BrowserMessageFilterQt(id, profile));
#if BUILDFLAG(ENABLE_EXTENSIONS)
host->AddFilter(new extensions::ExtensionMessageFilter(id, profile));
- host->AddFilter(new extensions::ExtensionsGuestViewMessageFilter(id, profile));
#endif //ENABLE_EXTENSIONS
bool is_incognito_process = profile->IsOffTheRecord();
@@ -457,50 +477,60 @@ void ContentBrowserClientQt::ExposeInterfacesToRenderer(service_manager::BinderR
#if BUILDFLAG(ENABLE_EXTENSIONS)
associated_registry->AddInterface(base::BindRepeating(&extensions::EventRouter::BindForRenderer,
render_process_host->GetID()));
+ associated_registry->AddInterface(base::BindRepeating(&extensions::ExtensionsGuestView::CreateForComponents,
+ render_process_host->GetID()));
+ associated_registry->AddInterface(base::BindRepeating(&extensions::ExtensionsGuestView::CreateForExtensions,
+ render_process_host->GetID()));
#else
Q_UNUSED(associated_registry);
#endif
}
-// TODO: BindAssociatedReceiverForFrame -> RegisterAssociatedInterfaceBindersForRenderFrameHost
-// https://chromium-review.googlesource.com/c/chromium/src/+/3281481
-bool ContentBrowserClientQt::BindAssociatedReceiverFromFrame(content::RenderFrameHost *rfh,
- const std::string &interface_name,
- mojo::ScopedInterfaceEndpointHandle *handle)
+void ContentBrowserClientQt::RegisterAssociatedInterfaceBindersForRenderFrameHost(
+ content::RenderFrameHost &rfh,
+ blink::AssociatedInterfaceRegistry &associated_registry)
{
#if QT_CONFIG(webengine_webchannel)
- if (interface_name == qtwebchannel::mojom::WebChannelTransportHost::Name_) {
- auto *web_contents = content::WebContents::FromRenderFrameHost(rfh);
- auto *adapter = static_cast<WebContentsDelegateQt *>(web_contents->GetDelegate())->webContentsAdapter();
- adapter->webChannelTransport()->BindReceiver(
- mojo::PendingAssociatedReceiver<qtwebchannel::mojom::WebChannelTransportHost>(std::move(*handle)), rfh);
- return true;
- }
+ associated_registry.AddInterface(
+ base::BindRepeating(
+ [](content::RenderFrameHost *render_frame_host,
+ mojo::PendingAssociatedReceiver<qtwebchannel::mojom::WebChannelTransportHost> receiver) {
+ auto *web_contents = content::WebContents::FromRenderFrameHost(render_frame_host);
+ auto *adapter = static_cast<WebContentsDelegateQt *>(web_contents->GetDelegate())->webContentsAdapter();
+ adapter->webChannelTransport()->BindReceiver(std::move(receiver), render_frame_host);
+ }, &rfh));
#endif
#if BUILDFLAG(ENABLE_PRINTING) && BUILDFLAG(ENABLE_PRINT_PREVIEW)
- if (interface_name == printing::mojom::PrintManagerHost::Name_) {
- mojo::PendingAssociatedReceiver<printing::mojom::PrintManagerHost> receiver(std::move(*handle));
- PrintViewManagerQt::BindPrintManagerHost(std::move(receiver), rfh);
- return true;
- }
+ associated_registry.AddInterface(
+ base::BindRepeating(
+ [](content::RenderFrameHost* render_frame_host,
+ mojo::PendingAssociatedReceiver<printing::mojom::PrintManagerHost> receiver) {
+ PrintViewManagerQt::BindPrintManagerHost(std::move(receiver), render_frame_host);
+ }, &rfh));
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS)
- if (interface_name == extensions::mojom::LocalFrameHost::Name_) {
- extensions::ExtensionWebContentsObserverQt::BindLocalFrameHost(
- mojo::PendingAssociatedReceiver<extensions::mojom::LocalFrameHost>(std::move(*handle)), rfh);
- return true;
- }
+ associated_registry.AddInterface(
+ base::BindRepeating(
+ [](content::RenderFrameHost *render_frame_host,
+ mojo::PendingAssociatedReceiver<extensions::mojom::LocalFrameHost> receiver) {
+ extensions::ExtensionWebContentsObserverQt::BindLocalFrameHost(std::move(receiver), render_frame_host);
+ }, &rfh));
#endif
-
- if (interface_name == autofill::mojom::AutofillDriver::Name_) {
- mojo::PendingAssociatedReceiver<autofill::mojom::AutofillDriver> receiver(
- std::move(*handle));
- autofill::ContentAutofillDriverFactory::BindAutofillDriver(std::move(receiver), rfh);
- return true;
- }
-
- DCHECK(!ContentBrowserClient::BindAssociatedReceiverFromFrame(rfh, interface_name, handle));
- return false;
+ associated_registry.AddInterface(
+ base::BindRepeating(
+ [](content::RenderFrameHost *render_frame_host,
+ mojo::PendingAssociatedReceiver<autofill::mojom::AutofillDriver> receiver) {
+ autofill::ContentAutofillDriverFactory::BindAutofillDriver(std::move(receiver), render_frame_host);
+ }, &rfh));
+#if BUILDFLAG(ENABLE_PDF)
+ associated_registry.AddInterface(
+ base::BindRepeating(
+ [](content::RenderFrameHost *render_frame_host,
+ mojo::PendingAssociatedReceiver<pdf::mojom::PdfService> receiver) {
+ pdf::PDFWebContentsHelper::BindPdfService(std::move(receiver), render_frame_host);
+ }, &rfh));
+#endif // BUILDFLAG(ENABLE_PDF)
+ ContentBrowserClient::RegisterAssociatedInterfaceBindersForRenderFrameHost(rfh, associated_registry);
}
bool ContentBrowserClientQt::CanCreateWindow(
@@ -554,7 +584,7 @@ std::unique_ptr<device::LocationProvider> ContentBrowserClientQt::OverrideSystem
device::GeolocationManager *ContentBrowserClientQt::GetGeolocationManager()
{
-#if defined(OS_MAC)
+#if BUILDFLAG(IS_MAC)
return m_browserMainParts->GetGeolocationManager();
#else
return nullptr;
@@ -675,20 +705,22 @@ static void LaunchURL(const GURL& url,
bool ContentBrowserClientQt::HandleExternalProtocol(const GURL &url,
base::RepeatingCallback<content::WebContents*()> web_contents_getter,
- int child_id,
int frame_tree_node_id,
content::NavigationUIData *navigation_data,
- bool is_main_frame,
+ bool is_primary_main_frame,
+ bool is_in_fenced_frame_tree,
network::mojom::WebSandboxFlags sandbox_flags,
ui::PageTransition page_transition,
bool has_user_gesture,
const absl::optional<url::Origin> &initiating_origin,
+ content::RenderFrameHost *initiator_document,
mojo::PendingRemote<network::mojom::URLLoaderFactory> *out_factory)
{
- Q_UNUSED(child_id);
Q_UNUSED(frame_tree_node_id);
+ Q_UNUSED(is_in_fenced_frame_tree);
Q_UNUSED(navigation_data);
Q_UNUSED(initiating_origin);
+ Q_UNUSED(initiator_document);
Q_UNUSED(out_factory);
base::PostTask(FROM_HERE, {content::BrowserThread::UI},
@@ -697,7 +729,7 @@ bool ContentBrowserClientQt::HandleExternalProtocol(const GURL &url,
std::move(web_contents_getter),
page_transition,
sandbox_flags,
- is_main_frame,
+ is_primary_main_frame,
has_user_gesture));
return true;
}
@@ -784,14 +816,14 @@ WebContentsAdapterClient::NavigationType pageTransitionToNavigationType(ui::Page
}
}
-static bool navigationThrottleCallback(content::WebContents *source,
- const navigation_interception::NavigationParams &params)
+static bool navigationThrottleCallback(content::NavigationHandle *handle)
{
// We call navigationRequested later in launchExternalUrl for external protocols.
// The is_external_protocol parameter here is not fully accurate though,
// and doesn't know about profile specific custom URL schemes.
+ content::WebContents *source = handle->GetWebContents();
ProfileQt *profile = static_cast<ProfileQt *>(source->GetBrowserContext());
- if (params.is_external_protocol() && !profile->profileAdapter()->urlSchemeHandler(toQByteArray(params.url().scheme())))
+ if (handle->IsExternalProtocol() && !profile->profileAdapter()->urlSchemeHandler(toQByteArray(handle->GetURL().scheme())))
return false;
bool navigationAccepted = true;
@@ -802,14 +834,14 @@ static bool navigationThrottleCallback(content::WebContents *source,
return false;
// Redirects might not be reflected in transition_type at this point (see also chrome/.../web_navigation_api_helpers.cc)
- auto transition_type = params.transition_type();
- if (params.is_redirect())
+ auto transition_type = handle->GetPageTransition();
+ if (handle->WasServerRedirect())
transition_type = ui::PageTransitionFromInt(transition_type | ui::PAGE_TRANSITION_SERVER_REDIRECT);
client->navigationRequested(pageTransitionToNavigationType(transition_type),
- toQt(params.url()),
+ toQt(handle->GetURL()),
navigationAccepted,
- params.is_main_frame());
+ handle->IsInPrimaryMainFrame());
return !navigationAccepted;
}
@@ -822,9 +854,12 @@ std::vector<std::unique_ptr<content::NavigationThrottle>> ContentBrowserClientQt
base::BindRepeating(&navigationThrottleCallback),
navigation_interception::SynchronyMode::kSync));
+#if BUILDFLAG(ENABLE_PDF)
#if BUILDFLAG(ENABLE_EXTENSIONS)
MaybeAddThrottle(extensions::PDFIFrameNavigationThrottleQt::MaybeCreateThrottleFor(navigation_handle), &throttles);
-#endif
+#endif // BUILDFLAG(ENABLE_EXTENSIONS)
+ MaybeAddThrottle(pdf::PdfNavigationThrottle::MaybeCreateThrottleFor(navigation_handle, std::make_unique<PdfStreamDelegateQt>()), &throttles);
+#endif // BUILDFLAG(ENABLE_PDF)
return throttles;
}
@@ -1054,8 +1089,10 @@ void ContentBrowserClientQt::RegisterNonNetworkServiceWorkerUpdateURLLoaderFacto
}
void ContentBrowserClientQt::RegisterNonNetworkSubresourceURLLoaderFactories(int render_process_id, int render_frame_id,
+ const absl::optional<url::Origin> &request_initiator_origin,
NonNetworkURLLoaderFactoryMap *factories)
{
+ Q_UNUSED(request_initiator_origin);
content::RenderProcessHost *process_host = content::RenderProcessHost::FromID(render_process_id);
Profile *profile = Profile::FromBrowserContext(process_host->GetBrowserContext());
ProfileAdapter *profileAdapter = static_cast<ProfileQt *>(profile)->profileAdapter();
@@ -1147,6 +1184,9 @@ base::flat_set<std::string> ContentBrowserClientQt::GetPluginMimeTypesWithExtern
}
}
#endif
+#if BUILDFLAG(ENABLE_PDF)
+ mime_types.insert("application/x-google-chrome-pdf");
+#endif
return mime_types;
}
@@ -1184,6 +1224,25 @@ bool ContentBrowserClientQt::WillCreateURLLoaderFactory(
return true;
}
+std::vector<std::unique_ptr<content::URLLoaderRequestInterceptor>>
+ContentBrowserClientQt::WillCreateURLLoaderRequestInterceptors(content::NavigationUIData* navigation_ui_data,
+ int frame_tree_node_id,
+ const scoped_refptr<network::SharedURLLoaderFactory>& network_loader_factory)
+{
+ std::vector<std::unique_ptr<content::URLLoaderRequestInterceptor>> interceptors;
+#if BUILDFLAG(ENABLE_PDF)
+ {
+ std::unique_ptr<content::URLLoaderRequestInterceptor> pdf_interceptor =
+ pdf::PdfURLLoaderRequestInterceptor::MaybeCreateInterceptor(
+ frame_tree_node_id, std::make_unique<PdfStreamDelegateQt>());
+ if (pdf_interceptor)
+ interceptors.push_back(std::move(pdf_interceptor));
+ }
+#endif
+
+ return interceptors;
+}
+
bool ContentBrowserClientQt::WillInterceptWebSocket(content::RenderFrameHost *frame)
{
Q_UNUSED(frame);
diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h
index 220ab43f9..4ee5c0228 100644
--- a/src/core/content_browser_client_qt.h
+++ b/src/core/content_browser_client_qt.h
@@ -80,9 +80,8 @@ public:
void ExposeInterfacesToRenderer(service_manager::BinderRegistry *registry,
blink::AssociatedInterfaceRegistry *associated_registry,
content::RenderProcessHost *render_process_host) override;
- bool BindAssociatedReceiverFromFrame(content::RenderFrameHost *render_frame_host,
- const std::string &interface_name,
- mojo::ScopedInterfaceEndpointHandle *handle) override;
+ void RegisterAssociatedInterfaceBindersForRenderFrameHost(content::RenderFrameHost &render_frame_host,
+ blink::AssociatedInterfaceRegistry &associated_registry) override;
bool CanCreateWindow(content::RenderFrameHost *opener,
const GURL &opener_url,
@@ -170,14 +169,15 @@ public:
bool HandleExternalProtocol(
const GURL &url,
base::RepeatingCallback<content::WebContents*()> web_contents_getter,
- int child_id,
int frame_tree_node_id,
content::NavigationUIData *navigation_data,
- bool is_main_frame,
+ bool is_primary_main_frame,
+ bool is_in_fenced_frame_tree,
network::mojom::WebSandboxFlags sandbox_flags,
ui::PageTransition page_transition,
bool has_user_gesture,
const absl::optional<url::Origin> &initiating_origin,
+ content::RenderFrameHost *initiator_document,
mojo::PendingRemote<network::mojom::URLLoaderFactory> *out_factory) override;
std::vector<std::unique_ptr<blink::URLLoaderThrottle>> CreateURLLoaderThrottles(
@@ -192,7 +192,10 @@ public:
bool HasErrorPage(int http_status_code, content::WebContents *contents) override;
bool HasCustomSchemeHandler(content::BrowserContext *browser_context,
const std::string &scheme) override;
-
+ std::vector<std::unique_ptr<content::URLLoaderRequestInterceptor>>
+ WillCreateURLLoaderRequestInterceptors(content::NavigationUIData *navigation_ui_data,
+ int frame_tree_node_id,
+ const scoped_refptr<network::SharedURLLoaderFactory> &network_loader_factory) override;
bool WillCreateURLLoaderFactory(content::BrowserContext *browser_context,
content::RenderFrameHost *frame,
int render_process_id,
@@ -219,6 +222,7 @@ public:
ukm::SourceIdObj ukm_source_id,
NonNetworkURLLoaderFactoryMap *factories) override;
void RegisterNonNetworkSubresourceURLLoaderFactories(int render_process_id, int render_frame_id,
+ const absl::optional<url::Origin>& request_initiator_origin,
NonNetworkURLLoaderFactoryMap *factories) override;
void RegisterNonNetworkWorkerMainResourceURLLoaderFactories(content::BrowserContext* browser_context,
NonNetworkURLLoaderFactoryMap* factories) override;
diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp
index 553e4b4c8..92a00a5c8 100644
--- a/src/core/content_client_qt.cpp
+++ b/src/core/content_client_qt.cpp
@@ -5,9 +5,11 @@
#include "base/command_line.h"
#include "base/files/file_util.h"
+#include "base/json/json_string_value_serializer.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
+#include "base/values.h"
#include "base/version.h"
#include "content/public/common/cdm_info.h"
#include "content/public/common/content_constants.h"
@@ -37,9 +39,9 @@
// File name of the CDM on different platforms.
const char kWidevineCdmFileName[] =
-#if defined(OS_MAC)
+#if BUILDFLAG(IS_MAC)
"widevinecdm.plugin";
-#elif defined(OS_WIN)
+#elif BUILDFLAG(IS_WIN)
"widevinecdm.dll";
#else // OS_LINUX, etc.
"libwidevinecdm.so";
@@ -49,7 +51,6 @@ const char kWidevineCdmFileName[] =
#if QT_CONFIG(webengine_printing_and_pdf)
#include "pdf/pdf.h"
-#include "pdf/pdf_ppapi.h"
const char kPdfPluginMimeType[] = "application/x-google-chrome-pdf";
const char kPdfPluginPath[] = "internal-pdf-viewer";
#endif // QT_CONFIG(webengine_printing_and_pdf)
@@ -124,10 +125,6 @@ void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins)
pdf_info.path = base::FilePath::FromUTF8Unsafe(kPdfPluginPath);
content::WebPluginMimeType pdf_mime_type(kPdfPluginMimeType, "pdf", "Portable Document Format");
pdf_info.mime_types.push_back(pdf_mime_type);
- pdf_info.internal_entry_points.get_interface = chrome_pdf::PPP_GetInterface;
- pdf_info.internal_entry_points.initialize_module = chrome_pdf::PPP_InitializeModule;
- pdf_info.internal_entry_points.shutdown_module = chrome_pdf::PPP_ShutdownModule;
- pdf_info.permissions = ppapi::PERMISSION_DEV | ppapi::PERMISSION_PDF;
plugins->push_back(pdf_info);
#endif // QT_CONFIG(webengine_printing_and_pdf)
}
@@ -145,6 +142,37 @@ void ContentClientQt::AddPepperPlugins(std::vector<content::PepperPluginInfo>* p
namespace QtWebEngineCore {
#if defined(WIDEVINE_CDM_AVAILABLE_NOT_COMPONENT)
+#if defined(Q_OS_LINUX)
+static const QDir widevineCdmDirHint(const QDir &widevineDir)
+{
+ const QString hintFilePath = widevineDir.absolutePath() % QDir::separator()
+ % QLatin1String("latest-component-updated-widevine-cdm");
+ if (!QFileInfo::exists(hintFilePath)) {
+ // CDM hint file does not exist.
+ return widevineDir;
+ }
+
+ std::string jsonString;
+ if (!base::ReadFileToString(toFilePath(hintFilePath), &jsonString)) {
+ // Could not read the CDM hint file.
+ return widevineDir;
+ }
+
+ JSONStringValueDeserializer deserializer(jsonString);
+ std::unique_ptr<base::Value> dict = deserializer.Deserialize(nullptr, nullptr);
+ if (!dict || !dict->is_dict()) {
+ // Could not deserialize the CDM hint file.
+ return widevineDir;
+ }
+
+ std::string *widevineCdmDirPath = dict->FindStringKey("Path");
+ if (!widevineCdmDirPath)
+ return widevineDir;
+
+ return QDir(QString::fromStdString(*widevineCdmDirPath));
+}
+#endif // defined(Q_OS_LINUX)
+
static bool IsWidevineAvailable(base::FilePath *cdm_path,
media::CdmCapability *capability)
{
@@ -219,7 +247,7 @@ static bool IsWidevineAvailable(base::FilePath *cdm_path,
// Google Chrome widevine modules
QDir chromeWidevineDir(QDir::homePath() + "/.config/google-chrome/WidevineCdm");
if (chromeWidevineDir.exists())
- potentialWidevineVersionDirs << chromeWidevineDir;
+ potentialWidevineVersionDirs << widevineCdmDirHint(chromeWidevineDir);
// Firefox widevine modules
QDir firefoxPotentialProfilesDir(QDir::homePath() + "/.mozilla/firefox");
@@ -235,11 +263,12 @@ static bool IsWidevineAvailable(base::FilePath *cdm_path,
// Chromium widevine modules (might not work with proprietary codecs)
QDir chromiumWidevineDir(QDir::homePath() + "/.config/chromium/WidevineCdm");
if (chromiumWidevineDir.exists())
- potentialWidevineVersionDirs << chromiumWidevineDir;
+ potentialWidevineVersionDirs << widevineCdmDirHint(chromiumWidevineDir);
// Search for widewine versions
for (const QDir &dir : potentialWidevineVersionDirs) {
QFileInfoList widevineVersionDirs = dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Reversed);
+ widevineVersionDirs.prepend(QFileInfo(dir.absolutePath()));
// ### alternatively look up in the manifest.json and take the path from there.
#if Q_PROCESSOR_WORDSIZE == 8
const QString library = QLatin1String("/_platform_specific/linux_x64/libwidevinecdm.so");
@@ -312,7 +341,7 @@ void ContentClientQt::AddContentDecryptionModules(std::vector<content::CdmInfo>
const base::Version version;
cdms->push_back(content::CdmInfo(kWidevineKeySystem, Robustness::kSoftwareSecure, std::move(capability),
/*supports_sub_key_systems=*/false, kWidevineCdmDisplayName,
- kWidevineCdmType, version, cdm_path, kWidevineCdmFileSystemId));
+ kWidevineCdmType, version, cdm_path));
}
#endif // defined(WIDEVINE_CDM_AVAILABLE_NOT_COMPONENT)
@@ -343,13 +372,13 @@ void ContentClientQt::AddContentDecryptionModules(std::vector<content::CdmInfo>
Robustness::kSoftwareSecure, capability,
/*supports_sub_key_systems=*/false, media::kClearKeyCdmDisplayName,
media::kClearKeyCdmDifferentCdmType, base::Version("0.1.0.0"),
- clear_key_cdm_path, media::kClearKeyCdmFileSystemId));
+ clear_key_cdm_path));
cdms->push_back(content::CdmInfo(kExternalClearKeyKeySystem,
Robustness::kSoftwareSecure, capability,
/*supports_sub_key_systems=*/true, media::kClearKeyCdmDisplayName,
media::kClearKeyCdmType, base::Version("0.1.0.0"),
- clear_key_cdm_path, media::kClearKeyCdmFileSystemId));
+ clear_key_cdm_path));
}
#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS)
}
diff --git a/src/core/content_main_delegate_qt.cpp b/src/core/content_main_delegate_qt.cpp
index 6a5f61168..bd7a23497 100644
--- a/src/core/content_main_delegate_qt.cpp
+++ b/src/core/content_main_delegate_qt.cpp
@@ -6,6 +6,7 @@
#include "base/command_line.h"
#include "base/i18n/rtl.h"
#include "base/logging.h"
+#include "base/memory/ref_counted_memory.h"
#include "base/no_destructor.h"
#include "base/path_service.h"
#include "base/strings/string_number_conversions.h"
@@ -29,11 +30,11 @@
#include "web_engine_context.h"
#include "web_engine_library_info.h"
-#if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX))
+#if defined(ARCH_CPU_ARM_FAMILY) && (BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX))
#include "base/cpu.h"
#endif
-#if defined(OS_LINUX)
+#if BUILDFLAG(IS_LINUX)
#include "media/audio/audio_manager.h"
#include "ui/base/ui_base_switches.h"
#endif
@@ -41,12 +42,12 @@
// must be included before vaapi_wrapper.h
#include <QtCore/qcoreapplication.h>
-#if defined(OS_WIN)
+#if BUILDFLAG(IS_WIN)
#include "media/gpu/windows/dxva_video_decode_accelerator_win.h"
#include "media/gpu/windows/media_foundation_video_encode_accelerator_win.h"
#endif
-#if defined(OS_MAC)
+#if BUILDFLAG(IS_MAC)
#include "base/trace_event/trace_event.h"
#include "content/public/common/content_features.h"
#include "media/gpu/mac/vt_video_decode_accelerator_mac.h"
@@ -133,7 +134,7 @@ static logging::LoggingDestination DetermineLogMode(const base::CommandLine& com
void ContentMainDelegateQt::PreSandboxStartup()
{
-#if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX))
+#if defined(ARCH_CPU_ARM_FAMILY) && (BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX))
// Create an instance of the CPU class to parse /proc/cpuinfo and cache
// cpu_brand info.
base::CPU cpu_info;
@@ -166,7 +167,7 @@ void ContentMainDelegateQt::PreSandboxStartup()
}
}
-#if defined(OS_POSIX) && !defined(OS_ANDROID)
+#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID)
if (parsedCommandLine->HasSwitch(switches::kSingleProcess))
setlocale(LC_NUMERIC, "C");
#endif
@@ -175,12 +176,12 @@ void ContentMainDelegateQt::PreSandboxStartup()
#if BUILDFLAG(USE_VAAPI)
media::VaapiWrapper::PreSandboxInitialization();
#endif
-#if defined(OS_WIN)
+#if BUILDFLAG(IS_WIN)
media::DXVAVideoDecodeAccelerator::PreSandboxInitialization();
media::MediaFoundationVideoEncodeAccelerator::PreSandboxInitialization();
#endif
-#if defined(OS_MAC)
+#if BUILDFLAG(IS_MAC)
{
TRACE_EVENT0("gpu", "Initialize VideoToolbox");
media::InitializeVideoToolbox();
@@ -191,7 +192,7 @@ void ContentMainDelegateQt::PreSandboxStartup()
std::string appName = parsedCommandLine->GetSwitchValueASCII(switches::kApplicationName);
appName = QByteArray::fromPercentEncoding(QByteArray::fromStdString(appName)).toStdString();
QCoreApplication::setApplicationName(QString::fromStdString(appName));
-#if defined(OS_LINUX)
+#if BUILDFLAG(IS_LINUX)
media::AudioManager::SetGlobalAppName(appName);
#endif
}
@@ -221,7 +222,7 @@ content::ContentGpuClient *ContentMainDelegateQt::CreateContentGpuClient()
content::ContentRendererClient *ContentMainDelegateQt::CreateContentRendererClient()
{
-#if defined(OS_LINUX)
+#if BUILDFLAG(IS_LINUX)
base::CommandLine *parsedCommandLine = base::CommandLine::ForCurrentProcess();
std::string process_type = parsedCommandLine->GetSwitchValueASCII(switches::kProcessType);
bool no_sandbox = parsedCommandLine->HasSwitch(sandbox::policy::switches::kNoSandbox);
diff --git a/src/core/custom_handlers/protocol_handler_registry_factory.cpp b/src/core/custom_handlers/protocol_handler_registry_factory.cpp
index 14af1ed28..50b17006b 100644
--- a/src/core/custom_handlers/protocol_handler_registry_factory.cpp
+++ b/src/core/custom_handlers/protocol_handler_registry_factory.cpp
@@ -63,7 +63,7 @@ bool ProtocolHandlerRegistryFactory::ServiceIsNULLWhileTesting() const
KeyedService *ProtocolHandlerRegistryFactory::BuildServiceInstanceFor(content::BrowserContext *context) const
{
custom_handlers::ProtocolHandlerRegistry *registry =
- new custom_handlers::ProtocolHandlerRegistry(context,
+ new custom_handlers::ProtocolHandlerRegistry(/*prefs*/ nullptr,
std::make_unique<ProtocolHandlerRegistryDelegateQt>());
// Must be called as a part of the creation process.
diff --git a/src/core/custom_handlers/register_protocol_handler_request_controller_impl.cpp b/src/core/custom_handlers/register_protocol_handler_request_controller_impl.cpp
index fe6dcdd32..efaf54cd2 100644
--- a/src/core/custom_handlers/register_protocol_handler_request_controller_impl.cpp
+++ b/src/core/custom_handlers/register_protocol_handler_request_controller_impl.cpp
@@ -12,7 +12,7 @@ namespace QtWebEngineCore {
RegisterProtocolHandlerRequestControllerImpl::RegisterProtocolHandlerRequestControllerImpl(
content::WebContents *webContents,
- content::ProtocolHandler handler)
+ custom_handlers::ProtocolHandler handler)
: RegisterProtocolHandlerRequestController(
toQt(handler.url()),
toQt(handler.protocol()))
diff --git a/src/core/custom_handlers/register_protocol_handler_request_controller_impl.h b/src/core/custom_handlers/register_protocol_handler_request_controller_impl.h
index feb2cf0b8..073ca9bf8 100644
--- a/src/core/custom_handlers/register_protocol_handler_request_controller_impl.h
+++ b/src/core/custom_handlers/register_protocol_handler_request_controller_impl.h
@@ -4,10 +4,10 @@
#ifndef REGISTER_PROTOCOL_HANDLER_REQUEST_CONTROLLER_IMPL_H
#define REGISTER_PROTOCOL_HANDLER_REQUEST_CONTROLLER_IMPL_H
-#include "custom_handlers/register_protocol_handler_request_controller.h"
+#include "register_protocol_handler_request_controller.h"
#include "content/public/browser/web_contents_observer.h"
-#include "content/public/common/custom_handlers/protocol_handler.h"
+#include "components/custom_handlers/protocol_handler.h"
namespace custom_handlers {
class ProtocolHandlerRegistry;
@@ -20,7 +20,7 @@ class RegisterProtocolHandlerRequestControllerImpl final : public RegisterProtoc
public:
RegisterProtocolHandlerRequestControllerImpl(
content::WebContents *webContents,
- content::ProtocolHandler handler);
+ custom_handlers::ProtocolHandler handler);
~RegisterProtocolHandlerRequestControllerImpl();
@@ -30,7 +30,7 @@ protected:
private:
custom_handlers::ProtocolHandlerRegistry *protocolHandlerRegistry();
- content::ProtocolHandler m_handler;
+ custom_handlers::ProtocolHandler m_handler;
};
} // namespace QtWebEngineCore
diff --git a/src/core/desktop_screen_qt.cpp b/src/core/desktop_screen_qt.cpp
index 9d4bc71e2..47210aa09 100644
--- a/src/core/desktop_screen_qt.cpp
+++ b/src/core/desktop_screen_qt.cpp
@@ -42,12 +42,21 @@ display::Display toDisplayDisplay(int id, const QScreen *screen)
{
auto display = display::Display(id, toGfx(screen->geometry()));
display.set_work_area(toGfx(screen->availableGeometry()));
- display.set_device_scale_factor(screen->devicePixelRatio());
display.set_is_monochrome(screen->depth() == 1);
display.set_color_depth(screen->depth());
display.set_depth_per_component(8); // FIXME: find the real value
display.set_display_frequency(std::ceil(screen->refreshRate()));
display.set_rotation(toDisplayRotation(screen->orientation()));
+
+ // FIXME: support lower scale factor
+ float pixelRatio = screen->devicePixelRatio();
+ if (pixelRatio < 1) {
+ qWarning("Unsupported scale factor (%f) detected on Display%d", pixelRatio, id);
+ display.set_device_scale_factor(qGuiApp->devicePixelRatio());
+ } else {
+ display.set_device_scale_factor(pixelRatio);
+ }
+
if (screen->nativeOrientation() != Qt::PrimaryOrientation)
display.set_panel_rotation(toDisplayRotation(screen->nativeOrientation()));
return display;
@@ -110,6 +119,7 @@ display::Display DesktopScreenQt::GetDisplayNearestWindow(gfx::NativeWindow /*wi
return GetPrimaryDisplay();
}
+#if BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
bool DesktopScreenQt::SetScreenSaverSuspended(bool suspend)
{
#if defined(USE_XSCREENSAVER)
@@ -118,6 +128,7 @@ bool DesktopScreenQt::SetScreenSaverSuspended(bool suspend)
return false;
#endif
}
+#endif
bool DesktopScreenQt::IsScreenSaverActive() const
{
diff --git a/src/core/desktop_screen_qt.h b/src/core/desktop_screen_qt.h
index 385ffcfc1..33f0cf870 100644
--- a/src/core/desktop_screen_qt.h
+++ b/src/core/desktop_screen_qt.h
@@ -17,7 +17,9 @@ public:
~DesktopScreenQt() override;
display::Display GetDisplayNearestWindow(gfx::NativeWindow /*window*/) const override;
+#if BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
bool SetScreenSaverSuspended(bool suspend) override;
+#endif
bool IsScreenSaverActive() const override;
private:
diff --git a/src/core/devtools_frontend_qt.cpp b/src/core/devtools_frontend_qt.cpp
index 7f0168976..e706c680a 100644
--- a/src/core/devtools_frontend_qt.cpp
+++ b/src/core/devtools_frontend_qt.cpp
@@ -267,7 +267,7 @@ void DevToolsFrontendQt::ReadyToCommitNavigation(content::NavigationHandle *navi
}
}
-void DevToolsFrontendQt::DocumentAvailableInMainFrame(content::RenderFrameHost * /*render_frame_host*/)
+void DevToolsFrontendQt::DocumentOnLoadCompletedInPrimaryMainFrame()
{
if (!m_inspectedContents)
return;
@@ -354,9 +354,10 @@ void DevToolsFrontendQt::HandleMessageFromDevToolsFrontend(base::Value message)
int request_id = message.FindIntKey("id").value_or(0);
const std::string &method = *method_ptr;
- base::Value::ListView params;
+ base::Value::List *paramsPtr;
if (params_value)
- params = params_value->GetList();
+ paramsPtr = params_value->GetIfList();
+ base::Value::List &params = *paramsPtr;
if (method == "dispatchProtocolMessage" && params.size() == 1) {
const std::string *protocol_message = params[0].GetIfString();
@@ -575,7 +576,7 @@ void DevToolsFrontendQt::CallClientFunction(const std::string &object_name,
base::OnceCallback<void(base::Value)> cb)
{
- base::Value arguments(base::Value::Type::LIST);
+ base::Value::List arguments;
if (!arg1.is_none()) {
arguments.Append(std::move(arg1));
if (!arg2.is_none()) {
diff --git a/src/core/devtools_frontend_qt.h b/src/core/devtools_frontend_qt.h
index bbc867862..78a3aaefc 100644
--- a/src/core/devtools_frontend_qt.h
+++ b/src/core/devtools_frontend_qt.h
@@ -67,7 +67,7 @@ protected:
private:
// WebContentsObserver overrides
void ReadyToCommitNavigation(content::NavigationHandle* navigation_handle) override;
- void DocumentAvailableInMainFrame(content::RenderFrameHost *render_frame_host) override;
+ void DocumentOnLoadCompletedInPrimaryMainFrame() override;
void WebContentsDestroyed() override;
void SendMessageAck(int request_id, base::Value arg1);
diff --git a/src/core/doc/snippets/qtwebenginecore_build_snippet.qdoc b/src/core/doc/snippets/qtwebenginecore_build_snippet.qdoc
index eb4da08bd..ee22ea774 100644
--- a/src/core/doc/snippets/qtwebenginecore_build_snippet.qdoc
+++ b/src/core/doc/snippets/qtwebenginecore_build_snippet.qdoc
@@ -5,11 +5,6 @@
QT += webenginecore
//! [0]
-
-//! [1]
-#include <QtWebEngineCore>
-//! [1]
-
//! [2]
find_package(Qt6 REQUIRED COMPONENTS WebEngineCore)
target_link_libraries(target PRIVATE Qt::WebEngineCore)
diff --git a/src/core/doc/src/qtwebengine-deploying.qdoc b/src/core/doc/src/qtwebengine-deploying.qdoc
index 383f6828b..3fb46a672 100644
--- a/src/core/doc/src/qtwebengine-deploying.qdoc
+++ b/src/core/doc/src/qtwebengine-deploying.qdoc
@@ -105,8 +105,12 @@
\li On Linux and Windows: the \c resources directory in the directory
specified by QLibraryInfo::location(QLibraryInfo::DataPath)
\li On \macos: \c .app/Content/Resources
+ \li The application directory specified by QCoreApplication::applicationDirPath()
\endlist
+ Alternatively, a resources directory path can be set as a value of the
+ \c QTWEBENGINE_RESOURCES_PATH environment variable.
+
\section2 Translations
Locale data (such as \c en-US.pak) is searched form the following locations:
@@ -118,6 +122,9 @@
QLibraryInfo::location(QLibraryInfo::TranslationsPath)
\endlist
+ Alternatively, a locales directory path can be set as a value of the
+ \c QTWEBENGINE_LOCALES_PATH environment variable.
+
\section2 JavaScript Files in Qt Resource Files
If your WebEngine application is built using the Qt Quick Compiler, and the application ships
diff --git a/src/core/doc/src/qtwebengine-platform-notes.qdoc b/src/core/doc/src/qtwebengine-platform-notes.qdoc
index f2a39f7db..76f5bbfda 100644
--- a/src/core/doc/src/qtwebengine-platform-notes.qdoc
+++ b/src/core/doc/src/qtwebengine-platform-notes.qdoc
@@ -49,7 +49,7 @@
\li Visual Studio 2019 or later, or clang-cl version 10 or later
\li Active Template Library (ATL), usually included in the Visual Studio
installation
- \li Windows 10 SDK version 10.0.19041 or later
+ \li Windows 10 SDK version 10.0.20348.0 or later
\endlist
\QWE can only be built on 64-bit Windows, with a x64-bit toolchain.
@@ -101,8 +101,8 @@
\section1 Using Earlier Qt Versions to Build \QWE
Building \QWE with earlier Qt versions (down to the last LTS
- version) is supported. It means that \QWE 6.3 can be built with
- Qt 6.2.x, and Qt 6.3.
+ version) is supported. It means that \QWE 6.4 can be built with
+ Qt 6.2.x, Qt 6.3.x, and Qt 6.4.
To use an earlier Qt version to build Qt Webengine:
diff --git a/src/core/doc/src/qtwebenginecore-index.qdoc b/src/core/doc/src/qtwebenginecore-index.qdoc
index 73a6b4ead..cd6f2efe4 100644
--- a/src/core/doc/src/qtwebenginecore-index.qdoc
+++ b/src/core/doc/src/qtwebenginecore-index.qdoc
@@ -11,11 +11,6 @@
\section1 Getting Started
- To include the definitions of the module's classes, use the
- following directive:
-
- \snippet qtwebenginecore_build_snippet.qdoc 1
-
To link against the module, add this line to your qmake project file:
\snippet qtwebenginecore_build_snippet.qdoc 0
diff --git a/src/core/doc/src/qtwebenginecore-module.qdoc b/src/core/doc/src/qtwebenginecore-module.qdoc
index 2cb321e07..188609793 100644
--- a/src/core/doc/src/qtwebenginecore-module.qdoc
+++ b/src/core/doc/src/qtwebenginecore-module.qdoc
@@ -12,11 +12,6 @@
\qtvariable webenginecore
\qtcmakepackage WebEngineCore
- To include the definitions of the module's classes, use the
- following directive:
-
- \snippet qtwebenginecore_build_snippet.qdoc 1
-
If you use qmake to build your projects, \QWE Core is usually
indirectly included through the \l{Qt WebEngine QML Types}{Qt WebEngine Quick} or
\l{Qt WebEngine Widgets C++ Classes}{Qt WebEngine Widgets} modules.
diff --git a/src/core/doc/src/qwebenginehistory_lgpl.qdoc b/src/core/doc/src/qwebenginehistory_lgpl.qdoc
index 37f96e7c1..f61bb3b85 100644
--- a/src/core/doc/src/qwebenginehistory_lgpl.qdoc
+++ b/src/core/doc/src/qwebenginehistory_lgpl.qdoc
@@ -1,22 +1,6 @@
-/*
- Copyright (C) 2015 The Qt Company Ltd.
- Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+// Copyright (C) 2015 The Qt Company Ltd.
+// Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
// The documentation in this file was imported from QtWebKit and is thus constrained
// by its LGPL license. Documentation written from scratch for new methods should be
diff --git a/src/core/doc/src/qwebenginepage_lgpl.qdoc b/src/core/doc/src/qwebenginepage_lgpl.qdoc
index 4a058460b..19efa2903 100644
--- a/src/core/doc/src/qwebenginepage_lgpl.qdoc
+++ b/src/core/doc/src/qwebenginepage_lgpl.qdoc
@@ -1,24 +1,8 @@
-/*
- Copyright (C) 2019 The Qt Company Ltd.
- Copyright (C) 2008, 2009, 2012 Nokia Corporation and/or its subsidiary(-ies)
- Copyright (C) 2007 Staikos Computing Services Inc.
- Copyright (C) 2007 Apple Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+// Copyright (C) 2019 The Qt Company Ltd.
+// Copyright (C) 2008, 2009, 2012 Nokia Corporation and/or its subsidiary(-ies)
+// Copyright (C) 2007 Staikos Computing Services Inc.
+// Copyright (C) 2007 Apple Inc.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
// The documentation in this file was imported from QtWebKit and is thus constrained
// by its LGPL license. Documentation written from scratch for new methods should be
diff --git a/src/core/doc/src/qwebenginesettings_lgpl.qdoc b/src/core/doc/src/qwebenginesettings_lgpl.qdoc
index 9baeafaaf..5cd1e5419 100644
--- a/src/core/doc/src/qwebenginesettings_lgpl.qdoc
+++ b/src/core/doc/src/qwebenginesettings_lgpl.qdoc
@@ -1,22 +1,6 @@
-/*
- Copyright (C) 2022 The Qt Company Ltd.
- Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+// Copyright (C) 2022 The Qt Company Ltd.
+// Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
// The documentation in this file was imported from QtWebKit and is thus constrained
// by its LGPL license. Documentation written from scratch for new methods should be
@@ -97,7 +81,8 @@
Enables support for the HTML 5 local storage feature. Enabled by default.
\value LocalContentCanAccessRemoteUrls
Allows local origin documents to access remote resources that would normally be blocked.
- Disabled by default.
+ Disabled by default. Note DnsPrefetchEnabled below operates independently of this setting,
+ and can if enabled, cause remote accesses from local content.
\value XSSAuditingEnabled
Obsolete and has no effect.
\value SpatialNavigationEnabled
diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp
index b5ac6868c..65884c9b6 100644
--- a/src/core/download_manager_delegate_qt.cpp
+++ b/src/core/download_manager_delegate_qt.cpp
@@ -54,6 +54,7 @@ void DownloadManagerDelegateQt::cancelDownload(content::DownloadTargetCallback c
download::DownloadDangerType::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT,
download::DownloadItem::UNKNOWN,
base::FilePath(),
+ base::FilePath(),
absl::nullopt,
download::DownloadInterruptReason::DOWNLOAD_INTERRUPT_REASON_USER_CANCELED);
}
@@ -95,6 +96,7 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem *
download::DownloadDangerType::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
download::DownloadItem::VALIDATED,
item->GetForcedFilePath(),
+ item->GetFileNameToReportUser(),
absl::nullopt,
download::DownloadInterruptReason::DOWNLOAD_INTERRUPT_REASON_NONE);
return true;
@@ -164,14 +166,14 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem *
QFileInfo suggestedFile(info.path);
if (info.accepted && !suggestedFile.absoluteDir().mkpath(suggestedFile.absolutePath())) {
-#if defined(OS_WIN)
+#if defined(Q_OS_WIN)
// TODO: Remove this when https://bugreports.qt.io/browse/QTBUG-85997 is fixed.
QDir suggestedDir = QDir(suggestedFile.absolutePath());
if (!suggestedDir.isRoot() || !suggestedDir.exists()) {
#endif
qWarning("Creating download path failed, download cancelled: %s", suggestedFile.absolutePath().toUtf8().data());
info.accepted = false;
-#if defined(OS_WIN)
+#if defined(Q_OS_WIN)
}
#endif
}
@@ -187,6 +189,7 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem *
download::DownloadDangerType::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT,
download::DownloadItem::VALIDATED,
filePathForCallback.AddExtension(toFilePathString("download")),
+ base::FilePath(),
absl::nullopt,
download::DownloadInterruptReason::DOWNLOAD_INTERRUPT_REASON_NONE);
} else
diff --git a/src/core/extensions/component_extension_resource_manager_qt.cpp b/src/core/extensions/component_extension_resource_manager_qt.cpp
index d541dea37..b2cb7e356 100644
--- a/src/core/extensions/component_extension_resource_manager_qt.cpp
+++ b/src/core/extensions/component_extension_resource_manager_qt.cpp
@@ -42,7 +42,7 @@ ComponentExtensionResourceManagerQt::ComponentExtensionResourceManagerQt()
pdf_extension_util::AddAdditionalData(&dict);
ui::TemplateReplacements pdf_viewer_replacements;
- ui::TemplateReplacementsFromDictionaryValue(base::Value::AsDictionaryValue(dict), &pdf_viewer_replacements);
+ ui::TemplateReplacementsFromDictionaryValue(dict.GetDict(), &pdf_viewer_replacements);
template_replacements_[extension_misc::kPdfExtensionId] = std::move(pdf_viewer_replacements);
#endif
}
diff --git a/src/core/extensions/extension_host_delegate_qt.cpp b/src/core/extensions/extension_host_delegate_qt.cpp
index 7468cd9c5..6cc268e75 100644
--- a/src/core/extensions/extension_host_delegate_qt.cpp
+++ b/src/core/extensions/extension_host_delegate_qt.cpp
@@ -69,13 +69,9 @@ bool ExtensionHostDelegateQt::CheckMediaAccessPermission(content::RenderFrameHos
return false;
}
-content::PictureInPictureResult ExtensionHostDelegateQt::EnterPictureInPicture(content::WebContents *web_contents,
- const viz::SurfaceId &surface_id,
- const gfx::Size &natural_size)
+content::PictureInPictureResult ExtensionHostDelegateQt::EnterPictureInPicture(content::WebContents *web_contents)
{
Q_UNUSED(web_contents);
- Q_UNUSED(surface_id);
- Q_UNUSED(natural_size);
Q_UNREACHABLE();
return content::PictureInPictureResult::kNotSupported;
diff --git a/src/core/extensions/extension_host_delegate_qt.h b/src/core/extensions/extension_host_delegate_qt.h
index a9eed6462..e5577b3fd 100644
--- a/src/core/extensions/extension_host_delegate_qt.h
+++ b/src/core/extensions/extension_host_delegate_qt.h
@@ -30,9 +30,7 @@ public:
const GURL &security_origin,
blink::mojom::MediaStreamType type,
const Extension *extension) override;
- content::PictureInPictureResult EnterPictureInPicture(content::WebContents *web_contents,
- const viz::SurfaceId &surface_id,
- const gfx::Size &natural_size) override;
+ content::PictureInPictureResult EnterPictureInPicture(content::WebContents *web_contents) override;
void ExitPictureInPicture() override;
};
diff --git a/src/core/extensions/extension_system_qt.cpp b/src/core/extensions/extension_system_qt.cpp
index 99abc497a..67750fa6a 100644
--- a/src/core/extensions/extension_system_qt.cpp
+++ b/src/core/extensions/extension_system_qt.cpp
@@ -33,10 +33,10 @@
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_service.h"
-#include "content/public/browser/plugin_service.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/url_data_source.h"
#include "content/public/common/webplugininfo.h"
+#include "extensions/browser/app_sorting.h"
#include "extensions/browser/content_verifier.h"
#include "extensions/browser/content_verifier_delegate.h"
#include "extensions/browser/extension_pref_store.h"
@@ -46,7 +46,6 @@
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/info_map.h"
#include "extensions/browser/notification_types.h"
-#include "extensions/browser/null_app_sorting.h"
#include "extensions/browser/quota_service.h"
#include "extensions/browser/renderer_startup_helper.h"
#include "extensions/browser/service_worker_manager.h"
@@ -56,9 +55,15 @@
#include "extensions/common/manifest_handlers/mime_types_handler.h"
#include "extensions/common/manifest_url_handlers.h"
#include "net/base/mime_util.h"
+#include "pdf/buildflags.h"
+#include "ppapi/buildflags/buildflags.h"
#include "qtwebengine/grit/qt_webengine_resources.h"
#include "ui/base/resource/resource_bundle.h"
+#if BUILDFLAG(ENABLE_PLUGINS)
+#include "content/public/browser/plugin_service.h"
+#endif
+
using content::BrowserThread;
namespace extensions {
@@ -184,6 +189,7 @@ void ExtensionSystemQt::NotifyExtensionLoaded(const Extension *extension)
// know about it.
extension_registry_->TriggerOnLoaded(extension);
+#if BUILDFLAG(ENABLE_PLUGINS)
// Register plugins included with the extension.
// Implementation based on PluginManager::OnExtensionLoaded.
const MimeTypesHandler *handler = MimeTypesHandler::GetHandler(extension);
@@ -209,6 +215,7 @@ void ExtensionSystemQt::NotifyExtensionLoaded(const Extension *extension)
plugin_service->RefreshPlugins();
plugin_service->RegisterInternalPlugin(info, true);
}
+#endif // BUILDFLAG(ENABLE_PLUGINS)
}
bool ExtensionSystemQt::FinishDelayedInstallationIfReady(const std::string &extension_id, bool install_immediately)
@@ -277,7 +284,7 @@ QuotaService *ExtensionSystemQt::quota_service()
AppSorting *ExtensionSystemQt::app_sorting()
{
- return app_sorting_.get();
+ return nullptr;
}
ContentVerifier *ExtensionSystemQt::content_verifier()
@@ -312,7 +319,6 @@ void ExtensionSystemQt::Init(bool extensions_enabled)
service_worker_manager_ = std::make_unique<ServiceWorkerManager>(browser_context_);
user_script_manager_ = std::make_unique<UserScriptManager>(browser_context_);
quota_service_ = std::make_unique<QuotaService>();
- app_sorting_ = std::make_unique<NullAppSorting>();
// Make the chrome://extension-icon/ resource available.
// content::URLDataSource::Add(browser_context_, new ExtensionIconSource(browser_context_));
@@ -321,6 +327,7 @@ void ExtensionSystemQt::Init(bool extensions_enabled)
// Inform the rest of the extensions system to start.
ready_.Signal();
+#if BUILDFLAG(ENABLE_PDF)
{
std::string pdf_manifest = ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(IDR_PDF_MANIFEST);
base::ReplaceFirstSubstringAfterOffset(&pdf_manifest, 0, "<NAME>", "chromium-pdf");
@@ -332,6 +339,7 @@ void ExtensionSystemQt::Init(bool extensions_enabled)
std::string id = GenerateId(pdfManifestDict.get(), path);
LoadExtension(id, std::move(pdfManifestDict), path);
}
+#endif // BUILDFLAG(ENABLE_PDF)
#if BUILDFLAG(ENABLE_HANGOUT_SERVICES_EXTENSION)
{
@@ -378,12 +386,11 @@ void ExtensionSystemQt::RegisterExtensionWithRequestContexts(const Extension *ex
std::move(callback));
}
-void ExtensionSystemQt::UnregisterExtensionWithRequestContexts(const std::string &extension_id,
- const UnloadedExtensionReason reason)
+void ExtensionSystemQt::UnregisterExtensionWithRequestContexts(const std::string &extension_id)
{
base::PostTask(
FROM_HERE, {BrowserThread::IO},
- base::BindOnce(&InfoMap::RemoveExtension, info_map(), extension_id, reason));
+ base::BindOnce(&InfoMap::RemoveExtension, info_map(), extension_id));
}
bool ExtensionSystemQt::is_ready() const
diff --git a/src/core/extensions/extension_system_qt.h b/src/core/extensions/extension_system_qt.h
index 59a91b5c4..02fbaee37 100644
--- a/src/core/extensions/extension_system_qt.h
+++ b/src/core/extensions/extension_system_qt.h
@@ -65,8 +65,7 @@ public:
void RegisterExtensionWithRequestContexts(const Extension *extension,
base::OnceClosure callback) override;
- void UnregisterExtensionWithRequestContexts(const std::string &extension_id,
- const UnloadedExtensionReason reason) override;
+ void UnregisterExtensionWithRequestContexts(const std::string &extension_id) override;
ContentVerifier *content_verifier() override;
std::unique_ptr<ExtensionSet> GetDependentExtensions(const Extension *extension) override;
@@ -92,7 +91,6 @@ private:
std::unique_ptr<ServiceWorkerManager> service_worker_manager_;
std::unique_ptr<QuotaService> quota_service_;
- std::unique_ptr<AppSorting> app_sorting_;
std::unique_ptr<UserScriptManager> user_script_manager_;
diff --git a/src/core/extensions/extension_web_contents_observer_qt.cpp b/src/core/extensions/extension_web_contents_observer_qt.cpp
index acb05e147..22092be30 100644
--- a/src/core/extensions/extension_web_contents_observer_qt.cpp
+++ b/src/core/extensions/extension_web_contents_observer_qt.cpp
@@ -7,9 +7,8 @@
#include "extension_web_contents_observer_qt.h"
-#include "components/guest_view/browser/guest_view_base.h"
+#include "content/browser/renderer_host/render_frame_host_impl.h"
#include "content/public/browser/child_process_security_policy.h"
-#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "extensions/browser/extension_registry.h"
@@ -22,6 +21,7 @@ namespace extensions {
ExtensionWebContentsObserverQt::ExtensionWebContentsObserverQt(content::WebContents *web_contents)
: ExtensionWebContentsObserver(web_contents)
+ , content::WebContentsUserData<ExtensionWebContentsObserverQt>(*web_contents)
{
}
@@ -42,6 +42,17 @@ void ExtensionWebContentsObserverQt::RenderFrameCreated(content::RenderFrameHost
{
ExtensionWebContentsObserver::RenderFrameCreated(render_frame_host);
+ if (web_contents()->IsInnerWebContentsForGuest() && static_cast<content::RenderFrameHostImpl *>(render_frame_host)->is_local_root_subframe()) {
+ content::WebContents *parent = web_contents()->GetOutermostWebContents();
+ QtWebEngineCore::RenderWidgetHostViewQt *main_rwhv = static_cast<QtWebEngineCore::RenderWidgetHostViewQt *>(parent->GetRenderWidgetHostView());
+ // Main frame of guest WebContents
+ content::RenderWidgetHost *guest_render_widget_host = web_contents()->GetRenderViewHost()->GetWidget();
+ main_rwhv->addGuest(guest_render_widget_host);
+ // The frame which holds the actual PDF content inside the guest
+ content::RenderWidgetHost *pdf_render_widget_host = render_frame_host->GetRenderWidgetHost();
+ main_rwhv->addGuest(pdf_render_widget_host);
+ }
+
const Extension *extension = GetExtensionFromFrame(render_frame_host, false);
if (!extension)
return;
@@ -53,16 +64,6 @@ void ExtensionWebContentsObserverQt::RenderFrameCreated(content::RenderFrameHost
policy->GrantRequestOrigin(process_id, url::Origin::Create(GURL(blink::kChromeUIResourcesURL)));
}
-void ExtensionWebContentsObserverQt::RenderViewReady()
-{
- if (web_contents()->IsInnerWebContentsForGuest()) {
- content::RenderWidgetHost *render_widget_host = web_contents()->GetRenderViewHost()->GetWidget();
- content::WebContents *parent_web_contents = guest_view::GuestViewBase::GetTopLevelWebContents(web_contents());
- QtWebEngineCore::RenderWidgetHostViewQt *parent_rwhv = static_cast<QtWebEngineCore::RenderWidgetHostViewQt *>(parent_web_contents->GetRenderWidgetHostView());
- parent_rwhv->setGuest(static_cast<content::RenderWidgetHostImpl *>(render_widget_host));
- }
-}
-
WEB_CONTENTS_USER_DATA_KEY_IMPL(ExtensionWebContentsObserverQt);
} // namespace extensions
diff --git a/src/core/extensions/extension_web_contents_observer_qt.h b/src/core/extensions/extension_web_contents_observer_qt.h
index 7af1ee96d..ff50b28e2 100644
--- a/src/core/extensions/extension_web_contents_observer_qt.h
+++ b/src/core/extensions/extension_web_contents_observer_qt.h
@@ -25,7 +25,6 @@ public:
// content::WebContentsObserver overrides.
void RenderFrameCreated(content::RenderFrameHost *render_frame_host) override;
- void RenderViewReady() override;
private:
friend class content::WebContentsUserData<ExtensionWebContentsObserverQt>;
diff --git a/src/core/extensions/extensions_api_client_qt.cpp b/src/core/extensions/extensions_api_client_qt.cpp
index 9129ef3d6..3d86c65f7 100644
--- a/src/core/extensions/extensions_api_client_qt.cpp
+++ b/src/core/extensions/extensions_api_client_qt.cpp
@@ -10,12 +10,21 @@
#include "messaging_delegate_qt.h"
#include <memory>
-#include "components/pdf/browser/pdf_web_contents_helper.h"
+
#include "extension_web_contents_observer_qt.h"
#include "extensions/browser/guest_view/extensions_guest_view_manager_delegate.h"
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest_delegate.h"
#include "mime_handler_view_guest_delegate_qt.h"
+#include "pdf/buildflags.h"
+#include "printing/buildflags/buildflags.h"
+
+#if BUILDFLAG(ENABLE_PDF)
+#include "components/pdf/browser/pdf_web_contents_helper.h"
+#endif
+
+#if BUILDFLAG(ENABLE_PRINTING) && BUILDFLAG(ENABLE_PRINT_PREVIEW)
#include "printing/print_view_manager_qt.h"
+#endif
namespace extensions {
@@ -43,7 +52,9 @@ std::unique_ptr<MimeHandlerViewGuestDelegate> ExtensionsAPIClientQt::CreateMimeH
void ExtensionsAPIClientQt::AttachWebContentsHelpers(content::WebContents *web_contents) const
{
// PrefsTabHelper::CreateForWebContents(web_contents);
+#if BUILDFLAG(ENABLE_PRINTING) && BUILDFLAG(ENABLE_PRINT_PREVIEW)
QtWebEngineCore::PrintViewManagerQt::CreateForWebContents(web_contents);
+#endif
ExtensionWebContentsObserverQt::CreateForWebContents(web_contents);
}
diff --git a/src/core/extensions/extensions_browser_client_qt.cpp b/src/core/extensions/extensions_browser_client_qt.cpp
index fae252282..f013c04a4 100644
--- a/src/core/extensions/extensions_browser_client_qt.cpp
+++ b/src/core/extensions/extensions_browser_client_qt.cpp
@@ -167,7 +167,8 @@ private:
if (!head->mime_type.empty()) {
head->headers->AddHeader(net::HttpRequestHeaders::kContentType, head->mime_type.c_str());
}
- client_->OnReceiveResponse(std::move(head));
+ client_->OnReceiveResponse(std::move(head),
+ mojo::ScopedDataPipeConsumerHandle());
client_->OnStartLoadingResponseBody(std::move(consumer_handle));
uint32_t write_size = data->size();
@@ -501,7 +502,6 @@ ExtensionWebContentsObserver *ExtensionsBrowserClientQt::GetExtensionWebContents
KioskDelegate *ExtensionsBrowserClientQt::GetKioskDelegate()
{
- NOTREACHED();
return nullptr;
}
diff --git a/src/core/extensions/pdf_iframe_navigation_throttle_qt.cpp b/src/core/extensions/pdf_iframe_navigation_throttle_qt.cpp
index d3c5c7a63..a55294981 100644
--- a/src/core/extensions/pdf_iframe_navigation_throttle_qt.cpp
+++ b/src/core/extensions/pdf_iframe_navigation_throttle_qt.cpp
@@ -36,7 +36,8 @@ class PdfWebContentsLifetimeHelper : public content::WebContentsUserData<PdfWebC
{
public:
explicit PdfWebContentsLifetimeHelper(content::WebContents *web_contents)
- : web_contents_(web_contents)
+ : content::WebContentsUserData<PdfWebContentsLifetimeHelper>(*web_contents)
+ , web_contents_(web_contents)
{}
base::WeakPtr<PdfWebContentsLifetimeHelper> GetWeakPtr()
diff --git a/src/core/extensions/pdf_web_contents_helper_client_qt.h b/src/core/extensions/pdf_web_contents_helper_client_qt.h
deleted file mode 100644
index 49c670174..000000000
--- a/src/core/extensions/pdf_web_contents_helper_client_qt.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef PDF_WEB_CONTENTS_HELPER_CLIENT_QT_H_
-#define PDF_WEB_CONTENTS_HELPER_CLIENT_QT_H_
-
-#include "components/pdf/browser/pdf_web_contents_helper_client.h"
-
-namespace extensions {
-
-class PDFWebContentsHelperClientQt : public pdf::PDFWebContentsHelperClient
-{
-public:
- PDFWebContentsHelperClientQt();
- ~PDFWebContentsHelperClientQt() override;
-
-private:
- // pdf::PDFWebContentsHelperClient:
- void UpdateContentRestrictions(content::WebContents *contents, int content_restrictions) override;
- void OnPDFHasUnsupportedFeature(content::WebContents *contents) override;
- void OnSaveURL(content::WebContents *contents) override;
-};
-
-} // namespace extensions
-
-#endif // PDF_WEB_CONTENTS_HELPER_CLIENT_QT_H_
diff --git a/src/core/file_picker_controller.cpp b/src/core/file_picker_controller.cpp
index b81d7788a..84b5740d6 100644
--- a/src/core/file_picker_controller.cpp
+++ b/src/core/file_picker_controller.cpp
@@ -78,16 +78,16 @@ void FilePickerController::accepted(const QStringList &files)
base::FilePath filePath = toFilePath(urlString).NormalizePathSeparators();
std::vector<base::FilePath::StringType> pathComponents;
// Splits the file URL into scheme, host name, path and file name.
- filePath.GetComponents(&pathComponents);
+ pathComponents = filePath.GetComponents();
QString absolutePath;
-#if !defined(OS_WIN)
+#if !defined(Q_OS_WIN)
absolutePath = "/";
#endif
QString scheme = toQt(pathComponents[0]);
if (scheme.size() > 5) {
-#if defined(OS_WIN)
+#if defined(Q_OS_WIN)
// There is no slash at the end of the file scheme and it is valid on Windows: file:C:/
if (scheme.size() == 7 && scheme.at(5).isLetter() && scheme.at(6) == ':') {
absolutePath += scheme.at(5) + ":/";
@@ -95,7 +95,7 @@ void FilePickerController::accepted(const QStringList &files)
#endif
qWarning("Ignoring invalid item in FilePickerController::accepted(QStringList): %s", qPrintable(urlString));
continue;
-#if defined(OS_WIN)
+#if defined(Q_OS_WIN)
}
#endif
}
@@ -104,7 +104,7 @@ void FilePickerController::accepted(const QStringList &files)
if (base::FilePath::IsSeparator(urlString.at(5).toLatin1())
&& base::FilePath::IsSeparator(urlString.at(6).toLatin1())
&& !base::FilePath::IsSeparator(urlString.at(7).toLatin1())) {
-#if defined(OS_WIN)
+#if defined(Q_OS_WIN)
if (urlString.at(8) != ':' && pathComponents.size() > 2) {
absolutePath += "//";
#else
diff --git a/src/core/file_system_access/file_system_access_permission_context_qt.cpp b/src/core/file_system_access/file_system_access_permission_context_qt.cpp
index 8355444ca..3a9c80288 100644
--- a/src/core/file_system_access/file_system_access_permission_context_qt.cpp
+++ b/src/core/file_system_access/file_system_access_permission_context_qt.cpp
@@ -168,8 +168,7 @@ bool ShouldBlockAccessToPath(const base::FilePath &check_path, HandleType handle
base::FilePath diff;
nearest_ancestor.AppendRelativePath(check_path, &diff);
- std::vector<base::FilePath::StringType> diff_components;
- diff.GetComponents(&diff_components);
+ auto diff_components = diff.GetComponents();
if (diff_components.size() > 0 && toQt(diff_components[0]).contains(QCoreApplication::applicationName())) {
// The relative path contains the application name. Grant access.
return false;
diff --git a/src/core/file_system_access/file_system_access_permission_request_manager_qt.cpp b/src/core/file_system_access/file_system_access_permission_request_manager_qt.cpp
index e7471c9bd..423cdd777 100644
--- a/src/core/file_system_access/file_system_access_permission_request_manager_qt.cpp
+++ b/src/core/file_system_access/file_system_access_permission_request_manager_qt.cpp
@@ -83,6 +83,7 @@ void FileSystemAccessPermissionRequestManagerQt::AddRequest(
FileSystemAccessPermissionRequestManagerQt::FileSystemAccessPermissionRequestManagerQt(
content::WebContents *web_contents)
: content::WebContentsObserver(web_contents)
+ , content::WebContentsUserData<FileSystemAccessPermissionRequestManagerQt>(*web_contents)
{
}
@@ -90,7 +91,7 @@ bool FileSystemAccessPermissionRequestManagerQt::CanShowRequest() const
{
// Delay showing requests until the main frame is fully loaded.
// ScheduleShowRequest() will be called again when that happens.
- return web_contents()->IsDocumentOnLoadCompletedInMainFrame() && !m_queuedRequests.empty()
+ return web_contents()->IsDocumentOnLoadCompletedInPrimaryMainFrame() && !m_queuedRequests.empty()
&& !m_currentRequest;
}
@@ -126,7 +127,7 @@ void FileSystemAccessPermissionRequestManagerQt::DequeueAndShowRequest()
}
QWebEngineFileSystemAccessRequest request(
- QSharedPointer<FileSystemAccessPermissionRequestControllerImpl>::create(
+ std::make_shared<FileSystemAccessPermissionRequestControllerImpl>(
m_currentRequest->data,
base::BindOnce(
&FileSystemAccessPermissionRequestManagerQt::OnPermissionDialogResult,
@@ -134,8 +135,7 @@ void FileSystemAccessPermissionRequestManagerQt::DequeueAndShowRequest()
client->runFileSystemAccessRequest(std::move(request));
}
-void FileSystemAccessPermissionRequestManagerQt::DocumentOnLoadCompletedInMainFrame(
- content::RenderFrameHost *)
+void FileSystemAccessPermissionRequestManagerQt::DocumentOnLoadCompletedInPrimaryMainFrame()
{
// This is scheduled because while all calls to the browser have been
// issued at DOMContentLoaded, they may be bouncing around in scheduled
diff --git a/src/core/file_system_access/file_system_access_permission_request_manager_qt.h b/src/core/file_system_access/file_system_access_permission_request_manager_qt.h
index b88640f14..f8746eabf 100644
--- a/src/core/file_system_access/file_system_access_permission_request_manager_qt.h
+++ b/src/core/file_system_access/file_system_access_permission_request_manager_qt.h
@@ -58,7 +58,7 @@ private:
void DequeueAndShowRequest();
// content::WebContentsObserver
- void DocumentOnLoadCompletedInMainFrame(content::RenderFrameHost *) override;
+ void DocumentOnLoadCompletedInPrimaryMainFrame() override;
void DidFinishNavigation(content::NavigationHandle *navigation_handle) override;
void WebContentsDestroyed() override;
diff --git a/src/core/find_text_helper.cpp b/src/core/find_text_helper.cpp
index 0fe6442e7..5dc12fab7 100644
--- a/src/core/find_text_helper.cpp
+++ b/src/core/find_text_helper.cpp
@@ -85,7 +85,7 @@ void FindTextHelper::startFinding(const QString &findText, bool caseSensitively,
m_previousFindText = findText;
m_currentFindRequestId = m_findRequestIdCounter++;
- m_webContents->Find(m_currentFindRequestId, toString16(findText), std::move(options));
+ m_webContents->Find(m_currentFindRequestId, toString16(findText), std::move(options), /*skip_delay=*/true);
}
void FindTextHelper::stopFinding()
diff --git a/src/core/media_capture_devices_dispatcher.cpp b/src/core/media_capture_devices_dispatcher.cpp
index 7a080aabf..cddb5a290 100644
--- a/src/core/media_capture_devices_dispatcher.cpp
+++ b/src/core/media_capture_devices_dispatcher.cpp
@@ -12,6 +12,7 @@
#include "web_contents_view_qt.h"
#include "web_engine_settings.h"
+#include "base/task/post_task.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/desktop_media_id.h"
@@ -215,7 +216,7 @@ public:
}
private:
- gfx::NativeViewId OnStarted(base::OnceClosure stop, SourceCallback source,
+ gfx::NativeViewId OnStarted(base::RepeatingClosure stop, SourceCallback source,
const std::string& label,
std::vector<content::DesktopMediaID> screen_capture_ids,
StateChangeCallback state_change) override
@@ -241,7 +242,7 @@ private:
base::WeakPtr<WebContentsDelegateQt> m_delegate;
const blink::MediaStreamDevices m_devices;
bool m_started = false;
- base::OnceClosure m_onStop; // currently unused
+ base::RepeatingClosure m_onStop; // currently unused
};
} // namespace
@@ -293,6 +294,7 @@ void MediaCaptureDevicesDispatcher::handleMediaAccessPermissionResponse(content:
case blink::MEDIA_DEVICE_ACCESS:
case blink::MEDIA_DEVICE_UPDATE:
case blink::MEDIA_GENERATE_STREAM:
+ case blink::MEDIA_GET_OPEN_DEVICE:
getDefaultDevices(request.requested_audio_device_id, request.requested_video_device_id,
microphoneRequested, webcamRequested, &devices);
break;
@@ -332,7 +334,7 @@ MediaCaptureDevicesDispatcher *MediaCaptureDevicesDispatcher::GetInstance()
MediaCaptureDevicesDispatcher::MediaCaptureDevicesDispatcher()
: m_webContentsCollection(this)
{
-#if defined(OS_WIN)
+#if defined(Q_OS_WIN)
// Currently loopback audio capture is supported only on Windows.
m_loopbackAudioSupported = true;
#endif
diff --git a/src/core/native_web_keyboard_event_qt.cpp b/src/core/native_web_keyboard_event_qt.cpp
index 77bc068c7..4755c60bf 100644
--- a/src/core/native_web_keyboard_event_qt.cpp
+++ b/src/core/native_web_keyboard_event_qt.cpp
@@ -34,28 +34,31 @@ using blink::WebKeyboardEvent;
namespace content {
-NativeWebKeyboardEvent::NativeWebKeyboardEvent(blink::WebKeyboardEvent const&, gfx::NativeView)
- : os_event(0)
+NativeWebKeyboardEvent::NativeWebKeyboardEvent(const blink::WebKeyboardEvent &web_event, gfx::NativeView)
+ : WebKeyboardEvent(web_event)
+ , os_event(nullptr)
, skip_in_browser(false)
{
}
-NativeWebKeyboardEvent::NativeWebKeyboardEvent(blink::WebInputEvent::Type, int, base::TimeTicks)
- : os_event(0)
+NativeWebKeyboardEvent::NativeWebKeyboardEvent(blink::WebInputEvent::Type type, int modifiers,
+ base::TimeTicks timestamp)
+ : WebKeyboardEvent(type, modifiers, timestamp)
+ , os_event(nullptr)
, skip_in_browser(false)
{
}
NativeWebKeyboardEvent::NativeWebKeyboardEvent(gfx::NativeEvent native_event)
- : os_event(CopyEvent(native_event)),
- skip_in_browser(false)
+ : os_event(CopyEvent(native_event))
+ , skip_in_browser(false)
{
}
NativeWebKeyboardEvent::NativeWebKeyboardEvent(const NativeWebKeyboardEvent& other)
- : WebKeyboardEvent(other),
- os_event(CopyEvent(other.os_event)),
- skip_in_browser(other.skip_in_browser)
+ : WebKeyboardEvent(other)
+ , os_event(CopyEvent(other.os_event))
+ , skip_in_browser(other.skip_in_browser)
{
}
diff --git a/src/core/net/client_cert_override.cpp b/src/core/net/client_cert_override.cpp
index 875918c57..9a8cca839 100644
--- a/src/core/net/client_cert_override.cpp
+++ b/src/core/net/client_cert_override.cpp
@@ -7,6 +7,7 @@
#include "base/task/post_task.h"
#include "base/callback_forward.h"
#include "content/public/browser/browser_task_traits.h"
+#include "crypto/crypto_buildflags.h"
#include "net/ssl/client_cert_store.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "net/ssl/ssl_private_key.h"
@@ -20,15 +21,15 @@
#include <QtNetwork/qtnetworkglobal.h>
-#if defined(USE_NSS_CERTS)
+#if BUILDFLAG(USE_NSS_CERTS)
#include "net/ssl/client_cert_store_nss.h"
#endif
-#if defined(OS_WIN)
+#if defined(Q_OS_WIN)
#include "net/ssl/client_cert_store_win.h"
#endif
-#if defined(OS_MAC)
+#if BUILDFLAG(IS_MAC)
#include "net/ssl/client_cert_store_mac.h"
#endif
@@ -46,13 +47,6 @@ public:
std::move(private_key_callback).Run(m_key);
}
-#if defined(OS_MAC)
- SecIdentityRef sec_identity_ref() const override
- {
- return nullptr;
- }
-#endif
-
private:
scoped_refptr<net::SSLPrivateKey> m_key;
};
@@ -123,11 +117,11 @@ void ClientCertOverrideStore::GetClientCerts(const net::SSLCertRequestInfo &cert
// static
std::unique_ptr<net::ClientCertStore> ClientCertOverrideStore::createNativeStore()
{
-#if defined(USE_NSS_CERTS)
+#if BUILDFLAG(USE_NSS_CERTS)
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreNSS(net::ClientCertStoreNSS::PasswordDelegateFactory()));
-#elif defined(OS_WIN)
+#elif defined(Q_OS_WIN)
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreWin());
-#elif defined(OS_MAC)
+#elif BUILDFLAG(IS_MAC)
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreMac());
#else
return nullptr;
diff --git a/src/core/net/cookie_monster_delegate_qt.cpp b/src/core/net/cookie_monster_delegate_qt.cpp
index 0f82a4d1f..dc47de207 100644
--- a/src/core/net/cookie_monster_delegate_qt.cpp
+++ b/src/core/net/cookie_monster_delegate_qt.cpp
@@ -140,7 +140,7 @@ void CookieMonsterDelegateQt::deleteAllCookies()
m_mojoCookieManager->DeleteCookies(std::move(filter), network::mojom::CookieManager::DeleteCookiesCallback());
}
-void CookieMonsterDelegateQt::setMojoCookieManager(network::mojom::CookieManagerPtrInfo cookie_manager_info)
+void CookieMonsterDelegateQt::setMojoCookieManager(mojo::PendingRemote<network::mojom::CookieManager> cookie_manager_info)
{
if (m_mojoCookieManager.is_bound())
unsetMojoCookieManager();
diff --git a/src/core/net/cookie_monster_delegate_qt.h b/src/core/net/cookie_monster_delegate_qt.h
index d84946bb9..4273e96ef 100644
--- a/src/core/net/cookie_monster_delegate_qt.h
+++ b/src/core/net/cookie_monster_delegate_qt.h
@@ -24,6 +24,7 @@
#endif
#include "base/memory/ref_counted.h"
#include "mojo/public/cpp/bindings/receiver.h"
+#include "mojo/public/cpp/bindings/remote.h"
#include "net/cookies/cookie_store.h"
#include "services/network/public/mojom/cookie_manager.mojom-forward.h"
#include "services/network/public/mojom/cookie_manager.mojom.h"
@@ -46,7 +47,7 @@ class Q_WEBENGINECORE_PRIVATE_EXPORT CookieMonsterDelegateQt : public base::RefC
QPointer<QWebEngineCookieStore> m_client;
std::vector<std::unique_ptr<net::CookieChangeSubscription>> m_subscriptions;
- network::mojom::CookieManagerPtr m_mojoCookieManager;
+ mojo::Remote<network::mojom::CookieManager> m_mojoCookieManager;
std::unique_ptr<network::mojom::CookieChangeListener> m_listener;
std::unique_ptr<network::mojom::CookieRemoteAccessFilter> m_filter;
mojo::Receiver<network::mojom::CookieChangeListener> m_receiver;
@@ -65,7 +66,7 @@ public:
void deleteAllCookies();
void setClient(QWebEngineCookieStore *client);
- void setMojoCookieManager(network::mojom::CookieManagerPtrInfo cookie_manager_info);
+ void setMojoCookieManager(mojo::PendingRemote<network::mojom::CookieManager> cookie_manager_info);
void unsetMojoCookieManager();
void setHasFilter(bool b);
diff --git a/src/core/net/custom_url_loader_factory.cpp b/src/core/net/custom_url_loader_factory.cpp
index a41ece61b..bd7d7dc58 100644
--- a/src/core/net/custom_url_loader_factory.cpp
+++ b/src/core/net/custom_url_loader_factory.cpp
@@ -44,13 +44,13 @@ class CustomURLLoader : public network::mojom::URLLoader
{
public:
static void CreateAndStart(const network::ResourceRequest &request,
- network::mojom::URLLoaderRequest loader,
- network::mojom::URLLoaderClientPtrInfo client_info,
+ mojo::PendingReceiver<network::mojom::URLLoader> loader,
+ mojo::PendingRemote<network::mojom::URLLoaderClient> client_remote,
QPointer<ProfileAdapter> profileAdapter)
{
// CustomURLLoader will handle its own life-cycle, and delete when
// the client lets go.
- auto *customUrlLoader = new CustomURLLoader(request, std::move(loader), std::move(client_info), profileAdapter);
+ auto *customUrlLoader = new CustomURLLoader(request, std::move(loader), std::move(client_remote), profileAdapter);
customUrlLoader->Start();
}
@@ -83,14 +83,14 @@ public:
private:
CustomURLLoader(const network::ResourceRequest &request,
- network::mojom::URLLoaderRequest loader,
- network::mojom::URLLoaderClientPtrInfo client_info,
+ mojo::PendingReceiver<network::mojom::URLLoader> loader,
+ mojo::PendingRemote<network::mojom::URLLoaderClient> client_remote,
QPointer<ProfileAdapter> profileAdapter)
// ### We can opt to run the url-loader on the UI thread instead
: m_taskRunner(base::CreateSingleThreadTaskRunner({ content::BrowserThread::IO }))
, m_proxy(new URLRequestCustomJobProxy(this, request.url.scheme(), profileAdapter))
, m_receiver(this, std::move(loader))
- , m_client(std::move(client_info))
+ , m_client(std::move(client_remote))
, m_request(request)
{
DCHECK(m_taskRunner->RunsTasksInCurrentSequence());
@@ -286,19 +286,18 @@ private:
m_head->mime_type = m_mimeType;
m_head->charset = m_charset;
m_headerBytesRead = m_head->headers->raw_headers().length();
- m_client->OnReceiveResponse(std::move(m_head));
+ m_client->OnReceiveResponse(std::move(m_head), mojo::ScopedDataPipeConsumerHandle());
m_client->OnStartLoadingResponseBody(std::move(m_pipeConsumerHandle));
m_head = nullptr;
- if (readAvailableData()) // May delete this
- return;
-
m_watcher = std::make_unique<mojo::SimpleWatcher>(
- FROM_HERE, mojo::SimpleWatcher::ArmingPolicy::AUTOMATIC, m_taskRunner);
+ FROM_HERE, mojo::SimpleWatcher::ArmingPolicy::MANUAL, m_taskRunner);
m_watcher->Watch(m_pipeProducerHandle.get(), MOJO_HANDLE_SIGNAL_WRITABLE,
MOJO_WATCH_CONDITION_SATISFIED,
base::BindRepeating(&CustomURLLoader::notifyReadyWrite,
m_weakPtrFactory.GetWeakPtr()));
+
+ readAvailableData(); // May delete this
}
void notifyCanceled() override
{
@@ -338,7 +337,7 @@ private:
m_head->headers = base::MakeRefCounted<net::HttpResponseHeaders>(net::HttpUtil::AssembleRawHeaders(headers));
m_head->encoded_data_length = m_head->headers->raw_headers().length();
m_head->content_length = m_head->encoded_body_length = -1;
- m_client->OnReceiveResponse(std::move(m_head));
+ m_client->OnReceiveResponse(std::move(m_head), mojo::ScopedDataPipeConsumerHandle());
CompleteWithFailure(net::Error(error));
}
void notifyReadyRead() override
@@ -366,8 +365,10 @@ private:
uint32_t bufferSize = 0;
MojoResult beginResult = m_pipeProducerHandle->BeginWriteData(
&buffer, &bufferSize, MOJO_BEGIN_WRITE_DATA_FLAG_NONE);
- if (beginResult == MOJO_RESULT_SHOULD_WAIT)
+ if (beginResult == MOJO_RESULT_SHOULD_WAIT) {
+ m_watcher->ArmOrNotify();
return false; // Wait for pipe watcher
+ }
if (beginResult != MOJO_RESULT_OK)
break;
if (m_maxBytesToRead > 0 && m_maxBytesToRead <= int64_t{std::numeric_limits<uint32_t>::max()})
@@ -379,13 +380,20 @@ private:
m_totalBytesRead += bytesRead;
m_client->OnTransferSizeUpdated(m_totalBytesRead);
- if (m_device->atEnd() || (m_maxBytesToRead > 0 && m_totalBytesRead >= m_maxBytesToRead)) {
+ const bool deviceAtEnd = m_device->atEnd();
+ if ((deviceAtEnd && !m_device->isSequential())
+ || (m_maxBytesToRead > 0 && m_totalBytesRead >= m_maxBytesToRead)) {
OnTransferComplete(MOJO_RESULT_OK);
return true; // Done with reading
}
if (readResult == 0)
return false; // Wait for readyRead
+ if (readResult < 0 && deviceAtEnd && m_device->isSequential()) {
+ // Failure on read, and sequential device claiming to be at end, so treat it as a successful end-of-data.
+ OnTransferComplete(MOJO_RESULT_OK);
+ return true; // Done with reading
+ }
if (readResult < 0)
break;
}
@@ -418,7 +426,7 @@ private:
scoped_refptr<URLRequestCustomJobProxy> m_proxy;
mojo::Receiver<network::mojom::URLLoader> m_receiver;
- network::mojom::URLLoaderClientPtr m_client;
+ mojo::Remote<network::mojom::URLLoaderClient> m_client;
mojo::ScopedDataPipeProducerHandle m_pipeProducerHandle;
mojo::ScopedDataPipeConsumerHandle m_pipeConsumerHandle;
std::unique_ptr<mojo::SimpleWatcher> m_watcher;
diff --git a/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp b/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp
index e0e9bc80a..1bcb3ddea 100644
--- a/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp
+++ b/src/core/net/plugin_response_interceptor_url_loader_throttle.cpp
@@ -28,6 +28,51 @@
#include "web_engine_settings.h"
#include <string>
+#include <tuple>
+
+namespace {
+void ClearAllButFrameAncestors(network::mojom::URLResponseHead *response_head)
+{
+ response_head->headers->RemoveHeader("Content-Security-Policy");
+ response_head->headers->RemoveHeader("Content-Security-Policy-Report-Only");
+
+ if (!response_head->parsed_headers)
+ return;
+
+ std::vector<network::mojom::ContentSecurityPolicyPtr> &csp =
+ response_head->parsed_headers->content_security_policy;
+ std::vector<network::mojom::ContentSecurityPolicyPtr> cleared;
+
+ for (auto &policy : csp) {
+ auto frame_ancestors = policy->directives.find(network::mojom::CSPDirectiveName::FrameAncestors);
+ if (frame_ancestors == policy->directives.end())
+ continue;
+
+ auto cleared_policy = network::mojom::ContentSecurityPolicy::New();
+ cleared_policy->self_origin = std::move(policy->self_origin);
+ cleared_policy->header = std::move(policy->header);
+ cleared_policy->header->header_value = "";
+ cleared_policy->directives[network::mojom::CSPDirectiveName::FrameAncestors] = std::move(frame_ancestors->second);
+
+ auto raw_frame_ancestors = policy->raw_directives.find(network::mojom::CSPDirectiveName::FrameAncestors);
+ DCHECK(raw_frame_ancestors != policy->raw_directives.end());
+
+ cleared_policy->header->header_value = "frame-ancestors " + raw_frame_ancestors->second;
+ response_head->headers->AddHeader(
+ cleared_policy->header->type == network::mojom::ContentSecurityPolicyType::kEnforce
+ ? "Content-Security-Policy"
+ : "Content-Security-Policy-Report-Only",
+ cleared_policy->header->header_value);
+ cleared_policy->raw_directives[network::mojom::CSPDirectiveName::FrameAncestors] =
+ std::move(raw_frame_ancestors->second);
+
+ cleared.push_back(std::move(cleared_policy));
+ }
+
+ csp.swap(cleared);
+}
+} // namespace
+
namespace QtWebEngineCore {
@@ -72,7 +117,7 @@ void PluginResponseInterceptorURLLoaderThrottle::WillProcessResponse(const GURL
// Content-Security-Policy, and does not currently respect the policy anyway.
// Ignore CSP served on a PDF response. https://crbug.com/271452
if (extension_id == extension_misc::kPdfExtensionId && response_head->headers)
- response_head->headers->RemoveHeader("Content-Security-Policy");
+ ClearAllButFrameAncestors(response_head);
MimeTypesHandler::ReportUsedHandler(extension_id);
@@ -81,7 +126,7 @@ void PluginResponseInterceptorURLLoaderThrottle::WillProcessResponse(const GURL
std::string payload = view_id;
mojo::PendingRemote<network::mojom::URLLoader> dummy_new_loader;
- ignore_result(dummy_new_loader.InitWithNewPipeAndPassReceiver());
+ std::ignore = dummy_new_loader.InitWithNewPipeAndPassReceiver();
mojo::Remote<network::mojom::URLLoaderClient> new_client;
mojo::PendingReceiver<network::mojom::URLLoaderClient> new_client_receiver =
new_client.BindNewPipeAndPassReceiver();
@@ -115,9 +160,11 @@ void PluginResponseInterceptorURLLoaderThrottle::WillProcessResponse(const GURL
mojo::PendingRemote<network::mojom::URLLoader> original_loader;
mojo::PendingReceiver<network::mojom::URLLoaderClient> original_client;
+ mojo::ScopedDataPipeConsumerHandle body;
delegate_->InterceptResponse(std::move(dummy_new_loader),
- std::move(new_client_receiver), &original_loader,
- &original_client);
+ std::move(new_client_receiver),
+ &original_loader, &original_client,
+ &body);
// Make a deep copy of URLResponseHead before passing it cross-thread.
auto deep_copied_response = response_head->Clone();
@@ -135,6 +182,7 @@ void PluginResponseInterceptorURLLoaderThrottle::WillProcessResponse(const GURL
transferrable_loader->url_loader_client = std::move(original_client);
transferrable_loader->head = std::move(deep_copied_response);
transferrable_loader->head->intercepted_by_plugin = true;
+ transferrable_loader->body = std::move(body);
bool embedded = m_request_destination !=
network::mojom::RequestDestination::kDocument;
@@ -143,7 +191,6 @@ void PluginResponseInterceptorURLLoaderThrottle::WillProcessResponse(const GURL
base::BindOnce(
&extensions::StreamsPrivateAPI::SendExecuteMimeTypeHandlerEvent,
extension_id, view_id, embedded, m_frame_tree_node_id,
- -1 /* render_process_id */, -1 /* render_frame_id */,
std::move(transferrable_loader), response_url));
}
diff --git a/src/core/net/proxying_restricted_cookie_manager_qt.cpp b/src/core/net/proxying_restricted_cookie_manager_qt.cpp
index 0109f5697..ab435f8e2 100644
--- a/src/core/net/proxying_restricted_cookie_manager_qt.cpp
+++ b/src/core/net/proxying_restricted_cookie_manager_qt.cpp
@@ -69,12 +69,14 @@ void ProxyingRestrictedCookieManagerQt::GetAllForUrl(const GURL &url,
const net::SiteForCookies &site_for_cookies,
const url::Origin &top_frame_origin,
network::mojom::CookieManagerGetOptionsPtr options,
+ bool partitioned_cookies_runtime_feature_enabled,
GetAllForUrlCallback callback)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (allowCookies(url, site_for_cookies)) {
- underlying_restricted_cookie_manager_->GetAllForUrl(url, site_for_cookies, top_frame_origin, std::move(options), std::move(callback));
+ underlying_restricted_cookie_manager_->GetAllForUrl(url, site_for_cookies, top_frame_origin, std::move(options),
+ partitioned_cookies_runtime_feature_enabled, std::move(callback));
} else {
std::move(callback).Run(std::vector<net::CookieWithAccessResult>());
}
@@ -84,12 +86,13 @@ void ProxyingRestrictedCookieManagerQt::SetCanonicalCookie(const net::CanonicalC
const GURL &url,
const net::SiteForCookies &site_for_cookies,
const url::Origin &top_frame_origin,
+ net::CookieInclusionStatus status,
SetCanonicalCookieCallback callback)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (allowCookies(url, site_for_cookies)) {
- underlying_restricted_cookie_manager_->SetCanonicalCookie(cookie, url, site_for_cookies, top_frame_origin, std::move(callback));
+ underlying_restricted_cookie_manager_->SetCanonicalCookie(cookie, url, site_for_cookies, top_frame_origin, status, std::move(callback));
} else {
std::move(callback).Run(false);
}
@@ -109,12 +112,14 @@ void ProxyingRestrictedCookieManagerQt::SetCookieFromString(const GURL &url,
const net::SiteForCookies &site_for_cookies,
const url::Origin &top_frame_origin,
const std::string &cookie,
+ bool partitioned_cookies_runtime_feature_enabled,
SetCookieFromStringCallback callback)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (allowCookies(url, site_for_cookies)) {
- underlying_restricted_cookie_manager_->SetCookieFromString(url, site_for_cookies, top_frame_origin, cookie, std::move(callback));
+ underlying_restricted_cookie_manager_->SetCookieFromString(url, site_for_cookies, top_frame_origin, cookie,
+ partitioned_cookies_runtime_feature_enabled, std::move(callback));
} else {
std::move(callback).Run();
}
@@ -123,12 +128,14 @@ void ProxyingRestrictedCookieManagerQt::SetCookieFromString(const GURL &url,
void ProxyingRestrictedCookieManagerQt::GetCookiesString(const GURL &url,
const net::SiteForCookies &site_for_cookies,
const url::Origin &top_frame_origin,
+ bool partitioned_cookies_runtime_feature_enabled,
GetCookiesStringCallback callback)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (allowCookies(url, site_for_cookies)) {
- underlying_restricted_cookie_manager_->GetCookiesString(url, site_for_cookies, top_frame_origin, std::move(callback));
+ underlying_restricted_cookie_manager_->GetCookiesString(url, site_for_cookies, top_frame_origin,
+ partitioned_cookies_runtime_feature_enabled, std::move(callback));
} else {
std::move(callback).Run("");
}
diff --git a/src/core/net/proxying_restricted_cookie_manager_qt.h b/src/core/net/proxying_restricted_cookie_manager_qt.h
index 7b897e5a4..7ac6807ac 100644
--- a/src/core/net/proxying_restricted_cookie_manager_qt.h
+++ b/src/core/net/proxying_restricted_cookie_manager_qt.h
@@ -28,11 +28,13 @@ public:
const net::SiteForCookies &site_for_cookies,
const url::Origin &top_frame_origin,
network::mojom::CookieManagerGetOptionsPtr options,
+ bool partitioned_cookies_runtime_feature_enabled,
GetAllForUrlCallback callback) override;
void SetCanonicalCookie(const net::CanonicalCookie& cookie,
const GURL &url,
const net::SiteForCookies &site_for_cookies,
const url::Origin &top_frame_origin,
+ net::CookieInclusionStatus status,
SetCanonicalCookieCallback callback) override;
void AddChangeListener(const GURL &url,
const net::SiteForCookies &site_for_cookies,
@@ -43,10 +45,12 @@ public:
const net::SiteForCookies &site_for_cookies,
const url::Origin &top_frame_origin,
const std::string &cookie,
+ bool partitioned_cookies_runtime_feature_enabled,
SetCookieFromStringCallback callback) override;
void GetCookiesString(const GURL &url,
const net::SiteForCookies &site_for_cookies,
const url::Origin &top_frame_origin,
+ bool partitioned_cookies_runtime_feature_enabled,
GetCookiesStringCallback callback) override;
void CookiesEnabledFor(const GURL &url,
const net::SiteForCookies &site_for_cookies,
diff --git a/src/core/net/proxying_url_loader_factory_qt.cpp b/src/core/net/proxying_url_loader_factory_qt.cpp
index 43fba5583..0b82ceb41 100644
--- a/src/core/net/proxying_url_loader_factory_qt.cpp
+++ b/src/core/net/proxying_url_loader_factory_qt.cpp
@@ -68,6 +68,18 @@ static QWebEngineUrlRequestInfo::NavigationType toQt(WebContentsAdapterClient::N
return static_cast<QWebEngineUrlRequestInfo::NavigationType>(navigationType);
}
+static QHash<QByteArray, QByteArray> toQt(const net::HttpRequestHeaders &headers)
+{
+ const auto vector = headers.GetHeaderVector();
+ QHash<QByteArray, QByteArray> hash;
+
+ for (const auto &header : vector) {
+ hash.insert(QByteArray::fromStdString(header.key), QByteArray::fromStdString(header.value));
+ }
+
+ return hash;
+}
+
// Handles intercepted, in-progress requests/responses, so that they can be
// controlled and modified accordingly.
class InterceptedRequest : public network::mojom::URLLoader
@@ -86,7 +98,7 @@ public:
void Restart();
// network::mojom::URLLoaderClient
- void OnReceiveResponse(network::mojom::URLResponseHeadPtr head) override;
+ void OnReceiveResponse(network::mojom::URLResponseHeadPtr head, mojo::ScopedDataPipeConsumerHandle) override;
void OnReceiveRedirect(const net::RedirectInfo &redirect_info, network::mojom::URLResponseHeadPtr head) override;
void OnUploadProgress(int64_t current_position, int64_t total_size, OnUploadProgressCallback callback) override;
void OnReceiveCachedMetadata(mojo_base::BigBuffer data) override;
@@ -298,8 +310,14 @@ void InterceptedRequest::Restart()
else
firstPartyUrl = toQt(request_.site_for_cookies.first_party_url()); // m_topDocumentUrl can be empty for the main-frame.
- auto info = new QWebEngineUrlRequestInfoPrivate(resourceType, navigationType, originalUrl, firstPartyUrl,
- initiator, QByteArray::fromStdString(request_.method));
+ QHash<QByteArray, QByteArray> headers = toQt(request_.headers);
+
+ if (!request_.referrer.is_empty())
+ headers.insert("Referer", toQt(request_.referrer).toEncoded());
+
+ auto info = new QWebEngineUrlRequestInfoPrivate(
+ resourceType, navigationType, originalUrl, firstPartyUrl, initiator,
+ QByteArray::fromStdString(request_.method), headers);
Q_ASSERT(!request_info_);
request_info_.reset(new QWebEngineUrlRequestInfo(info));
@@ -376,11 +394,11 @@ void InterceptedRequest::ContinueAfterIntercept()
// URLLoaderClient methods.
-void InterceptedRequest::OnReceiveResponse(network::mojom::URLResponseHeadPtr head)
+void InterceptedRequest::OnReceiveResponse(network::mojom::URLResponseHeadPtr head, mojo::ScopedDataPipeConsumerHandle handle)
{
current_response_ = head.Clone();
- target_client_->OnReceiveResponse(std::move(head));
+ target_client_->OnReceiveResponse(std::move(head), std::move(handle));
}
void InterceptedRequest::OnReceiveRedirect(const net::RedirectInfo &redirect_info, network::mojom::URLResponseHeadPtr head)
diff --git a/src/core/net/qrc_url_scheme_handler.cpp b/src/core/net/qrc_url_scheme_handler.cpp
index 416fb82ff..ab66acac0 100644
--- a/src/core/net/qrc_url_scheme_handler.cpp
+++ b/src/core/net/qrc_url_scheme_handler.cpp
@@ -31,7 +31,10 @@ void QrcUrlSchemeHandler::requestStarted(QWebEngineUrlRequestJob *job)
QFileInfo fileInfo(*file);
QMimeDatabase mimeDatabase;
QMimeType mimeType = mimeDatabase.mimeTypeForFile(fileInfo);
- job->reply(mimeType.name().toUtf8(), file.take());
+ if (mimeType.name() == QStringLiteral("application/x-extension-html"))
+ job->reply("text/html", file.take());
+ else
+ job->reply(mimeType.name().toUtf8(), file.take());
}
} // namespace QtWebEngineCore
diff --git a/src/core/net/system_network_context_manager.cpp b/src/core/net/system_network_context_manager.cpp
index a804ff8f7..ec936fd10 100644
--- a/src/core/net/system_network_context_manager.cpp
+++ b/src/core/net/system_network_context_manager.cpp
@@ -30,6 +30,11 @@
#include "services/network/public/mojom/network_context.mojom.h"
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
+#if BUILDFLAG(IS_WIN)
+#include "components/os_crypt/os_crypt.h"
+#include "content/public/common/network_service_util.h"
+#endif
+
namespace {
// The global instance of the SystemNetworkContextmanager.
@@ -37,9 +42,8 @@ SystemNetworkContextManager *g_system_network_context_manager = nullptr;
network::mojom::HttpAuthStaticParamsPtr CreateHttpAuthStaticParams()
{
- network::mojom::HttpAuthStaticParamsPtr auth_static_params = network::mojom::HttpAuthStaticParams::New();
-
- auth_static_params->supported_schemes = { "basic", "digest", "ntlm", "negotiate" };
+ network::mojom::HttpAuthStaticParamsPtr auth_static_params =
+ network::mojom::HttpAuthStaticParams::New();
return auth_static_params;
}
@@ -48,6 +52,8 @@ network::mojom::HttpAuthDynamicParamsPtr CreateHttpAuthDynamicParams()
{
network::mojom::HttpAuthDynamicParamsPtr auth_dynamic_params = network::mojom::HttpAuthDynamicParams::New();
+ auth_dynamic_params->allowed_schemes = { "basic", "digest", "ntlm", "negotiate" };
+
auto *command_line = base::CommandLine::ForCurrentProcess();
auth_dynamic_params->server_allowlist = command_line->GetSwitchValueASCII(switches::kAuthServerAllowlist);
// auth_dynamic_params->delegate_allowlist = command_line->GetSwitchValueASCII(switches::kAuthNegotiateDelegateWhitelist);
@@ -185,28 +191,45 @@ void SystemNetworkContextManager::OnNetworkServiceCreated(network::mojom::Networ
network_service->SetUpHttpAuth(CreateHttpAuthStaticParams());
network_service->ConfigureHttpAuthPrefs(CreateHttpAuthDynamicParams());
+#if BUILDFLAG(IS_WIN)
+ if (content::IsOutOfProcessNetworkService())
+ network_service->SetEncryptionKey(OSCrypt::GetRawEncryptionKey());
+#endif
+
// Configure the Certificate Transparency logs.
- std::vector<std::pair<std::string, base::TimeDelta>> disqualified_logs =
+ std::vector<std::pair<std::string, base::Time>> disqualified_logs =
certificate_transparency::GetDisqualifiedLogs();
std::vector<network::mojom::CTLogInfoPtr> log_list_mojo;
for (const auto &ct_log : certificate_transparency::GetKnownLogs()) {
network::mojom::CTLogInfoPtr log_info = network::mojom::CTLogInfo::New();
log_info->public_key = std::string(ct_log.log_key, ct_log.log_key_length);
+ log_info->id = crypto::SHA256HashString(log_info->public_key);
log_info->name = ct_log.log_name;
+ log_info->current_operator = ct_log.current_operator;
- std::string log_id = crypto::SHA256HashString(log_info->public_key);
auto it = std::lower_bound(
- std::begin(disqualified_logs), std::end(disqualified_logs), log_id,
+ std::begin(disqualified_logs), std::end(disqualified_logs), log_info->id,
[](const auto& disqualified_log, const std::string& log_id) {
return disqualified_log.first < log_id;
});
- if (it != std::end(disqualified_logs) && it->first == log_id)
+ if (it != std::end(disqualified_logs) && it->first == log_info->id)
log_info->disqualified_at = it->second;
+
+ for (size_t i = 0; i < ct_log.previous_operators_length; i++) {
+ const auto& op = ct_log.previous_operators[i];
+ network::mojom::PreviousOperatorEntryPtr previous_operator =
+ network::mojom::PreviousOperatorEntry::New();
+ previous_operator->name = op.name;
+ previous_operator->end_time = op.end_time;
+ log_info->previous_operators.push_back(std::move(previous_operator));
+ }
+
log_list_mojo.push_back(std::move(log_info));
}
network_service->UpdateCtLogList(
- std::move(log_list_mojo),
- certificate_transparency::GetLogListTimestamp());
+ std::move(log_list_mojo),
+ certificate_transparency::GetLogListTimestamp(),
+ base::DoNothing());
// The system NetworkContext is created first
network_service_network_context_.reset();
@@ -254,7 +277,15 @@ void SystemNetworkContextManager::ConfigureDefaultNetworkContextParams(network::
// respect prefs::kEnableReferrers from the appropriate pref store.
network_context_params->enable_referrers = false;
- network_context_params->proxy_resolver_factory = ChromeMojoProxyResolverFactory::CreateWithSelfOwnedReceiver();
+ const base::CommandLine& command_line =
+ *base::CommandLine::ForCurrentProcess();
+
+ if (command_line.HasSwitch(switches::kSingleProcess)) {
+ LOG(ERROR) << "Cannot use V8 Proxy resolver in single process mode.";
+ } else {
+ network_context_params->proxy_resolver_factory =
+ ChromeMojoProxyResolverFactory::CreateWithSelfOwnedReceiver();
+ }
// Use the SystemNetworkContextManager to populate and update SSL
// configuration. The SystemNetworkContextManager is owned by the
diff --git a/src/core/net/webui_controller_factory_qt.cpp b/src/core/net/webui_controller_factory_qt.cpp
index acb0b3fcc..68bbb42fa 100644
--- a/src/core/net/webui_controller_factory_qt.cpp
+++ b/src/core/net/webui_controller_factory_qt.cpp
@@ -17,7 +17,6 @@
#include "chrome/browser/ui/webui/device_log_ui.h"
#include "chrome/browser/ui/webui/devtools_ui.h"
#include "chrome/browser/ui/webui/net_internals/net_internals_ui.h"
-#include "chrome/browser/ui/webui/quota_internals/quota_internals_ui.h"
#include "chrome/browser/ui/webui/user_actions/user_actions_ui.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/web_ui.h"
@@ -27,7 +26,7 @@
#include "printing/buildflags/buildflags.h"
#include "url/gurl.h"
-#if defined(OS_LINUX) || defined(OS_ANDROID)
+#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
#include "chrome/browser/ui/webui/sandbox/sandbox_internals_ui.h"
#endif
@@ -93,9 +92,6 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI *web_ui, Profile *profile, co
if (url.host() == chrome::kChromeUINetInternalsHost)
return &NewWebUI<NetInternalsUI>;
- if (url.host() == chrome::kChromeUIQuotaInternalsHost)
- return &NewWebUI<QuotaInternalsUI>;
-
if (url.SchemeIs(content::kChromeDevToolsScheme)) {
// if (!DevToolsUIBindings::IsValidFrontendURL(url))
// return nullptr;
@@ -131,7 +127,7 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI *web_ui, Profile *profile, co
if (url.host_piece() == chrome::kChromeUIWebRtcLogsHost)
return &NewWebUI<WebRtcLogsUI>;
#endif
-#if defined(OS_LINUX) || defined(OS_ANDROID)
+#if BUILDFLAG(IS_LINUX) // Consider enabling for BUILDFLAG(IS_WIN)
if (url.host_piece() == chrome::kChromeUISandboxHost)
return &NewWebUI<SandboxInternalsUI>;
#endif
diff --git a/src/core/ozone/gl_context_qt.cpp b/src/core/ozone/gl_context_qt.cpp
index ab6c5ca8c..75f8e8422 100644
--- a/src/core/ozone/gl_context_qt.cpp
+++ b/src/core/ozone/gl_context_qt.cpp
@@ -11,7 +11,7 @@
#include "ui/gl/gl_context_egl.h"
#include "ui/gl/gl_implementation.h"
-#if defined(OS_WIN)
+#if BUILDFLAG(IS_WIN)
#include "ui/gl/gl_context_wgl.h"
#endif
@@ -94,7 +94,7 @@ void* GLContextHelper::getGlXConfig()
void* GLContextHelper::getEGLDisplay()
{
-#ifdef Q_OS_WIN
+#if BUILDFLAG(IS_WIN)
// Windows QPA plugin does not implement resourceForIntegration for "egldisplay".
// Use resourceForContext instead.
return resourceForContext(QByteArrayLiteral("egldisplay"));
@@ -165,7 +165,7 @@ bool GLContextHelper::isCreateContextRobustnessSupported()
QT_END_NAMESPACE
-#if defined(OS_WIN)
+#if BUILDFLAG(IS_WIN)
namespace gl {
namespace init {
@@ -192,4 +192,4 @@ scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group,
} // namespace init
} // namespace gl
-#endif // defined(OS_WIN)
+#endif // BUILDFLAG(IS_WIN)
diff --git a/src/core/ozone/gl_surface_egl_qt.cpp b/src/core/ozone/gl_surface_egl_qt.cpp
index 9b3e0b8ad..bd9ec060e 100644
--- a/src/core/ozone/gl_surface_egl_qt.cpp
+++ b/src/core/ozone/gl_surface_egl_qt.cpp
@@ -8,9 +8,10 @@
#include "gl_context_qt.h"
#include "ozone/gl_surface_egl_qt.h"
-#if !defined(OS_MAC)
+#if !BUILDFLAG(IS_MAC)
#include "ui/gl/egl_util.h"
#include "ui/gl/gl_bindings.h"
+#include "ui/gl/gl_display.h"
#include "ui/gl/gl_surface_egl.h"
#include "ui/gl/init/gl_factory.h"
@@ -31,7 +32,7 @@ bool GLSurfaceEGL::InitializeExtensionSettingsOneOff()
EGLDisplay GLSurfaceEGL::GetHardwareDisplay()
{
- return static_cast<EGLDisplay>(GLSurfaceQt::g_display);
+ return GLSurfaceQt::g_display ? static_cast<EGLDisplay>(GLSurfaceQt::g_display->GetDisplay()) : EGL_NO_DISPLAY;
}
bool GLSurfaceEGL::IsCreateContextRobustnessSupported()
@@ -107,9 +108,9 @@ bool GLSurfaceEGL::IsANGLEContextVirtualizationSupported()
return false;
}
-bool GLSurfaceEGL::IsANGLEVulkanImageClientBufferSupported()
+bool GLSurfaceEGL::IsANGLEVulkanImageSupported()
{
- return false;
+ return false;
}
bool GLSurfaceEGL::IsEGLQueryDeviceSupported()
@@ -141,7 +142,7 @@ bool GLSurfaceEGL::HasEGLExtension(const char *name)
return ExtensionsContain(GetEGLExtensions(), name);
}
-bool GLSurfaceEGL::InitializeOneOff(gl::EGLDisplayPlatform /*native_display*/)
+bool GLSurfaceEGL::InitializeOneOff(gl::EGLDisplayPlatform /*native_display*/, uint64_t)
{
return GLSurfaceEGLQt::InitializeOneOff();
}
@@ -188,8 +189,10 @@ bool GLSurfaceEGLQt::InitializeOneOff()
// Must be called before initializing the display.
g_driver_egl.InitializeClientExtensionBindings();
- g_display = GLContextHelper::getEGLDisplay();
- if (!g_display) {
+ auto *egl_display = new GLDisplayEGL();
+ g_display = egl_display;
+ egl_display->SetDisplay(GLContextHelper::getEGLDisplay());
+ if (!g_display->GetDisplay()) {
LOG(ERROR) << "GLContextHelper::getEGLDisplay() failed.";
return false;
}
@@ -200,13 +203,13 @@ bool GLSurfaceEGLQt::InitializeOneOff()
return false;
}
- if (!eglInitialize(g_display, NULL, NULL)) {
+ if (!eglInitialize(g_display->GetDisplay(), NULL, NULL)) {
LOG(ERROR) << "eglInitialize failed with error " << GetLastEGLErrorString();
return false;
}
g_client_extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
- g_extensions = eglQueryString(g_display, EGL_EXTENSIONS);
+ g_extensions = eglQueryString(g_display->GetDisplay(), EGL_EXTENSIONS);
g_egl_surfaceless_context_supported = ExtensionsContain(g_extensions.c_str(), "EGL_KHR_surfaceless_context");
if (g_egl_surfaceless_context_supported) {
scoped_refptr<GLSurface> surface = new GLSurfacelessQtEGL(gfx::Size(1, 1));
@@ -242,7 +245,7 @@ bool GLSurfaceEGLQt::Initialize(GLSurfaceFormat format)
Q_ASSERT(!m_surfaceBuffer);
m_format = format;
- EGLDisplay display = g_display;
+ EGLDisplay display = g_display->GetDisplay();
if (!display) {
LOG(ERROR) << "Trying to create surface with invalid display.";
return false;
@@ -270,7 +273,7 @@ bool GLSurfaceEGLQt::Initialize(GLSurfaceFormat format)
void GLSurfaceEGLQt::Destroy()
{
if (m_surfaceBuffer) {
- if (!eglDestroySurface(g_display, m_surfaceBuffer))
+ if (!eglDestroySurface(g_display->GetDisplay(), m_surfaceBuffer))
LOG(ERROR) << "eglDestroySurface failed with error " << GetLastEGLErrorString();
m_surfaceBuffer = 0;
@@ -367,4 +370,4 @@ std::string DriverEGL::GetPlatformExtensions()
return "";
}
} // namespace gl
-#endif // !defined(OS_MAC)
+#endif // !BUILDFLAG(IS_MAC)
diff --git a/src/core/ozone/gl_surface_glx_qt.cpp b/src/core/ozone/gl_surface_glx_qt.cpp
index 757662211..f97f3de1e 100644
--- a/src/core/ozone/gl_surface_glx_qt.cpp
+++ b/src/core/ozone/gl_surface_glx_qt.cpp
@@ -8,6 +8,7 @@
#include "gl_context_qt.h"
#include "ozone/gl_surface_glx_qt.h"
#include "ui/gl/gl_bindings.h"
+#include "ui/gl/gl_display.h"
#include "ui/gl/gl_surface_glx.h"
namespace gl {
@@ -90,8 +91,8 @@ bool GLSurfaceGLXQt::InitializeOneOff()
if (s_initialized)
return true;
- g_display = GLContextHelper::getXDisplay();
- if (!g_display) {
+ g_display = new GLDisplayX11();
+ if (!g_display->GetDisplay()) {
LOG(ERROR) << "GLContextHelper::getXDisplay() failed.";
return false;
}
@@ -102,7 +103,7 @@ bool GLSurfaceGLXQt::InitializeOneOff()
return false;
}
- Display* display = static_cast<Display*>(g_display);
+ Display* display = static_cast<Display*>(g_display->GetDisplay());
int major, minor;
if (!glXQueryVersion(display, &major, &minor)) {
LOG(ERROR) << "glxQueryVersion failed.";
@@ -124,7 +125,7 @@ bool GLSurfaceGLXQt::InitializeExtensionSettingsOneOff()
if (!s_initialized)
return false;
- Display* display = static_cast<Display*>(g_display);
+ Display* display = static_cast<Display*>(g_display->GetDisplay());
GLSurfaceQt::g_extensions = glXQueryExtensionsString(display, 0);
g_driver_glx.InitializeExtensionBindings(g_extensions.c_str());
return true;
@@ -139,7 +140,7 @@ bool GLSurfaceGLXQt::Initialize(GLSurfaceFormat format)
{
Q_ASSERT(!m_surfaceBuffer);
- Display* display = static_cast<Display*>(g_display);
+ Display* display = static_cast<Display*>(g_display->GetDisplay());
const int pbuffer_attributes[] = {
GLX_PBUFFER_WIDTH, m_size.width(),
GLX_PBUFFER_HEIGHT, m_size.height(),
@@ -162,7 +163,7 @@ bool GLSurfaceGLXQt::Initialize(GLSurfaceFormat format)
void GLSurfaceGLXQt::Destroy()
{
if (m_surfaceBuffer) {
- glXDestroyPbuffer(static_cast<Display*>(g_display), m_surfaceBuffer);
+ glXDestroyPbuffer(static_cast<Display*>(g_display->GetDisplay()), m_surfaceBuffer);
m_surfaceBuffer = 0;
}
}
diff --git a/src/core/ozone/gl_surface_qt.cpp b/src/core/ozone/gl_surface_qt.cpp
index 0e181b4c1..0d7f686e8 100644
--- a/src/core/ozone/gl_surface_qt.cpp
+++ b/src/core/ozone/gl_surface_qt.cpp
@@ -5,12 +5,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE.Chromium file.
-#if !defined(OS_MAC)
+#include "qtwebenginecoreglobal_p.h"
+
+#if !defined(Q_OS_MACOS)
#include "gl_surface_qt.h"
-#include "qtwebenginecoreglobal_p.h"
-#if defined(OS_WIN)
+#include "base/logging.h"
+
+#if BUILDFLAG(IS_WIN)
#include "web_engine_context.h"
#include "ozone/gl_surface_wgl_qt.h"
#include "ozone/gl_surface_egl_qt.h"
@@ -24,7 +27,7 @@
namespace gl {
-void *GLSurfaceQt::g_display = nullptr;
+GLDisplay *GLSurfaceQt::g_display = nullptr;
void *GLSurfaceQt::g_config = nullptr;
std::string GLSurfaceQt::g_client_extensions;
std::string GLSurfaceQt::g_extensions;
@@ -73,7 +76,7 @@ GLSurfaceFormat GLSurfaceQt::GetFormat()
return m_format;
}
-void* GLSurfaceQt::GetDisplay()
+GLDisplay *GLSurfaceQt::GetGLDisplay()
{
return g_display;
}
@@ -83,9 +86,9 @@ void* GLSurfaceQt::GetConfig()
return g_config;
}
-#if defined(OS_WIN)
+#if BUILDFLAG(IS_WIN)
namespace init {
-bool InitializeGLOneOffPlatform()
+bool InitializeGLOneOffPlatform(uint64_t system_device_id)
{
VSyncProviderWin::InitializeOneOff();
@@ -100,7 +103,11 @@ bool InitializeGLOneOffPlatform()
bool usingSoftwareDynamicGL()
{
+#if QT_CONFIG(opengl)
return QtWebEngineCore::usingSoftwareDynamicGL();
+#else
+ return false;
+#endif // QT_CONFIG(opengl)
}
scoped_refptr<GLSurface>
@@ -149,10 +156,10 @@ CreateViewGLSurface(gfx::AcceleratedWidget window)
}
} // namespace init
-#endif // defined(OS_WIN)
+#endif // BUILDFLAG(IS_WIN)
} // namespace gl
-#if defined(OS_WIN)
+#if BUILDFLAG(IS_WIN)
namespace gpu {
class GpuCommandBufferStub;
class GpuChannelManager;
@@ -204,6 +211,11 @@ void DirectCompositionSurfaceWin::DisableDecodeSwapChain()
void DirectCompositionSurfaceWin::DisableSoftwareOverlays()
{
}
+
+void DirectCompositionSurfaceWin::ShutdownOneOff()
+{
+}
+
} // namespace gl
-#endif
-#endif // !defined(OS_MAC)
+#endif // BUILDFLAG(IS_WIN)
+#endif // !defined(Q_OS_MACOS)
diff --git a/src/core/ozone/gl_surface_qt.h b/src/core/ozone/gl_surface_qt.h
index c6ea79a94..f9d18a0ae 100644
--- a/src/core/ozone/gl_surface_qt.h
+++ b/src/core/ozone/gl_surface_qt.h
@@ -18,7 +18,7 @@ public:
static bool HasEGLExtension(const char* name);
// Implement GLSurface.
- void *GetDisplay() override;
+ GLDisplay *GetGLDisplay() override;
void *GetConfig() override;
bool IsOffscreen() override;
gfx::SwapResult SwapBuffers(PresentationCallback callback) override;
@@ -34,7 +34,7 @@ protected:
public:
static void* g_config;
- static void* g_display;
+ static GLDisplay *g_display;
static std::string g_extensions;
static std::string g_client_extensions;
};
diff --git a/src/core/ozone/gl_surface_wgl_qt.cpp b/src/core/ozone/gl_surface_wgl_qt.cpp
index 0d830451a..57493c14a 100644
--- a/src/core/ozone/gl_surface_wgl_qt.cpp
+++ b/src/core/ozone/gl_surface_wgl_qt.cpp
@@ -3,7 +3,7 @@
#include "gl_surface_wgl_qt.h"
-#if defined(OS_WIN)
+#if BUILDFLAG(IS_WIN)
#include "ui/gl/gl_surface_wgl.h"
namespace gl {
@@ -41,9 +41,9 @@ void *GLSurfaceWGLQt::GetHandle()
return m_surfaceBuffer->GetHandle();
}
-void *GLSurfaceWGLQt::GetDisplay()
+GLDisplay *GLSurfaceWGLQt::GetGLDisplay()
{
- return m_surfaceBuffer->GetDisplay();
+ return m_surfaceBuffer->GetGLDisplay();
}
void *GLSurfaceWGLQt::GetConfig()
@@ -53,4 +53,4 @@ void *GLSurfaceWGLQt::GetConfig()
} //namespace gl
-#endif // defined(OS_WIN)
+#endif // BUILDFLAG(IS_WIN)
diff --git a/src/core/ozone/gl_surface_wgl_qt.h b/src/core/ozone/gl_surface_wgl_qt.h
index 667a94f84..e1a1253bb 100644
--- a/src/core/ozone/gl_surface_wgl_qt.h
+++ b/src/core/ozone/gl_surface_wgl_qt.h
@@ -6,7 +6,7 @@
#include "gl_surface_qt.h"
-#if defined(OS_WIN)
+#if BUILDFLAG(IS_WIN)
namespace gl {
@@ -21,7 +21,7 @@ public:
bool Initialize(GLSurfaceFormat format) override;
void Destroy() override;
void *GetHandle() override;
- void *GetDisplay() override;
+ GLDisplay *GetGLDisplay() override;
void *GetConfig() override;
protected:
@@ -32,6 +32,6 @@ private:
};
}
-#endif // defined(OS_WIN)
+#endif // BUILDFLAG(IS_WIN)
#endif // GL_SURFACE_WGL_QT_H
diff --git a/src/core/ozone/ozone_platform_qt.cpp b/src/core/ozone/ozone_platform_qt.cpp
index f3ba7dc50..8ab3aa1a7 100644
--- a/src/core/ozone/ozone_platform_qt.cpp
+++ b/src/core/ozone/ozone_platform_qt.cpp
@@ -53,7 +53,7 @@ public:
std::unique_ptr<InputMethod> CreateInputMethod(internal::InputMethodDelegate *delegate, gfx::AcceleratedWidget widget) override;
std::unique_ptr<ui::PlatformScreen> CreateScreen() override { return nullptr; }
private:
- void InitializeUI(const ui::OzonePlatform::InitParams &) override;
+ bool InitializeUI(const ui::OzonePlatform::InitParams &) override;
void InitializeGPU(const ui::OzonePlatform::InitParams &) override;
void InitScreen(ui::PlatformScreen *) override {}
@@ -162,7 +162,7 @@ static std::string getCurrentKeyboardLayout()
}
#endif // BUILDFLAG(USE_XKBCOMMON)
-void OzonePlatformQt::InitializeUI(const ui::OzonePlatform::InitParams &)
+bool OzonePlatformQt::InitializeUI(const ui::OzonePlatform::InitParams &)
{
#if BUILDFLAG(USE_XKBCOMMON)
std::string layout = getCurrentKeyboardLayout();
@@ -182,6 +182,7 @@ void OzonePlatformQt::InitializeUI(const ui::OzonePlatform::InitParams &)
input_controller_ = CreateStubInputController();
cursor_factory_.reset(new BitmapCursorFactory());
gpu_platform_support_host_.reset(ui::CreateStubGpuPlatformSupportHost());
+ return true;
}
void OzonePlatformQt::InitializeGPU(const ui::OzonePlatform::InitParams &)
diff --git a/src/core/ozone/ozone_platform_qt.h b/src/core/ozone/ozone_platform_qt.h
index ca1dea917..23629b2eb 100644
--- a/src/core/ozone/ozone_platform_qt.h
+++ b/src/core/ozone/ozone_platform_qt.h
@@ -4,16 +4,12 @@
#ifndef OZONE_PLATFORM_QT_H
#define OZONE_PLATFORM_QT_H
-#if defined(USE_OZONE)
-
-#include "ui/ozone/public/ozone_platform.h"
-
namespace ui {
+class OzonePlatform;
// Constructor hook for use in ozone_platform_list.cc
-OzonePlatform* CreateOzonePlatformQt();
+OzonePlatform *CreateOzonePlatformQt();
} // namespace ui
-#endif // defined(USE_OZONE)
#endif // OZONE_PLATFORM_QT_H
diff --git a/src/core/permission_manager_qt.cpp b/src/core/permission_manager_qt.cpp
index 4d0f17a49..a1727bda3 100644
--- a/src/core/permission_manager_qt.cpp
+++ b/src/core/permission_manager_qt.cpp
@@ -51,7 +51,7 @@ static ProfileAdapter::PermissionType toQt(content::PermissionType type)
case content::PermissionType::AR:
case content::PermissionType::VR:
case content::PermissionType::STORAGE_ACCESS_GRANT:
- case content::PermissionType::FONT_ACCESS:
+ case content::PermissionType::LOCAL_FONTS:
case content::PermissionType::DISPLAY_CAPTURE:
case content::PermissionType::NUM:
LOG(INFO) << "Unexpected unsupported permission type: " << static_cast<int>(type);
@@ -289,6 +289,24 @@ blink::mojom::PermissionStatus PermissionManagerQt::GetPermissionStatusForFrame(
render_frame_host->GetLastCommittedOrigin().GetURL());
}
+blink::mojom::PermissionStatus PermissionManagerQt::GetPermissionStatusForCurrentDocument(
+ content::PermissionType permission,
+ content::RenderFrameHost *render_frame_host)
+{
+ return GetPermissionStatusForFrame(
+ permission,
+ render_frame_host,
+ render_frame_host->GetLastCommittedOrigin().GetURL());
+}
+
+blink::mojom::PermissionStatus PermissionManagerQt::GetPermissionStatusForWorker(
+ content::PermissionType permission,
+ content::RenderProcessHost *render_process_host,
+ const GURL &url)
+{
+ return GetPermissionStatus(permission, url, url);
+}
+
void PermissionManagerQt::ResetPermission(
content::PermissionType permission,
const GURL& requesting_origin,
@@ -304,6 +322,7 @@ void PermissionManagerQt::ResetPermission(
content::PermissionControllerDelegate::SubscriptionId PermissionManagerQt::SubscribePermissionStatusChange(
content::PermissionType permission,
+ content::RenderProcessHost * /*render_process_host*/,
content::RenderFrameHost * /* render_frame_host */,
const GURL& requesting_origin,
base::RepeatingCallback<void(blink::mojom::PermissionStatus)> callback)
diff --git a/src/core/permission_manager_qt.h b/src/core/permission_manager_qt.h
index cca94974c..566e0839b 100644
--- a/src/core/permission_manager_qt.h
+++ b/src/core/permission_manager_qt.h
@@ -40,6 +40,10 @@ public:
content::RenderFrameHost *render_frame_host,
const GURL& requesting_origin) override;
+ blink::mojom::PermissionStatus GetPermissionStatusForCurrentDocument(content::PermissionType, content::RenderFrameHost *) override;
+
+ blink::mojom::PermissionStatus GetPermissionStatusForWorker(content::PermissionType, content::RenderProcessHost *, const GURL &) override;
+
void ResetPermission(
content::PermissionType permission,
const GURL& requesting_origin,
@@ -55,6 +59,7 @@ public:
content::PermissionControllerDelegate::SubscriptionId SubscribePermissionStatusChange(
content::PermissionType permission,
+ content::RenderProcessHost* render_process_host,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
const base::RepeatingCallback<void(blink::mojom::PermissionStatus)> callback) override;
diff --git a/src/core/pref_service_adapter.cpp b/src/core/pref_service_adapter.cpp
index 48deb5ced..6c3a1918c 100644
--- a/src/core/pref_service_adapter.cpp
+++ b/src/core/pref_service_adapter.cpp
@@ -18,6 +18,8 @@
#include "components/prefs/pref_service.h"
#include "components/prefs/pref_service_factory.h"
#include "components/prefs/pref_registry_simple.h"
+#include "components/signin/internal/identity_manager/account_tracker_service.h"
+#include "components/signin/public/base/signin_pref_names.h"
#include "components/user_prefs/user_prefs.h"
#include "components/proxy_config/pref_proxy_config_tracker_impl.h"
#include "chrome/common/pref_names.h"
@@ -37,6 +39,10 @@
#include "extensions/common/constants.h"
#endif
+#if defined(Q_OS_WIN)
+#include "components/os_crypt/os_crypt.h"
+#endif
+
namespace {
static const char kPrefMediaDeviceIDSalt[] = "qtwebengine.media_device_salt_id";
}
@@ -76,6 +82,23 @@ void PrefServiceAdapter::setup(const ProfileAdapter &profileAdapter)
registry->RegisterBooleanPref(prefs::kShowInternalAccessibilityTree, false);
registry->RegisterBooleanPref(prefs::kAccessibilityImageLabelsEnabled, false);
registry->RegisterIntegerPref(prefs::kNotificationNextPersistentId, 10000);
+ registry->RegisterDictionaryPref(prefs::kPushMessagingAppIdentifierMap);
+ registry->RegisterListPref(prefs::kAccountInfo);
+ registry->RegisterIntegerPref(prefs::kAccountIdMigrationState,
+ AccountTrackerService::MIGRATION_NOT_STARTED);
+ registry->RegisterStringPref(prefs::kGoogleServicesLastAccountId,
+ std::string());
+ registry->RegisterStringPref(prefs::kGoogleServicesLastUsername,
+ std::string());
+ registry->RegisterStringPref(prefs::kGoogleServicesAccountId, std::string());
+ registry->RegisterBooleanPref(prefs::kGoogleServicesConsentedToSync, false);
+ registry->RegisterBooleanPref(prefs::kAutologinEnabled, true);
+ registry->RegisterListPref(prefs::kReverseAutologinRejectedEmailList);
+ registry->RegisterBooleanPref(prefs::kSigninAllowed, true);
+ registry->RegisterBooleanPref(prefs::kSignedInWithCredentialProvider, false);
+#if defined(Q_OS_WIN)
+ OSCrypt::RegisterLocalPrefs(registry.get());
+#endif
#if BUILDFLAG(ENABLE_EXTENSIONS)
registry->RegisterDictionaryPref(extensions::pref_names::kExtensions);
diff --git a/src/core/printing/pdf_stream_delegate_qt.cpp b/src/core/printing/pdf_stream_delegate_qt.cpp
new file mode 100644
index 000000000..bb7b37532
--- /dev/null
+++ b/src/core/printing/pdf_stream_delegate_qt.cpp
@@ -0,0 +1,91 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+// based on chrome/browser/pdf/chrome_pdf_stream_delegate.cc:
+
+#include "pdf_stream_delegate_qt.h"
+
+#include "base/no_destructor.h"
+#include "chrome/grit/pdf_resources.h"
+#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h"
+#include "extensions/common/constants.h"
+#include "ui/base/resource/resource_bundle.h"
+
+// Associates a `pdf::PdfStreamDelegate::StreamInfo` with a `WebContents`.
+// `PdfStreamDelegateQt::MapToOriginalUrl()` initializes this in
+// `PdfNavigationThrottle`, and then `PdfStreamDelegateQt::GetStreamInfo()`
+// returns the stashed result to `PdfURLLoaderRequestInterceptor`.
+class StreamInfoHelper : public content::WebContentsUserData<StreamInfoHelper>
+{
+public:
+ absl::optional<pdf::PdfStreamDelegate::StreamInfo> TakeStreamInfo()
+ { return std::move(stream_info_); }
+
+private:
+ friend class content::WebContentsUserData<StreamInfoHelper>;
+ WEB_CONTENTS_USER_DATA_KEY_DECL();
+
+ StreamInfoHelper(content::WebContents *contents,
+ pdf::PdfStreamDelegate::StreamInfo stream_info)
+ : content::WebContentsUserData<StreamInfoHelper>(*contents),
+ stream_info_(std::move(stream_info)) {}
+
+ absl::optional<pdf::PdfStreamDelegate::StreamInfo> stream_info_;
+};
+
+WEB_CONTENTS_USER_DATA_KEY_IMPL(StreamInfoHelper);
+
+PdfStreamDelegateQt::PdfStreamDelegateQt() = default;
+PdfStreamDelegateQt::~PdfStreamDelegateQt() = default;
+
+absl::optional<GURL> PdfStreamDelegateQt::MapToOriginalUrl(content::WebContents *contents, const GURL &stream_url)
+{
+ StreamInfoHelper *helper = StreamInfoHelper::FromWebContents(contents);
+ if (helper) {
+ // PDF viewer and Print Preview only do this once per WebContents.
+ return absl::nullopt;
+ }
+
+ GURL original_url;
+ StreamInfo info;
+
+ extensions::MimeHandlerViewGuest *guest =
+ extensions::MimeHandlerViewGuest::FromWebContents(contents);
+ if (guest) {
+ base::WeakPtr<extensions::StreamContainer> stream = guest->GetStreamWeakPtr();
+ if (!stream || stream->extension_id() != extension_misc::kPdfExtensionId ||
+ stream->stream_url() != stream_url ||
+ !stream->pdf_plugin_attributes()) {
+ return absl::nullopt;
+ }
+
+ original_url = stream->original_url();
+ info.background_color = base::checked_cast<SkColor>(stream->pdf_plugin_attributes()->background_color);
+ info.full_frame = !stream->embedded();
+ info.allow_javascript = stream->pdf_plugin_attributes()->allow_javascript;
+ } else {
+ return absl::nullopt;
+ }
+
+ static const base::NoDestructor<std::string> injected_script(
+ ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
+ IDR_PDF_PDF_INTERNAL_PLUGIN_WRAPPER_ROLLUP_JS));
+
+ info.stream_url = stream_url;
+ info.original_url = original_url;
+ info.injected_script = injected_script.get();
+ StreamInfoHelper::CreateForWebContents(contents, std::move(info));
+ return original_url;
+}
+
+absl::optional<pdf::PdfStreamDelegate::StreamInfo>
+PdfStreamDelegateQt::GetStreamInfo(content::WebContents *contents)
+{
+ StreamInfoHelper *helper = StreamInfoHelper::FromWebContents(contents);
+ if (!helper)
+ return absl::nullopt;
+
+ // Only the call immediately following `MapToOriginalUrl()` requires a valid
+ // `StreamInfo`; subsequent calls should just get nothing.
+ return helper->TakeStreamInfo();
+}
diff --git a/src/core/printing/pdf_stream_delegate_qt.h b/src/core/printing/pdf_stream_delegate_qt.h
new file mode 100644
index 000000000..47621576f
--- /dev/null
+++ b/src/core/printing/pdf_stream_delegate_qt.h
@@ -0,0 +1,23 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef PDF_STREAM_DELEGATE_QT_H
+#define PDF_STREAM_DELEGATE_QT_H
+
+#include "components/pdf/browser/pdf_stream_delegate.h"
+
+// based on chrome/browser/pdf/chrome_pdf_stream_delegate.h:
+class PdfStreamDelegateQt : public pdf::PdfStreamDelegate
+{
+public:
+ PdfStreamDelegateQt();
+ PdfStreamDelegateQt(const PdfStreamDelegateQt &) = delete;
+ PdfStreamDelegateQt operator=(const PdfStreamDelegateQt &) = delete;
+ ~PdfStreamDelegateQt() override;
+
+ // pdf::PdfStreamDelegate:
+ absl::optional<GURL> MapToOriginalUrl(content::WebContents *contents, const GURL &stream_url) override;
+ absl::optional<StreamInfo> GetStreamInfo(content::WebContents *contents) override;
+};
+
+#endif // PDF_STREAM_DELEGATE_QT_H
diff --git a/src/core/printing/pdf_web_contents_helper_client_qt.cpp b/src/core/printing/pdf_web_contents_helper_client_qt.cpp
new file mode 100644
index 000000000..7c2a46ebf
--- /dev/null
+++ b/src/core/printing/pdf_web_contents_helper_client_qt.cpp
@@ -0,0 +1,56 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+// based on chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.cc:
+
+#include "pdf_web_contents_helper_client_qt.h"
+
+#include "content/public/browser/render_process_host.h"
+#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h"
+#include "extensions/common/constants.h"
+
+namespace {
+bool IsPdfExtensionOrigin(const url::Origin &origin)
+{
+ return origin.scheme() == extensions::kExtensionScheme &&
+ origin.host() == extension_misc::kPdfExtensionId;
+}
+
+// from chrome/browser/pdf/pdf_frame_util.cc:
+content::RenderFrameHost *FindPdfChildFrame(content::RenderFrameHost *rfh)
+{
+ if (!IsPdfExtensionOrigin(rfh->GetLastCommittedOrigin()))
+ return nullptr;
+
+ content::RenderFrameHost *pdf_rfh = nullptr;
+ rfh->ForEachRenderFrameHost(
+ base::BindRepeating(
+ [](content::RenderFrameHost *&pdf_rfh, content::RenderFrameHost *rfh) {
+ if (!rfh->GetProcess()->IsPdf())
+ return;
+
+ DCHECK(IsPdfExtensionOrigin(rfh->GetParent()->GetLastCommittedOrigin()));
+ DCHECK(!pdf_rfh);
+ pdf_rfh = rfh;
+ }, std::ref(pdf_rfh)));
+
+ return pdf_rfh;
+}
+} // namespace
+
+PDFWebContentsHelperClientQt::PDFWebContentsHelperClientQt() = default;
+PDFWebContentsHelperClientQt::~PDFWebContentsHelperClientQt() = default;
+
+content::RenderFrameHost *PDFWebContentsHelperClientQt::FindPdfFrame(content::WebContents *contents)
+{
+ content::RenderFrameHost *main_frame = contents->GetMainFrame();
+ content::RenderFrameHost *pdf_frame = FindPdfChildFrame(main_frame);
+ return pdf_frame ? pdf_frame : main_frame;
+}
+
+void PDFWebContentsHelperClientQt::SetPluginCanSave(content::WebContents *contents, bool can_save)
+{
+ auto *guest_view = extensions::MimeHandlerViewGuest::FromWebContents(contents);
+ if (guest_view)
+ guest_view->SetPluginCanSave(can_save);
+}
diff --git a/src/core/printing/pdf_web_contents_helper_client_qt.h b/src/core/printing/pdf_web_contents_helper_client_qt.h
new file mode 100644
index 000000000..ccc552986
--- /dev/null
+++ b/src/core/printing/pdf_web_contents_helper_client_qt.h
@@ -0,0 +1,27 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef PDF_WEB_CONTENTS_HELPER_CLIENT_QT_H
+#define PDF_WEB_CONTENTS_HELPER_CLIENT_QT_H
+
+#include "components/pdf/browser/pdf_web_contents_helper_client.h"
+
+// based on chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h:
+class PDFWebContentsHelperClientQt : public pdf::PDFWebContentsHelperClient
+{
+public:
+ PDFWebContentsHelperClientQt();
+ PDFWebContentsHelperClientQt(const PDFWebContentsHelperClientQt&) = delete;
+ PDFWebContentsHelperClientQt& operator=(const PDFWebContentsHelperClientQt&) = delete;
+ ~PDFWebContentsHelperClientQt() override;
+
+private:
+ // pdf::PDFWebContentsHelperClient:
+ content::RenderFrameHost* FindPdfFrame(content::WebContents *contents) override;
+ void UpdateContentRestrictions(content::WebContents *contents, int content_restrictions) override {}
+ void OnPDFHasUnsupportedFeature(content::WebContents *contents) override {}
+ void OnSaveURL(content::WebContents *contents) override {}
+ void SetPluginCanSave(content::WebContents *contents, bool can_save) override;
+};
+
+#endif // PDF_WEB_CONTENTS_HELPER_CLIENT_QT_H
diff --git a/src/core/printing/print_view_manager_base_qt.cpp b/src/core/printing/print_view_manager_base_qt.cpp
index 1b412c71c..3af6ecf44 100644
--- a/src/core/printing/print_view_manager_base_qt.cpp
+++ b/src/core/printing/print_view_manager_base_qt.cpp
@@ -76,22 +76,29 @@ void GetDefaultPrintSettingsReplyOnIO(scoped_refptr<printing::PrintQueriesQueue>
void GetDefaultPrintSettingsOnIO(printing::mojom::PrintManagerHost::GetDefaultPrintSettingsCallback callback,
scoped_refptr<printing::PrintQueriesQueue> queue,
- int process_id, int routing_id)
+ bool is_modifiable,
+ content::GlobalRenderFrameHostId rfh_id)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
std::unique_ptr<printing::PrinterQuery> printer_query = queue->PopPrinterQuery(0);
if (!printer_query)
- printer_query = queue->CreatePrinterQuery(process_id, routing_id);
+ printer_query = queue->CreatePrinterQuery(rfh_id);
// Loads default settings. This is asynchronous, only the mojo message sender
// will hang until the settings are retrieved.
auto *printer_query_ptr = printer_query.get();
- printer_query_ptr->GetSettings(
- printing::PrinterQuery::GetSettingsAskParam::DEFAULTS, 0, false,
- printing::mojom::MarginType::kDefaultMargins, false, false,
- base::BindOnce(&GetDefaultPrintSettingsReplyOnIO, queue,
- std::move(printer_query), std::move(callback)));
+ printer_query_ptr->GetDefaultSettings(
+ base::BindOnce(&GetDefaultPrintSettingsReplyOnIO, queue,
+ std::move(printer_query), std::move(callback)),
+ is_modifiable);
+}
+
+printing::mojom::PrintPagesParamsPtr CreateEmptyPrintPagesParamsPtr()
+{
+ auto params = printing::mojom::PrintPagesParams::New();
+ params->params = printing::mojom::PrintParams::New();
+ return params;
}
// Runs |callback| with |params| to reply to
@@ -100,11 +107,8 @@ void UpdatePrintSettingsReply(printing::mojom::PrintManagerHost::UpdatePrintSett
printing::mojom::PrintPagesParamsPtr params, bool canceled)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- if (!params) {
- // Fills |params| with initial values.
- params = printing::mojom::PrintPagesParams::New();
- params->params = printing::mojom::PrintParams::New();
- }
+ if (!params)
+ params = CreateEmptyPrintPagesParamsPtr();
std::move(callback).Run(std::move(params), canceled);
}
@@ -138,13 +142,13 @@ void UpdatePrintSettingsReplyOnIO(scoped_refptr<printing::PrintQueriesQueue> que
void UpdatePrintSettingsOnIO(int32_t cookie,
printing::mojom::PrintManagerHost::UpdatePrintSettingsCallback callback,
scoped_refptr<printing::PrintQueriesQueue> queue,
- base::Value job_settings,
+ base::Value::Dict job_settings,
int process_id, int routing_id)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
std::unique_ptr<printing::PrinterQuery> printer_query = queue->PopPrinterQuery(cookie);
if (!printer_query)
- printer_query = queue->CreatePrinterQuery(content::ChildProcessHost::kInvalidUniqueID, MSG_ROUTING_NONE);
+ printer_query = queue->CreatePrinterQuery(content::GlobalRenderFrameHostId());
auto *printer_query_ptr = printer_query.get();
printer_query_ptr->SetSettings(
@@ -154,37 +158,13 @@ void UpdatePrintSettingsOnIO(int32_t cookie,
process_id, routing_id));
}
-// Runs |callback| with |params| to reply to
-// mojom::PrintManagerHost::ScriptedPrint.
-void ScriptedPrintReply(printing::mojom::PrintManagerHost::ScriptedPrintCallback callback,
- printing::mojom::PrintPagesParamsPtr params,
- int process_id)
-{
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
-
- if (!content::RenderProcessHost::FromID(process_id)) {
- // Early return if the renderer is not alive.
- return;
- }
-
- if (!params) {
- // Fills |params| with initial values.
- params = printing::mojom::PrintPagesParams::New();
- params->params = printing::mojom::PrintParams::New();
- }
- std::move(callback).Run(std::move(params));
-}
-
void ScriptedPrintReplyOnIO(scoped_refptr<printing::PrintQueriesQueue> queue,
std::unique_ptr<printing::PrinterQuery> printer_query,
- printing::mojom::PrintManagerHost::ScriptedPrintCallback callback,
- int process_id)
+ printing::mojom::PrintManagerHost::ScriptedPrintCallback callback)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
- auto params = printing::mojom::PrintPagesParams::New();
- params->params = printing::mojom::PrintParams::New();
- if (printer_query->last_status() == printing::mojom::ResultCode::kSuccess &&
- printer_query->settings().dpi()) {
+ printing::mojom::PrintPagesParamsPtr params = CreateEmptyPrintPagesParamsPtr();
+ if (printer_query->last_status() == printing::mojom::ResultCode::kSuccess && printer_query->settings().dpi()) {
RenderParamsFromPrintSettings(printer_query->settings(), params->params.get());
params->params->document_cookie = printer_query->cookie();
params->pages = printing::PageRange::GetPages(printer_query->settings().ranges());
@@ -192,8 +172,7 @@ void ScriptedPrintReplyOnIO(scoped_refptr<printing::PrintQueriesQueue> queue,
bool has_valid_cookie = params->params->document_cookie;
bool has_dpi = !params->params->dpi.IsEmpty();
content::GetUIThreadTaskRunner({})->PostTask(
- FROM_HERE, base::BindOnce(&ScriptedPrintReply, std::move(callback),
- std::move(params), process_id));
+ FROM_HERE, base::BindOnce(std::move(callback), std::move(params)));
if (has_dpi && has_valid_cookie) {
queue->QueuePrinterQuery(std::move(printer_query));
@@ -205,22 +184,20 @@ void ScriptedPrintReplyOnIO(scoped_refptr<printing::PrintQueriesQueue> queue,
void ScriptedPrintOnIO(printing::mojom::ScriptedPrintParamsPtr params,
printing::mojom::PrintManagerHost::ScriptedPrintCallback callback,
scoped_refptr<printing::PrintQueriesQueue> queue,
- int process_id,
- int routing_id)
+ bool is_modifiable,
+ content::GlobalRenderFrameHostId rfh_id)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
std::unique_ptr<printing::PrinterQuery> printer_query = queue->PopPrinterQuery(params->cookie);
if (!printer_query)
- printer_query = queue->CreatePrinterQuery(process_id, routing_id);
+ printer_query = queue->CreatePrinterQuery(rfh_id);
auto *printer_query_ptr = printer_query.get();
- printer_query_ptr->GetSettings(
- printing::PrinterQuery::GetSettingsAskParam::ASK_USER, params->expected_pages_count,
- params->has_selection, params->margin_type, params->is_scripted,
- params->is_modifiable,
- base::BindOnce(&ScriptedPrintReplyOnIO, queue, std::move(printer_query),
- std::move(callback), process_id));
+ printer_query_ptr->GetSettingsFromUser(
+ params->expected_pages_count, params->has_selection, params->margin_type,
+ params->is_scripted, is_modifiable,
+ base::BindOnce(&ScriptedPrintReplyOnIO, queue, std::move(printer_query), std::move(callback)));
}
} // namespace
@@ -248,6 +225,25 @@ void PrintViewManagerBaseQt::SetPrintingRFH(content::RenderFrameHost *rfh)
m_printingRFH = rfh;
}
+void PrintViewManagerBaseQt::ScriptedPrintReply(ScriptedPrintCallback callback,
+ int process_id,
+ printing::mojom::PrintPagesParamsPtr params) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+
+#if BUILDFLAG(ENABLE_OOP_PRINTING)
+ // Finished getting all settings (defaults and from user), no further need
+ // to be registered as a system print client.
+ UnregisterSystemPrintClient();
+#endif
+ if (!content::RenderProcessHost::FromID(process_id)) {
+ // Early return if the renderer is not alive.
+ return;
+ }
+
+// set_cookie(params->params->document_cookie);
+ std::move(callback).Run(std::move(params));
+}
+
void PrintViewManagerBaseQt::UpdatePrintingEnabled()
{
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -334,14 +330,15 @@ void PrintViewManagerBaseQt::DidPrintDocument(printing::mojom::DidPrintDocumentP
void PrintViewManagerBaseQt::GetDefaultPrintSettings(GetDefaultPrintSettingsCallback callback)
{
- content::RenderFrameHost* render_frame_host =
- print_manager_host_receivers_.GetCurrentTargetFrame();
-
+ content::RenderFrameHost *render_frame_host =
+ print_manager_host_receivers_.GetCurrentTargetFrame();
+ content::RenderProcessHost *render_process_host =
+ render_frame_host->GetProcess();
content::GetIOThreadTaskRunner({})->PostTask(
FROM_HERE,
base::BindOnce(&GetDefaultPrintSettingsOnIO, std::move(callback), m_printerQueriesQueue,
- render_frame_host->GetProcess()->GetID(),
- render_frame_host->GetRoutingID()));
+ !render_process_host->IsPdf(),
+ render_frame_host->GetGlobalId()));
}
void PrintViewManagerBaseQt::PrintingFailed(int32_t cookie)
@@ -362,12 +359,16 @@ void PrintViewManagerBaseQt::ScriptedPrint(printing::mojom::ScriptedPrintParamsP
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
content::RenderFrameHost *render_frame_host =
print_manager_host_receivers_.GetCurrentTargetFrame();
+ content::RenderProcessHost *render_process_host =
+ render_frame_host->GetProcess();
+ auto callback_wrapper = base::BindOnce(
+ &PrintViewManagerBaseQt::ScriptedPrintReply, weak_ptr_factory_.GetWeakPtr(),
+ std::move(callback), render_process_host->GetID());
content::GetIOThreadTaskRunner({})->PostTask(
FROM_HERE,
- base::BindOnce(&ScriptedPrintOnIO, std::move(params), std::move(callback),
- m_printerQueriesQueue, render_frame_host->GetProcess()->GetID(),
- render_frame_host->GetRoutingID()));
+ base::BindOnce(&ScriptedPrintOnIO, std::move(params), std::move(callback_wrapper),
+ m_printerQueriesQueue, !render_process_host->IsPdf(), render_frame_host->GetGlobalId()));
}
void PrintViewManagerBaseQt::ShowInvalidPrinterSettingsError()
@@ -461,8 +462,8 @@ bool PrintViewManagerBaseQt::RenderAllMissingPagesNow()
// We can't print if there is no renderer.
if (!web_contents() ||
- !web_contents()->GetRenderViewHost() ||
- !web_contents()->GetRenderViewHost()->IsRenderViewLive()) {
+ !web_contents()->GetMainFrame() ||
+ !web_contents()->GetMainFrame()->IsRenderFrameLive()) {
return false;
}
@@ -504,8 +505,8 @@ bool PrintViewManagerBaseQt::CreateNewPrintJob(std::unique_ptr<printing::Printer
DisconnectFromCurrentPrintJob();
// We can't print if there is no renderer.
- if (!web_contents()->GetRenderViewHost() ||
- !web_contents()->GetRenderViewHost()->IsRenderViewLive()) {
+ if (!web_contents()->GetMainFrame() ||
+ !web_contents()->GetMainFrame()->IsRenderFrameLive()) {
return false;
}
@@ -513,7 +514,7 @@ bool PrintViewManagerBaseQt::CreateNewPrintJob(std::unique_ptr<printing::Printer
// view and switch to it, initialize the printer and show the print dialog.
DCHECK(!m_printJob.get());
- m_printJob = base::MakeRefCounted<printing::PrintJob>();
+ m_printJob = base::MakeRefCounted<printing::PrintJob>(nullptr /*g_browser_process->print_job_manager()*/);
m_printJob->Initialize(std::move(query), RenderSourceName(), number_pages_);
m_registrar.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT,
content::Source<printing::PrintJob>(m_printJob.get()));
@@ -682,12 +683,12 @@ void PrintViewManagerBaseQt::SendPrintingEnabled(bool enabled, content::RenderFr
GetPrintRenderFrame(rfh)->SetPrintingEnabled(enabled);
}
-void PrintViewManagerBaseQt::UpdatePrintSettings(int32_t cookie, base::Value job_settings,
+void PrintViewManagerBaseQt::UpdatePrintSettings(int32_t cookie, base::Value::Dict job_settings,
UpdatePrintSettingsCallback callback)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- if (!job_settings.FindIntKey(printing::kSettingPrinterType)) {
+ if (!job_settings.FindInt(printing::kSettingPrinterType)) {
UpdatePrintSettingsReply(std::move(callback), nullptr, false);
return;
}
diff --git a/src/core/printing/print_view_manager_base_qt.h b/src/core/printing/print_view_manager_base_qt.h
index 602f5ef82..b83a9d286 100644
--- a/src/core/printing/print_view_manager_base_qt.h
+++ b/src/core/printing/print_view_manager_base_qt.h
@@ -47,7 +47,7 @@ public:
void DidPrintDocument(printing::mojom::DidPrintDocumentParamsPtr params,
DidPrintDocumentCallback callback) override;
void GetDefaultPrintSettings(GetDefaultPrintSettingsCallback callback) override;
- void UpdatePrintSettings(int32_t cookie, base::Value job_settings,
+ void UpdatePrintSettings(int32_t cookie, base::Value::Dict job_settings,
UpdatePrintSettingsCallback callback) override;
void ScriptedPrint(printing::mojom::ScriptedPrintParamsPtr,
printing::mojom::PrintManagerHost::ScriptedPrintCallback) override;
@@ -94,6 +94,11 @@ private:
// been requested to the renderer.
bool RenderAllMissingPagesNow();
+ // Runs `callback` with `params` to reply to ScriptedPrint().
+ void ScriptedPrintReply(ScriptedPrintCallback callback,
+ int process_id,
+ printing::mojom::PrintPagesParamsPtr params);
+
// Checks that synchronization is correct with |print_job_| based on |cookie|.
bool PrintJobHasDocument(int cookie);
@@ -147,6 +152,8 @@ private:
// rendered or the print settings are being loaded.
base::OnceClosure m_quitInnerLoop;
scoped_refptr<printing::PrintQueriesQueue> m_printerQueriesQueue;
+
+ base::WeakPtrFactory<PrintViewManagerBaseQt> weak_ptr_factory_{this};
};
} // namespace QtWebEngineCore
diff --git a/src/core/printing/print_view_manager_qt.cpp b/src/core/printing/print_view_manager_qt.cpp
index 0cda52940..6eb3d7419 100644
--- a/src/core/printing/print_view_manager_qt.cpp
+++ b/src/core/printing/print_view_manager_qt.cpp
@@ -250,6 +250,7 @@ bool PrintViewManagerQt::PrintToPDFInternal(const QPageLayout &pageLayout,
PrintViewManagerQt::PrintViewManagerQt(content::WebContents *contents)
: PrintViewManagerBaseQt(contents)
+ , content::WebContentsUserData<PrintViewManagerQt>(*contents)
, m_printPreviewRfh(nullptr)
{
diff --git a/src/core/process_main.cpp b/src/core/process_main.cpp
index 70c4a0970..ce92db083 100644
--- a/src/core/process_main.cpp
+++ b/src/core/process_main.cpp
@@ -4,10 +4,10 @@
#include "qtwebenginecoreglobal_p.h"
#include "content_main_delegate_qt.h"
#include "content/public/app/content_main.h"
-#if defined(OS_WIN)
+#if BUILDFLAG(IS_WIN)
#include "sandbox/win/src/sandbox_types.h"
#include "content/public/app/sandbox_helper_win.h"
-#elif defined(OS_MAC)
+#elif BUILDFLAG(IS_MAC)
#include "sandbox/mac/seatbelt_exec.h"
#endif
@@ -19,7 +19,7 @@ int processMain(int argc, const char **argv)
ContentMainDelegateQt delegate;
content::ContentMainParams params(&delegate);
-#if defined(OS_WIN)
+#if BUILDFLAG(IS_WIN)
HINSTANCE instance_handle = NULL;
params.sandbox_info = QtWebEngineSandbox::staticSandboxInterfaceInfo();
sandbox::SandboxInterfaceInfo sandbox_info = {nullptr};
@@ -31,14 +31,14 @@ int processMain(int argc, const char **argv)
#else
params.argc = argc;
params.argv = argv;
-#endif // OS_WIN
-#if defined(OS_MAC)
+#endif // IS_WIN
+#if BUILDFLAG(IS_MAC)
sandbox::SeatbeltExecServer::CreateFromArgumentsResult seatbelt =
sandbox::SeatbeltExecServer::CreateFromArguments(argv[0], argc, const_cast<char**>(argv));
if (seatbelt.sandbox_required) {
CHECK(seatbelt.server->InitializeSandbox());
}
-#endif // defined(OS_MAC)
+#endif // IS_MAC
return content::ContentMain(std::move(params));
}
diff --git a/src/core/profile_adapter.cpp b/src/core/profile_adapter.cpp
index e557e69a7..36c756a7e 100644
--- a/src/core/profile_adapter.cpp
+++ b/src/core/profile_adapter.cpp
@@ -76,6 +76,8 @@ ProfileAdapter::ProfileAdapter(const QString &storageName):
extensions::ExtensionSystem::Get(m_profile.data())->InitForRegularProfile(true);
#endif
m_cancelableTaskTracker.reset(new base::CancelableTaskTracker());
+
+ m_profile->DoFinalInit();
}
ProfileAdapter::~ProfileAdapter()
@@ -626,6 +628,16 @@ bool ProfileAdapter::isSpellCheckEnabled() const
#endif
}
+QUrl ProfileAdapter::pushServiceEndpoint() const
+{
+ return m_pushServiceEndpoint;
+}
+
+void ProfileAdapter::setPushServiceEndpoint(const QUrl &endpoint)
+{
+ m_pushServiceEndpoint = endpoint;
+}
+
void ProfileAdapter::addWebContentsAdapterClient(WebContentsAdapterClient *client)
{
m_webContentsAdapterClients.append(client);
diff --git a/src/core/profile_adapter.h b/src/core/profile_adapter.h
index 46993f5bd..90c5238b2 100644
--- a/src/core/profile_adapter.h
+++ b/src/core/profile_adapter.h
@@ -101,6 +101,9 @@ public:
void setSpellCheckEnabled(bool enabled);
bool isSpellCheckEnabled() const;
+ QUrl pushServiceEndpoint() const;
+ void setPushServiceEndpoint(const QUrl &endpoint);
+
void addWebContentsAdapterClient(WebContentsAdapterClient *client);
void removeWebContentsAdapterClient(WebContentsAdapterClient *client);
void releaseAllWebContentsAdapterClients();
@@ -213,6 +216,7 @@ private:
QString m_httpUserAgent;
HttpCacheType m_httpCacheType;
QString m_httpAcceptLanguage;
+ QUrl m_pushServiceEndpoint;
PersistentCookiesPolicy m_persistentCookiesPolicy;
VisitedLinksPolicy m_visitedLinksPolicy;
QHash<QByteArray, QPointer<QWebEngineUrlSchemeHandler>> m_customUrlSchemeHandlers;
diff --git a/src/core/profile_io_data_qt.cpp b/src/core/profile_io_data_qt.cpp
index 3e1635290..7fd6163f2 100644
--- a/src/core/profile_io_data_qt.cpp
+++ b/src/core/profile_io_data_qt.cpp
@@ -210,13 +210,13 @@ void ProfileIODataQt::ConfigureNetworkContextParams(bool in_memory,
network_context_params->http_cache_enabled = m_httpCacheType != ProfileAdapter::NoCache;
network_context_params->http_cache_max_size = m_httpCacheMaxSize;
if (m_httpCacheType == ProfileAdapter::DiskHttpCache && !m_httpCachePath.isEmpty() && !m_inMemoryOnly && !in_memory)
- network_context_params->http_cache_path = toFilePath(m_httpCachePath);
+ network_context_params->http_cache_directory = toFilePath(m_httpCachePath);
network_context_params->persist_session_cookies = false;
if (!m_inMemoryOnly && !in_memory) {
network_context_params->file_paths =
network::mojom::NetworkContextFilePaths::New();
- network_context_params->file_paths->data_path = toFilePath(m_dataPath);
+ network_context_params->file_paths->data_directory = toFilePath(m_dataPath);
network_context_params->file_paths->http_server_properties_file_name = base::FilePath::FromASCII("Network Persistent State");
network_context_params->file_paths->transport_security_persister_file_name = base::FilePath::FromASCII("TransportSecurity");
network_context_params->file_paths->trust_token_database_name = base::FilePath::FromASCII("Trust Tokens");
diff --git a/src/core/profile_qt.cpp b/src/core/profile_qt.cpp
index 9820ca787..1355140e3 100644
--- a/src/core/profile_qt.cpp
+++ b/src/core/profile_qt.cpp
@@ -35,6 +35,9 @@
#include "components/user_prefs/user_prefs.h"
#include "components/profile_metrics/browser_profile_type.h"
#include "components/proxy_config/pref_proxy_config_tracker_impl.h"
+#include "chrome/browser/push_messaging/push_messaging_app_identifier.h"
+#include "chrome/browser/push_messaging/push_messaging_service_factory.h"
+#include "chrome/browser/push_messaging/push_messaging_service_impl.h"
#include "chrome/common/pref_names.h"
#if QT_CONFIG(webengine_spellchecker)
#include "chrome/browser/spellchecker/spellcheck_service.h"
@@ -50,6 +53,10 @@
#include "extensions/extension_system_qt.h"
#endif
+#if defined(Q_OS_WIN)
+#include "components/os_crypt/os_crypt.h"
+#endif
+
namespace QtWebEngineCore {
ProfileQt::ProfileQt(ProfileAdapter *profileAdapter)
@@ -59,8 +66,16 @@ ProfileQt::ProfileQt(ProfileAdapter *profileAdapter)
, m_extensionSystem(nullptr)
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
{
+ profile_metrics::SetBrowserProfileType(this, IsOffTheRecord()
+ ? profile_metrics::BrowserProfileType::kIncognito
+ : profile_metrics::BrowserProfileType::kRegular);
+
setupPrefService();
+#if defined(Q_OS_WIN)
+ OSCrypt::Init(m_prefServiceAdapter.prefService());
+#endif
+
// Mark the context as live. This prevents the use-after-free DCHECK in
// AssertBrowserContextWasntDestroyed from being triggered when a new
// ProfileQt object is allocated at the same address as a previously
@@ -78,12 +93,20 @@ ProfileQt::~ProfileQt()
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
m_prefServiceAdapter.commit();
BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices(this);
+ // Remembering push subscriptions and not persisting notification permissions would
+ // confuse most of web applications.
+ PushMessagingAppIdentifier::DeleteAllFromPrefs(this);
ShutdownStoragePartitions();
m_profileIOData->shutdownOnUIThread();
//Should be deleted by IO Thread
m_profileIOData.release();
}
+void ProfileQt::DoFinalInit()
+{
+ PushMessagingServiceImpl::InitializeForProfile(this);
+}
+
PrefService* ProfileQt::GetPrefs()
{
return m_prefServiceAdapter.prefService();
@@ -139,9 +162,17 @@ storage::SpecialStoragePolicy *ProfileQt::GetSpecialStoragePolicy()
return nullptr;
}
+std::string ProfileQt::GetPushMessagingEndpoint() const
+{
+ return m_profileAdapter->pushServiceEndpoint().toString().toStdString();
+}
+
content::PushMessagingService *ProfileQt::GetPushMessagingService()
{
- return nullptr;
+ if (!m_profileAdapter->pushServiceEndpoint().isEmpty())
+ return PushMessagingServiceFactory::GetForProfile(this);
+ else
+ return nullptr;
}
content::SSLHostStateDelegate* ProfileQt::GetSSLHostStateDelegate()
diff --git a/src/core/profile_qt.h b/src/core/profile_qt.h
index 2f8ff3255..d05998ea2 100644
--- a/src/core/profile_qt.h
+++ b/src/core/profile_qt.h
@@ -56,13 +56,14 @@ public:
content::PlatformNotificationService *GetPlatformNotificationService() override;
std::string GetMediaDeviceIDSalt() override;
content::FileSystemAccessPermissionContext *GetFileSystemAccessPermissionContext() override;
+ std::string GetPushMessagingEndpoint() const override;
// Profile implementation:
PrefService *GetPrefs() override;
const PrefService *GetPrefs() const override;
bool IsNewProfile() const override;
- void Initialize();
+ void DoFinalInit();
ProfileAdapter *profileAdapter() { return m_profileAdapter; }
#if QT_CONFIG(webengine_spellchecker)
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index 3c47fed35..dfbbe72e7 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -92,16 +92,27 @@ static inline ui::GestureProvider::Config QtGestureProviderConfig() {
extern display::Display toDisplayDisplay(int id, const QScreen *screen);
-static display::ScreenInfo screenInfoFromQScreen(QScreen *screen)
+static display::ScreenInfos screenInfosFromQtForUpdate(QScreen *currentScreen)
{
- display::ScreenInfo r;
- if (!screen)
- screen = qApp->primaryScreen();
- if (screen)
- display::DisplayUtil::DisplayToScreenInfo(&r, toDisplayDisplay(0, screen));
- else
- r.device_scale_factor = qGuiApp->devicePixelRatio();
- return r;
+ display::ScreenInfo screenInfo;
+ const auto &screens = qApp->screens();
+ if (screens.isEmpty()) {
+ screenInfo.device_scale_factor = qGuiApp->devicePixelRatio();
+ return display::ScreenInfos(screenInfo);
+ }
+
+ Q_ASSERT(qApp->primaryScreen() == screens.first());
+ display::ScreenInfos result;
+ for (int i = 0; i < screens.length(); ++i) {
+ display::DisplayUtil::DisplayToScreenInfo(&screenInfo, toDisplayDisplay(i, screens.at(i)));
+ result.screen_infos.push_back(screenInfo);
+ if (currentScreen == screens.at(i))
+ result.current_display_id = i;
+ }
+
+ Q_ASSERT(result.current_display_id != display::kInvalidDisplayId);
+
+ return result;
}
// An minimal override to support progressing flings
@@ -234,7 +245,7 @@ void RenderWidgetHostViewQt::setAdapterClient(WebContentsAdapterClient *adapterC
m_adapterClient = nullptr; });
}
-void RenderWidgetHostViewQt::setGuest(content::RenderWidgetHostImpl *rwh)
+void RenderWidgetHostViewQt::addGuest(content::RenderWidgetHost *rwh)
{
rwh->AddInputEventObserver(m_guestInputEventObserver.get());
}
@@ -641,17 +652,6 @@ void RenderWidgetHostViewQt::UpdateTooltip(const std::u16string &tooltip_text)
m_adapterClient->setToolTip(toQt(tooltip_text));
}
-display::ScreenInfo RenderWidgetHostViewQt::GetScreenInfo() const
-{
- return m_screenInfo;
-}
-
-display::ScreenInfos RenderWidgetHostViewQt::GetScreenInfos() const
-{
- // FIXME: Return more than the current screen.
- return display::ScreenInfos(GetScreenInfo());
-}
-
gfx::Rect RenderWidgetHostViewQt::GetBoundsInRootWindow()
{
return toGfx(delegateClient()->windowRectInDips());
@@ -856,11 +856,17 @@ bool RenderWidgetHostViewQt::isPopup() const
bool RenderWidgetHostViewQt::updateScreenInfo()
{
- display::ScreenInfo oldScreenInfo = m_screenInfo;
- QScreen *screen = m_delegate->Window() ? m_delegate->Window()->screen() : nullptr;
- m_screenInfo = screenInfoFromQScreen(screen);
- return (m_screenInfo != oldScreenInfo);
+ QWindow *window = m_delegate->Window();
+ if (!window)
+ return false;
+
+ display::ScreenInfos newScreenInfos = screenInfosFromQtForUpdate(window->screen());
+ if (screen_infos_ == newScreenInfos)
+ return false;
+
+ screen_infos_ = std::move(newScreenInfos);
+ return true;
}
void RenderWidgetHostViewQt::handleWheelEvent(QWheelEvent *event)
diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h
index dfb451b4d..bdc0efc24 100644
--- a/src/core/render_widget_host_view_qt.h
+++ b/src/core/render_widget_host_view_qt.h
@@ -54,7 +54,7 @@ public:
WebContentsAdapterClient *adapterClient() { return m_adapterClient; }
void setAdapterClient(WebContentsAdapterClient *adapterClient);
RenderWidgetHostViewQtDelegateClient *delegateClient() const { return m_delegateClient.get(); }
- void setGuest(content::RenderWidgetHostImpl *);
+ void addGuest(content::RenderWidgetHost *);
void InitAsChild(gfx::NativeView) override;
void InitAsPopup(content::RenderWidgetHostView*, const gfx::Rect&, const gfx::Rect&) override;
@@ -100,8 +100,6 @@ public:
void OnDidUpdateVisualPropertiesComplete(const cc::RenderFrameMetadata &metadata);
// Overridden from RenderWidgetHostViewBase:
- display::ScreenInfo GetScreenInfo() const override;
- display::ScreenInfos GetScreenInfos() const override;
gfx::Rect GetBoundsInRootWindow() override;
void ProcessAckedTouchEvent(const content::TouchEventWithLatencyInfo &touch,
blink::mojom::InputEventResultState ack_result) override;
@@ -120,7 +118,7 @@ public:
ui::Compositor *GetCompositor() override;
absl::optional<content::DisplayFeature> GetDisplayFeature() override;
void SetDisplayFeatureForTesting(const content::DisplayFeature*) override;
-#if defined(OS_MAC)
+#if BUILDFLAG(IS_MAC)
void ShowSharePicker(
const std::string &title,
const std::string &text,
@@ -131,7 +129,7 @@ public:
void SpeakSelection() override { QT_NOT_YET_IMPLEMENTED }
void ShowDefinitionForSelection() override { QT_NOT_YET_IMPLEMENTED }
void SetWindowFrameInScreen(const gfx::Rect&) override { QT_NOT_YET_IMPLEMENTED }
-#endif // defined(OS_MAC)
+#endif // BUILDFLAG(IS_MAC)
void NotifyHostAndDelegateOnWasShown(blink::mojom::RecordContentToVisibleTimeRequestPtr) override { QT_NOT_YET_IMPLEMENTED }
void RequestPresentationTimeFromHostOrDelegate(blink::mojom::RecordContentToVisibleTimeRequestPtr) override { QT_NOT_YET_IMPLEMENTED }
void CancelPresentationTimeRequestForHostAndDelegate() override { QT_NOT_YET_IMPLEMENTED }
@@ -207,7 +205,6 @@ private:
DelegatedFrameHostClientQt m_delegatedFrameHostClient { this };
// VIZ
- display::ScreenInfo m_screenInfo;
std::unique_ptr<content::DelegatedFrameHost> m_delegatedFrameHost;
std::unique_ptr<ui::Layer> m_rootLayer;
std::unique_ptr<ui::Compositor> m_uiCompositor;
diff --git a/src/core/render_widget_host_view_qt_delegate.h b/src/core/render_widget_host_view_qt_delegate.h
index 40f341fd5..649fda77b 100644
--- a/src/core/render_widget_host_view_qt_delegate.h
+++ b/src/core/render_widget_host_view_qt_delegate.h
@@ -50,6 +50,7 @@ public:
virtual void setInputMethodHints(Qt::InputMethodHints hints) = 0;
virtual void setClearColor(const QColor &color) = 0;
virtual void adapterClientChanged(WebContentsAdapterClient *client) = 0;
+ virtual void updateAdapterClientIfNeeded(WebContentsAdapterClient *client) = 0;
virtual void unhandledWheelEvent(QWheelEvent *) {}
};
diff --git a/src/core/render_widget_host_view_qt_delegate_client.cpp b/src/core/render_widget_host_view_qt_delegate_client.cpp
index 3935517b6..2abfb4121 100644
--- a/src/core/render_widget_host_view_qt_delegate_client.cpp
+++ b/src/core/render_widget_host_view_qt_delegate_client.cpp
@@ -476,6 +476,9 @@ void RenderWidgetHostViewQtDelegateClient::handleKeyEvent(QKeyEvent *event)
if (event->type() == QEvent::KeyRelease && event->isAutoRepeat())
return;
+ if (!m_rwhv->GetFocusedWidget())
+ return;
+
content::NativeWebKeyboardEvent webEvent = WebEventFactory::toWebKeyboardEvent(event);
if (webEvent.GetType() == blink::WebInputEvent::Type::kRawKeyDown && !m_editCommand.empty()) {
ui::LatencyInfo latency;
diff --git a/src/core/render_widget_host_view_qt_delegate_item.cpp b/src/core/render_widget_host_view_qt_delegate_item.cpp
index 674b1ee73..f6962da14 100644
--- a/src/core/render_widget_host_view_qt_delegate_item.cpp
+++ b/src/core/render_widget_host_view_qt_delegate_item.cpp
@@ -395,6 +395,13 @@ void RenderWidgetHostViewQtDelegateItem::adapterClientChanged(WebContentsAdapter
m_widgetDelegate->Bind(client);
}
+void RenderWidgetHostViewQtDelegateItem::updateAdapterClientIfNeeded(WebContentsAdapterClient *client)
+{
+ if (client == m_adapterClient)
+ return;
+ adapterClientChanged(client);
+}
+
void RenderWidgetHostViewQtDelegateItem::unhandledWheelEvent(QWheelEvent *ev)
{
if (QWindow *w = Window()) {
diff --git a/src/core/render_widget_host_view_qt_delegate_item.h b/src/core/render_widget_host_view_qt_delegate_item.h
index afa1de44e..e057d37d9 100644
--- a/src/core/render_widget_host_view_qt_delegate_item.h
+++ b/src/core/render_widget_host_view_qt_delegate_item.h
@@ -96,6 +96,7 @@ protected:
QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
void adapterClientChanged(WebContentsAdapterClient *client) override;
+ void updateAdapterClientIfNeeded(WebContentsAdapterClient *client) override;
private Q_SLOTS:
void onBeforeRendering();
diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp
index 372c519f1..5544b08df 100644
--- a/src/core/renderer/content_renderer_client_qt.cpp
+++ b/src/core/renderer/content_renderer_client_qt.cpp
@@ -6,6 +6,7 @@
#include "extensions/buildflags/buildflags.h"
#include "printing/buildflags/buildflags.h"
#include "renderer/content_settings_observer_qt.h"
+#include "base/i18n/rtl.h"
#include "base/strings/string_split.h"
#if QT_CONFIG(webengine_spellchecker)
#include "components/spellcheck/renderer/spellcheck.h"
@@ -44,6 +45,8 @@
#include "ui/base/webui/jstemplate_builder.h"
#if QT_CONFIG(webengine_printing_and_pdf)
+#include "components/pdf/renderer/internal_plugin_renderer_helpers.h"
+#include "components/pdf/renderer/pdf_internal_plugin_delegate.h"
#include "renderer/print_web_view_helper_delegate_qt.h"
#endif
@@ -57,6 +60,7 @@
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "common/extensions/extensions_client_qt.h"
+#include "extensions/common/constants.h"
#include "extensions/extensions_renderer_client_qt.h"
#include "extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container_manager.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
@@ -238,6 +242,7 @@ void ContentRendererClientQt::RunScriptsAtDocumentIdle(content::RenderFrame *ren
void ContentRendererClientQt::PrepareErrorPage(content::RenderFrame *renderFrame,
const blink::WebURLError &web_error,
const std::string &httpMethod,
+ content::mojom::AlternativeErrorPageOverrideInfoPtr alternative_error_page_info,
std::string *errorHtml)
{
GetNavigationErrorStringsInternal(
@@ -251,6 +256,7 @@ void ContentRendererClientQt::PrepareErrorPageForHttpStatusError(content::Render
const blink::WebURLError &error,
const std::string &httpMethod,
int http_status,
+ content::mojom::AlternativeErrorPageOverrideInfoPtr alternative_error_page_info,
std::string *errorHtml)
{
GetNavigationErrorStringsInternal(renderFrame, httpMethod,
@@ -306,6 +312,66 @@ std::unique_ptr<blink::WebPrescientNetworking> ContentRendererClientQt::CreatePr
return std::make_unique<network_hints::WebPrescientNetworkingImpl>(render_frame);
}
+namespace {
+bool IsPdfExtensionOrigin(const url::Origin &origin)
+{
+#if BUILDFLAG(ENABLE_EXTENSIONS)
+ return origin.scheme() == extensions::kExtensionScheme &&
+ origin.host() == extension_misc::kPdfExtensionId;
+#else
+ return false;
+#endif
+}
+
+#if BUILDFLAG(ENABLE_PLUGINS)
+void AppendParams(const std::vector<content::WebPluginMimeType::Param> &additional_params,
+ blink::WebVector<blink::WebString> *existing_names,
+ blink::WebVector<blink::WebString> *existing_values)
+{
+ DCHECK(existing_names->size() == existing_values->size());
+ size_t existing_size = existing_names->size();
+ size_t total_size = existing_size + additional_params.size();
+
+ blink::WebVector<blink::WebString> names(total_size);
+ blink::WebVector<blink::WebString> values(total_size);
+
+ for (size_t i = 0; i < existing_size; ++i) {
+ names[i] = (*existing_names)[i];
+ values[i] = (*existing_values)[i];
+ }
+
+ for (size_t i = 0; i < additional_params.size(); ++i) {
+ names[existing_size + i] = blink::WebString::FromUTF16(additional_params[i].name);
+ values[existing_size + i] = blink::WebString::FromUTF16(additional_params[i].value);
+ }
+
+ existing_names->Swap(names);
+ existing_values->Swap(values);
+}
+#endif // BUILDFLAG(ENABLE_PLUGINS)
+
+#if QT_CONFIG(webengine_printing_and_pdf)
+// based on chrome/renderer/pdf/chrome_pdf_internal_plugin_delegate.cc:
+class PdfInternalPluginDelegateQt final
+ : public pdf::PdfInternalPluginDelegate
+{
+public:
+ PdfInternalPluginDelegateQt() = default;
+ PdfInternalPluginDelegateQt(const PdfInternalPluginDelegateQt &) = delete;
+ PdfInternalPluginDelegateQt& operator=(const PdfInternalPluginDelegateQt &) = delete;
+ ~PdfInternalPluginDelegateQt() override = default;
+
+ // `pdf::PdfInternalPluginDelegate`:
+ bool IsAllowedOrigin(const url::Origin &origin) const override;
+};
+
+bool PdfInternalPluginDelegateQt::IsAllowedOrigin(const url::Origin &origin) const
+{
+ return IsPdfExtensionOrigin(origin);
+}
+#endif
+} // namespace
+
bool ContentRendererClientQt::IsPluginHandledExternally(content::RenderFrame *render_frame,
const blink::WebElement &plugin_element,
const GURL &original_url,
@@ -320,6 +386,8 @@ bool ContentRendererClientQt::IsPluginHandledExternally(content::RenderFrame *re
original_url, original_mime_type, &found, &plugin_info, &mime_type);
if (!found)
return false;
+ if (IsPdfExtensionOrigin(render_frame->GetWebFrame()->GetSecurityOrigin()))
+ return true;
return extensions::MimeHandlerViewContainerManager::Get(
content::RenderFrame::FromWebFrame(
plugin_element.GetDocument().GetFrame()),
@@ -346,10 +414,24 @@ bool ContentRendererClientQt::OverrideCreatePlugin(content::RenderFrame *render_
static_cast<content::RenderFrameImpl *>(render_frame)->GetPepperHost()->GetPluginInfo(
params.url, params.mime_type.Utf8(), &found, &info, &mime_type);
- if (!found)
+ if (!found) {
*plugin = LoadablePluginPlaceholderQt::CreateLoadableMissingPlugin(render_frame, params)->plugin();
- else
- *plugin = render_frame->CreatePlugin(info, params);
+ return true;
+ }
+ if (info.name == u"Chromium PDF Viewer") {
+ blink::WebPluginParams new_params(params);
+ for (const auto& mime_type : info.mime_types) {
+ if (mime_type.mime_type == params.mime_type.Utf8()) {
+ AppendParams(mime_type.additional_params, &new_params.attribute_names,
+ &new_params.attribute_values);
+ break;
+ }
+ }
+
+ *plugin = pdf::CreateInternalPlugin(std::move(new_params), render_frame, std::make_unique<PdfInternalPluginDelegateQt>());
+ return true;
+ }
+ *plugin = render_frame->CreatePlugin(info, params);
#endif // BUILDFLAG(ENABLE_PLUGINS)
return true;
}
@@ -381,18 +463,19 @@ void ContentRendererClientQt::GetInterface(const std::string &interface_name, mo
// found in the LICENSE.Chromium file.
#if BUILDFLAG(ENABLE_LIBRARY_CDMS)
+static const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey";
+
// External Clear Key (used for testing).
-static void AddExternalClearKey(std::vector<std::unique_ptr<media::KeySystemProperties>> *key_systems)
+static void AddExternalClearKey(const media::mojom::KeySystemCapabilityPtr &capability,
+ media::KeySystemPropertiesVector *key_systems)
{
- static const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey";
-
- // TODO(xhwang): Actually use `capability` to determine capabilities.
- media::mojom::KeySystemCapabilityPtr capability;
- if (!content::IsKeySystemSupported(kExternalClearKeyKeySystem, &capability)) {
- DVLOG(1) << "External Clear Key not supported";
+ Q_UNUSED(capability);
+ if (!base::FeatureList::IsEnabled(media::kExternalClearKeyForTesting)) {
+ DLOG(ERROR) << "ExternalClearKey supported despite not enabled.";
return;
}
+ // TODO(xhwang): Actually use `capability` to determine capabilities.
key_systems->push_back(std::make_unique<cdm::ExternalClearKeyProperties>());
}
@@ -509,14 +592,9 @@ static media::SupportedCodecs GetSupportedCodecs(const media::CdmCapability& cap
return supported_codecs;
}
-static void AddWidevine(std::vector<std::unique_ptr<media::KeySystemProperties>> *key_systems)
+static void AddWidevine(const media::mojom::KeySystemCapabilityPtr &capability,
+ media::KeySystemPropertiesVector *key_systems)
{
- media::mojom::KeySystemCapabilityPtr capability;
- if (!content::IsKeySystemSupported(kWidevineKeySystem, &capability)) {
- DVLOG(1) << "Widevine CDM is not currently available.";
- return;
- }
-
// Codecs and encryption schemes.
media::SupportedCodecs codecs = media::EME_CODEC_NONE;
media::SupportedCodecs hw_secure_codecs = media::EME_CODEC_NONE;
@@ -565,17 +643,35 @@ static void AddWidevine(std::vector<std::unique_ptr<media::KeySystemProperties>>
#endif // BUILDFLAG(ENABLE_WIDEVINE)
#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS)
-void ContentRendererClientQt::AddSupportedKeySystems(std::vector<std::unique_ptr<media::KeySystemProperties>> *key_systems)
+void OnKeySystemSupportUpdated(media::GetSupportedKeySystemsCB cb,
+ content::KeySystemCapabilityPtrMap key_system_capabilities)
{
-#if BUILDFLAG(ENABLE_LIBRARY_CDMS)
- if (base::FeatureList::IsEnabled(media::kExternalClearKeyForTesting))
- AddExternalClearKey(key_systems);
-
+ media::KeySystemPropertiesVector key_systems;
+ for (const auto &entry : key_system_capabilities) {
+ const auto &key_system = entry.first;
+ const auto &capability = entry.second;
#if BUILDFLAG(ENABLE_WIDEVINE)
- AddWidevine(key_systems);
-#endif // BUILDFLAG(ENABLE_WIDEVINE)
+ if (key_system == kWidevineKeySystem) {
+ AddWidevine(capability, &key_systems);
+ continue;
+ }
+#endif // BUILDFLAG(ENABLE_WIDEVINE)
-#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS)
+ if (key_system == kExternalClearKeyKeySystem) {
+ AddExternalClearKey(capability, &key_systems);
+ continue;
+ }
+
+ DLOG(ERROR) << "Unrecognized key system: " << key_system;
+ }
+
+ cb.Run(std::move(key_systems));
+}
+
+void ContentRendererClientQt::GetSupportedKeySystems(media::GetSupportedKeySystemsCB cb)
+{
+ content::ObserveKeySystemSupportUpdate(
+ base::BindRepeating(&OnKeySystemSupportUpdated, std::move(cb)));
}
#if QT_CONFIG(webengine_spellchecker)
diff --git a/src/core/renderer/content_renderer_client_qt.h b/src/core/renderer/content_renderer_client_qt.h
index 8ecb0c831..6c4cdf0ee 100644
--- a/src/core/renderer/content_renderer_client_qt.h
+++ b/src/core/renderer/content_renderer_client_qt.h
@@ -56,18 +56,18 @@ public:
void PrepareErrorPage(content::RenderFrame *render_frame,
const blink::WebURLError &error,
const std::string &http_method,
+ content::mojom::AlternativeErrorPageOverrideInfoPtr alternative_error_page_info,
std::string *error_html) override;
void PrepareErrorPageForHttpStatusError(content::RenderFrame *render_frame,
const blink::WebURLError &error,
const std::string &http_method,
int http_status,
+ content::mojom::AlternativeErrorPageOverrideInfoPtr alternative_error_page_info,
std::string *error_html) override;
-
uint64_t VisitedLinkHash(const char *canonical_url, size_t length) override;
bool IsLinkVisited(uint64_t linkHash) override;
std::unique_ptr<blink::WebPrescientNetworking> CreatePrescientNetworking(content::RenderFrame *render_frame) override;
- void AddSupportedKeySystems(std::vector<std::unique_ptr<media::KeySystemProperties>> *key_systems) override;
-
+ void GetSupportedKeySystems(media::GetSupportedKeySystemsCB cb) override;
void RunScriptsAtDocumentStart(content::RenderFrame *render_frame) override;
void RunScriptsAtDocumentEnd(content::RenderFrame *render_frame) override;
void RunScriptsAtDocumentIdle(content::RenderFrame *render_frame) override;
diff --git a/src/core/renderer/extensions/extensions_renderer_client_qt.cpp b/src/core/renderer/extensions/extensions_renderer_client_qt.cpp
index 4f1ec5ba2..b29892b68 100644
--- a/src/core/renderer/extensions/extensions_renderer_client_qt.cpp
+++ b/src/core/renderer/extensions/extensions_renderer_client_qt.cpp
@@ -16,7 +16,6 @@
#include "base/command_line.h"
#include "base/lazy_instance.h"
#include "base/stl_util.h"
-#include "components/guest_view/renderer/guest_view_container_dispatcher.h"
#include "content/public/common/content_constants.h"
#include "content/public/common/content_switches.h"
#include "content/public/renderer/render_frame.h"
@@ -111,10 +110,8 @@ void ExtensionsRendererClientQt::RenderThreadStarted()
extension_dispatcher_->OnRenderThreadStarted(thread);
permissions_policy_delegate_.reset(new RendererPermissionsPolicyDelegateQt(extension_dispatcher_.get()));
resource_request_policy_.reset(new extensions::ResourceRequestPolicyQt(extension_dispatcher_.get()));
- guest_view_container_dispatcher_.reset(new guest_view::GuestViewContainerDispatcher());
thread->AddObserver(extension_dispatcher_.get());
- thread->AddObserver(guest_view_container_dispatcher_.get());
}
void ExtensionsRendererClientQt::RenderFrameCreated(content::RenderFrame *render_frame,
diff --git a/src/core/renderer/extensions/extensions_renderer_client_qt.h b/src/core/renderer/extensions/extensions_renderer_client_qt.h
index 33395a615..f9cac443c 100644
--- a/src/core/renderer/extensions/extensions_renderer_client_qt.h
+++ b/src/core/renderer/extensions/extensions_renderer_client_qt.h
@@ -35,10 +35,6 @@ class Dispatcher;
class ResourceRequestPolicyQt;
}
-namespace guest_view {
-class GuestViewContainerDispatcher;
-}
-
namespace QtWebEngineCore {
class ExtensionsDispatcherDelegateQt;
@@ -90,7 +86,6 @@ private:
std::unique_ptr<ExtensionsDispatcherDelegateQt> extension_dispatcher_delegate_;
std::unique_ptr<RendererPermissionsPolicyDelegateQt> permissions_policy_delegate_;
std::unique_ptr<extensions::Dispatcher> extension_dispatcher_;
- std::unique_ptr<guest_view::GuestViewContainerDispatcher> guest_view_container_dispatcher_;
std::unique_ptr<extensions::ResourceRequestPolicyQt> resource_request_policy_;
};
diff --git a/src/core/renderer/pepper/pepper_renderer_host_factory_qt.cpp b/src/core/renderer/pepper/pepper_renderer_host_factory_qt.cpp
index ae3ff26b7..d0daea8c2 100644
--- a/src/core/renderer/pepper/pepper_renderer_host_factory_qt.cpp
+++ b/src/core/renderer/pepper/pepper_renderer_host_factory_qt.cpp
@@ -9,18 +9,10 @@
#include "pepper_renderer_host_factory_qt.h"
#include "qtwebenginecoreglobal_p.h"
-#include "base/memory/ptr_util.h"
-#include "chrome/renderer/pepper/pepper_uma_host.h"
-#if QT_CONFIG(webengine_printing_and_pdf)
-#include "chrome/renderer/pepper/pepper_flash_font_file_host.h"
-#include "components/pdf/renderer/pepper_pdf_host.h"
-#endif // QT_CONFIG(webengine_printing_and_pdf)
#include "content/public/renderer/renderer_ppapi_host.h"
#include "ppapi/host/ppapi_host.h"
#include "ppapi/host/resource_host.h"
#include "ppapi/proxy/ppapi_messages.h"
-#include "ppapi/proxy/ppapi_message_utils.h"
-#include "ppapi/shared_impl/ppapi_permissions.h"
namespace QtWebEngineCore {
@@ -45,31 +37,6 @@ std::unique_ptr<ppapi::host::ResourceHost> PepperRendererHostFactoryQt::CreateRe
if (!host_->IsValidInstance(instance))
return nullptr;
- // TODO(raymes): PDF also needs access to the FlashFontFileHost currently.
- // We should either rename PPB_FlashFont_File to PPB_FontFile_Private or get
- // rid of its use in PDF if possible.
-#if QT_CONFIG(webengine_printing_and_pdf)
- if (host_->GetPpapiHost()->permissions().HasPermission(ppapi::PERMISSION_FLASH)
- || host_->GetPpapiHost()->permissions().HasPermission(ppapi::PERMISSION_PDF)) {
- switch (message.type()) {
- case PpapiHostMsg_FlashFontFile_Create::ID: {
- ppapi::proxy::SerializedFontDescription description;
- PP_PrivateFontCharset charset;
- if (ppapi::UnpackMessage<PpapiHostMsg_FlashFontFile_Create>(message, &description, &charset))
- return base::WrapUnique(new PepperFlashFontFileHost(host_, instance, resource, description, charset));
- break;
- }
- }
- }
-
- if (host_->GetPpapiHost()->permissions().HasPermission(ppapi::PERMISSION_PDF)) {
- switch (message.type()) {
- case PpapiHostMsg_PDF_Create::ID:
- return std::make_unique<pdf::PepperPDFHost>(host_, instance, resource);
- }
- }
-#endif // QT_CONFIG(webengine_printing_and_pdf)
-
// Create a default ResourceHost for this message type to suppress
// "Failed to create PPAPI resource host" console error message.
switch (message.type()) {
diff --git a/src/core/renderer_host/user_resource_controller_host.cpp b/src/core/renderer_host/user_resource_controller_host.cpp
index 7ceaa265b..b24e87e8b 100644
--- a/src/core/renderer_host/user_resource_controller_host.cpp
+++ b/src/core/renderer_host/user_resource_controller_host.cpp
@@ -5,12 +5,14 @@
#include "type_conversion.h"
#include "web_contents_adapter.h"
+
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_process_host_observer.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
+#include "ipc/ipc_channel_proxy.h"
#include "qtwebengine/userscript/userscript.mojom.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
diff --git a/src/core/resource_bundle_qt.cpp b/src/core/resource_bundle_qt.cpp
index 8c01fa8f8..693d1291f 100644
--- a/src/core/resource_bundle_qt.cpp
+++ b/src/core/resource_bundle_qt.cpp
@@ -15,7 +15,7 @@
#include "web_engine_library_info.h"
-#if defined(OS_LINUX)
+#if BUILDFLAG(IS_LINUX)
#include "base/posix/global_descriptors.h"
#include "global_descriptors_qt.h"
#endif
@@ -39,7 +39,7 @@ gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id)
// static
bool ResourceBundle::LocaleDataPakExists(const std::string& locale)
{
-#if defined(OS_LINUX)
+#if BUILDFLAG(IS_LINUX)
base::CommandLine *parsed_command_line = base::CommandLine::ForCurrentProcess();
std::string process_type = parsed_command_line->GetSwitchValueASCII(switches::kProcessType);
bool no_sandbox = parsed_command_line->HasSwitch(sandbox::policy::switches::kNoSandbox);
@@ -64,7 +64,7 @@ std::string ResourceBundle::LoadLocaleResources(const std::string &pref_locale,
std::string app_locale = l10n_util::GetApplicationLocale(pref_locale, false /* set_icu_locale */);
-#if defined(OS_LINUX)
+#if BUILDFLAG(IS_LINUX)
int locale_fd = base::GlobalDescriptors::GetInstance()->MaybeGet(kWebEngineLocale);
if (locale_fd > -1) {
std::unique_ptr<DataPack> data_pack(new DataPack(ui::k100Percent));
diff --git a/src/core/tools/CMakeLists.txt b/src/core/tools/CMakeLists.txt
index 5f14c6ebd..9029b60a1 100644
--- a/src/core/tools/CMakeLists.txt
+++ b/src/core/tools/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
##
# WEBENGINECORE DICT CONVERT TOOL
diff --git a/src/core/tools/main.cpp b/src/core/tools/main.cpp
index 1721f71d3..4b6c82997 100644
--- a/src/core/tools/main.cpp
+++ b/src/core/tools/main.cpp
@@ -7,8 +7,7 @@
** Modified work:
** Copyright (C) 2016 The Qt Company Ltd.
**
-** Use of this source code is governed by a BSD-style license that can be
-** found in the LICENSE.Chromium file.
+** SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
**
** This tool converts Hunspell .aff/.dic pairs to a combined binary dictionary
** format (.bdic). This format is more compact, and can be more efficiently
@@ -129,7 +128,7 @@ inline bool VerifyWords(const convert_dict::DicReader::WordList& org_words,
return true;
}
-#if defined(OS_MAC) && defined(QT_MAC_FRAMEWORK_BUILD)
+#if defined(Q_OS_DARWIN) && defined(QT_MAC_FRAMEWORK_BUILD)
QString frameworkIcuDataPath()
{
return QLibraryInfo::location(QLibraryInfo::LibrariesPath) +
@@ -169,7 +168,7 @@ int main(int argc, char *argv[])
icuDataDir = icuPossibleEnvDataDir;
icuDataDirFound = true;
}
-#if defined(OS_MAC) && defined(QT_MAC_FRAMEWORK_BUILD)
+#if defined(Q_OS_DARWIN) && defined(QT_MAC_FRAMEWORK_BUILD)
// In a macOS Qt framework build, the resources are inside the QtWebEngineCore framework
// Resources directory, rather than in the Qt install location.
else if (QFileInfo::exists(frameworkIcuDataPath())) {
diff --git a/src/core/touch_handle_drawable_qt.cpp b/src/core/touch_handle_drawable_qt.cpp
index 56f9c2086..1e979fa03 100644
--- a/src/core/touch_handle_drawable_qt.cpp
+++ b/src/core/touch_handle_drawable_qt.cpp
@@ -128,10 +128,11 @@ gfx::RectF TouchHandleDrawableQt::GetVisibleBounds() const
bounds.Offset(m_originPosition.x(), m_originPosition.y());
gfx::RectF visibleBounds(bounds);
- visibleBounds.Inset(kSelectionHandlePadding,
- kSelectionHandlePadding + kSelectionHandleVerticalVisualOffset,
- kSelectionHandlePadding,
- kSelectionHandlePadding);
+ visibleBounds.Inset(gfx::InsetsF::TLBR(
+ kSelectionHandlePadding,
+ kSelectionHandlePadding + kSelectionHandleVerticalVisualOffset,
+ kSelectionHandlePadding,
+ kSelectionHandlePadding));
return visibleBounds;
}
diff --git a/src/core/type_conversion.cpp b/src/core/type_conversion.cpp
index ffd1f6c16..54f6e2e4f 100644
--- a/src/core/type_conversion.cpp
+++ b/src/core/type_conversion.cpp
@@ -8,8 +8,9 @@
#include <net/cert/x509_certificate.h>
#include <net/cert/x509_util.h>
#include <ui/events/event_constants.h>
-#include <ui/gfx/image/image.h>
-#include <ui/gfx/image/image_skia.h>
+#include "ui/gfx/image/image.h"
+#include "ui/gfx/image/image_skia.h"
+#include "ui/gfx/image/image_skia_rep.h"
#include "third_party/blink/public/mojom/favicon/favicon_url.mojom.h"
#include <QtCore/qcoreapplication.h>
@@ -30,6 +31,7 @@ QImage toQImage(const SkBitmap &bitmap)
case kA16_unorm_SkColorType:
case kR16G16_float_SkColorType:
case kR16G16_unorm_SkColorType:
+ case kR8_unorm_SkColorType:
qWarning("Unknown or unsupported skia image format");
break;
case kAlpha_8_SkColorType:
diff --git a/src/core/type_conversion.h b/src/core/type_conversion.h
index d88fce42f..92304a7b8 100644
--- a/src/core/type_conversion.h
+++ b/src/core/type_conversion.h
@@ -39,7 +39,7 @@ class X509Certificate;
namespace QtWebEngineCore {
-#if defined(OS_WIN)
+#if defined(Q_OS_WIN)
inline QString toQt(const std::wstring &string)
{
return QString::fromStdWString(string);
@@ -169,6 +169,11 @@ inline QSizeF toQt(const gfx::SizeF &size)
return QSizeF(size.width(), size.height());
}
+inline QSize toQt(const SkISize &size)
+{
+ return QSize(size.width(), size.height());
+}
+
inline QColor toQt(const SkColor &c)
{
return QColor(SkColorGetR(c), SkColorGetG(c), SkColorGetB(c), SkColorGetA(c));
@@ -215,7 +220,7 @@ inline QNetworkCookie toQt(const net::CanonicalCookie & cookie)
inline base::FilePath::StringType toFilePathString(const QString &str)
{
-#if defined(OS_WIN)
+#if defined(Q_OS_WIN)
return QDir::toNativeSeparators(str).toStdWString();
#else
return str.toStdString();
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index 3521bb547..7dc96967f 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -61,6 +61,8 @@
#include "qtwebengine/browser/qtwebenginepage.mojom.h"
#if QT_CONFIG(webengine_printing_and_pdf)
+#include "components/pdf/browser/pdf_web_contents_helper.h"
+#include "printing/pdf_web_contents_helper_client_qt.h"
#include "printing/print_view_manager_qt.h"
#endif
@@ -95,8 +97,8 @@ namespace QtWebEngineCore {
if (!isInitialized()) \
return return_value
-#define CHECK_VALID_RENDER_WIDGET_HOST_VIEW(render_view_host) \
- if (!render_view_host->IsRenderViewLive() && render_view_host->GetWidget()->GetView()) { \
+#define CHECK_VALID_RENDER_WIDGET_HOST_VIEW(render_frame_host) \
+ if (!render_frame_host->IsRenderFrameLive() && render_frame_host->GetView()) { \
LOG(WARNING) << "Ignore navigation due to terminated render process with invalid RenderWidgetHostView."; \
return; \
}
@@ -129,22 +131,19 @@ static QVariant fromJSValue(const base::Value *result)
}
case base::Value::Type::STRING:
{
- std::u16string out;
- if (result->GetAsString(&out))
- ret.setValue(toQt(out));
+ if (auto out = result->GetIfString())
+ ret.setValue(toQt(*out));
break;
}
case base::Value::Type::LIST:
{
- const base::ListValue *out;
- if (result->GetAsList(&out)) {
- size_t size = out->GetList().size();
+ if (const auto out = result->GetIfList()) {
+ size_t size = out->size();
QVariantList list;
list.reserve(size);
for (size_t i = 0; i < size; ++i) {
- const base::Value *outVal = 0;
- if (out->Get(i, &outVal) && outVal)
- list.insert(i, fromJSValue(outVal));
+ auto &outVal = (*out)[i];
+ list.insert(i, fromJSValue(&outVal));
}
ret.setValue(list);
}
@@ -490,6 +489,11 @@ void WebContentsAdapter::initialize(content::SiteInstance *site)
webContents(), AutofillClientQt::FromWebContents(webContents()),
/* app_locale = */ "", autofill::AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER);
+#if QT_CONFIG(webengine_printing_and_pdf)
+ pdf::PDFWebContentsHelper::CreateForWebContentsWithClient(
+ webContents(), std::make_unique<PDFWebContentsHelperClientQt>());
+#endif
+
// Create an instance of WebEngineVisitedLinksManager to catch the first
// content::NOTIFICATION_RENDERER_PROCESS_CREATED event. This event will
// force to initialize visited links in VisitedLinkSlave.
@@ -499,7 +503,7 @@ void WebContentsAdapter::initialize(content::SiteInstance *site)
// Create a RenderView with the initial empty document
content::RenderViewHost *rvh = m_webContents->GetRenderViewHost();
Q_ASSERT(rvh);
- if (!rvh->IsRenderViewLive())
+ if (!m_webContents->GetMainFrame()->IsRenderFrameLive())
static_cast<content::WebContentsImpl*>(m_webContents.get())->CreateRenderViewForRenderManager(
rvh, absl::nullopt, nullptr);
@@ -582,7 +586,7 @@ void WebContentsAdapter::reload()
bool wasDiscarded = (m_lifecycleState == LifecycleState::Discarded);
setLifecycleState(LifecycleState::Active);
- CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetRenderViewHost());
+ CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetMainFrame());
WebEngineSettings *settings = WebEngineSettings::get(m_adapterClient->webEngineSettings());
settings->doApply();
if (!wasDiscarded) // undiscard() already triggers a reload
@@ -597,7 +601,7 @@ void WebContentsAdapter::reloadAndBypassCache()
bool wasDiscarded = (m_lifecycleState == LifecycleState::Discarded);
setLifecycleState(LifecycleState::Active);
- CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetRenderViewHost());
+ CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetMainFrame());
WebEngineSettings *settings = WebEngineSettings::get(m_adapterClient->webEngineSettings());
settings->doApply();
if (!wasDiscarded) // undiscard() already triggers a reload
@@ -629,7 +633,7 @@ void WebContentsAdapter::load(const QWebEngineHttpRequest &request)
setLifecycleState(LifecycleState::Active);
}
- CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetRenderViewHost());
+ CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetMainFrame());
WebEngineSettings::get(m_adapterClient->webEngineSettings())->doApply();
@@ -717,7 +721,7 @@ void WebContentsAdapter::setContent(const QByteArray &data, const QString &mimeT
else
setLifecycleState(LifecycleState::Active);
- CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetRenderViewHost());
+ CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetMainFrame());
WebEngineSettings::get(m_adapterClient->webEngineSettings())->doApply();
@@ -868,7 +872,7 @@ void WebContentsAdapter::navigateBack()
{
CHECK_INITIALIZED();
base::RecordAction(base::UserMetricsAction("Back"));
- CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetRenderViewHost());
+ CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetMainFrame());
if (!m_webContents->GetController().CanGoBack())
return;
m_webContents->GetController().GoBack();
@@ -879,7 +883,7 @@ void WebContentsAdapter::navigateForward()
{
CHECK_INITIALIZED();
base::RecordAction(base::UserMetricsAction("Forward"));
- CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetRenderViewHost());
+ CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetMainFrame());
if (!m_webContents->GetController().CanGoForward())
return;
m_webContents->GetController().GoForward();
@@ -889,7 +893,7 @@ void WebContentsAdapter::navigateForward()
void WebContentsAdapter::navigateToIndex(int offset)
{
CHECK_INITIALIZED();
- CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetRenderViewHost());
+ CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetMainFrame());
m_webContents->GetController().GoToIndex(offset);
focusIfNecessary();
}
@@ -897,7 +901,7 @@ void WebContentsAdapter::navigateToIndex(int offset)
void WebContentsAdapter::navigateToOffset(int offset)
{
CHECK_INITIALIZED();
- CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetRenderViewHost());
+ CHECK_VALID_RENDER_WIDGET_HOST_VIEW(m_webContents->GetMainFrame());
m_webContents->GetController().GoToOffset(offset);
focusIfNecessary();
}
@@ -1779,13 +1783,10 @@ WebContentsAdapterClient::renderProcessExitStatus(int terminationStatus) {
status = WebContentsAdapterClient::AbnormalTerminationStatus;
break;
case base::TERMINATION_STATUS_PROCESS_WAS_KILLED:
-#if defined(OS_CHROMEOS)
- case base::TERMINATION_STATUS_PROCESS_WAS_KILLED_BY_OOM:
-#endif
status = WebContentsAdapterClient::KilledTerminationStatus;
break;
case base::TERMINATION_STATUS_PROCESS_CRASHED:
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
case base::TERMINATION_STATUS_OOM_PROTECTED:
#endif
status = WebContentsAdapterClient::CrashedTerminationStatus;
@@ -2033,7 +2034,7 @@ void WebContentsAdapter::undiscard()
// Create a RenderView with the initial empty document
content::RenderViewHost *rvh = m_webContents->GetRenderViewHost();
Q_ASSERT(rvh);
- if (!rvh->IsRenderViewLive())
+ if (!m_webContents->GetMainFrame()->IsRenderFrameLive())
static_cast<content::WebContentsImpl *>(m_webContents.get())
->CreateRenderViewForRenderManager(rvh, absl::nullopt, nullptr);
m_webContentsDelegate->RenderViewHostChanged(nullptr, rvh);
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index f7c1ea164..66598203e 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -308,6 +308,17 @@ void WebContentsDelegateQt::RenderViewHostChanged(content::RenderViewHost *, con
}
}
+void WebContentsDelegateQt::RenderViewReady()
+{
+ // The render view might have returned after a crash without us getting a RenderViewHostChanged call
+ content::RenderWidgetHostView *newHostView = web_contents()->GetRenderWidgetHostView();
+ if (newHostView) {
+ auto *rwhv = static_cast<RenderWidgetHostViewQt *>(newHostView);
+ Q_ASSERT(rwhv->delegate());
+ rwhv->delegate()->updateAdapterClientIfNeeded(m_viewClient);
+ }
+}
+
void WebContentsDelegateQt::emitLoadStarted(bool isErrorPage)
{
for (auto &&wc : m_certificateErrorControllers)
@@ -742,8 +753,8 @@ void WebContentsDelegateQt::RegisterProtocolHandler(content::RenderFrameHost *fr
{
content::BrowserContext *context = frameHost->GetBrowserContext();
- content::ProtocolHandler handler =
- content::ProtocolHandler::CreateProtocolHandler(protocol, url);
+ custom_handlers::ProtocolHandler handler =
+ custom_handlers::ProtocolHandler::CreateProtocolHandler(protocol, url);
custom_handlers::ProtocolHandlerRegistry *registry =
ProtocolHandlerRegistryFactory::GetForBrowserContext(context);
@@ -759,8 +770,8 @@ void WebContentsDelegateQt::UnregisterProtocolHandler(content::RenderFrameHost *
{
content::BrowserContext* context = frameHost->GetBrowserContext();
- content::ProtocolHandler handler =
- content::ProtocolHandler::CreateProtocolHandler(protocol, url);
+ custom_handlers::ProtocolHandler handler =
+ custom_handlers::ProtocolHandler::CreateProtocolHandler(protocol, url);
custom_handlers::ProtocolHandlerRegistry* registry =
ProtocolHandlerRegistryFactory::GetForBrowserContext(context);
diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h
index 7157b5130..37ab7ef5d 100644
--- a/src/core/web_contents_delegate_qt.h
+++ b/src/core/web_contents_delegate_qt.h
@@ -116,6 +116,7 @@ public:
void PrimaryMainFrameRenderProcessGone(base::TerminationStatus status) override;
void RenderFrameHostChanged(content::RenderFrameHost *old_host, content::RenderFrameHost *new_host) override;
void RenderViewHostChanged(content::RenderViewHost *old_host, content::RenderViewHost *new_host) override;
+ void RenderViewReady() override;
void DidStartNavigation(content::NavigationHandle *navigation_handle) override;
void DidFinishNavigation(content::NavigationHandle *navigation_handle) override;
void PrimaryPageChanged(content::Page &page) override;
diff --git a/src/core/web_contents_view_qt.h b/src/core/web_contents_view_qt.h
index 605caa7d4..2e236f2b2 100644
--- a/src/core/web_contents_view_qt.h
+++ b/src/core/web_contents_view_qt.h
@@ -73,9 +73,9 @@ public:
void FocusThroughTabTraversal(bool reverse) override;
void OnCapturerCountChanged() override { QT_NOT_YET_IMPLEMENTED }
-#if defined(OS_MAC)
+#if BUILDFLAG(IS_MAC)
bool CloseTabAfterEventTrackingIfNeeded() override { QT_NOT_YET_IMPLEMENTED return false; }
-#endif // defined(OS_MAC)
+#endif
// content::RenderViewHostDelegateView overrides:
void StartDragging(const content::DropData& drop_data, blink::DragOperationsMask allowed_ops,
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index d81e1b86b..c1507d3df 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -70,10 +70,10 @@
#include "ui/events/event_switches.h"
#include "ui/native_theme/native_theme_features.h"
#include "ui/gl/gl_switches.h"
-#if defined(OS_WIN)
+#if defined(Q_OS_WIN)
#include "sandbox/win/src/sandbox_types.h"
#include "content/public/app/sandbox_helper_win.h"
-#endif // OS_WIN
+#endif // Q_OS_WIN
#if defined(Q_OS_MACOS)
#include "base/mac/foundation_util.h"
@@ -148,14 +148,21 @@ static bool usingSupportedSGBackend()
bool usingSoftwareDynamicGL()
{
+ const char openGlVar[] = "QT_OPENGL";
if (QCoreApplication::testAttribute(Qt::AA_UseSoftwareOpenGL))
return true;
+
+ if (qEnvironmentVariableIsSet(openGlVar)) {
+ const QByteArray requested = qgetenv(openGlVar);
+ if (requested == "software")
+ return true;
+ }
#if defined(Q_OS_WIN)
HMODULE handle = QNativeInterface::QWGLContext::openGLModuleHandle();
wchar_t path[MAX_PATH];
DWORD size = GetModuleFileName(handle, path, MAX_PATH);
QFileInfo openGLModule(QString::fromWCharArray(path, size));
- return !openGLModule.fileName().compare(QLatin1String("opengl32sw.dll"),Qt::CaseInsensitive);
+ return openGLModule.fileName().contains(QLatin1String("opengl32sw"),Qt::CaseInsensitive);
#else
return false;
#endif
@@ -649,8 +656,6 @@ WebEngineContext::WebEngineContext()
parsedCommandLine->AppendSwitch(sandbox::policy::switches::kNoSandbox);
qInfo() << "Sandboxing disabled by user.";
}
- // Do not try to be clever with device-scale-factor, it messes up scaling in accessibility for us
- parsedCommandLine->AppendSwitchASCII(switches::kEnableUseZoomForDSF, "false");
parsedCommandLine->AppendSwitch(switches::kEnableThreadedCompositing);
@@ -680,7 +685,6 @@ WebEngineContext::WebEngineContext()
// embedded switches are based on the switches for Android, see content/browser/android/content_startup_flags.cc
enableFeatures.push_back(features::kOverlayScrollbar.name);
parsedCommandLine->AppendSwitch(switches::kEnableViewport);
- parsedCommandLine->AppendSwitch(switches::kMainFrameResizesAreOrientationChanges);
parsedCommandLine->AppendSwitch(cc::switches::kDisableCompositedAntialiasing);
}
@@ -729,7 +733,7 @@ WebEngineContext::WebEngineContext()
content::ContentMainParams contentMainParams(m_mainDelegate.get());
contentMainParams.setup_signal_handlers = false;
-#if defined(OS_WIN)
+#if defined(Q_OS_WIN)
contentMainParams.sandbox_info = QtWebEngineSandbox::staticSandboxInterfaceInfo();
sandbox::SandboxInterfaceInfo sandbox_info = {nullptr};
if (!contentMainParams.sandbox_info) {
@@ -776,7 +780,7 @@ WebEngineContext::WebEngineContext()
// Initialize WebCacheManager here to ensure its subscription to render process creation events.
web_cache::WebCacheManager::GetInstance();
-#if defined(OS_LINUX)
+#if defined(Q_OS_LINUX)
media::AudioManager::SetGlobalAppName(QCoreApplication::applicationName().toStdString());
#endif
@@ -887,7 +891,7 @@ const char *qWebEngineChromiumVersion() noexcept
}
const char *qWebEngineChromiumSecurityPatchVersion() noexcept
{
- return "99.0.4844.84"; // FIXME: Remember to update
+ return "104.0.5112.102"; // FIXME: Remember to update
}
QT_END_NAMESPACE
diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp
index 962bd3ba8..151365693 100644
--- a/src/core/web_engine_library_info.cpp
+++ b/src/core/web_engine_library_info.cpp
@@ -23,11 +23,12 @@
#include <QFileInfo>
#include <QLibraryInfo>
#include <QLocale>
+#include <QLoggingCategory>
#include <QStandardPaths>
-#if defined(OS_WIN)
+#if defined(Q_OS_WIN)
#include <windows.h>
-#endif // OS_WIN
+#endif
#ifndef QTWEBENGINEPROCESS_NAME
#error "No name defined for QtWebEngine's process"
@@ -35,6 +36,8 @@
using namespace QtWebEngineCore;
+Q_LOGGING_CATEGORY(webEngineLibraryInfoLog, "qt.webengine.libraryinfo")
+
namespace {
QString fallbackDir() {
@@ -42,7 +45,7 @@ QString fallbackDir() {
return directory;
}
-#if defined(OS_MAC) && defined(QT_MAC_FRAMEWORK_BUILD)
+#if defined(Q_OS_DARWIN) && defined(QT_MAC_FRAMEWORK_BUILD)
static inline CFBundleRef frameworkBundle()
{
return CFBundleGetBundleWithIdentifier(CFSTR("org.qt-project.QtWebEngineCore"));
@@ -85,7 +88,7 @@ static QString getResourcesPath(CFBundleRef frameworkBundle)
}
#endif
-#if defined(OS_MAC)
+#if defined(Q_OS_DARWIN)
static QString getMainApplicationResourcesPath()
{
QString resourcesPath;
@@ -117,7 +120,7 @@ QString subProcessPath()
{
static QString processPath;
if (processPath.isEmpty()) {
-#if defined(OS_WIN)
+#if defined(Q_OS_WIN)
const QString processBinary = QLatin1String(QTWEBENGINEPROCESS_NAME) % QLatin1String(".exe");
#else
const QString processBinary = QLatin1String(QTWEBENGINEPROCESS_NAME);
@@ -129,7 +132,7 @@ QString subProcessPath()
// Only search in QTWEBENGINEPROCESS_PATH if set
candidatePaths << fromEnv;
} else {
-#if defined(OS_MAC) && defined(QT_MAC_FRAMEWORK_BUILD)
+#if defined(Q_OS_DARWIN) && defined(QT_MAC_FRAMEWORK_BUILD)
candidatePaths << getBundlePath(frameworkBundle())
% QStringLiteral("/Helpers/" QTWEBENGINEPROCESS_NAME ".app/Contents/MacOS/" QTWEBENGINEPROCESS_NAME);
#else
@@ -145,13 +148,27 @@ QString subProcessPath()
for (const QString &candidate : qAsConst(candidatePaths)) {
if (QFileInfo::exists(candidate)) {
processPath = candidate;
+ qCDebug(webEngineLibraryInfoLog, "Qt WebEngine process path: %s",
+ qPrintable(candidate));
break;
}
}
- if (processPath.isEmpty())
- qFatal("Could not find %s", processBinary.toUtf8().constData());
+ if (processPath.isEmpty()) {
+ QStringList errorMessage;
+ errorMessage.append(
+ QStringLiteral("The following paths were searched for Qt WebEngine Process:"));
+ for (const QString &candidate : qAsConst(candidatePaths))
+ errorMessage.append(QStringLiteral(" ") % candidate);
+ errorMessage.append(QStringLiteral("but could not find it."));
+ if (fromEnv.isEmpty()) {
+ errorMessage.append(
+ QStringLiteral("You may override the default search path by using "
+ "QTWEBENGINEPROCESS_PATH environment variable."));
+ }
+ qFatal("%s", qPrintable(errorMessage.join('\n')));
+ }
-#if defined(OS_WIN)
+#if defined(Q_OS_WIN)
base::CommandLine *parsedCommandLine = base::CommandLine::ForCurrentProcess();
if (!parsedCommandLine->HasSwitch(sandbox::policy::switches::kNoSandbox)) {
if (WebEngineLibraryInfo::isUNCPath(processPath) || WebEngineLibraryInfo::isRemoteDrivePath(processPath))
@@ -167,23 +184,55 @@ QString subProcessPath()
QString localesPath()
{
- static bool initialized = false;
- static QString potentialLocalesPath =
-#if defined(OS_MAC) && defined(QT_MAC_FRAMEWORK_BUILD)
- getResourcesPath(frameworkBundle()) % QLatin1String("/qtwebengine_locales");
+ static QString potentialLocalesPath;
+ if (potentialLocalesPath.isEmpty()) {
+ QStringList candidatePaths;
+ const QString translationPakFilename =
+#if QT_VERSION >= QT_VERSION_CHECK(6, 3, 0)
+ QLatin1String(WebEngineLibraryInfo::getResolvedLocale() + ".pak");
#else
- QLibraryInfo::path(QLibraryInfo::TranslationsPath) % QDir::separator() % QLatin1String("qtwebengine_locales");
+ QLatin1String((WebEngineLibraryInfo::getResolvedLocale() + ".pak").c_str());
+#endif
+ const QString fromEnv = qEnvironmentVariable("QTWEBENGINE_LOCALES_PATH");
+ if (!fromEnv.isEmpty()) {
+ // Only search in QTWEBENGINE_LOCALES_PATH if set
+ candidatePaths << fromEnv;
+ } else {
+#if defined(Q_OS_DARWIN) && defined(QT_MAC_FRAMEWORK_BUILD)
+ candidatePaths << getResourcesPath(frameworkBundle()) % QDir::separator()
+ % QLatin1String("qtwebengine_locales");
#endif
+ candidatePaths << QLibraryInfo::path(QLibraryInfo::TranslationsPath) % QDir::separator()
+ % QLatin1String("qtwebengine_locales");
+ candidatePaths << fallbackDir();
+ }
- if (!initialized) {
- initialized = true;
- if (!QFileInfo::exists(potentialLocalesPath)) {
- qWarning("Installed Qt WebEngine locales directory not found at location %s. Trying application directory...", qPrintable(potentialLocalesPath));
- potentialLocalesPath = QCoreApplication::applicationDirPath() % QDir::separator() % QLatin1String("qtwebengine_locales");
+ for (const QString &candidate : qAsConst(candidatePaths)) {
+ if (QFileInfo::exists(candidate % QDir::separator() % translationPakFilename)) {
+ potentialLocalesPath = candidate;
+ qCDebug(webEngineLibraryInfoLog, "Qt WebEngine locales path: %s",
+ qPrintable(candidate));
+ break;
+ }
}
- if (!QFileInfo::exists(potentialLocalesPath)) {
- qWarning("Qt WebEngine locales directory not found at location %s. Trying fallback directory... Translations MAY NOT not be correct.", qPrintable(potentialLocalesPath));
- potentialLocalesPath = fallbackDir();
+
+ if (potentialLocalesPath.isEmpty()) {
+ QStringList warningMessage;
+ warningMessage.append(
+ QStringLiteral("The following paths were searched for Qt WebEngine locales:"));
+ for (const QString &candidate : qAsConst(candidatePaths))
+ warningMessage.append(QStringLiteral(" ") % candidate);
+ warningMessage.append(
+ QStringLiteral(
+ "but could not find the translation file for the current locale: ")
+ % translationPakFilename);
+ if (fromEnv.isEmpty()) {
+ warningMessage.append(
+ QStringLiteral("You may override the default search paths by using "
+ "QTWEBENGINE_LOCALES_PATH environment variable."));
+ }
+ warningMessage.append(QStringLiteral("Translations WILL NOT be correct."));
+ qWarning("%s", qPrintable(warningMessage.join('\n')));
}
}
@@ -205,7 +254,7 @@ QString dictionariesPath()
candidatePaths << fromEnv;
} else {
// First try to find dictionaries near the application.
-#ifdef OS_MAC
+#ifdef Q_OS_DARWIN
QString resourcesDictionariesPath = getMainApplicationResourcesPath()
% QDir::separator() % QLatin1String("qtwebengine_dictionaries");
candidatePaths << resourcesDictionariesPath;
@@ -215,7 +264,7 @@ QString dictionariesPath()
candidatePaths << applicationDictionariesPath;
// Then try to find dictionaries near the installed library.
-#if defined(OS_MAC) && defined(QT_MAC_FRAMEWORK_BUILD)
+#if defined(Q_OS_DARWIN) && defined(QT_MAC_FRAMEWORK_BUILD)
QString frameworkDictionariesPath = getResourcesPath(frameworkBundle())
% QLatin1String("/qtwebengine_dictionaries");
candidatePaths << frameworkDictionariesPath;
@@ -229,6 +278,8 @@ QString dictionariesPath()
for (const QString &candidate : qAsConst(candidatePaths)) {
if (QFileInfo::exists(candidate)) {
potentialDictionariesPath = candidate;
+ qCDebug(webEngineLibraryInfoLog, "Qt WebEngine dictionaries path: %s",
+ qPrintable(candidate));
break;
}
}
@@ -238,28 +289,49 @@ QString dictionariesPath()
}
#endif // QT_CONFIG(webengine_spellchecker)
-QString resourcesDataPath()
+QString resourcesPath()
{
- static bool initialized = false;
- static QString potentialResourcesPath =
-#if defined(OS_MAC) && defined(QT_MAC_FRAMEWORK_BUILD)
- getResourcesPath(frameworkBundle());
-#else
- QLibraryInfo::path(QLibraryInfo::DataPath) % QLatin1String("/resources");
+ static QString potentialResourcesPath;
+ if (potentialResourcesPath.isEmpty()) {
+ QStringList candidatePaths;
+ const QString resourcesPakFilename = QLatin1String("qtwebengine_resources.pak");
+ const QString fromEnv = qEnvironmentVariable("QTWEBENGINE_RESOURCES_PATH");
+ if (!fromEnv.isEmpty()) {
+ // Only search in QTWEBENGINE_RESOURCES_PATH if set
+ candidatePaths << fromEnv;
+ } else {
+#if defined(Q_OS_DARWIN) && defined(QT_MAC_FRAMEWORK_BUILD)
+ candidatePaths << getResourcesPath(frameworkBundle());
#endif
- if (!initialized) {
- initialized = true;
- if (!QFileInfo::exists(potentialResourcesPath % QLatin1String("/qtwebengine_resources.pak"))) {
- qWarning("Qt WebEngine resources not found at %s. Trying parent directory...", qPrintable(potentialResourcesPath));
- potentialResourcesPath = QLibraryInfo::path(QLibraryInfo::DataPath);
+ candidatePaths << QLibraryInfo::path(QLibraryInfo::DataPath) % QDir::separator()
+ % QLatin1String("resources");
+ candidatePaths << QLibraryInfo::path(QLibraryInfo::DataPath);
+ candidatePaths << QCoreApplication::applicationDirPath();
+ candidatePaths << fallbackDir();
}
- if (!QFileInfo::exists(potentialResourcesPath % QLatin1String("/qtwebengine_resources.pak"))) {
- qWarning("Qt WebEngine resources not found at %s. Trying application directory...", qPrintable(potentialResourcesPath));
- potentialResourcesPath = QCoreApplication::applicationDirPath();
+
+ for (const QString &candidate : qAsConst(candidatePaths)) {
+ if (QFileInfo::exists(candidate % QDir::separator() % resourcesPakFilename)) {
+ potentialResourcesPath = candidate;
+ qCDebug(webEngineLibraryInfoLog, "Qt WebEngine resources path: %s",
+ qPrintable(candidate));
+ break;
+ }
}
- if (!QFileInfo::exists(potentialResourcesPath % QLatin1String("/qtwebengine_resources.pak"))) {
- qWarning("Qt WebEngine resources not found at %s. Trying fallback directory... The application MAY NOT work.", qPrintable(potentialResourcesPath));
- potentialResourcesPath = fallbackDir();
+
+ if (potentialResourcesPath.isEmpty()) {
+ QStringList errorMessage;
+ errorMessage.append(QStringLiteral(
+ "The following paths were searched for Qt WebEngine resources:"));
+ for (const QString &candidate : qAsConst(candidatePaths))
+ errorMessage.append(QStringLiteral(" ") % candidate);
+ errorMessage.append(QStringLiteral("but could not find any."));
+ if (fromEnv.isEmpty()) {
+ errorMessage.append(
+ QStringLiteral("You may override the default search paths by using "
+ "QTWEBENGINE_RESOURCES_PATH environment variable."));
+ }
+ qFatal("%s", qPrintable(errorMessage.join('\n')));
}
}
@@ -272,21 +344,21 @@ base::FilePath WebEngineLibraryInfo::getPath(int key)
QString directory;
switch (key) {
case QT_RESOURCES_PAK:
- return toFilePath(resourcesDataPath() % QLatin1String("/qtwebengine_resources.pak"));
+ return toFilePath(resourcesPath() % QLatin1String("/qtwebengine_resources.pak"));
case QT_RESOURCES_100P_PAK:
- return toFilePath(resourcesDataPath() % QLatin1String("/qtwebengine_resources_100p.pak"));
+ return toFilePath(resourcesPath() % QLatin1String("/qtwebengine_resources_100p.pak"));
case QT_RESOURCES_200P_PAK:
- return toFilePath(resourcesDataPath() % QLatin1String("/qtwebengine_resources_200p.pak"));
+ return toFilePath(resourcesPath() % QLatin1String("/qtwebengine_resources_200p.pak"));
case QT_RESOURCES_DEVTOOLS_PAK:
- return toFilePath(resourcesDataPath() % QLatin1String("/qtwebengine_devtools_resources.pak"));
-#if defined(OS_MAC) && defined(QT_MAC_FRAMEWORK_BUILD)
+ return toFilePath(resourcesPath() % QLatin1String("/qtwebengine_devtools_resources.pak"));
+#if defined(Q_OS_DARWIN) && defined(QT_MAC_FRAMEWORK_BUILD)
case QT_FRAMEWORK_BUNDLE:
return toFilePath(getBundlePath(frameworkBundle()));
#endif
case base::FILE_EXE:
case content::CHILD_PROCESS_EXE:
return toFilePath(subProcessPath());
-#if defined(OS_POSIX)
+#if BUILDFLAG(IS_POSIX)
case base::DIR_CACHE:
directory = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
break;
@@ -298,7 +370,7 @@ base::FilePath WebEngineLibraryInfo::getPath(int key)
directory = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
break;
case base::DIR_QT_LIBRARY_DATA:
- return toFilePath(resourcesDataPath());
+ return toFilePath(resourcesPath());
case ui::DIR_LOCALES:
return toFilePath(localesPath());
#if QT_CONFIG(webengine_spellchecker)
@@ -323,14 +395,16 @@ std::u16string WebEngineLibraryInfo::getApplicationName()
std::string WebEngineLibraryInfo::getResolvedLocale()
{
base::CommandLine *parsedCommandLine = base::CommandLine::ForCurrentProcess();
- if (parsedCommandLine->HasSwitch(switches::kLang)) {
- return parsedCommandLine->GetSwitchValueASCII(switches::kLang);
- } else {
- const QString &locale = QLocale().bcp47Name();
- std::string resolvedLocale;
- if (l10n_util::CheckAndResolveLocale(locale.toStdString(), &resolvedLocale))
- return resolvedLocale;
- }
+ std::string locale;
+ if (parsedCommandLine->HasSwitch(switches::kLang))
+ locale = parsedCommandLine->GetSwitchValueASCII(switches::kLang);
+ else
+ locale = QLocale().bcp47Name().toStdString();
+
+ std::string resolvedLocale;
+ if (l10n_util::CheckAndResolveLocale(locale, &resolvedLocale))
+ return resolvedLocale;
+
return "en-US";
}
@@ -342,7 +416,7 @@ std::string WebEngineLibraryInfo::getApplicationLocale()
: QLocale().bcp47Name().toStdString();
}
-#if defined(OS_WIN)
+#if defined(Q_OS_WIN)
bool WebEngineLibraryInfo::isRemoteDrivePath(const QString &path)
{
WCHAR wDriveLetter[4] = { 0 };
diff --git a/src/core/web_engine_library_info.h b/src/core/web_engine_library_info.h
index a81a433ca..b7503f2df 100644
--- a/src/core/web_engine_library_info.h
+++ b/src/core/web_engine_library_info.h
@@ -23,7 +23,7 @@ public:
static std::u16string getApplicationName();
static std::string getResolvedLocale();
static std::string getApplicationLocale();
-#if defined(OS_WIN)
+#if defined(Q_OS_WIN)
static bool isRemoteDrivePath(const QString &path);
static bool isUNCPath(const QString &path);
#endif
diff --git a/src/core/web_engine_settings.cpp b/src/core/web_engine_settings.cpp
index 3fdb48cb5..e7cc57ba4 100644
--- a/src/core/web_engine_settings.cpp
+++ b/src/core/web_engine_settings.cpp
@@ -332,6 +332,7 @@ void WebEngineSettings::applySettingsToWebPreferences(blink::web_pref::WebPrefer
// to enable them separately. With viewport-enabled we match Android defaults.
prefs->viewport_meta_enabled = true;
prefs->shrinks_viewport_contents_to_fit = true;
+ prefs->main_frame_resizes_are_orientation_changes = true;
}
// Attributes mapping.
diff --git a/src/gn/CMakeLists.txt b/src/gn/CMakeLists.txt
index 5e20b26f7..3897e123d 100644
--- a/src/gn/CMakeLists.txt
+++ b/src/gn/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.19)
diff --git a/src/host/CMakeLists.txt b/src/host/CMakeLists.txt
index 822fa8a27..2b92ebe85 100644
--- a/src/host/CMakeLists.txt
+++ b/src/host/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.19)
if(NOT DEFINED WEBENGINE_ROOT_SOURCE_DIR)
diff --git a/src/ninja/CMakeLists.txt b/src/ninja/CMakeLists.txt
index 6f43b89fc..0258b3da9 100644
--- a/src/ninja/CMakeLists.txt
+++ b/src/ninja/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.19)
diff --git a/src/pdf/CMakeLists.txt b/src/pdf/CMakeLists.txt
index ed2da1032..de0d42a94 100644
--- a/src/pdf/CMakeLists.txt
+++ b/src/pdf/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.19)
find_package(Ninja 1.7.2 REQUIRED)
find_package(Nodejs 12 REQUIRED)
diff --git a/src/pdf/configure.cmake b/src/pdf/configure.cmake
index 8d1a07183..ac4e4e25f 100644
--- a/src/pdf/configure.cmake
+++ b/src/pdf/configure.cmake
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
qt_feature("pdf-v8" PRIVATE
LABEL "Support V8"
PURPOSE "Enables javascript support."
diff --git a/src/pdf/doc/qtpdf.qdocconf b/src/pdf/doc/qtpdf.qdocconf
index 6be1b46e0..d55f88a41 100644
--- a/src/pdf/doc/qtpdf.qdocconf
+++ b/src/pdf/doc/qtpdf.qdocconf
@@ -1,4 +1,5 @@
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
+include($QT_INSTALL_DOCS/config/exampleurl-qtwebengine.qdocconf)
project = QtPdf
description = Qt Pdf Reference Documentation
@@ -29,6 +30,8 @@ qhp.QtPdf.subprojects.examples.indexTitle = Qt PDF Examples
qhp.QtPdf.subprojects.examples.selectors = doc:example
qhp.QtPdf.subprojects.examples.sortPages = true
+manifestmeta.highlighted.names += "QtPdf/PDF Multipage Viewer Example"
+
depends += qtcore \
qtwidgets \
qtgui \
@@ -37,7 +40,8 @@ depends += qtcore \
qtdesigner \
qtquick \
qtquickcontrols \
- qtcmake
+ qtcmake \
+ qtsvg
headerdirs += ../ \
../../pdfwidgets
diff --git a/src/pdf/doc/snippets/multipageview.qml b/src/pdf/doc/snippets/multipageview.qml
index ee695c03a..113444165 100644
--- a/src/pdf/doc/snippets/multipageview.qml
+++ b/src/pdf/doc/snippets/multipageview.qml
@@ -1,3 +1,6 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
//! [0]
import QtQuick
import QtQuick.Pdf
diff --git a/src/pdf/doc/snippets/qtpdf_build_snippet.qdoc b/src/pdf/doc/snippets/qtpdf_build_snippet.qdoc
index 4be08b5a7..7d30ccdfd 100644
--- a/src/pdf/doc/snippets/qtpdf_build_snippet.qdoc
+++ b/src/pdf/doc/snippets/qtpdf_build_snippet.qdoc
@@ -4,8 +4,3 @@
//! [0]
QT += pdf
//! [0]
-
-
-//! [1]
-#include <QtPdf>
-//! [1]
diff --git a/src/pdf/doc/src/qtpdf-index.qdoc b/src/pdf/doc/src/qtpdf-index.qdoc
index 1e37565f5..07c151f47 100644
--- a/src/pdf/doc/src/qtpdf-index.qdoc
+++ b/src/pdf/doc/src/qtpdf-index.qdoc
@@ -48,11 +48,6 @@
\section2 Building with qmake
- To include the definitions of the module's classes, use the
- following directive:
-
- \snippet qtpdf_build_snippet.qdoc 1
-
To link against the module, add this line to your qmake project file:
\snippet qtpdf_build_snippet.qdoc 0
diff --git a/src/pdf/doc/src/qtpdf-module.qdoc b/src/pdf/doc/src/qtpdf-module.qdoc
index 6fe1bbcac..e2ca8e4ce 100644
--- a/src/pdf/doc/src/qtpdf-module.qdoc
+++ b/src/pdf/doc/src/qtpdf-module.qdoc
@@ -13,11 +13,6 @@
The Qt PDF module contains classes and functions for rendering
PDF documents.
- To include the definitions of the module's classes, use the
- following directive:
-
- \snippet qtpdf_build_snippet.qdoc 1
-
\if !defined(qtforpython)
To link against the module, add this line to your qmake project file:
diff --git a/src/pdf/plugins/imageformats/pdf/CMakeLists.txt b/src/pdf/plugins/imageformats/pdf/CMakeLists.txt
index 517d152c7..73a0b3144 100644
--- a/src/pdf/plugins/imageformats/pdf/CMakeLists.txt
+++ b/src/pdf/plugins/imageformats/pdf/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
qt_internal_add_plugin(QPdfPlugin
OUTPUT_NAME qpdf
PLUGIN_TYPE imageformats
diff --git a/src/pdf/qpdfbookmarkmodel.cpp b/src/pdf/qpdfbookmarkmodel.cpp
index 50e1f88ba..7b984a300 100644
--- a/src/pdf/qpdfbookmarkmodel.cpp
+++ b/src/pdf/qpdfbookmarkmodel.cpp
@@ -219,6 +219,7 @@ struct QPdfBookmarkModelPrivate
QScopedPointer<BookmarkNode> m_rootNode;
QPointer<QPdfDocument> m_document;
+ QHash<int, QByteArray> m_roleNames;
};
@@ -243,7 +244,7 @@ struct QPdfBookmarkModelPrivate
\value Page The page number of the destination (int).
\value Location The position of the destination (QPointF).
\value Zoom The suggested zoom level (qreal).
- \omitvalue _Count
+ \omitvalue NRoles
*/
/*!
@@ -253,10 +254,10 @@ QPdfBookmarkModel::QPdfBookmarkModel(QObject *parent)
: QAbstractItemModel(parent), d(new QPdfBookmarkModelPrivate)
{
d->q = this;
- m_roleNames = QAbstractItemModel::roleNames();
+ d->m_roleNames = QAbstractItemModel::roleNames();
QMetaEnum rolesMetaEnum = metaObject()->enumerator(metaObject()->indexOfEnumerator("Role"));
- for (int r = Qt::UserRole; r < int(Role::_Count); ++r)
- m_roleNames.insert(r, QByteArray(rolesMetaEnum.valueToKey(r)).toLower());
+ for (int r = Qt::UserRole; r < int(Role::NRoles); ++r)
+ d->m_roleNames.insert(r, QByteArray(rolesMetaEnum.valueToKey(r)).toLower());
}
/*!
@@ -300,7 +301,7 @@ int QPdfBookmarkModel::columnCount(const QModelIndex &parent) const
*/
QHash<int, QByteArray> QPdfBookmarkModel::roleNames() const
{
- return m_roleNames;
+ return d->m_roleNames;
}
/*!
@@ -323,7 +324,7 @@ QVariant QPdfBookmarkModel::data(const QModelIndex &index, int role) const
return node->location();
case Role::Zoom:
return node->zoom();
- case Role::_Count:
+ case Role::NRoles:
break;
}
if (role == Qt::DisplayRole)
diff --git a/src/pdf/qpdfbookmarkmodel.h b/src/pdf/qpdfbookmarkmodel.h
index 616cb5379..5a3c24f84 100644
--- a/src/pdf/qpdfbookmarkmodel.h
+++ b/src/pdf/qpdfbookmarkmodel.h
@@ -26,7 +26,7 @@ public:
Page,
Location,
Zoom,
- _Count
+ NRoles
};
Q_ENUM(Role)
@@ -48,7 +48,6 @@ Q_SIGNALS:
void documentChanged(QPdfDocument *document);
private:
- QHash<int, QByteArray> m_roleNames;
std::unique_ptr<QPdfBookmarkModelPrivate> d;
Q_PRIVATE_SLOT(d, void _q_documentStatusChanged())
diff --git a/src/pdf/qpdfdocument.cpp b/src/pdf/qpdfdocument.cpp
index 26ca90e30..b738296ae 100644
--- a/src/pdf/qpdfdocument.cpp
+++ b/src/pdf/qpdfdocument.cpp
@@ -37,7 +37,7 @@ public:
{
m_roleNames = QAbstractItemModel::roleNames();
QMetaEnum rolesMetaEnum = doc->metaObject()->enumerator(doc->metaObject()->indexOfEnumerator("PageModelRole"));
- for (int r = Qt::UserRole; r < int(QPdfDocument::PageModelRole::_Count); ++r) {
+ for (int r = Qt::UserRole; r < int(QPdfDocument::PageModelRole::NRoles); ++r) {
auto name = QByteArray(rolesMetaEnum.valueToKey(r));
name[0] = tolower(name[0]);
m_roleNames.insert(r, name);
@@ -59,7 +59,7 @@ public:
return document()->pageLabel(index.row());
case QPdfDocument::PageModelRole::PointSize:
return document()->pagePointSize(index.row());
- case QPdfDocument::PageModelRole::_Count:
+ case QPdfDocument::PageModelRole::NRoles:
break;
}
return QVariant();
@@ -750,7 +750,7 @@ QSizeF QPdfDocument::pagePointSize(int page) const
\value Label The page number to be used for display purposes (QString).
\value PointSize The page size in points (1/72 of an inch) (QSizeF).
- \omitvalue _Count
+ \omitvalue NRoles
*/
/*!
@@ -824,16 +824,16 @@ QImage QPdfDocument::render(int page, QSize imageSize, QPdfDocumentRenderOptions
int rotation = 0;
switch (renderOptions.rotation()) {
- case QPdfDocumentRenderOptions::Rotation::Rotate0:
+ case QPdfDocumentRenderOptions::Rotation::None:
rotation = 0;
break;
- case QPdfDocumentRenderOptions::Rotation::Rotate90:
+ case QPdfDocumentRenderOptions::Rotation::Clockwise90:
rotation = 1;
break;
- case QPdfDocumentRenderOptions::Rotation::Rotate180:
+ case QPdfDocumentRenderOptions::Rotation::Clockwise180:
rotation = 2;
break;
- case QPdfDocumentRenderOptions::Rotation::Rotate270:
+ case QPdfDocumentRenderOptions::Rotation::Clockwise270:
rotation = 3;
break;
}
diff --git a/src/pdf/qpdfdocument.h b/src/pdf/qpdfdocument.h
index 1a96d6e11..5f55ed29c 100644
--- a/src/pdf/qpdfdocument.h
+++ b/src/pdf/qpdfdocument.h
@@ -62,7 +62,7 @@ public:
enum class PageModelRole {
Label = Qt::UserRole,
PointSize,
- _Count
+ NRoles
};
Q_ENUM(PageModelRole)
diff --git a/src/pdf/qpdfdocumentrenderoptions.h b/src/pdf/qpdfdocumentrenderoptions.h
index 0c935d425..af074d976 100644
--- a/src/pdf/qpdfdocumentrenderoptions.h
+++ b/src/pdf/qpdfdocumentrenderoptions.h
@@ -15,10 +15,10 @@ class QPdfDocumentRenderOptions
{
public:
enum class Rotation {
- Rotate0,
- Rotate90,
- Rotate180,
- Rotate270
+ None,
+ Clockwise90,
+ Clockwise180,
+ Clockwise270
};
enum class RenderFlag {
diff --git a/src/pdf/qpdfdocumentrenderoptions.qdoc b/src/pdf/qpdfdocumentrenderoptions.qdoc
index 11b5fb044..ad8e7bfdb 100644
--- a/src/pdf/qpdfdocumentrenderoptions.qdoc
+++ b/src/pdf/qpdfdocumentrenderoptions.qdoc
@@ -20,10 +20,10 @@ QT_BEGIN_NAMESPACE
This enum describes the rotation of the page for rendering.
- \value Rotate0 Do not rotate (the default)
- \value Rotate90 Rotate 90 degrees clockwise
- \value Rotate180 Rotate 180 degrees
- \value Rotate270 Rotate 270 degrees clockwise
+ \value None Do not rotate (the default)
+ \value Clockwise90 Rotate 90 degrees clockwise
+ \value Clockwise180 Rotate 180 degrees
+ \value Clockwise270 Rotate 270 degrees clockwise
\sa QPdfDocument::render()
*/
diff --git a/src/pdf/qpdflink.cpp b/src/pdf/qpdflink.cpp
index 6429f9f75..d1f5bdfdc 100644
--- a/src/pdf/qpdflink.cpp
+++ b/src/pdf/qpdflink.cpp
@@ -5,6 +5,7 @@
#include "qpdflink_p.h"
#include "qpdflinkmodel_p.h"
#include <QGuiApplication>
+#include <QDebug>
QT_BEGIN_NAMESPACE
@@ -168,6 +169,7 @@ void QPdfLink::copyToClipboard(QClipboard::Mode mode) const
QGuiApplication::clipboard()->setText(toString(), mode);
}
+#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QPdfLink &link)
{
QDebugStateSaver saver(dbg);
@@ -181,6 +183,7 @@ QDebug operator<<(QDebug dbg, const QPdfLink &link)
dbg << ')';
return dbg;
}
+#endif
QT_END_NAMESPACE
diff --git a/src/pdf/qpdflink.h b/src/pdf/qpdflink.h
index 637801512..63389afe6 100644
--- a/src/pdf/qpdflink.h
+++ b/src/pdf/qpdflink.h
@@ -5,7 +5,6 @@
#define QPDFLINK_H
#include <QtPdf/qtpdfglobal.h>
-#include <QtCore/qdebug.h>
#include <QtCore/qlist.h>
#include <QtCore/qobject.h>
#include <QtCore/qpoint.h>
@@ -15,6 +14,7 @@
QT_BEGIN_NAMESPACE
+class QDebug;
class QPdfLinkPrivate;
class QPdfLink
@@ -67,7 +67,9 @@ private: // storage
};
Q_DECLARE_SHARED(QPdfLink)
+#ifndef QT_NO_DEBUG_STREAM
Q_PDF_EXPORT QDebug operator<<(QDebug, const QPdfLink &);
+#endif
QT_END_NAMESPACE
diff --git a/src/pdf/qpdflinkmodel.cpp b/src/pdf/qpdflinkmodel.cpp
index 4fc9d8aea..349e6a40b 100644
--- a/src/pdf/qpdflinkmodel.cpp
+++ b/src/pdf/qpdflinkmodel.cpp
@@ -16,7 +16,7 @@ QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(qLcLink, "qt.pdf.links")
-/*!
+/*! \internal
\class QPdfLinkModel
\since 5.15
\inmodule QtPdf
@@ -28,7 +28,7 @@ Q_LOGGING_CATEGORY(qLcLink, "qt.pdf.links")
This is used in PDF viewers to implement the hyperlink mechanism.
*/
-/*!
+/*! \internal
\enum QPdfLinkModel::Role
\value Link A QPdfLink object.
@@ -37,21 +37,21 @@ Q_LOGGING_CATEGORY(qLcLink, "qt.pdf.links")
\value Page If the link is an internal link, the page number to which the link should jump; otherwise \c {-1}.
\value Location If the link is an internal link, the location on the page to which the link should jump.
\value Zoom If the link is an internal link, the suggested zoom level on the destination page.
- \omitvalue _Count
+ \omitvalue NRoles
*/
-/*!
+/*! \internal
Constructs a new link model with parent object \a parent.
*/
QPdfLinkModel::QPdfLinkModel(QObject *parent)
: QAbstractListModel(*(new QPdfLinkModelPrivate()), parent)
{
QMetaEnum rolesMetaEnum = metaObject()->enumerator(metaObject()->indexOfEnumerator("Role"));
- for (int r = Qt::UserRole; r < int(Role::_Count); ++r)
+ for (int r = Qt::UserRole; r < int(Role::NRoles); ++r)
m_roleNames.insert(r, QByteArray(rolesMetaEnum.valueToKey(r)).toLower());
}
-/*!
+/*! \internal
Destroys the model.
*/
QPdfLinkModel::~QPdfLinkModel() {}
@@ -61,7 +61,7 @@ QHash<int, QByteArray> QPdfLinkModel::roleNames() const
return m_roleNames;
}
-/*!
+/*! \internal
\reimp
*/
int QPdfLinkModel::rowCount(const QModelIndex &parent) const
@@ -71,7 +71,7 @@ int QPdfLinkModel::rowCount(const QModelIndex &parent) const
return d->links.count();
}
-/*!
+/*! \internal
\reimp
*/
QVariant QPdfLinkModel::data(const QModelIndex &index, int role) const
@@ -91,7 +91,7 @@ QVariant QPdfLinkModel::data(const QModelIndex &index, int role) const
return link.location();
case Role::Zoom:
return link.zoom();
- case Role::_Count:
+ case Role::NRoles:
break;
}
if (role == Qt::DisplayRole)
@@ -99,7 +99,7 @@ QVariant QPdfLinkModel::data(const QModelIndex &index, int role) const
return QVariant();
}
-/*!
+/*! \internal
\property QPdfLinkModel::document
\brief the document to load links from
*/
@@ -125,7 +125,7 @@ void QPdfLinkModel::setDocument(QPdfDocument *document)
d->update();
}
-/*!
+/*! \internal
\property QPdfLinkModel::page
\brief the page to load links from
*/
diff --git a/src/pdf/qpdflinkmodel_p.h b/src/pdf/qpdflinkmodel_p.h
index 48c973d11..3251d4e9a 100644
--- a/src/pdf/qpdflinkmodel_p.h
+++ b/src/pdf/qpdflinkmodel_p.h
@@ -39,7 +39,7 @@ public:
Page,
Location,
Zoom,
- _Count
+ NRoles
};
Q_ENUM(Role)
explicit QPdfLinkModel(QObject *parent = nullptr);
diff --git a/src/pdf/qpdfsearchmodel.cpp b/src/pdf/qpdfsearchmodel.cpp
index bead3165f..e8946ea86 100644
--- a/src/pdf/qpdfsearchmodel.cpp
+++ b/src/pdf/qpdfsearchmodel.cpp
@@ -47,7 +47,7 @@ static const double CharacterHitTolerance = 6.0;
\value Location The position of the search result on the page (QPointF).
\value ContextBefore The adjacent text on the page, before the search string (QString).
\value ContextAfter The adjacent text on the page, after the search string (QString).
- \omitvalue _Count
+ \omitvalue NRoles
\sa QPdfLink
*/
@@ -59,7 +59,7 @@ QPdfSearchModel::QPdfSearchModel(QObject *parent)
: QAbstractListModel(*(new QPdfSearchModelPrivate()), parent)
{
QMetaEnum rolesMetaEnum = metaObject()->enumerator(metaObject()->indexOfEnumerator("Role"));
- for (int r = Qt::UserRole; r < int(Role::_Count); ++r) {
+ for (int r = Qt::UserRole; r < int(Role::NRoles); ++r) {
QByteArray roleName = QByteArray(rolesMetaEnum.valueToKey(r));
if (roleName.isEmpty())
continue;
@@ -113,7 +113,7 @@ QVariant QPdfSearchModel::data(const QModelIndex &index, int role) const
return d->searchResults[pi.page][pi.index].contextBefore();
case Role::ContextAfter:
return d->searchResults[pi.page][pi.index].contextAfter();
- case Role::_Count:
+ case Role::NRoles:
break;
}
if (role == Qt::DisplayRole) {
diff --git a/src/pdf/qpdfsearchmodel.h b/src/pdf/qpdfsearchmodel.h
index 70342d691..c1e4e64ec 100644
--- a/src/pdf/qpdfsearchmodel.h
+++ b/src/pdf/qpdfsearchmodel.h
@@ -27,7 +27,7 @@ public:
Location,
ContextBefore,
ContextAfter,
- _Count
+ NRoles
};
Q_ENUM(Role)
QPdfSearchModel() : QPdfSearchModel(nullptr) {}
diff --git a/src/pdfquick/CMakeLists.txt b/src/pdfquick/CMakeLists.txt
index 112321015..560817446 100644
--- a/src/pdfquick/CMakeLists.txt
+++ b/src/pdfquick/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS Core Gui Qml Quick)
set(qml_files
diff --git a/src/pdfquick/PdfMultiPageView.qml b/src/pdfquick/PdfMultiPageView.qml
index 309088085..0f62a229d 100644
--- a/src/pdfquick/PdfMultiPageView.qml
+++ b/src/pdfquick/PdfMultiPageView.qml
@@ -172,8 +172,6 @@ Item {
This property holds the \l {QtQuick::Image::status}{rendering status} of
the \l {currentPage}{current page}.
-
- \sa PdfPageImage::status
*/
property int currentPageRenderingStatus: Image.Null
@@ -185,8 +183,6 @@ Item {
This property holds the ratio of pixels to points. The default is \c 1,
meaning one point (1/72 of an inch) equals 1 logical pixel.
-
- \sa PdfPageImage::status
*/
property real renderScale: 1
@@ -197,8 +193,6 @@ Item {
The default value is \c 0 degrees (that is, no rotation relative to the
orientation of the pages as stored in the PDF file).
-
- \sa PdfPageImage::rotation
*/
property real pageRotation: 0
@@ -264,8 +258,8 @@ Item {
\qmlproperty string PdfMultiPageView::searchString
This property holds the search string that the user may choose to search
- for. It is typically used in a binding to the
- \l {QtQuick.Controls::TextField::text}{text} property of a TextField.
+ for. It is typically used in a binding to the \c text property of a
+ TextField.
\sa searchModel
*/
@@ -299,6 +293,8 @@ Item {
TableView {
id: tableView
property bool debug: false
+ property real minScale: 0.1
+ property real maxScale: 10
property point jumpLocationMargin: Qt.point(10, 10) // px away from viewport edges
anchors.fill: parent
anchors.leftMargin: 2
@@ -405,11 +401,10 @@ Item {
}
PinchHandler {
id: pinch
- minimumScale: 0.1
- maximumScale: root.renderScale < 4 ? 2 : 1
+ minimumScale: tableView.minScale / root.renderScale
+ maximumScale: Math.max(1, tableView.maxScale / root.renderScale)
minimumRotation: root.pageRotation
maximumRotation: root.pageRotation
- enabled: image.sourceSize.width < 5000
onActiveChanged:
if (active) {
paper.z = 10
diff --git a/src/pdfquick/PdfPageView.qml b/src/pdfquick/PdfPageView.qml
index bb9f01b0e..8e99ead7e 100644
--- a/src/pdfquick/PdfPageView.qml
+++ b/src/pdfquick/PdfPageView.qml
@@ -37,8 +37,6 @@ Rectangle {
This property holds the \l {QtQuick::Image::status}{rendering status} of
the \l {currentPage}{current page}.
-
- \sa PdfPageImage::status
*/
property alias status: image.status
@@ -177,8 +175,6 @@ Rectangle {
This property holds the ratio of pixels to points. The default is \c 1,
meaning one point (1/72 of an inch) equals 1 logical pixel.
-
- \sa PdfPageImage::status
*/
property real renderScale: 1
@@ -187,7 +183,7 @@ Rectangle {
This property holds the scaled width and height of the full-frame image.
- \sa PdfPageImage::sourceSize
+ \sa {QtQuick::Image::sourceSize}{Image.sourceSize}
*/
property alias sourceSize: image.sourceSize
@@ -224,8 +220,8 @@ Rectangle {
Sets \l renderScale such that the whole first page will fit into a viewport
with the given \a width and \a height. The resulting \l renderScale depends
- on \l pageRotation: the page will fit into the viewport at a larger size if
- it is first rotated to have a matching aspect ratio.
+ on page rotation: the page will fit into the viewport at a larger size if it
+ is first rotated to have a matching aspect ratio.
*/
function scaleToPage(width, height) {
const windowAspect = width / height
@@ -269,8 +265,8 @@ Rectangle {
\qmlproperty string PdfPageView::searchString
This property holds the search string that the user may choose to search
- for. It is typically used in a binding to the
- \l {QtQuick.Controls::TextField::text}{text} property of a TextField.
+ for. It is typically used in a binding to the \c text property of a
+ TextField.
\sa searchModel
*/
diff --git a/src/pdfquick/PdfScrollablePageView.qml b/src/pdfquick/PdfScrollablePageView.qml
index b0d8fa8b8..5295db7f8 100644
--- a/src/pdfquick/PdfScrollablePageView.qml
+++ b/src/pdfquick/PdfScrollablePageView.qml
@@ -39,8 +39,6 @@ Flickable {
This property holds the \l {QtQuick::Image::status}{rendering status} of
the \l {currentPage}{current page}.
-
- \sa PdfPageImage::status
*/
property alias status: image.status
@@ -173,8 +171,6 @@ Flickable {
This property holds the ratio of pixels to points. The default is \c 1,
meaning one point (1/72 of an inch) equals 1 logical pixel.
-
- \sa PdfPageImage::status
*/
property real renderScale: 1
@@ -185,8 +181,6 @@ Flickable {
The default value is \c 0 degrees (that is, no rotation relative to the
orientation of the pages as stored in the PDF file).
-
- \sa PdfPageImage::rotation
*/
property real pageRotation: 0
@@ -195,7 +189,7 @@ Flickable {
This property holds the scaled width and height of the full-frame image.
- \sa PdfPageImage::sourceSize
+ \sa {QtQuick::Image::sourceSize}{Image.sourceSize}
*/
property alias sourceSize: image.sourceSize
@@ -259,8 +253,8 @@ Flickable {
\qmlproperty string PdfScrollablePageView::searchString
This property holds the search string that the user may choose to search
- for. It is typically used in a binding to the
- \l {QtQuick.Controls::TextField::text}{text} property of a TextField.
+ for. It is typically used in a binding to the \c text property of a
+ TextField.
\sa searchModel
*/
@@ -359,6 +353,8 @@ Flickable {
height: rot90 ? image.width : image.height
property real rotationModulus: Math.abs(root.pageRotation % 180)
property bool rot90: rotationModulus > 45 && rotationModulus < 135
+ property real minScale: 0.1
+ property real maxScale: 10
PdfPageImage {
id: image
@@ -453,11 +449,10 @@ Flickable {
PinchHandler {
id: pinch
- minimumScale: 0.1
- maximumScale: root.renderScale < 4 ? 2 : 1
+ minimumScale: paper.minScale / root.renderScale
+ maximumScale: Math.max(1, paper.maxScale / root.renderScale)
minimumRotation: 0
maximumRotation: 0
- enabled: image.sourceSize.width < 5000
onActiveChanged:
if (!active) {
const centroidInPoints = Qt.point(pinch.centroid.position.x / root.renderScale,
diff --git a/src/pdfquick/qquickpdfpageimage.cpp b/src/pdfquick/qquickpdfpageimage.cpp
index e002e9498..2ea8ebc12 100644
--- a/src/pdfquick/qquickpdfpageimage.cpp
+++ b/src/pdfquick/qquickpdfpageimage.cpp
@@ -13,7 +13,7 @@ Q_LOGGING_CATEGORY(qLcImg, "qt.pdf.image")
/*!
\qmltype PdfPageImage
//! \instantiates QQuickPdfPageImage
- \inqmlmodule QtPdf
+ \inqmlmodule QtQuick.Pdf
\ingroup pdf
\inherits Image
\brief Displays one page from a PDF document.
diff --git a/src/pdfquick/qquickpdfpagenavigator.cpp b/src/pdfquick/qquickpdfpagenavigator.cpp
index be828c059..939d928e9 100644
--- a/src/pdfquick/qquickpdfpagenavigator.cpp
+++ b/src/pdfquick/qquickpdfpagenavigator.cpp
@@ -6,8 +6,6 @@
QT_BEGIN_NAMESPACE
-Q_LOGGING_CATEGORY(qLcNav, "qt.pdf.pagenavigator")
-
/*!
\qmltype PdfPageNavigator
//! \instantiates QQuickPdfPageNavigator
diff --git a/src/pdfquick/qquickpdfselection.cpp b/src/pdfquick/qquickpdfselection.cpp
index c414e7ecf..ff50bcb23 100644
--- a/src/pdfquick/qquickpdfselection.cpp
+++ b/src/pdfquick/qquickpdfselection.cpp
@@ -46,8 +46,6 @@ QQuickPdfSelection::QQuickPdfSelection(QQuickItem *parent)
{
#if QT_CONFIG(im)
setFlags(ItemIsFocusScope | ItemAcceptsInputMethod);
- // workaround to get Copy instead of Paste on the popover menu (QTBUG-83811)
- setProperty("qt_im_readonly", QVariant(true));
#endif
}
@@ -151,6 +149,8 @@ void QQuickPdfSelection::clear()
*/
void QQuickPdfSelection::selectAll()
{
+ if (!m_document)
+ return;
QPdfSelection sel = m_document->document()->getAllText(m_page);
if (sel.text() != m_text) {
m_text = sel.text();
@@ -184,6 +184,8 @@ void QQuickPdfSelection::keyReleaseEvent(QKeyEvent *ev)
qCDebug(qLcIm) << "release" << ev;
const auto &allText = pageText();
if (ev == QKeySequence::MoveToPreviousWord) {
+ if (!m_document)
+ return;
// iOS sends MoveToPreviousWord first to get to the beginning of the word,
// and then SelectNextWord to select the whole word.
int i = allText.lastIndexOf(WordDelimiter, m_fromCharIndex - allText.length());
@@ -195,6 +197,8 @@ void QQuickPdfSelection::keyReleaseEvent(QKeyEvent *ev)
update(sel);
QGuiApplication::inputMethod()->update(Qt::ImAnchorRectangle);
} else if (ev == QKeySequence::SelectNextWord) {
+ if (!m_document)
+ return;
int i = allText.indexOf(WordDelimiter, m_toCharIndex);
if (i < 0)
i = allText.length(); // go to the end of m_textAfter
@@ -214,6 +218,8 @@ void QQuickPdfSelection::inputMethodEvent(QInputMethodEvent *event)
qCDebug(qLcIm) << "QInputMethodEvent::Cursor: moved to" << attr.start << "len" << attr.length;
break;
case QInputMethodEvent::Selection: {
+ if (!m_document)
+ return;
auto sel = m_document->document()->getSelectionAtIndex(m_page, attr.start, attr.length);
update(sel);
qCDebug(qLcIm) << "QInputMethodEvent::Selection: from" << attr.start << "len" << attr.length
@@ -235,6 +241,8 @@ QVariant QQuickPdfSelection::inputMethodQuery(Qt::InputMethodQuery query, const
if (!argument.isNull()) {
qCDebug(qLcIm) << "IM query" << query << "with arg" << argument;
if (query == Qt::ImCursorPosition) {
+ if (!m_document)
+ return {};
// If it didn't move since last time, return the same result.
if (m_hitPoint == argument.toPointF())
return inputMethodQuery(query);
@@ -309,6 +317,7 @@ QVariant QQuickPdfSelection::inputMethodQuery(Qt::InputMethodQuery query) const
case Qt::ImPlatformData:
break;
case Qt::ImReadOnly:
+ ret = true;
break;
case Qt::ImQueryInput:
case Qt::ImQueryAll:
@@ -323,6 +332,8 @@ QVariant QQuickPdfSelection::inputMethodQuery(Qt::InputMethodQuery query) const
const QString &QQuickPdfSelection::pageText() const
{
if (m_pageTextDirty) {
+ if (!m_document)
+ return m_pageText;
m_pageText = m_document->document()->getAllText(m_page).text();
m_pageTextDirty = false;
}
diff --git a/src/pdfwidgets/CMakeLists.txt b/src/pdfwidgets/CMakeLists.txt
index 2d2616556..d374315e3 100644
--- a/src/pdfwidgets/CMakeLists.txt
+++ b/src/pdfwidgets/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS Core Gui Widgets)
qt_internal_add_module(PdfWidgets
diff --git a/src/process/CMakeLists.txt b/src/process/CMakeLists.txt
index 7054cac79..4c283da11 100644
--- a/src/process/CMakeLists.txt
+++ b/src/process/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
if(NOT DEFINED WEBENGINE_ROOT_SOURCE_DIR)
get_filename_component(WEBENGINE_ROOT_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../.." REALPATH)
endif()
diff --git a/src/process/main.cpp b/src/process/main.cpp
index 5c3f0c02c..d71ab128e 100644
--- a/src/process/main.cpp
+++ b/src/process/main.cpp
@@ -49,7 +49,7 @@ struct tm* localtime64_r_proxy(const time_t* timep, struct tm* result)
return sandbox::localtime64_r_override(timep, result);
}
-#endif // defined(OS_LINUX)
+#endif // defined(Q_OS_LINUX)
#if defined(Q_OS_WIN32)
namespace QtWebEngineProcess {
diff --git a/src/webenginequick/CMakeLists.txt b/src/webenginequick/CMakeLists.txt
index ebe1ddf54..fd40081e9 100644
--- a/src/webenginequick/CMakeLists.txt
+++ b/src/webenginequick/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
add_subdirectory(ui)
qt_internal_add_qml_module(WebEngineQuick
diff --git a/src/webenginequick/api/qquickwebengineprofile.cpp b/src/webenginequick/api/qquickwebengineprofile.cpp
index 1cfaab3f5..131e59ad0 100644
--- a/src/webenginequick/api/qquickwebengineprofile.cpp
+++ b/src/webenginequick/api/qquickwebengineprofile.cpp
@@ -821,6 +821,49 @@ QString QQuickWebEngineProfile::downloadPath() const
}
/*!
+ \qmlproperty string WebEngineProfile::pushServiceEndpoint
+ \since QtWebEngine 6.5
+
+ The address used to create subscriptions for a push messaging service.
+
+ Subscription requests for the push service will be sent to the concatenation
+ of \a endpoint and a subscription ID (which is provided by the browser engine).
+
+ \note Default endpoint used by Google Chrome browser is \c {https://fcm.googleapis.com/fcm/send/}
+
+ \note By default, the endpoint is an empty URL and push messaging is disabled.
+*/
+
+/*!
+ \property QQuickWebEngineProfile::pushServiceEndpoint
+ \since QtWebEngine 6.5
+
+ The address used to create subscriptions for a push messaging service.
+
+ Subscription requests for the push service will be sent to the concatenation
+ of \a endpoint and a subscription ID (which is provided by the browser engine).
+
+ \note Default endpoint used by Google Chrome browser is \c {https://fcm.googleapis.com/fcm/send/}
+
+ \note By default, the endpoint is an empty URL and push messaging is disabled.
+*/
+
+QUrl QQuickWebEngineProfile::pushServiceEndpoint() const
+{
+ const Q_D(QQuickWebEngineProfile);
+ return d->profileAdapter()->pushServiceEndpoint();
+}
+
+void QQuickWebEngineProfile::setPushServiceEndpoint(const QUrl &endpoint)
+{
+ Q_D(QQuickWebEngineProfile);
+ if (pushServiceEndpoint() == endpoint)
+ return;
+ d->profileAdapter()->setPushServiceEndpoint(endpoint);
+ emit pushServiceEndpointChanged();
+}
+
+/*!
Returns the cookie store for this profile.
*/
diff --git a/src/webenginequick/api/qquickwebengineprofile.h b/src/webenginequick/api/qquickwebengineprofile.h
index 77e367d02..36789acf0 100644
--- a/src/webenginequick/api/qquickwebengineprofile.h
+++ b/src/webenginequick/api/qquickwebengineprofile.h
@@ -37,6 +37,7 @@ class Q_WEBENGINEQUICK_EXPORT QQuickWebEngineProfile : public QObject {
Q_PROPERTY(bool spellCheckEnabled READ isSpellCheckEnabled WRITE setSpellCheckEnabled NOTIFY spellCheckEnabledChanged FINAL REVISION(1,3))
Q_PROPERTY(QQuickWebEngineScriptCollection *userScripts READ userScripts)
Q_PROPERTY(QString downloadPath READ downloadPath WRITE setDownloadPath NOTIFY downloadPathChanged FINAL REVISION(1,5))
+ Q_PROPERTY(QUrl pushServiceEndpoint READ pushServiceEndpoint WRITE setPushServiceEndpoint NOTIFY pushServiceEndpointChanged FINAL REVISION(6,5))
QML_NAMED_ELEMENT(WebEngineProfile)
QML_ADDED_IN_VERSION(1, 1)
QML_EXTRA_VERSION(2, 0)
@@ -108,6 +109,9 @@ public:
QString downloadPath() const;
void setDownloadPath(const QString &path);
+ QUrl pushServiceEndpoint() const;
+ void setPushServiceEndpoint(const QUrl &endpoint);
+
QWebEngineClientCertificateStore *clientCertificateStore();
static QQuickWebEngineProfile *defaultProfile();
@@ -125,6 +129,7 @@ Q_SIGNALS:
Q_REVISION(1,3) void spellCheckLanguagesChanged();
Q_REVISION(1,3) void spellCheckEnabledChanged();
Q_REVISION(1,5) void downloadPathChanged();
+ Q_REVISION(6,5) void pushServiceEndpointChanged();
void downloadRequested(QQuickWebEngineDownloadRequest *download);
void downloadFinished(QQuickWebEngineDownloadRequest *download);
diff --git a/src/webenginequick/api/qquickwebenginesingleton.cpp b/src/webenginequick/api/qquickwebenginesingleton.cpp
index 0344f2fab..a51d2aca4 100644
--- a/src/webenginequick/api/qquickwebenginesingleton.cpp
+++ b/src/webenginequick/api/qquickwebenginesingleton.cpp
@@ -81,6 +81,7 @@ QWebEngineScript QQuickWebEngineSingleton::script() const
return QWebEngineScript();
}
+QT_END_NAMESPACE
+
#include "moc_qquickwebenginesingleton_p.cpp"
-QT_END_NAMESPACE
diff --git a/src/webenginequick/configure.cmake b/src/webenginequick/configure.cmake
index 649154301..b256e5a1d 100644
--- a/src/webenginequick/configure.cmake
+++ b/src/webenginequick/configure.cmake
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
qt_feature("webenginequick-ui-delegates" PRIVATE
SECTION "WebEngine"
LABEL "UI Delegates"
diff --git a/src/webenginequick/doc/snippets/qtwebengine_build_snippet.qdoc b/src/webenginequick/doc/snippets/qtwebengine_build_snippet.qdoc
index d1e230db1..76dea97cf 100644
--- a/src/webenginequick/doc/snippets/qtwebengine_build_snippet.qdoc
+++ b/src/webenginequick/doc/snippets/qtwebengine_build_snippet.qdoc
@@ -5,11 +5,6 @@
QT += webenginequick
//! [0]
-
-//! [1]
-#include <QtWebEngineQuick>
-//! [1]
-
//! [2]
find_package(Qt6 REQUIRED COMPONENTS WebEngineQuick)
target_link_libraries(target PRIVATE Qt::WebEngineQuick)
diff --git a/src/webenginequick/doc/src/qtwebengine-module.qdoc b/src/webenginequick/doc/src/qtwebengine-module.qdoc
index 21d8b4749..6f50cc2f4 100644
--- a/src/webenginequick/doc/src/qtwebengine-module.qdoc
+++ b/src/webenginequick/doc/src/qtwebengine-module.qdoc
@@ -12,11 +12,6 @@
The \QWE Quick module exposes C++ functionality to Qt Quick.
- To include the definitions of the module's classes, use the
- following directive:
-
- \snippet qtwebengine_build_snippet.qdoc 1
-
\if !defined(qtforpython)
To link against the module, add the following to your qmake project file:
diff --git a/src/webenginequick/doc/src/qtwebengine-qmlmodule.qdoc b/src/webenginequick/doc/src/qtwebengine-qmlmodule.qdoc
index 7899fad56..19348508c 100644
--- a/src/webenginequick/doc/src/qtwebengine-qmlmodule.qdoc
+++ b/src/webenginequick/doc/src/qtwebengine-qmlmodule.qdoc
@@ -8,11 +8,6 @@
\ingroup qtwebengine-modules
\ingroup qmlmodules
- The QML types can be imported into your application using the following import statements in
- your .qml file:
-
- \snippet qtwebengine_build_snippet.qdoc 1
-
To link against the module using build with qmake,
add the following QT variable to your qmake .pro file:
diff --git a/src/webenginequick/doc/src/webengineview_lgpl.qdoc b/src/webenginequick/doc/src/webengineview_lgpl.qdoc
index 6e3d9ebe3..6534518e7 100644
--- a/src/webenginequick/doc/src/webengineview_lgpl.qdoc
+++ b/src/webenginequick/doc/src/webengineview_lgpl.qdoc
@@ -1,24 +1,7 @@
-/*
- * Copyright (C) 2019 The Qt Company Ltd.
- * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
- * Copyright (c) 2012 Hewlett-Packard Development Company, L.P.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
+// Copyright (C) 2019 The Qt Company Ltd.
+// Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
+// Copyright (c) 2012 Hewlett-Packard Development Company, L.P.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
// The documentation in this file was imported from QtWebKit and is thus constrained
// by its LGPL license.
diff --git a/src/webenginequick/ui/AutofillPopup.qml b/src/webenginequick/ui/AutofillPopup.qml
index 28b274bb6..0a14b6233 100644
--- a/src/webenginequick/ui/AutofillPopup.qml
+++ b/src/webenginequick/ui/AutofillPopup.qml
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2022 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
import QtQuick
import QtQuick.Controls
diff --git a/src/webenginequick/ui/CMakeLists.txt b/src/webenginequick/ui/CMakeLists.txt
index c24d8da8d..dc9d14823 100644
--- a/src/webenginequick/ui/CMakeLists.txt
+++ b/src/webenginequick/ui/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
set(qml_files
"AlertDialog.qml"
"AuthenticationDialog.qml"
diff --git a/src/webenginewidgets/CMakeLists.txt b/src/webenginewidgets/CMakeLists.txt
index 97bde6b56..b6de53a04 100644
--- a/src/webenginewidgets/CMakeLists.txt
+++ b/src/webenginewidgets/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
if(TARGET Qt::Designer)
add_subdirectory(plugins/qwebengineview)
else()
@@ -10,11 +13,13 @@ qt_internal_add_module(WebEngineWidgets
api/qwebengineview.cpp api/qwebengineview.h api/qwebengineview_p.h
qwebengine_accessible.cpp qwebengine_accessible.h
ui/autofillpopupwidget.cpp ui/autofillpopupwidget_p.h
+ ui/touchhandlewidget.cpp ui/touchhandlewidget_p.h
DEFINES
QT_BUILD_WEBENGINEWIDGETS_LIB
INCLUDE_DIRECTORIES
../core
api
+ ui
LIBRARIES
Qt::CorePrivate
Qt::GuiPrivate
diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp
index 1703135be..927026050 100644
--- a/src/webenginewidgets/api/qwebengineview.cpp
+++ b/src/webenginewidgets/api/qwebengineview.cpp
@@ -8,6 +8,7 @@
#include "render_widget_host_view_qt_delegate_item.h"
#include "qwebengine_accessible.h"
#include "ui/autofillpopupwidget_p.h"
+#include "touchhandlewidget_p.h"
#include <QtWebEngineCore/private/qwebenginepage_p.h>
#include <QtWebEngineCore/qwebenginecontextmenurequest.h>
@@ -57,6 +58,7 @@
#if QT_CONFIG(webengine_printing_and_pdf)
#include "printing/printer_worker.h"
+#include <QPrintEngine>
#include <QPrinter>
#include <QThread>
#endif
@@ -78,7 +80,6 @@ public:
QQuickItem *root = new QQuickItem(); // Indirection so we don't delete m_contentItem
setContent(QUrl(), nullptr, root);
root->setFlags(QQuickItem::ItemHasContents);
- root->setFocus(true);
root->setVisible(true);
m_contentItem->setParentItem(root);
@@ -800,7 +801,11 @@ void QWebEngineViewPrivate::didPrintPage(QPrinter *&currentPrinter, QSharedPoint
printerWorker->m_documentCopies = currentPrinter->copyCount();
printerWorker->m_collateCopies = currentPrinter->collateCopies();
- QObject::connect(printerWorker, &QtWebEngineCore::PrinterWorker::resultReady, q, [q, &currentPrinter](bool success) {
+ int oldCopyCount = currentPrinter->copyCount();
+ currentPrinter->printEngine()->setProperty(QPrintEngine::PPK_CopyCount, 1);
+
+ QObject::connect(printerWorker, &QtWebEngineCore::PrinterWorker::resultReady, q, [q, &currentPrinter, oldCopyCount](bool success) {
+ currentPrinter->printEngine()->setProperty(QPrintEngine::PPK_CopyCount, oldCopyCount);
currentPrinter = nullptr;
Q_EMIT q->printFinished(success);
});
@@ -1584,6 +1589,13 @@ bool QContextMenuBuilder::isMenuItemEnabled(ContextMenuItem menuItem)
}
#endif // QT_CONFIG(action)
+QtWebEngineCore::TouchHandleDrawableDelegate *
+QWebEngineViewPrivate::createTouchHandleDelegate(const QMap<int, QImage> &images)
+{
+ Q_Q(QWebEngineView);
+ return new QtWebEngineWidgetUI::TouchHandleWidget(q, images);
+}
+
QT_END_NAMESPACE
#include "moc_qwebengineview.cpp"
diff --git a/src/webenginewidgets/api/qwebengineview_p.h b/src/webenginewidgets/api/qwebengineview_p.h
index 7855f9ef3..9e0a40799 100644
--- a/src/webenginewidgets/api/qwebengineview_p.h
+++ b/src/webenginewidgets/api/qwebengineview_p.h
@@ -29,6 +29,7 @@ class RenderWidgetHostViewQtDelegateClient;
namespace QtWebEngineWidgetUI {
class AutofillPopupWidget;
+class TouchHandleDrawableDelegate;
}
QT_BEGIN_NAMESPACE
@@ -71,6 +72,8 @@ public:
void showAutofillPopup(QtWebEngineCore::AutofillPopupController *controller,
const QRect &bounds, bool autoselectFirstSuggestion) override;
void hideAutofillPopup() override;
+ QtWebEngineCore::TouchHandleDrawableDelegate *
+ createTouchHandleDelegate(const QMap<int, QImage> &images) override;
QWebEngineViewPrivate();
virtual ~QWebEngineViewPrivate();
diff --git a/src/webenginewidgets/doc/snippets/qtwebenginewidgets_build_snippet.qdoc b/src/webenginewidgets/doc/snippets/qtwebenginewidgets_build_snippet.qdoc
index e732bbeed..4ab54a2ba 100644
--- a/src/webenginewidgets/doc/snippets/qtwebenginewidgets_build_snippet.qdoc
+++ b/src/webenginewidgets/doc/snippets/qtwebenginewidgets_build_snippet.qdoc
@@ -5,11 +5,6 @@
QT += webenginewidgets
//! [0]
-
-//! [1]
-#include <QtWebEngineWidgets>
-//! [1]
-
//! [2]
find_package(Qt6 REQUIRED COMPONENTS WebEngineWidgets)
target_link_libraries(target PRIVATE Qt::WebEngineWidgets)
diff --git a/src/webenginewidgets/doc/src/qtwebenginewidgets-index.qdoc b/src/webenginewidgets/doc/src/qtwebenginewidgets-index.qdoc
index a80400c60..8eb28b797 100644
--- a/src/webenginewidgets/doc/src/qtwebenginewidgets-index.qdoc
+++ b/src/webenginewidgets/doc/src/qtwebenginewidgets-index.qdoc
@@ -10,11 +10,6 @@
\section1 Getting Started
- To include the definitions of the module's classes, use the
- following directive:
-
- \snippet qtwebenginewidgets_build_snippet.qdoc 1
-
To link against the module, add this line to your qmake project file:
\snippet qtwebenginewidgets_build_snippet.qdoc 0
diff --git a/src/webenginewidgets/doc/src/qtwebenginewidgets-module.qdoc b/src/webenginewidgets/doc/src/qtwebenginewidgets-module.qdoc
index b88d7af36..df06909df 100644
--- a/src/webenginewidgets/doc/src/qtwebenginewidgets-module.qdoc
+++ b/src/webenginewidgets/doc/src/qtwebenginewidgets-module.qdoc
@@ -13,11 +13,6 @@
The \QWE Widgets module provides a web browser engine as well as C++ classes to render
and interact with web content.
- To include the definitions of the module's classes, use the
- following directive:
-
- \snippet qtwebenginewidgets_build_snippet.qdoc 1
-
\if !defined(qtforpython)
To link against the module using build with qmake,
add the following QT variable to your qmake .pro file:
diff --git a/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc
index 34aa53278..14e6c3ed8 100644
--- a/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc
+++ b/src/webenginewidgets/doc/src/qwebengineview_lgpl.qdoc
@@ -1,24 +1,8 @@
-/*
- Copyright (C) 2019 The Qt Company Ltd.
- Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
- Copyright (C) 2008 Holger Hans Peter Freyther
- Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+// Copyright (C) 2019 The Qt Company Ltd.
+// Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+// Copyright (C) 2008 Holger Hans Peter Freyther
+// Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
// The documentation in this file was imported from QtWebKit and is thus constrained
// by its LGPL license. Documentation written from scratch for new methods should be
diff --git a/src/webenginewidgets/plugins/qwebengineview/CMakeLists.txt b/src/webenginewidgets/plugins/qwebengineview/CMakeLists.txt
index 3e6f324da..0e7644bf7 100644
--- a/src/webenginewidgets/plugins/qwebengineview/CMakeLists.txt
+++ b/src/webenginewidgets/plugins/qwebengineview/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
qt_internal_add_plugin(QWebEngineViewPlugin
OUTPUT_NAME qwebengineview
PLUGIN_TYPE designer
diff --git a/src/webenginewidgets/ui/autofillpopupwidget.cpp b/src/webenginewidgets/ui/autofillpopupwidget.cpp
index 579869d9e..a4dc31beb 100644
--- a/src/webenginewidgets/ui/autofillpopupwidget.cpp
+++ b/src/webenginewidgets/ui/autofillpopupwidget.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2022 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "autofillpopupwidget_p.h"
#include "qwebengineview.h"
diff --git a/src/webenginewidgets/ui/autofillpopupwidget_p.h b/src/webenginewidgets/ui/autofillpopupwidget_p.h
index 064c4f824..79decc6ab 100644
--- a/src/webenginewidgets/ui/autofillpopupwidget_p.h
+++ b/src/webenginewidgets/ui/autofillpopupwidget_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2022 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef AUTOFILLPOPUPWIDGET_P_H
#define AUTOFILLPOPUPWIDGET_P_H
diff --git a/src/webenginewidgets/ui/touchhandlewidget.cpp b/src/webenginewidgets/ui/touchhandlewidget.cpp
new file mode 100644
index 000000000..88af0ff36
--- /dev/null
+++ b/src/webenginewidgets/ui/touchhandlewidget.cpp
@@ -0,0 +1,59 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "touchhandlewidget_p.h"
+#include "qwebengineview.h"
+
+#include <QBoxLayout>
+#include <QGraphicsOpacityEffect>
+#include <QLabel>
+#include <QWidget>
+
+namespace QtWebEngineWidgetUI {
+TouchHandleWidget::TouchHandleWidget(QWebEngineView *view, const QMap<int, QImage> &images)
+ : m_widget(new QWidget(view))
+ , m_label(new QLabel(m_widget))
+ , m_opacityEffect(new QGraphicsOpacityEffect(m_widget))
+ , m_images(images)
+{
+ m_widget->setAttribute(Qt::WA_AcceptTouchEvents, true);
+ m_widget->setAttribute(Qt::WA_TransparentForMouseEvents, true);
+}
+
+TouchHandleWidget::~TouchHandleWidget()
+{
+}
+
+void TouchHandleWidget::setImage(int orientation)
+{
+ const QImage &img = m_images[orientation];
+ m_label->setPixmap(QPixmap::fromImage(img));
+ m_label->setFrameStyle(QFrame::NoFrame);
+ m_label->resize(img.size());
+ m_label->setVisible(true);
+
+ QVBoxLayout layout;
+ layout.setSpacing(0);
+ layout.setContentsMargins(QMargins());
+ layout.addWidget(m_label);
+ layout.setParent(m_widget);
+ m_widget->setLayout(&layout);
+ m_widget->resize(img.size());
+}
+
+void TouchHandleWidget::setBounds(const QRect &bounds)
+{
+ m_widget->setGeometry(bounds);
+}
+
+void TouchHandleWidget::setVisible(bool visible)
+{
+ m_widget->setVisible(visible);
+}
+
+void TouchHandleWidget::setOpacity(float opacity)
+{
+ m_opacityEffect->setOpacity(opacity);
+ m_widget->setGraphicsEffect(m_opacityEffect);
+}
+} // namespace QtWebEngineWidgetUI
diff --git a/src/webenginewidgets/ui/touchhandlewidget_p.h b/src/webenginewidgets/ui/touchhandlewidget_p.h
new file mode 100644
index 000000000..9f181c935
--- /dev/null
+++ b/src/webenginewidgets/ui/touchhandlewidget_p.h
@@ -0,0 +1,50 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef TOUCHHANDLEWIDGET_P_H
+#define TOUCHHANDLEWIDGET_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "touch_handle_drawable_client.h"
+
+#include <QImage>
+#include <QMap>
+
+QT_BEGIN_NAMESPACE
+class QGraphicsOpacityEffect;
+class QLabel;
+class QWebEngineView;
+class QWidget;
+QT_END_NAMESPACE
+
+namespace QtWebEngineWidgetUI {
+class TouchHandleWidget : public QtWebEngineCore::TouchHandleDrawableDelegate
+{
+public:
+ TouchHandleWidget(QWebEngineView *view, const QMap<int, QImage> &images);
+ ~TouchHandleWidget();
+
+ void setImage(int orientation) override;
+ void setBounds(const QRect &bounds) override;
+ void setVisible(bool visible) override;
+ void setOpacity(float opacity) override;
+
+private:
+ QWidget *m_widget;
+ QLabel *m_label;
+ QGraphicsOpacityEffect *m_opacityEffect;
+ QMap<int, QImage> m_images;
+};
+} // namespace QtWebEngineWidgetUI
+
+#endif // TOUCHHANDLEWIDGET_P_H
diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt
index e000203d9..6fff2b35c 100644
--- a/tests/auto/CMakeLists.txt
+++ b/tests/auto/CMakeLists.txt
@@ -1,3 +1,5 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
if(TARGET Qt::WebEngineCore)
add_subdirectory(httpserver)
add_subdirectory(util)
@@ -11,4 +13,5 @@ if(TARGET Qt::WebEngineWidgets)
endif()
if(TARGET Qt::Pdf)
add_subdirectory(pdf)
+ add_subdirectory(pdfquick)
endif()
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt
index c5d7c3f9a..83ebf5a23 100644
--- a/tests/auto/cmake/CMakeLists.txt
+++ b/tests/auto/cmake/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.16)
diff --git a/tests/auto/core/CMakeLists.txt b/tests/auto/core/CMakeLists.txt
index ecb3b2cf9..5615d6b2d 100644
--- a/tests/auto/core/CMakeLists.txt
+++ b/tests/auto/core/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
add_subdirectory(qwebenginecookiestore)
add_subdirectory(qwebenginesettings)
add_subdirectory(qwebengineurlrequestinterceptor)
diff --git a/tests/auto/core/certificateerror/CMakeLists.txt b/tests/auto/core/certificateerror/CMakeLists.txt
index 57801e195..6223ca25c 100644
--- a/tests/auto/core/certificateerror/CMakeLists.txt
+++ b/tests/auto/core/certificateerror/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
include(../../httpserver/httpserver.cmake)
include(../../util/util.cmake)
diff --git a/tests/auto/core/devtools/CMakeLists.txt b/tests/auto/core/devtools/CMakeLists.txt
index fd8d850f0..efde75240 100644
--- a/tests/auto/core/devtools/CMakeLists.txt
+++ b/tests/auto/core/devtools/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
qt_internal_add_test(tst_devtools
SOURCES
tst_devtools.cpp
diff --git a/tests/auto/core/origins/CMakeLists.txt b/tests/auto/core/origins/CMakeLists.txt
index 79b8278a7..4a4219267 100644
--- a/tests/auto/core/origins/CMakeLists.txt
+++ b/tests/auto/core/origins/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
include(../../httpserver/httpserver.cmake)
include(../../util/util.cmake)
diff --git a/tests/auto/core/origins/resources/mixedSchemes.html b/tests/auto/core/origins/resources/mixedSchemes.html
index 260372a29..53c8c83ff 100644
--- a/tests/auto/core/origins/resources/mixedSchemes.html
+++ b/tests/auto/core/origins/resources/mixedSchemes.html
@@ -12,7 +12,7 @@
document.getElementById("iframe").setAttribute("src", url);
// Early fire is OK unless the test is expecting cannotLoad.
// If timeout is too short then a false positive is possible.
- setTimeout(() => { result = result || "cannotLoad"; }, 1000);
+ setTimeout(() => { result = result || "cannotLoad"; }, 3000);
}
addEventListener("load", function() {
diff --git a/tests/auto/core/qwebengineclientcertificatestore/CMakeLists.txt b/tests/auto/core/qwebengineclientcertificatestore/CMakeLists.txt
index fa2d5e538..0507d80f1 100644
--- a/tests/auto/core/qwebengineclientcertificatestore/CMakeLists.txt
+++ b/tests/auto/core/qwebengineclientcertificatestore/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
qt_internal_add_test(tst_qwebengineclientcertificatestore
SOURCES
tst_qwebengineclientcertificatestore.cpp
diff --git a/tests/auto/core/qwebenginecookiestore/CMakeLists.txt b/tests/auto/core/qwebenginecookiestore/CMakeLists.txt
index 33ba5ff1a..cc14940f1 100644
--- a/tests/auto/core/qwebenginecookiestore/CMakeLists.txt
+++ b/tests/auto/core/qwebenginecookiestore/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
include(../../httpserver/httpserver.cmake)
include(../../util/util.cmake)
diff --git a/tests/auto/core/qwebenginesettings/CMakeLists.txt b/tests/auto/core/qwebenginesettings/CMakeLists.txt
index 7f8b49d1b..44e8f5252 100644
--- a/tests/auto/core/qwebenginesettings/CMakeLists.txt
+++ b/tests/auto/core/qwebenginesettings/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
include(../../util/util.cmake)
qt_internal_add_test(tst_qwebenginesettings
diff --git a/tests/auto/core/qwebengineurlrequestinterceptor/CMakeLists.txt b/tests/auto/core/qwebengineurlrequestinterceptor/CMakeLists.txt
index 0f8d90a08..60add4567 100644
--- a/tests/auto/core/qwebengineurlrequestinterceptor/CMakeLists.txt
+++ b/tests/auto/core/qwebengineurlrequestinterceptor/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
include(../../util/util.cmake)
include(../../httpserver/httpserver.cmake)
diff --git a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp
index 99cf3f244..7626d0442 100644
--- a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp
+++ b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp
@@ -8,6 +8,7 @@
#include <QtWebEngineCore/qwebenginesettings.h>
#include <QtWebEngineCore/qwebengineprofile.h>
#include <QtWebEngineCore/qwebenginepage.h>
+#include <QtWebEngineCore/qwebenginehttprequest.h>
#include <httpserver.h>
#include <httpreqrep.h>
@@ -39,6 +40,7 @@ private Q_SLOTS:
void requestInterceptorByResourceType_data();
void requestInterceptorByResourceType();
void firstPartyUrlHttp();
+ void headers();
void customHeaders();
void initiator();
void jsServiceWorker();
@@ -77,12 +79,14 @@ struct RequestInfo {
, firstPartyUrl(info.firstPartyUrl())
, initiator(info.initiator())
, resourceType(info.resourceType())
+ , headers(info.httpHeaders())
{}
QUrl requestUrl;
QUrl firstPartyUrl;
QUrl initiator;
int resourceType;
+ QHash<QByteArray, QByteArray> headers;
};
static const QUrl kRedirectUrl = QUrl("qrc:///resources/content.html");
@@ -577,6 +581,40 @@ void tst_QWebEngineUrlRequestInterceptor::firstPartyUrlHttp()
QCOMPARE(info.firstPartyUrl, firstPartyUrl);
}
+void tst_QWebEngineUrlRequestInterceptor::headers()
+{
+ HttpServer httpServer;
+ httpServer.setResourceDirs({ QDir(QT_TESTCASE_SOURCEDIR).canonicalPath() + "/resources" });
+ QVERIFY(httpServer.start());
+ QWebEngineProfile profile;
+ TestRequestInterceptor interceptor(false);
+ profile.setUrlRequestInterceptor(&interceptor);
+
+ QWebEnginePage page(&profile);
+ QSignalSpy spy(&page, SIGNAL(loadFinished(bool)));
+
+ QWebEngineHttpRequest request(httpServer.url("/content.html"));
+ request.setHeader("X-HEADERNAME", "HEADERVALUE");
+ page.load(request);
+ QVERIFY(spy.wait());
+ QVERIFY(interceptor.requestInfos.last().headers.contains("X-HEADERNAME"));
+ QCOMPARE(interceptor.requestInfos.last().headers.value("X-HEADERNAME"),
+ QByteArray("HEADERVALUE"));
+
+ bool jsFinished = false;
+
+ page.runJavaScript(R"(
+var request = new XMLHttpRequest();
+request.open('GET', 'resource.html', /* async = */ false);
+request.setRequestHeader('X-FOO', 'BAR');
+request.send();
+)",
+ [&](const QVariant &) { jsFinished = true; });
+ QTRY_VERIFY(jsFinished);
+ QVERIFY(interceptor.requestInfos.last().headers.contains("X-FOO"));
+ QCOMPARE(interceptor.requestInfos.last().headers.value("X-FOO"), QByteArray("BAR"));
+}
+
void tst_QWebEngineUrlRequestInterceptor::customHeaders()
{
// Create HTTP Server to parse the request.
diff --git a/tests/auto/httpserver/CMakeLists.txt b/tests/auto/httpserver/CMakeLists.txt
index 7d4ddd030..0a1f881b9 100644
--- a/tests/auto/httpserver/CMakeLists.txt
+++ b/tests/auto/httpserver/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.18)
project(minimal LANGUAGES CXX)
diff --git a/tests/auto/httpserver/httpserver.cmake b/tests/auto/httpserver/httpserver.cmake
index 84b350c0e..f98434e1a 100644
--- a/tests/auto/httpserver/httpserver.cmake
+++ b/tests/auto/httpserver/httpserver.cmake
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
if (NOT TARGET Test::HttpServer)
add_library(httpserver STATIC
diff --git a/tests/auto/pdf/CMakeLists.txt b/tests/auto/pdf/CMakeLists.txt
index e2ba73c6e..8bda0c3c3 100644
--- a/tests/auto/pdf/CMakeLists.txt
+++ b/tests/auto/pdf/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
add_subdirectory(qpdfbookmarkmodel)
#add_subdirectory(qpdfpagenavigator)
add_subdirectory(qpdfpagerenderer)
diff --git a/tests/auto/pdf/qpdfbookmarkmodel/CMakeLists.txt b/tests/auto/pdf/qpdfbookmarkmodel/CMakeLists.txt
index f0300ce7b..d0dc966f0 100644
--- a/tests/auto/pdf/qpdfbookmarkmodel/CMakeLists.txt
+++ b/tests/auto/pdf/qpdfbookmarkmodel/CMakeLists.txt
@@ -1,7 +1,10 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
qt_internal_add_test(tst_qpdfbookmarkmodel
SOURCES
tst_qpdfbookmarkmodel.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Network
Qt::Pdf
diff --git a/tests/auto/pdf/qpdfdocument/CMakeLists.txt b/tests/auto/pdf/qpdfdocument/CMakeLists.txt
index 4551fdb6c..0d49bc6f1 100644
--- a/tests/auto/pdf/qpdfdocument/CMakeLists.txt
+++ b/tests/auto/pdf/qpdfdocument/CMakeLists.txt
@@ -1,7 +1,10 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
qt_internal_add_test(tst_qpdfdocument
SOURCES
tst_qpdfdocument.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Network
Qt::PrintSupport
diff --git a/tests/auto/pdf/qpdfdocument/tst_qpdfdocument.cpp b/tests/auto/pdf/qpdfdocument/tst_qpdfdocument.cpp
index a481ee57c..975708f65 100644
--- a/tests/auto/pdf/qpdfdocument/tst_qpdfdocument.cpp
+++ b/tests/auto/pdf/qpdfdocument/tst_qpdfdocument.cpp
@@ -54,7 +54,7 @@ struct TemporaryPdf: public QTemporaryFile
};
-TemporaryPdf::TemporaryPdf()
+TemporaryPdf::TemporaryPdf():QTemporaryFile(QStringLiteral("qpdfdocument"))
{
open();
pageLayout = QPageLayout(QPageSize(QPageSize::A4), QPageLayout::Portrait, QMarginsF());
diff --git a/tests/auto/pdf/qpdfpagerenderer/CMakeLists.txt b/tests/auto/pdf/qpdfpagerenderer/CMakeLists.txt
index f4084cce1..029563071 100644
--- a/tests/auto/pdf/qpdfpagerenderer/CMakeLists.txt
+++ b/tests/auto/pdf/qpdfpagerenderer/CMakeLists.txt
@@ -1,7 +1,10 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
qt_internal_add_test(tst_qpdfpagerenderer
SOURCES
tst_qpdfpagerenderer.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Network
Qt::Pdf
diff --git a/tests/auto/pdf/qpdfsearchmodel/CMakeLists.txt b/tests/auto/pdf/qpdfsearchmodel/CMakeLists.txt
index 2c3e744d0..15fecd21b 100644
--- a/tests/auto/pdf/qpdfsearchmodel/CMakeLists.txt
+++ b/tests/auto/pdf/qpdfsearchmodel/CMakeLists.txt
@@ -1,7 +1,10 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
qt_internal_add_test(tst_qpdfsearchmodel
SOURCES
tst_qpdfsearchmodel.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::Network
Qt::Pdf
diff --git a/tests/auto/pdfquick/CMakeLists.txt b/tests/auto/pdfquick/CMakeLists.txt
new file mode 100644
index 000000000..9f79459b2
--- /dev/null
+++ b/tests/auto/pdfquick/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(multipageview)
diff --git a/tests/auto/pdfquick/multipageview/BLACKLIST b/tests/auto/pdfquick/multipageview/BLACKLIST
new file mode 100644
index 000000000..b608bef1c
--- /dev/null
+++ b/tests/auto/pdfquick/multipageview/BLACKLIST
@@ -0,0 +1,3 @@
+# QTBUG-106072
+[password]
+windows
diff --git a/tests/auto/pdfquick/multipageview/CMakeLists.txt b/tests/auto/pdfquick/multipageview/CMakeLists.txt
new file mode 100644
index 000000000..283bebc79
--- /dev/null
+++ b/tests/auto/pdfquick/multipageview/CMakeLists.txt
@@ -0,0 +1,30 @@
+# Collect test data
+file(GLOB_RECURSE test_data_glob
+ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ data/*)
+list(APPEND test_data ${test_data_glob})
+
+qt_internal_add_test(tst_multipageview
+ SOURCES
+ tst_multipageview.cpp
+ ../shared/util.cpp ../shared/util.h
+ LIBRARIES
+ Qt::Gui
+ Qt::Quick
+ Qt::PdfQuickPrivate
+ TESTDATA ${test_data}
+)
+
+## Scopes:
+#####################################################################
+
+qt_internal_extend_target(tst_multipageview CONDITION ANDROID OR IOS
+ DEFINES
+ QT_QMLTEST_DATADIR=\\\":/data\\\"
+)
+
+qt_internal_extend_target(tst_multipageview CONDITION NOT ANDROID AND NOT IOS
+ DEFINES
+ QT_QMLTEST_DATADIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/data\\\"
+)
+
diff --git a/tests/auto/pdfquick/multipageview/data/bookmarksAndLinks.pdf b/tests/auto/pdfquick/multipageview/data/bookmarksAndLinks.pdf
new file mode 100644
index 000000000..aa0b99039
--- /dev/null
+++ b/tests/auto/pdfquick/multipageview/data/bookmarksAndLinks.pdf
@@ -0,0 +1,317 @@
+%PDF-1.7
+
+1 0 obj
+<<
+ /Type /Catalog
+ /PageMode /FullScreen
+ /Outlines 6 0 R
+ /Pages 2 0 R
+ /Names 50 0 R
+ /PageLabels 23 0 R
+ /ViewerPreferences<</NonFullScreenPageMode (UseThumbs)>>
+>>
+endobj
+
+50 0 obj
+<<
+ /Dests <</Names [ (ToTest2) [4 0 R /XYZ 300 300 1] (ToTest3) [5 0 R /XYZ 290 10 0.5] (ToTest1) [3 0 R /XYZ 600 800 1] ]>>
+>>
+endobj
+
+23 0 obj
+<<
+ /Nums [0 <</S /D /P(test )>> 3 <</S /A >> 4<</S /R/St >> 5<</S /r/St >> ]
+ /Limits [0 5]
+>>
+endobj
+
+2 0 obj
+<<
+ /Type /Pages
+ /Kids [3 0 R 4 0 R 5 0 R]
+ /Count 3
+>>
+endobj
+
+3 0 obj
+<<
+ /Type /Page
+ /Parent 2 0 R
+ /MediaBox [0 10 600 800]
+ /Annots [24 0 R 25 0 R]
+ /Contents 16 0 R
+ /Resources <<
+ /Font <</F1 18 0 R>>
+ >>
+>>
+endobj
+
+24 0 obj
+<<
+ /Subtype /Link
+ /Border [0 0 0]
+ /Dest (ToTest2)
+ /A << /Type /Action
+ /S /GoTo
+ /D [5 0 R /FitR C4 399 199 533]
+ >>
+ /Rect [10 690 150 720]
+
+>>
+endobj
+
+25 0 obj
+<<
+ /Subtype /Link
+ /Border [0 0 0]
+ /Dest (ToTest3)
+ /Rect [10 630 150 650]
+>>
+endobj
+
+
+16 0 obj
+<< /Length 0 >>
+ stream
+ BT
+ /F1 72 Tf
+ 200 200 TD
+ 0 0 1 RG
+ 5 Tr
+ (Test_1) Tj
+ 0 800 m
+ 600 0 l S
+ /F1 30 Tf
+ 0 1 0 RG
+ 1 Tr
+ -190 490 TD
+ (GO Test_2) Tj
+ 0 -50 TD
+ 5 w
+ 2 Tr
+ 1 0 0 RG
+ (GO Test_3) Tj
+ ET
+ endstream
+endobj
+
+
+endobj
+
+18 0 obj
+<<
+ /Type /Font
+ /Subtype /Type1
+ /Name /F1
+ /BaseFont /Helvetica
+>>
+endobj
+
+4 0 obj
+<<
+ /Type /Page
+ /Parent 2 0 R
+ /MediaBox [10 0 500 700]
+ /Annots [60 0 R]
+ /Contents 19 0 R
+ /Resources <<
+ /Font <</F2 20 0 R>>
+ >>
+>>
+endobj
+
+19 0 obj
+<< /Length 0 >>
+stream
+BT
+ 1 -0.7 0 1 30 100 cm
+ /F2 50 Tf
+ 10 50 TD
+ (TEST_2) Tj
+
+ 1 0.7 0 1 -30 -100 cm
+ /F2 25 Tf
+ 1 0 1 RG
+ 7 w
+ 100 60 TD
+
+ (GO Test_1) Tj
+ 100 100 140 40 re S f
+ET
+endstream
+endobj
+
+20 0 obj
+<<
+ /Type /Font
+ /Subtype /TrueType
+ /Name /F2
+ /BaseFont /NewYork , Bold
+ /FirstChar 0
+ /LastChar 255
+ /Widths 23 0 R
+ /FontDescriptor 7 0 R
+ /Encoding /MacRomanEncoding
+>>
+endobj
+
+60 0 obj
+<<
+ /Subtype /Link
+ /Border [0 0 0]
+ /Dest (ToTest1)
+ /Rect [110 110 230 150]
+>>
+endobj
+
+5 0 obj
+<<
+ /Type /Page
+ /Parent 2 0 R
+ /MediaBox [-10 -10 400 600]
+ /Annots [61 0 R]
+ /Contents 21 0 R
+ /Resources << /Font <</F3 22 0 R>> >>
+>>
+endobj
+
+21 0 obj
+<< /Length 0 >>
+stream
+BT
+ /F3 30 Tf
+ 290 10 TD
+ (TEST_3) Tj
+ -50 90 TD
+ (GO Test_2)Tj
+ET
+endstream
+endobj
+
+22 0 obj
+<<
+ /Type /Font
+ /Subtype /Type1
+ /Name /F3
+ /BaseFont /Courier-Bold
+>>
+endobj
+
+61 0 obj
+<<
+ /Subtype /Link
+ /Border [0 0 0]
+ /Dest (ToTest2)
+ /Rect [240 90 400 130]
+>>
+
+6 0 obj
+<<
+ /Type /Outlines
+ /First 7 0 R
+ /Last 11 0 R
+ /Count 4 0 R
+>>
+endobj
+
+7 0 obj
+<<
+ /Title (First)
+ /Parent 6 0 R
+ /Next 8 0 R
+ /C [1 0 0]
+ /Dest [ 3 0 R /XYZ 600 800 0.5 ]
+>>
+endobj
+
+8 0 obj
+<<
+ /Title (Second)
+ /Parent 6 0 R
+ /Prev 7 0 R
+ /Next 9 0 R
+ /C [0 1 0]
+ % /Dest [ 4 0 R /XYZ 500 700 null ]
+/Dest (ToTest2)
+>>
+endobj
+
+9 0 obj
+<<
+ /Title (Third)
+ /Parent 6 0 R
+ /Prev 8 0 R
+ /Next 10 0 R
+ /C [0 0 1]
+ /Dest [ 5 0 R /XYZ 400 600 0.8 ]
+>>
+endobj
+
+10 0 obj
+<<
+ /Title (Fourth)
+ /Parent 6 0 R
+ /Prev 9 0 R
+ /Next 11 0 R
+>>
+endobj
+
+11 0 obj
+<<
+ /Title (Fivth)
+ /Parent 6 0 R
+ /Prev 10 0 R
+ /First 12 0 R
+ /Last 15 0 R
+ /Count 4
+>>
+endobj
+
+12 0 obj
+<<
+ /Title (Fivth_1)
+ /Parent 11 0 R
+ /Next 13 0 R
+>>
+endobj
+
+13 0 obj
+<<
+ /Title (Fivth_2)
+ /Parent 11 0 R
+ /Prev 12 0 R
+ /Next 14 0 R
+>>
+endobj
+
+14 0 obj
+<<
+ /Title (Fivth_3)
+ /Parent 11 0 R
+ /Prev 13 0 R
+ /Next 15 0 R
+>>
+endobj
+
+15 0 obj
+<<
+ /Title (Fivth_4)
+ /Parent 11 0 R
+ /Prev 14 0 R
+>>
+endobj
+
+
+
+
+xref
+0000000000 65536 f
+
+trailer
+<<
+ /Size 0
+ /Root 1 0 R
+>>
+startxref
+0
+%%EOF
diff --git a/tests/auto/pdfquick/multipageview/data/multiPageView.qml b/tests/auto/pdfquick/multipageview/data/multiPageView.qml
new file mode 100644
index 000000000..bf88180ce
--- /dev/null
+++ b/tests/auto/pdfquick/multipageview/data/multiPageView.qml
@@ -0,0 +1,8 @@
+import QtQuick
+import QtQuick.Pdf
+
+PdfMultiPageView {
+ width: 480; height: 480
+ property alias source: document.source
+ document: PdfDocument { id: document }
+}
diff --git a/tests/auto/pdfquick/multipageview/data/multiPageViewWithFeedback.qml b/tests/auto/pdfquick/multipageview/data/multiPageViewWithFeedback.qml
new file mode 100644
index 000000000..93a556c97
--- /dev/null
+++ b/tests/auto/pdfquick/multipageview/data/multiPageViewWithFeedback.qml
@@ -0,0 +1,18 @@
+import QtQuick
+import QtQuick.Pdf
+
+PdfMultiPageView {
+ id: view
+ property point hoverPos: hover.point.position
+ width: 640; height: 480
+ document: PdfDocument { }
+
+ // mouse hover feedback for test development
+ Rectangle {
+ width: 200
+ height: hoverPosLabel.implicitHeight + 12
+ color: "beige"
+ Text { id: hoverPosLabel; x: 6; y: 6; text: view.hoverPos.x + ", " + view.hoverPos.y }
+ }
+ HoverHandler { id: hover }
+}
diff --git a/tests/auto/pdfquick/multipageview/data/pdf-sample.protected.pdf b/tests/auto/pdfquick/multipageview/data/pdf-sample.protected.pdf
new file mode 100644
index 000000000..d76fdd1a6
--- /dev/null
+++ b/tests/auto/pdfquick/multipageview/data/pdf-sample.protected.pdf
Binary files differ
diff --git a/tests/auto/pdfquick/multipageview/data/qpdfwriter.pdf b/tests/auto/pdfquick/multipageview/data/qpdfwriter.pdf
new file mode 100644
index 000000000..4abc76f6d
--- /dev/null
+++ b/tests/auto/pdfquick/multipageview/data/qpdfwriter.pdf
Binary files differ
diff --git a/tests/auto/pdfquick/multipageview/tst_multipageview.cpp b/tests/auto/pdfquick/multipageview/tst_multipageview.cpp
new file mode 100644
index 000000000..eb70ebf17
--- /dev/null
+++ b/tests/auto/pdfquick/multipageview/tst_multipageview.cpp
@@ -0,0 +1,357 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include <QSignalSpy>
+#include <QTest>
+#include <QtCore/QLoggingCategory>
+#include <QtGui/QClipboard>
+#include <QtGui/QPointingDevice>
+#include <QtQuick/QQuickView>
+#include <QtPdfQuick/private/qquickpdflinkmodel_p.h>
+#include <QtPdfQuick/private/qquickpdfsearchmodel_p.h>
+#include <QtPdfQuick/private/qquickpdfpageimage_p.h>
+#include "../shared/util.h"
+
+Q_LOGGING_CATEGORY(lcTests, "qt.pdf.tests")
+
+class tst_MultiPageView : public QQuickDataTest
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void internalLink_data();
+ void internalLink();
+ void navigation_data();
+ void navigation();
+ void password();
+ void selectionAndClipboard();
+ void search();
+
+public:
+ enum NavigationAction {
+ Back,
+ Forward,
+ GotoPage,
+ GotoLocation,
+ ClickLink
+ };
+ Q_ENUM(NavigationAction)
+
+ struct NavigationCommand {
+ NavigationAction action;
+ int index;
+ QPointF location;
+ qreal zoom;
+ QPointF expectedContentPos;
+ int expectedCurrentPage;
+ };
+
+private:
+ QScopedPointer<QPointingDevice> touchscreen = QScopedPointer<QPointingDevice>(QTest::createTouchDevice());
+};
+
+void tst_MultiPageView::internalLink_data()
+{
+ QTest::addColumn<int>("linkIndex");
+ QTest::addColumn<int>("expectedPage");
+ QTest::addColumn<qreal>("expectedZoom");
+ QTest::addColumn<QPoint>("expectedScroll");
+
+ QTest::newRow("first link") << 0 << 1 << qreal(1) << QPoint(134, 1276);
+ // TODO fails because it zooms out, and the view leaves gaps between pages currently
+// QTest::newRow("second link") << 1 << 2 << qreal(0.5) << QPoint(0, 717);
+}
+
+void tst_MultiPageView::internalLink()
+{
+ QFETCH(int, linkIndex);
+ QFETCH(int, expectedPage);
+ QFETCH(qreal, expectedZoom);
+ QFETCH(QPoint, expectedScroll);
+
+ QQuickView window;
+ QVERIFY(showView(window, testFileUrl("multiPageView.qml")));
+ QQuickItem *pdfView = window.rootObject();
+ QVERIFY(pdfView);
+ pdfView->setProperty("source", "bookmarksAndLinks.pdf");
+ QTRY_COMPARE(pdfView->property("currentPageRenderingStatus").toInt(), QQuickPdfPageImage::Ready);
+
+ QQuickItem *table = static_cast<QQuickItem *>(findFirstChild(pdfView, "QQuickTableView"));
+ QVERIFY(table);
+ QQuickItem *firstPage = tableViewItemAtCell(table, 0, 0);
+ QVERIFY(firstPage);
+ QQuickPdfLinkModel *linkModel = firstPage->findChild<QQuickPdfLinkModel*>();
+ QVERIFY(linkModel);
+ QQuickItem *repeater = qobject_cast<QQuickItem *>(linkModel->parent());
+ QVERIFY(repeater);
+ QVERIFY(repeater->property("count").toInt() > linkIndex);
+
+ QCOMPARE(pdfView->property("backEnabled").toBool(), false);
+ QCOMPARE(pdfView->property("forwardEnabled").toBool(), false);
+
+ // get the PdfLinkDelegate instance, which has a TapHandler declared inside
+ QQuickItem *linkDelegate = repeaterItemAt(repeater, linkIndex);
+ QVERIFY(linkDelegate);
+ const auto modelIdx = linkModel->index(linkIndex);
+ const int linkPage = linkModel->data(modelIdx, int(QPdfLinkModel::Role::Page)).toInt();
+ QVERIFY(linkPage >= 0);
+ const QPointF linkLocation = linkModel->data(modelIdx, int(QPdfLinkModel::Role::Location)).toPointF();
+ const qreal linkZoom = linkModel->data(modelIdx, int(QPdfLinkModel::Role::Zoom)).toReal();
+
+ // click on it, and check whether it went to the right place
+ const auto point = linkDelegate->position().toPoint() + QPoint(15, 15);
+ QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, point);
+ QTRY_COMPARE(tableViewContentPos(table).y(), expectedScroll.y());
+ const auto linkScrollPos = tableViewContentPos(table);
+ qCDebug(lcTests, "clicked link @ %d, %d and expected scrolling to %d, %d; actually scrolled to %d, %d",
+ point.x(), point.y(), expectedScroll.x(), expectedScroll.y(), linkScrollPos.x(), linkScrollPos.y());
+ QVERIFY(qAbs(linkScrollPos.x() - expectedScroll.x()) < 15);
+ QTRY_COMPARE(pdfView->property("currentPageRenderingStatus").toInt(), QQuickPdfPageImage::Ready);
+ QCOMPARE(pdfView->property("currentPage").toInt(), linkPage);
+ QCOMPARE(linkPage, expectedPage);
+ QCOMPARE(pdfView->property("renderScale").toReal(), linkZoom);
+ QCOMPARE(linkZoom, expectedZoom);
+ qCDebug(lcTests, "link %d goes to page %d location {%lf,%lf} zoom %lf scroll to {%lf,%lf}",
+ linkIndex, linkPage, linkLocation.x(), linkLocation.y(), linkZoom,
+ table->property("contentX").toReal(), table->property("contentY").toReal());
+
+ // check that we can go back to where we came from
+ QCOMPARE(pdfView->property("backEnabled").toBool(), true);
+ QCOMPARE(pdfView->property("forwardEnabled").toBool(), false);
+ QVERIFY(QMetaObject::invokeMethod(pdfView, "back"));
+ QTRY_COMPARE(tableViewContentPos(table), QPoint(0, 0));
+ QCOMPARE(pdfView->property("currentPage").toInt(), 0);
+ QCOMPARE(pdfView->property("renderScale").toReal(), qreal(1));
+
+ // and then forward again
+ QCOMPARE(pdfView->property("backEnabled").toBool(), false);
+ QCOMPARE(pdfView->property("forwardEnabled").toBool(), true);
+ QVERIFY(QMetaObject::invokeMethod(pdfView, "forward"));
+ QTRY_COMPARE(tableViewContentPos(table), linkScrollPos);
+ QCOMPARE(pdfView->property("currentPage").toInt(), linkPage);
+ QCOMPARE(pdfView->property("renderScale").toReal(), linkZoom);
+}
+
+void tst_MultiPageView::navigation_data()
+{
+ QTest::addColumn<QList<NavigationCommand>>("actions");
+ const int totalPageSpacing = 832; // 826 points + 6 px (rowSpacing)
+
+ QList<NavigationCommand> actions;
+ actions << NavigationCommand {NavigationAction::GotoPage, 2, {}, 0, {0, 1664}, 2}
+ << NavigationCommand {NavigationAction::GotoPage, 3, {}, 0, {0, 2496}, 3}
+ << NavigationCommand {NavigationAction::Back, 0, {}, 0, {0, 1664}, 2}
+ << NavigationCommand {NavigationAction::Back, 0, {}, 0, {0, 0}, 0};
+ QTest::newRow("goto and back") << actions;
+
+ actions.clear();
+ actions // first link is "More..." going to page 0, location 8, 740
+ << NavigationCommand {NavigationAction::ClickLink, 0, {465, 65}, 0, {0, 740}, 0}
+ << NavigationCommand {NavigationAction::Back, 0, {}, 0, {0, 0}, 0}
+ // link "setPdfVersion()" going to page 3, location 8, 295
+ << NavigationCommand {NavigationAction::ClickLink, 0, {255, 455}, 0, {0, totalPageSpacing * 3 + 295}, 3}
+ << NavigationCommand {NavigationAction::Back, 0, {}, 0, {0, 0}, 0};
+ QTest::newRow("click links and go back, twice") << actions;
+
+ actions.clear();
+ actions // first link is "More..." going to page 0, location 8, 740
+ << NavigationCommand {NavigationAction::ClickLink, 0, {465, 65}, 0, {0, 740}, 0}
+ // link "newPage()" going to page 1, location 8, 290
+ << NavigationCommand {NavigationAction::ClickLink, 0, {480, 40}, 0, {0, totalPageSpacing + 290}, 1} // fails, goes back to page 0
+ << NavigationCommand {NavigationAction::Back, 0, {}, 0, {8, 740}, 0}
+ << NavigationCommand {NavigationAction::Back, 0, {}, 0, {0, 0}, 0};
+ QTest::newRow("click two links in series and then go back") << actions;
+}
+
+void tst_MultiPageView::navigation()
+{
+ QFETCH(QList<NavigationCommand>, actions);
+
+ QQuickView window;
+ window.setColor(Qt::gray);
+ window.setSource(testFileUrl("multiPageViewWithFeedback.qml"));
+ QTRY_COMPARE(window.status(), QQuickView::Ready);
+ QQuickItem *pdfView = window.rootObject();
+ QVERIFY(pdfView);
+ QObject *doc = pdfView->property("document").value<QObject *>();
+ QVERIFY(doc);
+ doc->setProperty("source", testFileUrl("qpdfwriter.pdf"));
+ QQuickItem *table = static_cast<QQuickItem *>(findFirstChild(pdfView, "QQuickTableView"));
+ QVERIFY(table);
+ // Expect that contentY == destination y after a jump, for ease of comparison.
+ // 0.01 is close enough to 0 that we can compare int positions accurately,
+ // but nonzero so that QRectF::isValid() is true in tableView.positionViewAtCell()
+ table->setProperty("jumpLocationMargin", QPointF(0.01, 0.01));
+
+ window.show();
+ window.requestActivate();
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
+
+ QTRY_COMPARE(table->property("contentHeight").toInt(), 3322);
+ QCOMPARE(table->property("contentY").toInt(), 0);
+
+ for (const NavigationCommand &nav : actions) {
+ switch (nav.action) {
+ case NavigationAction::Back:
+ QVERIFY(QMetaObject::invokeMethod(pdfView, "back"));
+ QCOMPARE(pdfView->property("forwardEnabled").toBool(), true);
+ break;
+ case NavigationAction::Forward:
+ QVERIFY(QMetaObject::invokeMethod(pdfView, "forward"));
+ QCOMPARE(pdfView->property("backEnabled").toBool(), true);
+ break;
+ case NavigationAction::GotoPage:
+ QVERIFY(QMetaObject::invokeMethod(pdfView, "goToPage",
+ Q_ARG(QVariant, QVariant(nav.index))));
+ QCOMPARE(pdfView->property("backEnabled").toBool(), true);
+ break;
+ case NavigationAction::GotoLocation:
+ QVERIFY(QMetaObject::invokeMethod(pdfView, "goToLocation",
+ Q_ARG(QVariant, QVariant(nav.index)),
+ Q_ARG(QVariant, QVariant(nav.location)),
+ Q_ARG(QVariant, QVariant(nav.zoom)) ));
+ break;
+ case NavigationAction::ClickLink:
+ // Link delegates don't exist until page rendering is done
+ QTRY_VERIFY(pdfView->property("currentPageRenderingStatus").toInt() == 1); // QQuickImage::Status::Ready
+ QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, nav.location.toPoint());
+ // Wait for the destination page to be rendered
+ QTRY_VERIFY(pdfView->property("currentPageRenderingStatus").toInt() == 1); // QQuickImage::Status::Ready
+ break;
+ }
+ qCDebug(lcTests) << "action" << nav.action << "index" << nav.index
+ << "contentX,Y" << table->property("contentX").toInt() << table->property("contentY").toInt()
+ << "expected" << nav.expectedContentPos;
+ QTRY_COMPARE(table->property("contentY").toInt(), nav.expectedContentPos.y());
+ // some minor side-to-side scrolling happens, in practice
+ QVERIFY(qAbs(table->property("contentX").toInt() - nav.expectedContentPos.x()) < 10);
+ QCOMPARE(pdfView->property("currentPage").toInt(), nav.expectedCurrentPage);
+ }
+
+ QCOMPARE(pdfView->property("backEnabled").toBool(), false);
+}
+
+void tst_MultiPageView::password()
+{
+ QQuickView window;
+ QVERIFY(showView(window, testFileUrl("multiPageView.qml")));
+ QQuickItem *pdfView = window.rootObject();
+ QVERIFY(pdfView);
+ QQuickPdfDocument *doc = pdfView->property("document").value<QQuickPdfDocument*>();
+ QVERIFY(doc);
+ QPdfDocument *cppDoc = static_cast<QPdfDocument *>(qmlExtendedObject(doc));
+ QVERIFY(cppDoc);
+ QSignalSpy passwordRequiredSpy(doc, SIGNAL(passwordRequired()));
+ // actually QPdfDocument::passwordRequired, but QML_EXTENDED gives us this signal virtually in QQuickPdfDocument
+ QVERIFY(passwordRequiredSpy.isValid());
+ QSignalSpy passwordChangedSpy(doc, SIGNAL(passwordChanged()));
+ // actually QPdfDocument::passwordChanged, but QML_EXTENDED gives us this signal virtually in QQuickPdfDocument
+ QVERIFY(passwordChangedSpy.isValid());
+ QSignalSpy statusChangedSpy(doc, SIGNAL(statusChanged(QPdfDocument::Status)));
+ // actually QPdfDocument::statusChanged, but QML_EXTENDED gives us this signal virtually in QQuickPdfDocument
+ QVERIFY(statusChangedSpy.isValid());
+ QSignalSpy pageCountChangedSpy(doc, SIGNAL(pageCountChanged(int)));
+ // QPdfDocument::pageCountChanged(int), but QML_EXTENDED gives us this signal virtually in QQuickPdfDocument
+ QVERIFY(pageCountChangedSpy.isValid());
+ QSignalSpy extPageCountChangedSpy(cppDoc, &QPdfDocument::pageCountChanged);
+ // actual QPdfDocument::pageCountChanged(int), for comparison with the illusory QQuickPdfDocument::pageCountChanged
+ QVERIFY(extPageCountChangedSpy.isValid());
+
+ QVERIFY(pdfView->setProperty("source", u"pdf-sample.protected.pdf"_qs));
+
+ QTRY_COMPARE(passwordRequiredSpy.count(), 1);
+ qCDebug(lcTests) << "error while awaiting password" << doc->error()
+ << "passwordRequired count" << passwordRequiredSpy.count()
+ << "statusChanged count" << statusChangedSpy.count();
+ QCOMPARE(doc->property("status").toInt(), int(QPdfDocument::Status::Error));
+ QCOMPARE(pageCountChangedSpy.count(), 0);
+ QCOMPARE(extPageCountChangedSpy.count(), 0);
+ QCOMPARE(statusChangedSpy.count(), 2); // Loading and then Error
+ statusChangedSpy.clear();
+ QVERIFY(doc->setProperty("password", u"Qt"_qs));
+ QCOMPARE(passwordChangedSpy.count(), 1);
+ QTRY_COMPARE(doc->property("status").toInt(), int(QPdfDocument::Status::Ready));
+ qCDebug(lcTests) << "after setPassword" << doc->error()
+ << "passwordChanged count" << passwordChangedSpy.count()
+ << "statusChanged count" << statusChangedSpy.count()
+ << "pageCountChanged count" << pageCountChangedSpy.count();
+ QCOMPARE(statusChangedSpy.count(), 2); // Loading and then Ready
+ QCOMPARE(pageCountChangedSpy.count(), 1);
+ QCOMPARE(extPageCountChangedSpy.count(), pageCountChangedSpy.count());
+}
+
+void tst_MultiPageView::selectionAndClipboard()
+{
+ QQuickView window;
+ QVERIFY(showView(window, testFileUrl("multiPageView.qml")));
+ QQuickItem *pdfView = window.rootObject();
+ QVERIFY(pdfView);
+ QQuickPdfDocument *doc = pdfView->property("document").value<QQuickPdfDocument*>();
+ QVERIFY(doc);
+ QVERIFY(doc->setProperty("password", u"Qt"_qs));
+ QVERIFY(pdfView->setProperty("source", u"pdf-sample.protected.pdf"_qs));
+ QTRY_COMPARE(pdfView->property("currentPageRenderingStatus").toInt(), QQuickPdfPageImage::Ready);
+
+ QVERIFY(QMetaObject::invokeMethod(pdfView, "selectAll"));
+ QString sel = pdfView->property("selectedText").toString();
+ QCOMPARE(sel.length(), 1073);
+
+#if QT_CONFIG(clipboard)
+ QClipboard *clip = qApp->clipboard();
+ if (clip->supportsSelection())
+ QCOMPARE(clip->text(QClipboard::Selection), sel);
+ QVERIFY(QMetaObject::invokeMethod(pdfView, "copySelectionToClipboard"));
+ QCOMPARE(clip->text(QClipboard::Clipboard), sel);
+#endif // clipboard
+}
+
+void tst_MultiPageView::search()
+{
+ QQuickView window;
+ QVERIFY(showView(window, testFileUrl("multiPageView.qml")));
+ window.setResizeMode(QQuickView::SizeRootObjectToView);
+ window.resize(200, 200);
+ QQuickItem *pdfView = window.rootObject();
+ QVERIFY(pdfView);
+ QTRY_COMPARE(pdfView->width(), 200);
+ QQuickPdfDocument *doc = pdfView->property("document").value<QQuickPdfDocument*>();
+ QVERIFY(doc);
+ QVERIFY(doc->setProperty("password", u"Qt"_qs));
+ QVERIFY(pdfView->setProperty("source", u"pdf-sample.protected.pdf"_qs));
+ QTRY_COMPARE(pdfView->property("currentPageRenderingStatus").toInt(), QQuickPdfPageImage::Ready);
+ QPdfSearchModel *searchModel = pdfView->property("searchModel").value<QPdfSearchModel*>();
+ QVERIFY(searchModel);
+ QQuickItem *table = static_cast<QQuickItem *>(findFirstChild(pdfView, "QQuickTableView"));
+ QVERIFY(table);
+ QQuickItem *firstPage = tableViewItemAtCell(table, 0, 0);
+ QVERIFY(firstPage);
+ QObject *multiline = findFirstChild(firstPage, "QQuickPathMultiline");
+ QVERIFY(multiline);
+
+ pdfView->setProperty("searchString", u"PDF"_qs);
+ QTRY_COMPARE(searchModel->rowCount(QModelIndex()), 7); // occurrences of the word "PDF" in this file
+ const int count = searchModel->rowCount(QModelIndex());
+ QList<QList<QPointF>> resultOutlines = multiline->property("paths").value<QList<QList<QPointF>>>();
+ QCOMPARE(resultOutlines.count(), 7);
+ QPoint contentPos = tableViewContentPos(table);
+ int movements = 0;
+ for (int i = 0; i < count; ++i) {
+ // only one page, so IndexOnPage data is the same as overall index
+ QCOMPARE(i, searchModel->data(searchModel->index(i), int(QPdfSearchModel::Role::IndexOnPage)).toInt());
+ QCOMPARE(resultOutlines.at(i).count(), 5); // 5-point polygon is a rectangle (including drawing back to the start, to close it)
+ QCOMPARE(resultOutlines.at(i).first(), searchModel->data(searchModel->index(i), int(QPdfSearchModel::Role::Location)).toPointF());
+
+ QVERIFY(QMetaObject::invokeMethod(pdfView, "searchForward"));
+ QTest::qWait(500); // animation time; but it doesn't always need to move
+ // TODO maybe: if movement starts, wait for it to stop somehow?
+ qCDebug(lcTests) << i << resultOutlines.at(i) << "scrolled to" << tableViewContentPos(table);
+ if (tableViewContentPos(table) != contentPos)
+ ++movements;
+ contentPos = tableViewContentPos(table);
+ }
+ qCDebug(lcTests) << "total movements" << movements;
+ QVERIFY(movements > 4);
+}
+
+QTEST_MAIN(tst_MultiPageView)
+#include "tst_multipageview.moc"
diff --git a/tests/auto/pdfquick/shared/util.cpp b/tests/auto/pdfquick/shared/util.cpp
new file mode 100644
index 000000000..c540ebfa6
--- /dev/null
+++ b/tests/auto/pdfquick/shared/util.cpp
@@ -0,0 +1,110 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "util.h"
+#include <QtQuick/QQuickItem>
+
+QQuickDataTest::QQuickDataTest() :
+ m_initialized(false),
+#ifdef QT_TESTCASE_BUILDDIR
+ m_dataDirectory(QTest::qFindTestData("data", QT_QMLTEST_DATADIR, 0, QT_TESTCASE_BUILDDIR)),
+#else
+ m_dataDirectory(QTest::qFindTestData("data", QT_QMLTEST_DATADIR, 0)),
+#endif
+
+ m_dataDirectoryUrl(m_dataDirectory.startsWith(QLatin1Char(':'))
+ ? QUrl(QLatin1String("qrc") + m_dataDirectory)
+ : QUrl::fromLocalFile(m_dataDirectory + QLatin1Char('/')))
+{
+}
+
+QQuickDataTest::~QQuickDataTest()
+{
+}
+
+void QQuickDataTest::initTestCase()
+{
+ QVERIFY2(!m_dataDirectory.isEmpty(), "'data' directory not found");
+ m_directory = QFileInfo(m_dataDirectory).absolutePath();
+ if (m_dataDirectoryUrl.scheme() != QLatin1String("qrc"))
+ QVERIFY2(QDir::setCurrent(m_directory), qPrintable(QLatin1String("Could not chdir to ") + m_directory));
+
+ if (QGuiApplication::platformName() == QLatin1String("offscreen")
+ || QGuiApplication::platformName() == QLatin1String("minimal"))
+ {
+ QSKIP("Skipping visual tests due to running with offscreen/minimal");
+ }
+
+ m_initialized = true;
+}
+
+void QQuickDataTest::cleanupTestCase()
+{
+ m_initialized = false;
+}
+
+QString QQuickDataTest::testFile(const QString &fileName) const
+{
+ if (m_directory.isEmpty())
+ qFatal("QQuickDataTest::initTestCase() not called.");
+ QString result = m_dataDirectory;
+ result += QLatin1Char('/');
+ result += fileName;
+ return result;
+}
+
+QObject *QQuickDataTest::findFirstChild(QObject *parent, const char *className)
+{
+ const auto children = parent->findChildren<QObject*>();
+ for (QObject *child : children) {
+ if (child->inherits(className))
+ return child;
+ }
+ return nullptr;
+}
+
+bool QQuickDataTest::showView(QQuickView &view, const QUrl &url)
+{
+ view.setSource(url);
+ while (view.status() == QQuickView::Loading)
+ QTest::qWait(10);
+ if (view.status() != QQuickView::Ready)
+ return false;
+ const QRect screenGeometry = view.screen()->availableGeometry();
+ const QSize size = view.size();
+ const QPoint offset = QPoint(size.width() / 2, size.height() / 2);
+ view.setFramePosition(screenGeometry.center() - offset);
+#if QT_CONFIG(cursor) // Get the cursor out of the way.
+ QCursor::setPos(view.geometry().topRight() + QPoint(100, 100));
+#endif
+ view.show();
+ if (!QTest::qWaitForWindowExposed(&view))
+ return false;
+ if (!view.rootObject())
+ return false;
+ return true;
+}
+
+QQuickItem *QQuickDataTest::repeaterItemAt(QQuickItem *repeater, int i)
+{
+ static const QMetaMethod itemAtMethod = repeater->metaObject()->method(
+ repeater->metaObject()->indexOfMethod("itemAt(int)"));
+ QQuickItem *ret = nullptr;
+ itemAtMethod.invoke(repeater, Qt::DirectConnection, Q_RETURN_ARG(QQuickItem*, ret), Q_ARG(int, i));
+ return ret;
+}
+
+QQuickItem *QQuickDataTest::tableViewItemAtCell(QQuickItem *table, int col, int row)
+{
+ static const QMetaMethod itemAtCellMethod = table->metaObject()->method(
+ table->metaObject()->indexOfMethod("itemAtCell(int,int)"));
+ QQuickItem *ret = nullptr;
+ itemAtCellMethod.invoke(table, Qt::DirectConnection,
+ Q_RETURN_ARG(QQuickItem*, ret), Q_ARG(int, col), Q_ARG(int, row));
+ return ret;
+}
+
+QPoint QQuickDataTest::tableViewContentPos(QQuickItem *table)
+{
+ return QPoint(table->property("contentX").toInt(), table->property("contentY").toInt());
+}
diff --git a/tests/auto/pdfquick/shared/util.h b/tests/auto/pdfquick/shared/util.h
new file mode 100644
index 000000000..9ceb711af
--- /dev/null
+++ b/tests/auto/pdfquick/shared/util.h
@@ -0,0 +1,58 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QUICK_VISUAL_TEST_UTIL_H
+#define QUICK_VISUAL_TEST_UTIL_H
+
+#include <QtCore/QUrl>
+#include <QtQuick/QQuickView>
+#include <QtTest/QTest>
+
+/*! \internal
+ Base class for tests with data that are located in a "data" subfolder.
+*/
+class QQuickDataTest : public QObject
+{
+ Q_OBJECT
+public:
+ QQuickDataTest();
+ ~QQuickDataTest();
+
+ bool initialized() const { return m_initialized; }
+
+ bool showView(QQuickView &view, const QUrl &url);
+
+ QString testFile(const QString &fileName) const;
+ inline QString testFile(const char *fileName) const
+ { return testFile(QLatin1String(fileName)); }
+ inline QUrl testFileUrl(const QString &fileName) const
+ {
+ const QString fn = testFile(fileName);
+ return fn.startsWith(QLatin1Char(':'))
+ ? QUrl(QLatin1String("qrc") + fn)
+ : QUrl::fromLocalFile(fn);
+ }
+ inline QUrl testFileUrl(const char *fileName) const
+ { return testFileUrl(QLatin1String(fileName)); }
+
+ inline QString dataDirectory() const { return m_dataDirectory; }
+ inline QUrl dataDirectoryUrl() const { return m_dataDirectoryUrl; }
+ inline QString directory() const { return m_directory; }
+
+ QObject *findFirstChild(QObject *parent, const char *className);
+ QQuickItem *repeaterItemAt(QQuickItem *repeater, int i);
+ QQuickItem *tableViewItemAtCell(QQuickItem *table, int col, int row);
+ QPoint tableViewContentPos(QQuickItem *table);
+
+public slots:
+ virtual void initTestCase();
+ virtual void cleanupTestCase();
+
+private:
+ bool m_initialized;
+ QString m_dataDirectory;
+ QUrl m_dataDirectoryUrl;
+ QString m_directory;
+};
+
+#endif
diff --git a/tests/auto/quick/CMakeLists.txt b/tests/auto/quick/CMakeLists.txt
index d44d67d38..d2cf7c3b3 100644
--- a/tests/auto/quick/CMakeLists.txt
+++ b/tests/auto/quick/CMakeLists.txt
@@ -1,8 +1,14 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
add_subdirectory(dialogs)
add_subdirectory(publicapi)
add_subdirectory(qquickwebenginedefaultsurfaceformat)
add_subdirectory(qtbug-70248)
-add_subdirectory(uidelegates)
+# Re-enable if QTBUG-101744 and QTBUG-103354 have been fixed.
+if(NOT MACOS)
+ add_subdirectory(uidelegates)
+endif()
add_subdirectory(inspectorserver)
add_subdirectory(qmltests)
add_subdirectory(qquickwebengineview)
diff --git a/tests/auto/quick/dialogs/CMakeLists.txt b/tests/auto/quick/dialogs/CMakeLists.txt
index b7f088f0d..4d8dc853b 100644
--- a/tests/auto/quick/dialogs/CMakeLists.txt
+++ b/tests/auto/quick/dialogs/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
include(../../httpserver/httpserver.cmake)
include(../../util/util.cmake)
diff --git a/tests/auto/quick/inspectorserver/CMakeLists.txt b/tests/auto/quick/inspectorserver/CMakeLists.txt
index e2c3bb2ab..d890581b8 100644
--- a/tests/auto/quick/inspectorserver/CMakeLists.txt
+++ b/tests/auto/quick/inspectorserver/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
qt_internal_add_test(tst_inspectorserver
SOURCES
tst_inspectorserver.cpp
diff --git a/tests/auto/quick/inspectorserver/tst_inspectorserver.cpp b/tests/auto/quick/inspectorserver/tst_inspectorserver.cpp
index 6c22c5d33..58e8f7d11 100644
--- a/tests/auto/quick/inspectorserver/tst_inspectorserver.cpp
+++ b/tests/auto/quick/inspectorserver/tst_inspectorserver.cpp
@@ -136,7 +136,7 @@ void tst_InspectorServer::testRemoteDebuggingMessage()
.arg(pageList.at(0).toObject().value("webSocketDebuggerUrl").toString())
.arg(jsExpression));
- QTRY_COMPARE(webSocketQueryWebView->title(), jsExpressionResult);
+ QTRY_COMPARE_WITH_TIMEOUT(webSocketQueryWebView->title(), jsExpressionResult, 10000);
}
void tst_InspectorServer::openRemoteDebuggingSession()
@@ -160,7 +160,7 @@ void tst_InspectorServer::openRemoteDebuggingSession()
// - The page list didn't return a valid inspector URL
// - Or the front-end couldn't be loaded through the inspector HTTP server
// - Or the web socket connection couldn't be established between the front-end and the page through the inspector server
- QTRY_VERIFY_WITH_TIMEOUT(inspectorWebView->title().startsWith("DevTools -"), 30000);
+ QTRY_VERIFY_WITH_TIMEOUT(inspectorWebView->title().startsWith("DevTools -"), 60000);
}
QTEST_MAIN(tst_InspectorServer)
diff --git a/tests/auto/quick/publicapi/CMakeLists.txt b/tests/auto/quick/publicapi/CMakeLists.txt
index 4fa18e0b3..e345a076a 100644
--- a/tests/auto/quick/publicapi/CMakeLists.txt
+++ b/tests/auto/quick/publicapi/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
qt_internal_add_test(tst_publicapi
SOURCES
tst_publicapi.cpp
diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp
index 75c7cd4f7..bd8c331ac 100644
--- a/tests/auto/quick/publicapi/tst_publicapi.cpp
+++ b/tests/auto/quick/publicapi/tst_publicapi.cpp
@@ -363,6 +363,8 @@ static const QStringList expectedAPI = QStringList()
<< "QQuickWebEngineProfile.persistentCookiesPolicyChanged() --> void"
<< "QQuickWebEngineProfile.persistentStoragePath --> QString"
<< "QQuickWebEngineProfile.persistentStoragePathChanged() --> void"
+ << "QQuickWebEngineProfile.pushServiceEndpoint --> QUrl"
+ << "QQuickWebEngineProfile.pushServiceEndpointChanged() --> void"
<< "QQuickWebEngineProfile.spellCheckEnabled --> bool"
<< "QQuickWebEngineProfile.spellCheckEnabledChanged() --> void"
<< "QQuickWebEngineProfile.spellCheckLanguages --> QStringList"
diff --git a/tests/auto/quick/qmltests/BLACKLIST b/tests/auto/quick/qmltests/BLACKLIST
index 2f8fa5e66..36c737693 100644
--- a/tests/auto/quick/qmltests/BLACKLIST
+++ b/tests/auto/quick/qmltests/BLACKLIST
@@ -9,3 +9,9 @@ macos
[CertificateError::test_error]
*
+
+[WebViewFindText::test_findTextInterruptedByLoad]
+b2qt arm 64bit
+
+[WebEngineViewLoadUrl::test_loadStartedAfterInPageNavigation]
+b2qt
diff --git a/tests/auto/quick/qmltests/CMakeLists.txt b/tests/auto/quick/qmltests/CMakeLists.txt
index 53c8ed231..6f41b3e6d 100644
--- a/tests/auto/quick/qmltests/CMakeLists.txt
+++ b/tests/auto/quick/qmltests/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
include(../../httpserver/httpserver.cmake)
include(../../util/util.cmake)
diff --git a/tests/auto/quick/qmltests/data/TestWebEngineView.qml b/tests/auto/quick/qmltests/data/TestWebEngineView.qml
index 7f8c271d0..415985471 100644
--- a/tests/auto/quick/qmltests/data/TestWebEngineView.qml
+++ b/tests/auto/quick/qmltests/data/TestWebEngineView.qml
@@ -40,7 +40,7 @@ WebEngineView {
}
function _waitFor(predicate, timeout) {
if (timeout === undefined)
- timeout = 12000;
+ timeout = 30000;
var i = 0
while (i < timeout && !predicate()) {
testResult.wait(50)
diff --git a/tests/auto/quick/qmltests/data/tst_datalist.qml b/tests/auto/quick/qmltests/data/tst_datalist.qml
index 66cc49b0c..f739639b2 100644
--- a/tests/auto/quick/qmltests/data/tst_datalist.qml
+++ b/tests/auto/quick/qmltests/data/tst_datalist.qml
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2022 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick
import QtQuick.Controls
diff --git a/tests/auto/quick/qmltests/data/tst_newViewRequest.qml b/tests/auto/quick/qmltests/data/tst_newViewRequest.qml
index 6d4bdbb41..a47862565 100644
--- a/tests/auto/quick/qmltests/data/tst_newViewRequest.qml
+++ b/tests/auto/quick/qmltests/data/tst_newViewRequest.qml
@@ -98,7 +98,7 @@ TestWebEngineView {
if (viewType === "dialog") {
tryVerify(dialog.webEngineView.loadSucceeded)
- compare(dialog.webEngineView.url, Qt.url("about:blank"));
+ compare(dialog.webEngineView.url, "");
dialog.destroy();
}
// https://chromium-review.googlesource.com/c/chromium/src/+/1300395
diff --git a/tests/auto/quick/qmltests/data/tst_runJavaScript.qml b/tests/auto/quick/qmltests/data/tst_runJavaScript.qml
index 22e427ad4..f16cd9c41 100644
--- a/tests/auto/quick/qmltests/data/tst_runJavaScript.qml
+++ b/tests/auto/quick/qmltests/data/tst_runJavaScript.qml
@@ -34,8 +34,7 @@ TestWebEngineView {
compare(result, testTitle2);
callbackCalled = true;
});
- wait(100);
- verify(callbackCalled);
+ tryVerify(function() { return callbackCalled; });
}
}
}
diff --git a/tests/auto/quick/qmltests/data/tst_viewSource.qml b/tests/auto/quick/qmltests/data/tst_viewSource.qml
index 44a88daab..d4449f7de 100644
--- a/tests/auto/quick/qmltests/data/tst_viewSource.qml
+++ b/tests/auto/quick/qmltests/data/tst_viewSource.qml
@@ -122,7 +122,7 @@ TestWebEngineView {
WebEngine.settings.errorPageEnabled = true
webEngineView.url = row.userInputUrl;
- tryCompare(loadSpy, 'count', 2);
+ tryCompare(loadSpy, 'count', 2, 12000);
let load = loadSpy.signalArguments[1][0]
let expectedStatus = row.loadSucceed ? WebEngineView.LoadSucceededStatus : WebEngineView.LoadFailedStatus
compare(load.status, expectedStatus);
diff --git a/tests/auto/quick/qquickwebenginedefaultsurfaceformat/CMakeLists.txt b/tests/auto/quick/qquickwebenginedefaultsurfaceformat/CMakeLists.txt
index 07b184b89..9856ed513 100644
--- a/tests/auto/quick/qquickwebenginedefaultsurfaceformat/CMakeLists.txt
+++ b/tests/auto/quick/qquickwebenginedefaultsurfaceformat/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
include(../../util/util.cmake)
qt_internal_add_test(tst_qquickwebenginedefaultsurfaceformat
diff --git a/tests/auto/quick/qquickwebengineview/CMakeLists.txt b/tests/auto/quick/qquickwebengineview/CMakeLists.txt
index b0488048f..307ea36c9 100644
--- a/tests/auto/quick/qquickwebengineview/CMakeLists.txt
+++ b/tests/auto/quick/qquickwebengineview/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
include(../../util/util.cmake)
qt_internal_add_test(tst_qquickwebengineview
diff --git a/tests/auto/quick/qquickwebengineviewgraphics/CMakeLists.txt b/tests/auto/quick/qquickwebengineviewgraphics/CMakeLists.txt
index 6bc0bc866..f22408d15 100644
--- a/tests/auto/quick/qquickwebengineviewgraphics/CMakeLists.txt
+++ b/tests/auto/quick/qquickwebengineviewgraphics/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
include(../../util/util.cmake)
qt_internal_add_test(tst_qquickwebengineviewgraphics
SOURCES
diff --git a/tests/auto/quick/qtbug-70248/CMakeLists.txt b/tests/auto/quick/qtbug-70248/CMakeLists.txt
index b1df50211..b177c5309 100644
--- a/tests/auto/quick/qtbug-70248/CMakeLists.txt
+++ b/tests/auto/quick/qtbug-70248/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
qt_internal_add_test(tst_qtbug-70248
SOURCES
tst_qtbug-70248.cpp
diff --git a/tests/auto/quick/uidelegates/CMakeLists.txt b/tests/auto/quick/uidelegates/CMakeLists.txt
index d8699ccfc..bdf041e04 100644
--- a/tests/auto/quick/uidelegates/CMakeLists.txt
+++ b/tests/auto/quick/uidelegates/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
include(../../httpserver/httpserver.cmake)
include(../../util/util.cmake)
diff --git a/tests/auto/util/CMakeLists.txt b/tests/auto/util/CMakeLists.txt
index fa2f84cec..0af0e5032 100644
--- a/tests/auto/util/CMakeLists.txt
+++ b/tests/auto/util/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
cmake_minimum_required(VERSION 3.18)
project(minimal LANGUAGES CXX)
diff --git a/tests/auto/util/util.cmake b/tests/auto/util/util.cmake
index 84d7f593f..e5142d0b2 100644
--- a/tests/auto/util/util.cmake
+++ b/tests/auto/util/util.cmake
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
if (NOT TARGET Test::Util)
add_library(qtestutil INTERFACE)
target_include_directories(qtestutil INTERFACE ${CMAKE_CURRENT_LIST_DIR})
diff --git a/tests/auto/widgets/CMakeLists.txt b/tests/auto/widgets/CMakeLists.txt
index bedb00f53..34d165c94 100644
--- a/tests/auto/widgets/CMakeLists.txt
+++ b/tests/auto/widgets/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
add_subdirectory(defaultsurfaceformat)
add_subdirectory(qwebenginepage)
add_subdirectory(qwebengineprofile)
diff --git a/tests/auto/widgets/accessibility/CMakeLists.txt b/tests/auto/widgets/accessibility/CMakeLists.txt
index bd04bddd0..4c0bb17ee 100644
--- a/tests/auto/widgets/accessibility/CMakeLists.txt
+++ b/tests/auto/widgets/accessibility/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
include(../../util/util.cmake)
qt_internal_add_test(tst_webengine_accessibility
diff --git a/tests/auto/widgets/accessibility/tst_accessibility.cpp b/tests/auto/widgets/accessibility/tst_accessibility.cpp
index be1257b82..5bb4e822b 100644
--- a/tests/auto/widgets/accessibility/tst_accessibility.cpp
+++ b/tests/auto/widgets/accessibility/tst_accessibility.cpp
@@ -529,10 +529,10 @@ void tst_Accessibility::roles()
QFETCH(QAccessible::Role, role);
QWebEngineView webView;
+ QSignalSpy spyFinished(&webView, &QWebEngineView::loadFinished);
webView.setHtml("<html><body>" + html + "</body></html>");
webView.show();
- QSignalSpy spyFinished(&webView, &QWebEngineView::loadFinished);
- QVERIFY(spyFinished.wait());
+ QTRY_COMPARE_WITH_TIMEOUT(spyFinished.count(), 1, 20000);
QAccessibleInterface *view = QAccessible::queryAccessibleInterface(&webView);
@@ -542,7 +542,7 @@ void tst_Accessibility::roles()
return;
}
- QTRY_COMPARE(view->child(0)->childCount(), 1);
+ QTRY_COMPARE_WITH_TIMEOUT(view->child(0)->childCount(), 1, 20000);
QAccessibleInterface *document = view->child(0);
QAccessibleInterface *element = document->child(0);
diff --git a/tests/auto/widgets/defaultsurfaceformat/CMakeLists.txt b/tests/auto/widgets/defaultsurfaceformat/CMakeLists.txt
index 6dd05f58f..d95c1355b 100644
--- a/tests/auto/widgets/defaultsurfaceformat/CMakeLists.txt
+++ b/tests/auto/widgets/defaultsurfaceformat/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
include(../../util/util.cmake)
qt_internal_add_test(tst_defaultsurfaceformat
diff --git a/tests/auto/widgets/favicon/CMakeLists.txt b/tests/auto/widgets/favicon/CMakeLists.txt
index 3a2f6f255..0deae6a37 100644
--- a/tests/auto/widgets/favicon/CMakeLists.txt
+++ b/tests/auto/widgets/favicon/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
include(../../util/util.cmake)
qt_internal_add_test(tst_favicon
diff --git a/tests/auto/widgets/loadsignals/CMakeLists.txt b/tests/auto/widgets/loadsignals/CMakeLists.txt
index 5de957148..bbd0387d9 100644
--- a/tests/auto/widgets/loadsignals/CMakeLists.txt
+++ b/tests/auto/widgets/loadsignals/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
include(../../httpserver/httpserver.cmake)
include(../../util/util.cmake)
diff --git a/tests/auto/widgets/loadsignals/tst_loadsignals.cpp b/tests/auto/widgets/loadsignals/tst_loadsignals.cpp
index 28dd5f938..9f196972d 100644
--- a/tests/auto/widgets/loadsignals/tst_loadsignals.cpp
+++ b/tests/auto/widgets/loadsignals/tst_loadsignals.cpp
@@ -277,7 +277,7 @@ void tst_LoadSignals::monotonicity()
QVERIFY(server.start());
view.load(server.url("/loadprogress/main.html"));
- QTRY_COMPARE(loadFinishedSpy.size(), 1);
+ QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.size(), 1, 10000);
QVERIFY(loadFinishedSpy[0][0].toBool());
QVERIFY(page.loadProgress.size() >= 3);
diff --git a/tests/auto/widgets/offscreen/CMakeLists.txt b/tests/auto/widgets/offscreen/CMakeLists.txt
index d51459a3e..756e53c43 100644
--- a/tests/auto/widgets/offscreen/CMakeLists.txt
+++ b/tests/auto/widgets/offscreen/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
qt_internal_add_test(tst_offscreen
SOURCES
tst_offscreen.cpp
diff --git a/tests/auto/widgets/printing/CMakeLists.txt b/tests/auto/widgets/printing/CMakeLists.txt
index 9e14fd752..baa3cf747 100644
--- a/tests/auto/widgets/printing/CMakeLists.txt
+++ b/tests/auto/widgets/printing/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
include(../../util/util.cmake)
find_package(PkgConfig)
@@ -8,10 +11,9 @@ endif()
qt_internal_add_test(tst_printing
SOURCES
tst_printing.cpp
- PUBLIC_LIBRARIES
- Qt::WebEngineWidgets
LIBRARIES
Qt::CorePrivate
+ Qt::WebEngineWidgets
Qt::WebEngineCorePrivate
Test::Util
)
diff --git a/tests/auto/widgets/proxy/CMakeLists.txt b/tests/auto/widgets/proxy/CMakeLists.txt
index 03af3c35f..95dc903ed 100644
--- a/tests/auto/widgets/proxy/CMakeLists.txt
+++ b/tests/auto/widgets/proxy/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
include(../../httpserver/httpserver.cmake)
qt_internal_add_test(tst_webengine_proxy
diff --git a/tests/auto/widgets/proxypac/CMakeLists.txt b/tests/auto/widgets/proxypac/CMakeLists.txt
index 1dd2c8bec..f27160cb6 100644
--- a/tests/auto/widgets/proxypac/CMakeLists.txt
+++ b/tests/auto/widgets/proxypac/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
include(../../httpserver/httpserver.cmake)
qt_internal_add_test(tst_proxypac_file
@@ -21,6 +24,22 @@ set_tests_properties(tst_proxypac_file PROPERTIES
ENVIRONMENT QTWEBENGINE_CHROMIUM_FLAGS=${fileEnvArg}
)
+if(NOT (LINUX AND CMAKE_CROSSCOMPILING))
+ set(fileEnvArg "--single-process ${fileEnvArg}")
+
+ qt_internal_add_test(tst_proxypac_single_process
+ SOURCES
+ tst_proxypac.cpp
+ LIBRARIES
+ Qt::WebEngineCore
+ Test::HttpServer
+ )
+
+ set_tests_properties(tst_proxypac_single_process PROPERTIES
+ ENVIRONMENT QTWEBENGINE_CHROMIUM_FLAGS=${fileEnvArg}
+ )
+endif()
+
qt_internal_add_test(tst_proxypac_qrc
SOURCES
tst_proxypac.cpp
@@ -40,8 +59,6 @@ set_tests_properties(tst_proxypac_qrc PROPERTIES
)
qt_internal_add_resource(tst_proxypac_qrc "proxypac"
- PREFIX
- "/"
- FILES
- "proxy.pac"
+ PREFIX "/"
+ FILES "proxy.pac"
)
diff --git a/tests/auto/widgets/proxypac/proxy.pac b/tests/auto/widgets/proxypac/proxy.pac
index 1d29847b9..966c37ba5 100644
--- a/tests/auto/widgets/proxypac/proxy.pac
+++ b/tests/auto/widgets/proxypac/proxy.pac
@@ -2,6 +2,6 @@ function FindProxyForURL(url, host)
{
if (shExpMatch(host, "*.proxy1.com")) return "PROXY localhost:5551";
if (shExpMatch(host, "*.proxy2.com")) return "PROXY localhost:5552";
- return "PROXY proxy.url:8080";
+ return "DIRECT";
}
diff --git a/tests/auto/widgets/proxypac/tst_proxypac.cpp b/tests/auto/widgets/proxypac/tst_proxypac.cpp
index 8667af24a..d372f77fa 100644
--- a/tests/auto/widgets/proxypac/tst_proxypac.cpp
+++ b/tests/auto/widgets/proxypac/tst_proxypac.cpp
@@ -8,7 +8,6 @@
#include <QWebEnginePage>
#include <QNetworkProxy>
-
class tst_ProxyPac : public QObject {
Q_OBJECT
public:
@@ -39,11 +38,20 @@ void tst_ProxyPac::proxypac()
QWebEngineProfile profile;
QWebEnginePage page(&profile);
+
+ const bool v8_proxy_resolver_enabled = !fromEnv.contains("--single-process");
page.load(QUrl("http://test.proxy1.com"));
- QTRY_COMPARE(proxySpy1.count() >= 1, true);
+ QTRY_COMPARE(proxySpy1.count() >= 1, v8_proxy_resolver_enabled);
QVERIFY(proxySpy2.count() == 0);
page.load(QUrl("http://test.proxy2.com"));
- QTRY_COMPARE(proxySpy2.count() >= 1 , true);
+ QTRY_COMPARE(proxySpy2.count() >= 1, v8_proxy_resolver_enabled);
+
+ // check for crash
+ QSignalSpy spyFinished(&page, &QWebEnginePage::loadFinished);
+ page.load(QUrl("https://contribute.qt-project.org"));
+
+ QTRY_VERIFY_WITH_TIMEOUT(!spyFinished.isEmpty(), 100000);
+
}
#include "tst_proxypac.moc"
diff --git a/tests/auto/widgets/qwebenginedownloadrequest/CMakeLists.txt b/tests/auto/widgets/qwebenginedownloadrequest/CMakeLists.txt
index 3a8244c0f..5b76909b1 100644
--- a/tests/auto/widgets/qwebenginedownloadrequest/CMakeLists.txt
+++ b/tests/auto/widgets/qwebenginedownloadrequest/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
include(../../httpserver/httpserver.cmake)
include(../../util/util.cmake)
diff --git a/tests/auto/widgets/qwebenginehistory/CMakeLists.txt b/tests/auto/widgets/qwebenginehistory/CMakeLists.txt
index b91281a45..e277a7326 100644
--- a/tests/auto/widgets/qwebenginehistory/CMakeLists.txt
+++ b/tests/auto/widgets/qwebenginehistory/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
include(../../util/util.cmake)
qt_internal_add_test(tst_qwebenginehistory
diff --git a/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp b/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp
index 448b2232b..f67c2e03d 100644
--- a/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp
+++ b/tests/auto/widgets/qwebenginehistory/tst_qwebenginehistory.cpp
@@ -487,9 +487,9 @@ void tst_QWebEngineHistory::clear()
QWebEnginePage page2(this);
QWebEngineHistory* hist2 = page2.history();
- QVERIFY(hist2->count() == 1);
+ QVERIFY(hist2->count() == 0);
hist2->clear();
- QVERIFY(hist2->count() == 1); // Do not change anything.
+ QVERIFY(hist2->count() == 0); // Do not change anything.
}
void tst_QWebEngineHistory::historyItemFromDeletedPage()
diff --git a/tests/auto/widgets/qwebenginepage/CMakeLists.txt b/tests/auto/widgets/qwebenginepage/CMakeLists.txt
index 599e22990..af2767500 100644
--- a/tests/auto/widgets/qwebenginepage/CMakeLists.txt
+++ b/tests/auto/widgets/qwebenginepage/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
include(../../httpserver/httpserver.cmake)
include(../../util/util.cmake)
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 262e1ea8d..ed1c1cae6 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -69,6 +69,8 @@
#include <qwebengineview.h>
#include <qimagewriter.h>
#include <QColorSpace>
+#include <QQuickRenderControl>
+#include <QQuickWindow>
static void removeRecursive(const QString& dirname)
{
@@ -154,7 +156,7 @@ private Q_SLOTS:
#endif
void openWindowDefaultSize();
-#ifdef Q_OS_MAC
+#ifdef Q_OS_MACOS
void macCopyUnicodeToClipboard();
#endif
@@ -1324,7 +1326,9 @@ static QWindow *findNewTopLevelWindow(const QWindowList &oldTopLevelWindows)
{
const auto tlws = QGuiApplication::topLevelWindows();
for (auto w : tlws) {
- if (!oldTopLevelWindows.contains(w)) {
+ // note 'offscreen' window is a top-level window
+ if (!oldTopLevelWindows.contains(w)
+ && !QQuickRenderControl::renderWindowFor(qobject_cast<QQuickWindow *>(w))) {
return w;
}
}
@@ -1344,28 +1348,29 @@ void tst_QWebEnginePage::comboBoxPopupPositionAfterMove()
view.move(QGuiApplication::primaryScreen()->availableGeometry().topLeft());
view.resize(640, 480);
view.show();
-
- QSignalSpy loadSpy(&view, SIGNAL(loadFinished(bool)));
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
+ QSignalSpy spyLoadFinished(&view, SIGNAL(loadFinished(bool)));
view.setHtml(QLatin1String("<html><head></head><body><select id='foo'>"
"<option>fran</option><option>troz</option>"
"</select></body></html>"));
- QTRY_COMPARE(loadSpy.count(), 1);
+ QTRY_COMPARE(spyLoadFinished.count(), 1);
const auto oldTlws = QGuiApplication::topLevelWindows();
-
QFETCH(bool, withTouch);
QWindow *window = view.windowHandle();
- makeClick(window, withTouch, elementCenter(view.page(), "foo"));
-
+ auto pos = elementCenter(view.page(), "foo");
+ makeClick(window, withTouch, pos);
QWindow *popup = nullptr;
QTRY_VERIFY(popup = findNewTopLevelWindow(oldTlws));
+ QVERIFY(QTest::qWaitForWindowExposed(popup));
+ QTRY_VERIFY(popup->width() > 0 && popup->height() > 0);
QTRY_VERIFY(QGuiApplication::topLevelWindows().contains(popup));
QTRY_VERIFY(!popup->position().isNull());
QPoint popupPos = popup->position();
-
+ QPointer<QWindow> pw(popup);
// Close the popup by clicking somewhere into the page.
makeClick(window, withTouch, QPoint(1, 1));
QTRY_VERIFY(!QGuiApplication::topLevelWindows().contains(popup));
-
+ QTRY_VERIFY(!pw);
auto jsViewPosition = [&view]() {
QLatin1String script("(function() { return [window.screenX, window.screenY]; })()");
QVariantList posList = evaluateJavaScriptSync(view.page(), script).toList();
@@ -1384,6 +1389,7 @@ void tst_QWebEnginePage::comboBoxPopupPositionAfterMove()
QTRY_COMPARE(jsViewPosition(), view.pos());
makeClick(window, withTouch, elementCenter(view.page(), "foo"));
QTRY_VERIFY(popup = findNewTopLevelWindow(oldTlws));
+ QTRY_VERIFY(popup->width() > 0 && popup->height() > 0);
QTRY_VERIFY(QGuiApplication::topLevelWindows().contains(popup));
QTRY_VERIFY(!popup->position().isNull());
QCOMPARE(popupPos + offset, popup->position());
@@ -1413,6 +1419,7 @@ void tst_QWebEnginePage::comboBoxPopupPositionAfterChildMove()
mainWidget.move(screen->availableGeometry().topLeft());
mainWidget.resize(640, 480);
mainWidget.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&mainWidget));
QSignalSpy loadSpy(&view, SIGNAL(loadFinished(bool)));
view.setHtml(QLatin1String("<html><head></head><body><select autofocus id='foo'>"
@@ -1427,6 +1434,8 @@ void tst_QWebEnginePage::comboBoxPopupPositionAfterChildMove()
QWindow *popup = nullptr;
QTRY_VERIFY(popup = findNewTopLevelWindow(oldTlws));
+ QVERIFY(QTest::qWaitForWindowExposed(popup));
+ QTRY_VERIFY(popup->width() > 0 && popup->height() > 0);
QTRY_VERIFY(QGuiApplication::topLevelWindows().contains(popup));
QTRY_VERIFY(!popup->position().isNull());
QPoint popupPos = popup->position();
@@ -1452,11 +1461,15 @@ void tst_QWebEnginePage::comboBoxPopupPositionAfterChildMove()
makeClick(window, withTouch, view.mapTo(view.window(), elementCenter(view.page(), "foo")));
QTRY_VERIFY(popup = findNewTopLevelWindow(oldTlws));
+ QVERIFY(QTest::qWaitForWindowExposed(popup));
+ QTRY_VERIFY(popup->width() > 0 && popup->height() > 0);
QTRY_VERIFY(!popup->position().isNull());
QCOMPARE(popupPos + QPoint(offset, 0), popup->position());
+ makeClick(window, withTouch, QPoint(1, 1));
+ QTRY_VERIFY(!QGuiApplication::topLevelWindows().contains(popup));
}
-#ifdef Q_OS_MAC
+#ifdef Q_OS_MACOS
void tst_QWebEnginePage::macCopyUnicodeToClipboard()
{
QString unicodeText = QString::fromUtf8("αβγδεζηθικλμπ");
@@ -2047,14 +2060,14 @@ void tst_QWebEnginePage::symmetricUrl()
QVERIFY(view.url().isEmpty());
- QCOMPARE(view.history()->count(), 1);
+ QCOMPARE(view.history()->count(), 0);
QUrl dataUrl("data:text/html,<h1>Test");
view.setUrl(dataUrl);
view.show();
QCOMPARE(view.url(), dataUrl);
- QCOMPARE(view.history()->count(), 1);
+ QCOMPARE(view.history()->count(), 0);
// loading is _not_ immediate, so the text isn't set just yet.
QVERIFY(toPlainTextSync(view.page()).isEmpty());
@@ -2367,7 +2380,7 @@ void tst_QWebEnginePage::setHtmlWithBaseURL()
QCOMPARE(evaluateJavaScriptSync(&page, "document.images[0].height").toInt(), 128);
// no history item has to be added.
- QCOMPARE(m_view->page()->history()->count(), 1);
+ QCOMPARE(m_view->page()->history()->count(), 0);
}
class MyPage : public QWebEnginePage
@@ -2797,7 +2810,7 @@ void tst_QWebEnginePage::setUrlHistory()
int expectedLoadFinishedCount = 0;
QSignalSpy spy(m_page, SIGNAL(loadFinished(bool)));
- QCOMPARE(m_page->history()->count(), 1);
+ QCOMPARE(m_page->history()->count(), 0);
m_page->setUrl(QUrl());
expectedLoadFinishedCount++;
@@ -2871,7 +2884,7 @@ void tst_QWebEnginePage::setUrlUsingStateObject()
QSignalSpy loadFinishedSpy(m_page, SIGNAL(loadFinished(bool)));
int expectedUrlChangeCount = 0;
- QCOMPARE(m_page->history()->count(), 1);
+ QCOMPARE(m_page->history()->count(), 0);
url = QUrl("qrc:/resources/test1.html");
m_page->setUrl(url);
@@ -3085,7 +3098,7 @@ void tst_QWebEnginePage::loadFromQrc()
// Resource not found, loading fails.
page.load(QStringLiteral("qrc:///nope"));
- QTRY_COMPARE(spy.count(), 1);
+ QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 1, 10000);
QCOMPARE(spy.takeFirst().value(0).toBool(), false);
}
@@ -3693,7 +3706,7 @@ void tst_QWebEnginePage::openLinkInNewPage()
QCOMPARE(page1.history()->count(), 1);
else
QCOMPARE(page1.history()->count(), 2);
- QCOMPARE(page2.history()->count(), 1);
+ QCOMPARE(page2.history()->count(), 0);
break;
case Effect::LoadInOther:
QTRY_COMPARE(page2.spy.count(), 1);
diff --git a/tests/auto/widgets/qwebengineprofile/CMakeLists.txt b/tests/auto/widgets/qwebengineprofile/CMakeLists.txt
index 744f44405..d7393eaef 100644
--- a/tests/auto/widgets/qwebengineprofile/CMakeLists.txt
+++ b/tests/auto/widgets/qwebengineprofile/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
include(../../httpserver/httpserver.cmake)
include(../../util/util.cmake)
diff --git a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
index 3b595f199..35c66e9ed 100644
--- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
+++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
@@ -41,6 +41,7 @@ private Q_SLOTS:
void urlSchemeHandlerFailRequest();
void urlSchemeHandlerFailOnRead();
void urlSchemeHandlerStreaming();
+ void urlSchemeHandlerStreaming2();
void urlSchemeHandlerRequestHeaders();
void urlSchemeHandlerInstallation();
void urlSchemeHandlerXhrStatus();
@@ -264,10 +265,12 @@ public:
QList<QPointer<QBuffer>> m_buffers;
};
-class StreamingIODevice : public QIODevice {
+// an evil version constantly claiming to be at end, similar to QNetworkReply
+class StreamingIODeviceBasic : public QIODevice
+{
Q_OBJECT
public:
- StreamingIODevice(QObject *parent) : QIODevice(parent), m_bytesRead(0), m_bytesAvailable(0)
+ StreamingIODeviceBasic(QObject *parent) : QIODevice(parent), m_bytesRead(0), m_bytesAvailable(0)
{
setOpenMode(QIODevice::ReadOnly);
m_timer.start(100, this);
@@ -278,12 +281,11 @@ public:
const std::lock_guard<QRecursiveMutex> lock(m_mutex);
return m_bytesAvailable;
}
- bool atEnd() const override
+protected:
+ bool internalAtEnd() const
{
- const std::lock_guard<QRecursiveMutex> lock(m_mutex);
return (m_data.size() >= 1000 && m_bytesRead >= 1000);
}
-protected:
void timerEvent(QTimerEvent *) override
{
const std::lock_guard<QRecursiveMutex> lock(m_mutex);
@@ -304,7 +306,7 @@ protected:
memcpy(data, m_data.constData() + m_bytesRead, len);
m_bytesAvailable -= len;
m_bytesRead += len;
- } else if (atEnd())
+ } else if (internalAtEnd())
return -1;
return len;
@@ -314,14 +316,26 @@ protected:
return 0;
}
-private:
mutable QRecursiveMutex m_mutex;
+private:
QByteArray m_data;
QBasicTimer m_timer;
int m_bytesRead;
int m_bytesAvailable;
};
+// A nicer version implementing atEnd
+class StreamingIODevice : public StreamingIODeviceBasic
+{
+public:
+ StreamingIODevice(QObject *parent) : StreamingIODeviceBasic(parent) {}
+ bool atEnd() const override
+ {
+ const std::lock_guard<QRecursiveMutex> lock(m_mutex);
+ return internalAtEnd();
+ }
+};
+
class StreamingUrlSchemeHandler : public QWebEngineUrlSchemeHandler
{
public:
@@ -336,6 +350,20 @@ public:
}
};
+class StreamingUrlSchemeHandler2 : public QWebEngineUrlSchemeHandler
+{
+public:
+ StreamingUrlSchemeHandler2(QObject *parent = nullptr)
+ : QWebEngineUrlSchemeHandler(parent)
+ {
+ }
+
+ void requestStarted(QWebEngineUrlRequestJob *job) override
+ {
+ job->reply("text/plain;charset=utf-8", new StreamingIODeviceBasic(job));
+ }
+};
+
void tst_QWebEngineProfile::urlSchemeHandlers()
{
RedirectingUrlSchemeHandler lettertoHandler;
@@ -477,6 +505,23 @@ void tst_QWebEngineProfile::urlSchemeHandlerStreaming()
QCOMPARE(toPlainTextSync(view.page()), QString::fromLatin1(result));
}
+void tst_QWebEngineProfile::urlSchemeHandlerStreaming2()
+{
+ StreamingUrlSchemeHandler2 handler;
+ QWebEngineProfile profile;
+ profile.installUrlSchemeHandler("stream", &handler);
+ QWebEngineView view;
+ QSignalSpy loadFinishedSpy(&view, SIGNAL(loadFinished(bool)));
+ view.setPage(new QWebEnginePage(&profile, &view));
+ view.settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, false);
+ view.load(QUrl(QStringLiteral("stream://whatever")));
+ view.show();
+ QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000);
+ QByteArray result;
+ result.append(1000, 'c');
+ QCOMPARE(toPlainTextSync(view.page()), QString::fromLatin1(result));
+}
+
class ExtraHeaderInterceptor : public QWebEngineUrlRequestInterceptor
{
public:
@@ -942,7 +987,7 @@ void tst_QWebEngineProfile::initiator()
// Directly calling load/setUrl should have initiator QUrl(), meaning
// browser-initiated, trusted.
page.load(QUrl("foo:bar"));
- QTRY_COMPARE(loadFinishedSpy.count(), 1);
+ QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 10000);
QCOMPARE(handler.initiator, QUrl());
}
diff --git a/tests/auto/widgets/qwebenginescript/CMakeLists.txt b/tests/auto/widgets/qwebenginescript/CMakeLists.txt
index 6e768cf90..d0d499b84 100644
--- a/tests/auto/widgets/qwebenginescript/CMakeLists.txt
+++ b/tests/auto/widgets/qwebenginescript/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
include(../../util/util.cmake)
qt_internal_add_test(tst_qwebenginescript
diff --git a/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp b/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp
index 26ba71ae3..6a97e5db0 100644
--- a/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp
+++ b/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp
@@ -457,7 +457,7 @@ void tst_QWebEngineScript::scriptsInNestedIframes()
QSignalSpy spyFinished(&page, &QWebEnginePage::loadFinished);
page.load(QUrl("qrc:/resources/test_iframe_main.html"));
view.show();
- QVERIFY(spyFinished.wait());
+ QTRY_VERIFY_WITH_TIMEOUT(spyFinished.count() > 0, 20000);
// Check that main frame has modified content.
QCOMPARE(
diff --git a/tests/auto/widgets/qwebengineview/BLACKLIST b/tests/auto/widgets/qwebengineview/BLACKLIST
index ed022878e..5d9cc038a 100644
--- a/tests/auto/widgets/qwebengineview/BLACKLIST
+++ b/tests/auto/widgets/qwebengineview/BLACKLIST
@@ -6,3 +6,6 @@ windows
[navigateOnDrop:file_no_navigate]
windows
+
+[horizontalScrollbarTest]
+b2qt # different scrollbar
diff --git a/tests/auto/widgets/qwebengineview/CMakeLists.txt b/tests/auto/widgets/qwebengineview/CMakeLists.txt
index b06ee7201..9583184d0 100644
--- a/tests/auto/widgets/qwebengineview/CMakeLists.txt
+++ b/tests/auto/widgets/qwebengineview/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
include(../../util/util.cmake)
qt_internal_add_test(tst_qwebengineview
diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
index f54fdbbfc..7cfe072b3 100644
--- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
+++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp
@@ -636,7 +636,7 @@ void tst_QWebEngineView::unhandledKeyEventPropagation()
QSignalSpy loadFinishedSpy(&webView, SIGNAL(loadFinished(bool)));
webView.load(QUrl("qrc:///resources/keyboardEvents.html"));
- QVERIFY(loadFinishedSpy.wait());
+ QTRY_VERIFY_WITH_TIMEOUT(loadFinishedSpy.count() > 0, 20000);
evaluateJavaScriptSync(webView.page(), "document.getElementById('first_div').focus()");
QTRY_COMPARE(evaluateJavaScriptSync(webView.page(), "document.activeElement.id").toString(), QStringLiteral("first_div"));
@@ -1146,20 +1146,22 @@ void tst_QWebEngineView::focusInternalRenderWidgetHostViewQuickItem()
QWebEngineView *webView = new QWebEngineView;
QWebEngineSettings *settings = webView->page()->settings();
settings->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, false);
- webView->resize(300, 300);
+ webView->resize(300, 100);
- QHBoxLayout *layout = new QHBoxLayout;
+ QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(label);
layout->addWidget(webView);
+ containerWidget->resize(300, 200);
containerWidget->setLayout(layout);
containerWidget->show();
QVERIFY(QTest::qWaitForWindowExposed(containerWidget.data()));
// Load the content, and check that focus is not set.
QSignalSpy loadSpy(webView, SIGNAL(loadFinished(bool)));
- webView->setHtml("<html><head><title>Title</title></head><body>Hello"
- "<input id=\"input\" type=\"text\"></body></html>");
+ webView->setHtml("<html><body>"
+ " <input id='input1' type='text'/>"
+ "</body></html>");
QTRY_COMPARE(loadSpy.count(), 1);
QTRY_COMPARE(webView->hasFocus(), false);
@@ -1169,15 +1171,43 @@ void tst_QWebEngineView::focusInternalRenderWidgetHostViewQuickItem()
// Check that focus is set in QWebEngineView and all internal classes.
QTRY_COMPARE(webView->hasFocus(), true);
- QQuickWidget *renderWidgetHostViewQtDelegateWidget =
- qobject_cast<QQuickWidget *>(webView->focusProxy());
- QVERIFY(renderWidgetHostViewQtDelegateWidget);
- QTRY_COMPARE(renderWidgetHostViewQtDelegateWidget->hasFocus(), true);
+ QQuickWidget *webEngineQuickWidget = qobject_cast<QQuickWidget *>(webView->focusProxy());
+ QVERIFY(webEngineQuickWidget);
+ QTRY_COMPARE(webEngineQuickWidget->hasFocus(), true);
+
+ QQuickItem *root = webEngineQuickWidget->rootObject();
+ // The root item should not has focus, otherwise it would handle input events
+ // instead of the RenderWidgetHostViewQtDelegateItem.
+ QVERIFY(!root->hasFocus());
+
+ QCOMPARE(root->childItems().size(), 1);
+ QQuickItem *renderWidgetHostViewQtDelegateItem = root->childItems().at(0);
+ QVERIFY(renderWidgetHostViewQtDelegateItem);
+ QTRY_COMPARE(renderWidgetHostViewQtDelegateItem->hasFocus(), true);
+ // Test if QWebEngineView handles key events.
+ QTRY_COMPARE(renderWidgetHostViewQtDelegateItem->hasActiveFocus(), true);
+
+ // Key events should not be forwarded to the unfocused input field.
+ QTRY_COMPARE(evaluateJavaScriptSync(webView->page(),
+ "document.getElementById('input1').value").toString(),
+ QStringLiteral(""));
+ QTest::keyClick(webView->focusProxy(), Qt::Key_X);
+ QTest::qWait(100);
+ QTRY_COMPARE(evaluateJavaScriptSync(webView->page(),
+ "document.getElementById('input1').value").toString(),
+ QStringLiteral(""));
+
+ // Focus the input field. Focus rectangle is expected to appear around the input field.
+ evaluateJavaScriptSync(webView->page(), "document.getElementById('input1').focus()");
+ QTRY_COMPARE(evaluateJavaScriptSync(webView->page(),
+ "document.activeElement.id").toString(),
+ QStringLiteral("input1"));
- QQuickItem *renderWidgetHostViewQuickItem =
- renderWidgetHostViewQtDelegateWidget->rootObject();
- QVERIFY(renderWidgetHostViewQuickItem);
- QTRY_COMPARE(renderWidgetHostViewQuickItem->hasFocus(), true);
+ // Test the focused input field with a key event.
+ QTest::keyClick(webView->focusProxy(), Qt::Key_X);
+ QTRY_COMPARE(evaluateJavaScriptSync(webView->page(),
+ "document.getElementById('input1').value").toString(),
+ QStringLiteral("x"));
}
void tst_QWebEngineView::doNotBreakLayout()
@@ -1367,7 +1397,7 @@ void tst_QWebEngineView::keyboardEvents()
view.show();
QSignalSpy loadFinishedSpy(&view, SIGNAL(loadFinished(bool)));
view.load(QUrl("qrc:///resources/keyboardEvents.html"));
- QVERIFY(loadFinishedSpy.wait());
+ QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000);
QStringList elements;
elements << "first_div" << "second_div";
@@ -3148,45 +3178,50 @@ void tst_QWebEngineView::webUIURLs_data()
QTest::addColumn<bool>("supported");
QTest::newRow("about") << QUrl("chrome://about") << false;
QTest::newRow("accessibility") << QUrl("chrome://accessibility") << true;
+ QTest::newRow("app-service-internals") << QUrl("chrome://app-service-internals") << false;
+ QTest::newRow("app-settings") << QUrl("chrome://app-settings") << false;
QTest::newRow("apps") << QUrl("chrome://apps") << false;
+ QTest::newRow("attribution-internals") << QUrl("chrome://attribution-internals") << true;
QTest::newRow("autofill-internals") << QUrl("chrome://autofill-internals") << false;
QTest::newRow("blob-internals") << QUrl("chrome://blob-internals") << true;
QTest::newRow("bluetooth-internals") << QUrl("chrome://bluetooth-internals") << false;
QTest::newRow("bookmarks") << QUrl("chrome://bookmarks") << false;
QTest::newRow("chrome-urls") << QUrl("chrome://chrome-urls") << false;
QTest::newRow("components") << QUrl("chrome://components") << false;
- QTest::newRow("conversion-internals") << QUrl("chrome://conversion-internals") << true;
+ QTest::newRow("connectors-internals") << QUrl("chrome://connectors-internals") << false;
QTest::newRow("crashes") << QUrl("chrome://crashes") << false;
QTest::newRow("credits") << QUrl("chrome://credits") << false;
QTest::newRow("device-log") << QUrl("chrome://device-log") << true;
- QTest::newRow("devices") << QUrl("chrome://devices") << false;
QTest::newRow("dino") << QUrl("chrome://dino") << false; // It works but this is an error page
QTest::newRow("discards") << QUrl("chrome://discards") << false;
QTest::newRow("download-internals") << QUrl("chrome://download-internals") << false;
QTest::newRow("downloads") << QUrl("chrome://downloads") << false;
QTest::newRow("extensions") << QUrl("chrome://extensions") << false;
+ QTest::newRow("extensions-internals") << QUrl("chrome://extensions-internals") << false;
QTest::newRow("flags") << QUrl("chrome://flags") << false;
QTest::newRow("gcm-internals") << QUrl("chrome://gcm-internals") << false;
QTest::newRow("gpu") << QUrl("chrome://gpu") << true;
QTest::newRow("help") << QUrl("chrome://help") << false;
QTest::newRow("histograms") << QUrl("chrome://histograms") << true;
QTest::newRow("history") << QUrl("chrome://history") << false;
+ QTest::newRow("history-clusters-internals") << QUrl("chrome://history-clusters-internals") << false;
QTest::newRow("indexeddb-internals") << QUrl("chrome://indexeddb-internals") << true;
QTest::newRow("inspect") << QUrl("chrome://inspect") << false;
QTest::newRow("interstitials") << QUrl("chrome://interstitials") << false;
- QTest::newRow("interventions-internals") << QUrl("chrome://interventions-internals") << false;
QTest::newRow("invalidations") << QUrl("chrome://invalidations") << false;
QTest::newRow("linux-proxy-config") << QUrl("chrome://linux-proxy-config") << false;
QTest::newRow("local-state") << QUrl("chrome://local-state") << false;
QTest::newRow("management") << QUrl("chrome://management") << false;
QTest::newRow("media-engagement") << QUrl("chrome://media-engagement") << false;
QTest::newRow("media-internals") << QUrl("chrome://media-internals") << true;
+ QTest::newRow("nacl") << QUrl("chrome://nacl") << false;
QTest::newRow("net-export") << QUrl("chrome://net-export") << false;
QTest::newRow("net-internals") << QUrl("chrome://net-internals") << true;
QTest::newRow("network-error") << QUrl("chrome://network-error") << false;
QTest::newRow("network-errors") << QUrl("chrome://network-errors") << true;
QTest::newRow("ntp-tiles-internals") << QUrl("chrome://ntp-tiles-internals") << false;
QTest::newRow("omnibox") << QUrl("chrome://omnibox") << false;
+ QTest::newRow("optimization-guide-internals") << QUrl("chrome://optimization-guide-internals") << false;
QTest::newRow("password-manager-internals") << QUrl("chrome://password-manager-internals") << false;
QTest::newRow("policy") << QUrl("chrome://policy") << false;
QTest::newRow("predictors") << QUrl("chrome://predictors") << false;
@@ -3204,8 +3239,6 @@ void tst_QWebEngineView::webUIURLs_data()
QTest::newRow("settings") << QUrl("chrome://settings") << false;
QTest::newRow("signin-internals") << QUrl("chrome://signin-internals") << false;
QTest::newRow("site-engagement") << QUrl("chrome://site-engagement") << false;
- QTest::newRow("suggestions") << QUrl("chrome://suggestions") << false;
- QTest::newRow("supervised-user-internals") << QUrl("chrome://supervised-user-internals") << false;
QTest::newRow("sync-internals") << QUrl("chrome://sync-internals") << false;
QTest::newRow("system") << QUrl("chrome://system") << false;
QTest::newRow("terms") << QUrl("chrome://terms") << false;
@@ -3215,12 +3248,14 @@ void tst_QWebEngineView::webUIURLs_data()
QTest::newRow("usb-internals") << QUrl("chrome://usb-internals") << false;
QTest::newRow("user-actions") << QUrl("chrome://user-actions") << true;
QTest::newRow("version") << QUrl("chrome://version") << false;
+ QTest::newRow("web-app-internals") << QUrl("chrome://web-app-internals") << false;
#if QT_CONFIG(webengine_webrtc)
QTest::newRow("webrtc-internals") << QUrl("chrome://webrtc-internals") << true;
#if QT_CONFIG(webengine_extensions)
QTest::newRow("webrtc-logs") << QUrl("chrome://webrtc-logs") << true;
#endif // QT_CONFIG(webengine_extensions)
#endif // QT_CONFIG(webengine_webrtc)
+ QTest::newRow("whats-new") << QUrl("chrome://whats-new") << false;
}
void tst_QWebEngineView::webUIURLs()
@@ -3232,7 +3267,7 @@ void tst_QWebEngineView::webUIURLs()
view.settings()->setAttribute(QWebEngineSettings::ErrorPageEnabled, false);
QSignalSpy loadFinishedSpy(&view, SIGNAL(loadFinished(bool)));
view.load(url);
- QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 30000);
+ QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.count(), 1, 90000);
QCOMPARE(loadFinishedSpy.takeFirst().at(0).toBool(), supported);
}
diff --git a/tests/auto/widgets/schemes/CMakeLists.txt b/tests/auto/widgets/schemes/CMakeLists.txt
index 446ae5751..ae3a38f91 100644
--- a/tests/auto/widgets/schemes/CMakeLists.txt
+++ b/tests/auto/widgets/schemes/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
qt_internal_add_test(tst_schemes
SOURCES
tst_schemes.cpp
diff --git a/tests/auto/widgets/shutdown/CMakeLists.txt b/tests/auto/widgets/shutdown/CMakeLists.txt
index 12ca27c3d..e2ce9eeb9 100644
--- a/tests/auto/widgets/shutdown/CMakeLists.txt
+++ b/tests/auto/widgets/shutdown/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
qt_internal_add_test(tst_shutdown
SOURCES
tst_shutdown.cpp
diff --git a/tests/auto/widgets/spellchecking/CMakeLists.txt b/tests/auto/widgets/spellchecking/CMakeLists.txt
index 2c1926476..8c538377d 100644
--- a/tests/auto/widgets/spellchecking/CMakeLists.txt
+++ b/tests/auto/widgets/spellchecking/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
include(../../util/util.cmake)
qt_internal_add_test(tst_spellchecking
diff --git a/tests/auto/widgets/touchinput/CMakeLists.txt b/tests/auto/widgets/touchinput/CMakeLists.txt
index 82e3fca4a..bd76666d6 100644
--- a/tests/auto/widgets/touchinput/CMakeLists.txt
+++ b/tests/auto/widgets/touchinput/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
include(../../util/util.cmake)
qt_internal_add_test(tst_touchinput
diff --git a/tests/manual/quick/touchbrowser/CMakeLists.txt b/tests/manual/quick/touchbrowser/CMakeLists.txt
index c211ba8e6..d4064c05e 100644
--- a/tests/manual/quick/touchbrowser/CMakeLists.txt
+++ b/tests/manual/quick/touchbrowser/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
if (NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
cmake_minimum_required(VERSION 3.16)
project(touchbrowser LANGUAGES CXX)
@@ -15,7 +18,7 @@ qt_internal_add_manual_test(touchbrowser
main.cpp
utils.h
${SOURCES}
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::GuiPrivate
Qt::Quick
Qt::WebEngineQuick
diff --git a/tests/manual/widgets/inputmethods/CMakeLists.txt b/tests/manual/widgets/inputmethods/CMakeLists.txt
index 4bc6e76db..acd5bca50 100644
--- a/tests/manual/widgets/inputmethods/CMakeLists.txt
+++ b/tests/manual/widgets/inputmethods/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
if (NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
cmake_minimum_required(VERSION 3.16)
project(inputmethods LANGUAGES CXX)
@@ -13,7 +16,7 @@ qt_internal_add_manual_test(inputmethods
referenceview.cpp
testview.cpp
webview.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Core
Qt::Gui
Qt::Test
diff --git a/tests/manual/widgets/webgl/CMakeLists.txt b/tests/manual/widgets/webgl/CMakeLists.txt
index 9eaa50c00..034a06a79 100644
--- a/tests/manual/widgets/webgl/CMakeLists.txt
+++ b/tests/manual/widgets/webgl/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
if (NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
cmake_minimum_required(VERSION 3.16)
project(webgl LANGUAGES CXX)
@@ -8,7 +11,7 @@ qt_internal_add_manual_test(webgl
GUI
SOURCES
main.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Core
Qt::Gui
Qt::WebEngineWidgets
diff --git a/tools/scripts/take_snapshot.py b/tools/scripts/take_snapshot.py
index ab8ebaeb3..f82ff7d03 100755
--- a/tools/scripts/take_snapshot.py
+++ b/tools/scripts/take_snapshot.py
@@ -86,7 +86,7 @@ def isInChromiumBlacklist(file_path):
or file_path.startswith('components/invalidation/')
or file_path.startswith('components/nacl/')
or file_path.startswith('components/omnibox/')
- or file_path.startswith('components/policy/')
+ or file_path.startswith('components/policy/resources/')
or file_path.startswith('components/proximity_auth/')
or (file_path.startswith('components/resources/terms/')
and not file_path.endswith('terms_chromium.html'))
@@ -98,10 +98,10 @@ def isInChromiumBlacklist(file_path):
or file_path.startswith('components/translate/')
))
or file_path.startswith('content/public/android/java')
- or (file_path.startswith('content/shell')
- and not file_path.startswith('content/shell/common')
- and not file_path.endswith('.grd'))
+ or file_path.startswith('content/shell/android/')
+ or file_path.startswith('content/shell/browser/')
or file_path.startswith('courgette')
+ or file_path.startswith('docs/website/')
or file_path.startswith('google_update')
or file_path.startswith('ios')
or file_path.startswith('media/base/android/java')
@@ -147,21 +147,48 @@ def isInChromiumBlacklist(file_path):
or file_path.startswith('third_party/colorama')
or file_path.startswith('third_party/depot_tools')
or (file_path.startswith('third_party/node/node_modules/')
+ and not file_path.startswith('third_party/node/node_modules/@babel/')
+ and not file_path.startswith('third_party/node/node_modules/@types/d3')
+ and not file_path.startswith('third_party/node/node_modules/@types/trusted-types/')
+ and not file_path.startswith('third_party/node/node_modules/ansi-styles/')
+ and not file_path.startswith('third_party/node/node_modules/balanced-match/')
+ and not file_path.startswith('third_party/node/node_modules/brace-expansion/')
and not file_path.startswith('third_party/node/node_modules/cancel-token/')
+ and not file_path.startswith('third_party/node/node_modules/chalk/')
+ and not file_path.startswith('third_party/node/node_modules/color-convert/')
+ and not file_path.startswith('third_party/node/node_modules/color-name/')
+ and not file_path.startswith('third_party/node/node_modules/commander/')
+ and not file_path.startswith('third_party/node/node_modules/concat-map/')
and not file_path.startswith('third_party/node/node_modules/cssbeautify/')
+ and not file_path.startswith('third_party/node/node_modules/debug/')
+ and not file_path.startswith('third_party/node/node_modules/escape-string-regexp/')
+ and not file_path.startswith('third_party/node/node_modules/esutils/')
+ and not file_path.startswith('third_party/node/node_modules/function-bind/')
+ and not file_path.startswith('third_party/node/node_modules/globals/')
and not file_path.startswith('third_party/node/node_modules/has-ansi/')
+ and not file_path.startswith('third_party/node/node_modules/has-flag/')
+ and not file_path.startswith('third_party/node/node_modules/has/')
and not file_path.startswith('third_party/node/node_modules/indent/')
+ and not file_path.startswith('third_party/node/node_modules/is-core-module/')
and not file_path.startswith('third_party/node/node_modules/is-windows/')
+ and not file_path.startswith('third_party/node/node_modules/js-tokens/')
+ and not file_path.startswith('third_party/node/node_modules/jsesc/')
and not file_path.startswith('third_party/node/node_modules/jsonschema/')
and not file_path.startswith('third_party/node/node_modules/lodash.camelcase/')
and not file_path.startswith('third_party/node/node_modules/lodash.sortby/')
+ and not file_path.startswith('third_party/node/node_modules/minimatch/')
+ and not file_path.startswith('third_party/node/node_modules/ms/')
+ and not file_path.startswith('third_party/node/node_modules/path-is-inside/')
and not file_path.startswith('third_party/node/node_modules/polymer-analyzer/')
and not file_path.startswith('third_party/node/node_modules/polymer-css-build/')
+ and not file_path.startswith('third_party/node/node_modules/resolve/')
and not file_path.startswith('third_party/node/node_modules/rollup/')
and not file_path.startswith('third_party/node/node_modules/shady-css-parser/')
and not file_path.startswith('third_party/node/node_modules/source-map/')
and not file_path.startswith('third_party/node/node_modules/stable/')
+ and not file_path.startswith('third_party/node/node_modules/supports-color/')
and not file_path.startswith('third_party/node/node_modules/terser/')
+ and not file_path.startswith('third_party/node/node_modules/to-fast-properties/')
and not file_path.startswith('third_party/node/node_modules/tr46/')
and not file_path.startswith('third_party/node/node_modules/typescript/')
and not file_path.startswith('third_party/node/node_modules/vscode-uri/')
diff --git a/tools/scripts/version_resolver.py b/tools/scripts/version_resolver.py
index d94764f39..921e97f36 100644
--- a/tools/scripts/version_resolver.py
+++ b/tools/scripts/version_resolver.py
@@ -12,8 +12,8 @@ import json
import urllib3
import git_submodule as GitSubmodule
-chromium_version = '98.0.4758.90'
-chromium_branch = '4758'
+chromium_version = '102.0.5005.177'
+chromium_branch = '5005'
ninja_version = 'v1.8.2'
json_url = 'http://omahaproxy.appspot.com/all.json'