summaryrefslogtreecommitdiffstats
path: root/src/plugins/darwin
Commit message (Collapse)AuthorAgeFilesLines
* Add runJavascript() to C++ APIKaloyan Chehlarski2025-12-012-7/+9
| | | | | | | | | | | | | | | | | The API follows what we have in WebEngine, with an optional std::function callback. No world ID argument is provided, however; most of the backends don't support the concept. The new function is not exposed to QML, since we cannot expose std::function arguments. Instead, the existing QML API is kept, and calls to it simply redirect to the C++ implementation. Also removes runJavaScriptPrivate() from QWebView, and its related implementation details in the plugins. Task-number: QTBUG-131837 Change-Id: Idc1e492916e17caa3f061c0b2738b3c735837cf8 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Remove Q_SLOTS from backendsKaloyan Chehlarski2025-12-011-2/+0
| | | | | | | | | | All functions that used to be slots are called directly now, and keeping the Q_SLOTS around is unnecessary (and caused build failures on macOS) Task-number: QTBUG-131837 Change-Id: I75e59769bd0e570faba4226810e2513c6ac9e048 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Clean up and rename QAbstractWebView and QAbstractWebViewSettingsMichal Klocek2025-12-013-15/+12
| | | | | | | | These are really just private implementations. Task-number: QTBUG-131837 Change-Id: I0f70456ff78aa85a519e41d5b0e31b7086e8fc93 Reviewed-by: Moss Heim <moss.heim@qt.io>
* Clean up and rename qabstractwebview_p.h to qwebview_p.hMichal Klocek2025-12-011-1/+1
| | | | | | | | Prepare for proper private class for QWebView. Task-number: QTBUG-131837 Change-Id: I7303055370ff946cbc7be94ea54a4c57a57021ca Reviewed-by: Moss Heim <moss.heim@qt.io>
* Make QWebViewLoadRequest a public classKaloyan Chehlarski2025-12-011-12/+17
| | | | | | | | | | | Move LoadStatus enum from QWebView class to QWebLoadRequest class. Small adjustments to fix compile issues. Task-number: QTBUG-131837 Change-Id: I79b6a48b0426b177133502f75fb34af9d2120e46 Reviewed-by: Moss Heim <moss.heim@qt.io>
* Rename qwebview_p.h qwebviewloadrequest_p.hMichal Klocek2025-12-011-2/+2
| | | | | | | This class just removes _p suffix and fixes include headers. Change-Id: I4cc819631f9f8f969264da99f0e32b8b56735704 Reviewed-by: Moss Heim <moss.heim@qt.io>
* Cleanup QQuickWebView initializationMichal Klocek2025-11-281-0/+1
| | | | | | | | | | | | | | In case of QQuickWebview with web engine backend, we need to pass qt quick parent item. So far it was was done by setting parent for QWebView and then extracting it on web engine plugin backend's initialization. Add initialize() call instead. For time being use just QObject as parameter as it is only used by webengine to pass parent QQuickItem. Change-Id: I8d84313e93e2ad67ec1f008bee532f20b0d0a68e Reviewed-by: Moss Heim <moss.heim@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Darwin: Protect against use after freeMichal Klocek2025-11-281-12/+31
| | | | | | | | | In case 'plugin' get destroyed, make sure late callbacks do not use deleted objects. Done-by: Kaloyan Chehlarski <kaloyan.chehlarski@qt.io> Change-Id: I347d3ba8b0d570491fe252a090150b5e3cac6292 Reviewed-by: Moss Heim <moss.heim@qt.io>
* Emit signals only on public class (pimpl wise)Michal Klocek2025-11-281-29/+38
| | | | | | | | | | | | | | | | | | | | | | So far we emitted signals on qabstractwebview and then reemited it later from qwebview to quickwebview. Make emit directly from qwebview. Note this patch changes the expected progress to 100 for failed load. As this code was removed from QWebView::onLoadingChanged. if (loadRequest.m_status == QWebView::LoadFailedStatus) m_progress = 0; Note on windows plugin the loading progress is just boolean, moreover if it 'not loading' the load progress is 100, which would now give wrong value on first initialization (100), therefore add m_progress as workaround. Task-number: QTBUG-131837 Change-Id: I9cd003be3185ad956d35bbdbcf01a0349421a1d4 Reviewed-by: Moss Heim <moss.heim@qt.io>
* Use QWebView as parent window in backendsMichal Klocek2025-11-271-0/+8
| | | | | | | | | | | | | | | | | | | | | Each backend besides QtWebEngine, provides native window to be set by setContainedWindow in QQuickWebView. The android backend will have QWebView as parent window, the same as darwin plugin. Wasm and Webview2 do not create native child window. Note the wasm in handled in follow up commit. Note we do note make use of qquickwindow for webengine in this commit, we barely just store the pointer, or create the window if plugin was created without the qquickwindow. Change-Id: Ie98dc0103e353c280ebcb7add3c66f43d3618314 Reviewed-by: Moss Heim <moss.heim@qt.io>
* Pass the pointer to QWebView for private counterpartMichal Klocek2025-11-273-6/+5
| | | | | | | | | QAbstarctWebView is going to be base class of pimpl for QWebView. Change-Id: I58636bc5017092e1b9360d05109a305d49899043 Reviewed-by: Kaloyan Chehlarski <kaloyan.chehlarski@qt.io> Reviewed-by: Moss Heim <moss.heim@qt.io>
* Darwin: Return user agent when no custom one is setKaloyan Chehlarski2025-10-301-1/+1
| | | | | | | | The plugin previously returned an empty string when no custom agent was set. Change-Id: Ibf6f6ba87e9535532e609e6a5764f632d5e7974d Reviewed-by: Michael Brüning <michael.bruning@qt.io>
* Cleanup. Rename getSettings() to settings() in private classesKaloyan Chehlarski2025-10-282-2/+2
| | | | | | Task-number: QTBUG-131837 Change-Id: If86e9f707abcc0ef5916ea4c938fe59f6f270a7c Reviewed-by: Moss Heim <moss.heim@qt.io>
* Add url() virtual method to private classesKaloyan Chehlarski2025-10-271-1/+1
| | | | | | Task-number: QTBUG-131837 Change-Id: I28c33c9c688c4218a350524b254ca893a6dfd950 Reviewed-by: Moss Heim <moss.heim@qt.io>
* CRA mark src/Moss Heim2025-10-092-0/+2
| | | | | | | | | Some winrt plugin functions do data parsing but since this plugin is defunct, it is still marked with default security level. Fixes: QTBUG-135784 Change-Id: I99739cc762b1801fee65df7e08be17443cad157d Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Make tests based on runtime plugin settingMichal Klocek2025-06-261-1/+4
| | | | | | | | | | | | | Do not rely on compile time flags, as we can run the test with backend selected during runtime. Introduce WebViewFactory to hide the fact that webview tests uses quick apis. This should be all clean up when c++ api are introduced. Pick-to: 6.10 Change-Id: Ib630e828e6277061b84c1fe528c2d497ba4d0b4e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Make use of the new Window container classesChristian Strømme2025-03-182-164/+7
| | | | | | | | | | | | | | | | | With the new window container classes we no longer need our own implementation here in QtWebView, the new one is also much more powerful with better integration into the Qt scene(s). Also took the opportunity to get rid of the over complicated interfaces. Note: While wasm isn't officially supported, some support code was left to make sure it functions to a similar degree as before. Once wasm has better support for using the Window container the remaining code can be removed. Change-Id: If4af9a546bc230aa9fa69ba3fb6dfb8fcf1f0be6 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* macOS: Flip the switch and make the native back-end the defaultChristian Strømme2024-12-052-2/+11
| | | | | | | | | | | | | | | In practice this have been the case for anyone not installing QtWebEngine and the platform issue that we had, and that required special initialization set-up, hasn't been an issue and that code has been removed from 6.5 and newer (see: 5f15afaaf07586006b1731cadcb061fa23c71aef). With this change we'll use the native back-end by default on macOS. [ChangeLog][macOS] macOS will now use the native WebView backend by default, meaning QtWebEngine is no longer required on macOS. Change-Id: Iebcefddf93432c5184d495d286bdead679e423de Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Clean up unused url() web interfaceMichal Klocek2024-11-071-1/+1
| | | | | | | | | | | | | All the backends implement url(), however it is never used. The loadingChanged signal delivers url which is used later by qquickwebview. Make it less confusing and remove unused code paths. Note actually loadingChanged should be required interface. Change-Id: If410845a39b09c2ec4e8ffb177d334d807561860 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Add support for NSArray and NSDictionary in Darwin WebView's fromJSValueTor Arne Vestbø2024-08-161-1/+25
| | | | | | | | | | | | | To not have to write NSArray and NSDictionary conversion from scratch we round-trip via JSON. One quirk of this approach is that NSDate is supported as a standalone result object, but not nested in an array or dictionary, as NSJSONSerialization doesn't support that. But at least this brings us some of the way for array and dictionary support. Fixes: QTBUG-70166 Pick-to: 6.8 6.7 6.5 Change-Id: Ied8a261e964c5adbadb503efb0bb7812ef911b83 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* CMake: Fix multi-arch iOS builds due to absolute framework pathsAlexandru Croitor2023-11-021-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | find_library(FWWebKit WebKit) stores the absolute path to the framework of one of the sysroots, into FWWebKit. When building with CMake 3.27 targeting multi-arch iOS, this results in the following flag being passed to the compiler, regardless of the architecture/sysroot: -F/Applications/Xcode14.app/Contents/Developer/Platforms/ iPhoneOS.platform/Developer/SDKs/iPhoneOS16.2.sdk/ System/Library/Frameworks This causes warnings when building qdarwinwebview.mm regarding unsupported webkit features during the x86_64 simulator build. When combined with -Werror, it fails the build. Use qt_internal_find_apple_system_framework() instead of find_library(), to ensure we pass '-framework WebKit' instead of the absolute path to the framework. This avoids warnings and is cross-sysroot compatible. As a drive-by, also fix the lookup of the Foundation framework. It's called Foundation, not FoundationKit. Pick-to: 6.2 6.5 6.6 Task-number: QTBUG-118138 Change-Id: I4379f14d65a37470f08ae8e7f46e00b886eadaf1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Include what you need: <QPointer>Marc Mutz2023-10-131-0/+2
| | | | | | | | | | | | | | | | | | | | | | | All these TUs relied on transitive includes of qpointer.h, maybe to a large extent via qevent.h, though, given that qevent.h is more or less the only public QtBase header that includes qpointer.h, something else seems to be at play here. Said qevent.h actually needs QPointer in-name-only, so a forward declaration would suffice. Prepare for qevent.h dropping the include. The algorithm I used was: If the TU mentions 'passiveGrabbers', the name of the QEvent function that returns QPointers, and the TU doesn't have qpointer.h included explicitly, include it. That may produce False Positives, but better safe than sorry. Otherwise, in src/, add an include to all source and header files which mention QPointer. Exception: if foo.h of a foo.cpp already includes it, don't include again. Task-number: QTBUG-117670 Change-Id: I4f4f738e6dc46aec3e5772036cf2c94e6141c535 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix cookie comparison when removing cookiesChristian Strømme2023-06-141-1/+1
| | | | | | | | | Use isEqualToString to actually check the content of the NS strings. Task-number: QTBUG-114495 Pick-to: 6.6 6.5 6.5.2 Change-Id: Iadffee7e9b47286f347731639f094ae5cb748926 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix title updates in the darwin backendChristian Strømme2023-06-141-1/+7
| | | | | | | | | Use KVO the same way we do for the progress Task-number: QTBUG-114495 Pick-to: 6.6 6.5 6.5.2 Change-Id: I8fd9f6adaa1fba052d25e1480836dca61558351c Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Remove unneeded prep step in the Darwin pluginChristian Strømme2023-06-141-7/+0
| | | | | | | | QT_MAC_WANTS_LAYER is on by default on macOS now. Pick-to: 6.6 6.5 Change-Id: I1788e01056a572aaa73293a596dad4068f3f3bfd Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add settings API for QtWebViewChristian Strømme2022-10-272-2/+109
| | | | | | | | | | | | | Adds API and implementation for changing the settings of the WebView. [ChangeLog][General] Added settings API to make it possible to modify some of the WebView's built-in functionality. Task-number: QTBUG-97487 Task-number: QTBUG-98549 Change-Id: Ia121175ec08c96f56fd2148b02dccbc963fff244 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Fix assert when WebView is used in combination with QQuickWidgetChristian Strømme2022-10-273-1/+29
| | | | | | | | | | | | | | | Using the WebView with QQuickWidget is not really a use-case the WebView is well suited for, due to the native WebView being an overlay, however it should not crash or trigger an assert, so this change tries to avoid some of the caveats when mixing with QQuickWidget. For example, we cannot under any circumstances call winId() before the window the QQuickWidget lives under, is backed by a platform window. The native WebView is therefore not added before the platform window is created. Pick-to: 6.4 6.2 5.15 Fixes: QTBUG-46084 Change-Id: I815d37cdd0328b3a258ef60294b5ea282f41cfc6 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-231-1/+1
| | | | | | | Task-number: QTBUG-105718 Change-Id: I824b873d98c922af8a4a290dcd797a2135d1147f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Add license headers to cmake filesLucie Gérard2022-07-071-0/+3
| | | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: Iff8b50e402d070ba5fa2562fef50b7d7d3743cb4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Fix CMake warning about using PUBLIC_LIBRARIES for pluginsChristian Strømme2022-06-171-1/+0
| | | | | | Pick-to: 6.4 6.3 Change-Id: I1832215bb1c0904aa21b511db79803f2d6570324 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-103-114/+6
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I0f719de9e6e1fd4a7c50a247831e5a768e08df14 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Use up-to date LGPL license headerKai Köhne2022-02-143-33/+42
| | | | | | | | | | | | | Remove usages of outdated LGPL3 header that references LICENSES.LGPLv3 instead of LICENSES.LGPL3. Use BSD instead in the examples, updated LGPL otherwise. Also remove the now unreferenced LICENSE.LGPLv3, LICENSE.GPLv2 files, and instead the newly referenced files instead. Pick-to: 6.2 6.3 Change-Id: I01e1325ee2c7a147e095c08b370b88ded9a8daff Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* Add support functions to manage cookiesAgnieszka Jaworska2021-12-142-0/+71
| | | | | | | | | Setting and deleting cookies, changes for android, darwin and webengine plugins Pick-to: 6.3 Task-number: QTBUG-96204 Change-Id: I4f79d34384e490b70a1e9f89196dd113733d5fe1 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* CMake: Use renamed qt6_add_plugin PLUGIN_TYPE optionAlexandru Croitor2021-08-121-1/+1
| | | | | | | Task-number: QTBUG-95170 Pick-to: 6.2 Change-Id: Id3a2ece3a3d2fa2eadb78fa5dc558466654c42a6 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Remove qmake filesMichal Klocek2021-06-171-22/+0
| | | | | | Pick-to: 6.2 Change-Id: I04c6f3f6bdfadcddac6d79440d6e292241bc50cd Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Add cmake buildMichal Klocek2021-06-021-0/+33
| | | | | | | | | Update dependencies to latest shas. Fix compilation issues. Task-number: QTBUG-88620 Change-Id: I0c82431e6ffd142302cce12e6ee74d2139e1e42f Reviewed-by: Christian Strømme <christian.stromme@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Replace 0 with nullptrAllan Sandfeld Jensen2021-02-021-1/+1
| | | | | Change-Id: I9d225accdf7d7f91efd189588453d2a39f2a11e7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Replace Q_DECL_OVERRIDE with overrideAllan Sandfeld Jensen2021-02-021-24/+24
| | | | | Change-Id: I3ebce12c9b14cd413f06eb36b836b1e10adbbed6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add QtWebView::WebView::httpUserAgent propertyArmin Felder2019-05-152-0/+15
| | | | | | | | | The httpUserAgent property allows to get and set the User Agent. Task-number: QTBUG-68746 Change-Id: I12fb5da00b14ecba53e71c532f2c8401f8f2a009 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* iOS: Check if the external browser can open the url firstAndy Shaw2019-01-081-1/+7
| | | | | | | | | | | | | If the external browser cannot open the url (as can be the case with file schemes) then it should fall back to using the same webview instead so that the link is not ignored. [ChangeLog][Platform Specific Changes][iOS] Now opens links with _blank target in the current WebView if the external browser cannot open them. Fixes: QTBUG-63963 Change-Id: Ibd77c82a084d130e034c4d98ba9b08bb5cdf5743 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* iOS: Keep the navigation object passed into didStart for finishingAndy Shaw2018-11-292-26/+26
| | | | | | | | | | Instead of relying on the different frames to fail or finish as this is not reliable in iOS 12 we check if the navigation object passed into didFinish is the last one we got in didStart. At that point we can assume that the page has in fact finished loading. Change-Id: I06c20863b27a384d3532c06a18723ad5d3347363 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* Darwin: open links with target="_blank" externallyv5.11.0-beta4Jason Erb2018-04-051-0/+4
| | | | | | | | | Without this change, such links do not open at all. Task-number: QTBUG-67293 Change-Id: I15e7944dc75271948c6356ac9f949333039b9671 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Darwin: Implement didFailNavigation to handle when an error occursv5.11.0-beta3Andy Shaw2018-03-211-12/+27
| | | | | | | | | | | When an error occurs during navigation then didFailNavigation will be called. As didFailProvisionalNavigation is not called in this case then we need to handle it in the same way to ensure the request count is correctly decremented. Change-Id: Ib0bab408c4d8a54a1f1e7e0b1c3832f05cd10f65 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* Remove AppKit dependency from iOSv5.11.0-beta2v5.11.0-beta1Jason Erb2018-02-231-1/+2
| | | | | | Task-number: QTBUG-66552 Change-Id: Ic5f4947a6da425e229e66b293f0c156b1049ef3f Reviewed-by: Christian Stromme <christian.stromme@qt.io>
* Remove obsolete code pathsJake Petroules2018-02-121-8/+4
| | | | | Change-Id: I0608503fd0db30bf409893cab754b66952210eff Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
* Make QtWebView plugin basedChristian Stromme2018-01-265-0/+664
This removes the hard build dependency to QtWebEngine, which opens up the possibility for QtWebEngine, or others, to provide their own plugin. Another benefit of having the backends loaded at run-time, is that we can provide an alternative for developers that wants to publish their application in the App Store, where shipping QtWebEngine isn't an option, due to store policies, and where we already have an alternative/experimental backend that can be used. [ChangeLog][WebView] QtWebView will now load its backends at run-time. Task-number: QTBUG-63137 Change-Id: I581940fe4c3b5e6bb41896367d3163ac8bc7b6b9 Reviewed-by: Kai Koehne <kai.koehne@qt.io>