WebKit Bugzilla
Attachment 356723 Details for
Bug 191464
: [WPE] Add Qt extension
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-191464-20181206101112.patch (text/plain), 111.00 KB, created by
Philippe Normand
on 2018-12-06 02:11:14 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Philippe Normand
Created:
2018-12-06 02:11:14 PST
Size:
111.00 KB
patch
obsolete
>Subversion Revision: 238927 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index d250437cf9bdabde199f55999811bb297861b2ba..cc0c5e66fbf3512a5880d246e9422e4774cc3949 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,98 @@ >+2018-12-06 Philippe Normand <pnormand@igalia.com> >+ >+ [WPE] Add Qt extension >+ https://bugs.webkit.org/show_bug.cgi?id=191464 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This new extension is a QML plugin embedding a WPE ViewBackend >+ implementation. It provides a public API very similar to Qt's >+ WebView module. It comes with a simple mini-browser implemented in >+ QML. >+ >+ QtWPE is known to work with the Wayland-EGL (in GNOME and Weston >+ compositors) and EGLFS QPAs. >+ >+ For commodity purposes a Flatpak build manifest is available but >+ nothing prevents distributors to ship this extension as a >+ standalone module because it uses a regular QMake build-system >+ along with WebKit's CMake build-system. >+ >+ * CMakeLists.txt: >+ * UIProcess/API/QtWPE/CMakeLists.txt: Added. >+ * UIProcess/API/QtWPE/COPYING.LGPL2: Added. >+ * UIProcess/API/QtWPE/QtViewBackend.cpp: Added. >+ (configureCallback): >+ (QtViewBackend::QtViewBackend): >+ (QtViewBackend::configureGlibEglDisplay): >+ (QtViewBackend::configureEglDisplay): >+ (QtViewBackend::initialize): >+ (QtViewBackend::backend const): >+ (QtViewBackend::resize): >+ (QtViewBackend::getTexture): >+ (QtViewBackend::initSurface): >+ (QtViewBackend::displayBuffer): >+ (QtViewBackend::modifiers const): >+ (QtViewBackend::dispatchHoverEnterEvent): >+ (QtViewBackend::dispatchHoverLeaveEvent): >+ (QtViewBackend::dispatchHoverMoveEvent): >+ (QtViewBackend::dispatchMousePressEvent): >+ (QtViewBackend::dispatchMouseReleaseEvent): >+ (QtViewBackend::dispatchWheelEvent): >+ (QtViewBackend::dispatchKeyEvent): >+ (QtViewBackend::dispatchTouchEvent): >+ * UIProcess/API/QtWPE/QtViewBackend.h: Added. >+ * UIProcess/API/QtWPE/qmldir: Added. >+ * UIProcess/API/QtWPE/qtwpe.pro: Added. >+ * UIProcess/API/QtWPE/qtwpe_plugin.cpp: Added. >+ (QtwpePlugin::registerTypes): >+ * UIProcess/API/QtWPE/qtwpe_plugin.h: Added. >+ * UIProcess/API/QtWPE/wpeview.cpp: Added. >+ (WPEView::WPEView): >+ (WPEView::~WPEView): >+ (WPEView::geometryChanged): >+ (WPEView::configureWindow): >+ (WPEView::createOffscreen): >+ (WPEView::backendCreated): >+ (WPEView::notifyUrlChangedCallback): >+ (WPEView::notifyTitleChangedCallback): >+ (WPEView::notifyLoadProgressCallback): >+ (WPEView::notifyLoadChangedCallback): >+ (WPEView::notifyLoadFailedCallback): >+ (WPEView::updatePaintNode): >+ (WPEView::url const): >+ (WPEView::setUrl): >+ (WPEView::loadProgress const): >+ (WPEView::title const): >+ (WPEView::canGoBack const): >+ (WPEView::isLoading const): >+ (WPEView::canGoForward const): >+ (WPEView::goBack): >+ (WPEView::goForward): >+ (WPEView::reload): >+ (WPEView::stop): >+ (WPEView::loadHtml): >+ (jsAsyncReadyCallback): >+ (WPEView::handleJsResult): >+ (WPEView::runJavaScript): >+ (WPEView::mousePressEvent): >+ (WPEView::mouseReleaseEvent): >+ (WPEView::hoverEnterEvent): >+ (WPEView::hoverLeaveEvent): >+ (WPEView::hoverMoveEvent): >+ (WPEView::wheelEvent): >+ (WPEView::keyPressEvent): >+ (WPEView::keyReleaseEvent): >+ (WPEView::touchEvent): >+ * UIProcess/API/QtWPE/wpeview.h: Added. >+ * UIProcess/API/QtWPE/wpeviewloadrequest.cpp: Added. >+ (WPEViewLoadRequest::WPEViewLoadRequest): >+ (WPEViewLoadRequest::~WPEViewLoadRequest): >+ (WPEViewLoadRequest::url const): >+ (WPEViewLoadRequest::status const): >+ (WPEViewLoadRequest::errorString const): >+ * UIProcess/API/QtWPE/wpeviewloadrequest.h: Added. >+ > 2018-12-05 Ryosuke Niwa <rniwa@webkit.org> > > REGRESSION(PSON): Process swapping code doesn't set DisplayID in WebContent process >diff --git a/Source/WebKit/CMakeLists.txt b/Source/WebKit/CMakeLists.txt >index 6db1e9118a6994f945f38f1af2dfaca20b8c3d84..c76cb5deb6f2b0b79c6932b4e7eed31fcadd39f2 100644 >--- a/Source/WebKit/CMakeLists.txt >+++ b/Source/WebKit/CMakeLists.txt >@@ -474,3 +474,7 @@ else () > RUNTIME DESTINATION "${LIBEXEC_INSTALL_DIR}" > ) > endif () >+ >+if ("${PORT}" STREQUAL "WPE") >+ add_subdirectory(UIProcess/API/QtWPE) >+endif () >diff --git a/Source/WebKit/UIProcess/API/QtWPE/CMakeLists.txt b/Source/WebKit/UIProcess/API/QtWPE/CMakeLists.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..6a002e210a1e67b77ff34189549d372c5779568e >--- /dev/null >+++ b/Source/WebKit/UIProcess/API/QtWPE/CMakeLists.txt >@@ -0,0 +1,63 @@ >+# NOTE: This CMake file should only be used within WebKit's build system. To >+# build QtWPE as a standalone project please use the qmake build definitions. >+ >+include(GNUInstallDirs) >+ >+set(qtwpe_SOURCES >+ QtViewBackend.cpp >+ qtwpe_plugin.cpp >+ wpeview.cpp >+ wpeviewloadrequest.cpp >+) >+ >+set(qtwpe_HEADERS >+ QtViewBackend.h >+ qtwpe_plugin.h >+ wpeview.h >+ wpeviewloadrequest.h >+) >+ >+find_package(Qt5 QUIET COMPONENTS Core Quick Gui) >+ >+if (Qt5_FOUND) >+ find_package(PkgConfig) >+ pkg_check_modules(WPE_FDO_DEP REQUIRED wpebackend-fdo-0.1) >+ >+ set(qtwpe_LIBRARIES >+ Qt5::Core Qt5::Quick >+ WebKit >+ ${LIBEPOXY_LIBRARIES} >+ ${WPE_FDO_DEP_LIBRARIES} >+ ) >+ >+ set(qtwpe_INCLUDE_DIRECTORIES >+ ${Qt5_INCLUDE_DIRS} >+ ${Qt5Gui_PRIVATE_INCLUDE_DIRS} >+ ${LIBEPOXY_INCLUDE_DIRS} >+ ${WPE_FDO_DEP_INCLUDE_DIRS} >+ ) >+ >+ add_definitions(-DQT_NO_KEYWORDS=1) >+ set(CMAKE_AUTOMOC ON) >+ >+ if (DEVELOPER_MODE) >+ add_definitions(-DWEBKIT_INJECTED_BUNDLE_PATH="${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") >+ endif () >+ >+ add_library(qtwpe SHARED ${qtwpe_SOURCES} ${qtwpe_HEADERS}) >+ set_property(TARGET qtwpe PROPERTY OUTPUT_NAME qtwpe) >+ target_link_libraries(qtwpe ${qtwpe_LIBRARIES}) >+ target_include_directories(qtwpe SYSTEM PRIVATE ${qtwpe_INCLUDE_DIRECTORIES}) >+ install(TARGETS qtwpe DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/qt5/qml/org/wpewebkit/qtwpe/") >+ >+ file(MAKE_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/qml/org/wpewebkit/qtwpe) >+ add_custom_command(TARGET qtwpe POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy >+ ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libqtwpe.so >+ ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/qml/org/wpewebkit/qtwpe) >+ add_custom_command(TARGET qtwpe POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy >+ ${CMAKE_CURRENT_SOURCE_DIR}/qmldir >+ ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/qml/org/wpewebkit/qtwpe) >+ >+else () >+ message(WARNING "Qt5 development libraries not found. QtWPE will not be built") >+endif () >diff --git a/Source/WebKit/UIProcess/API/QtWPE/COPYING.LGPL2 b/Source/WebKit/UIProcess/API/QtWPE/COPYING.LGPL2 >new file mode 100644 >index 0000000000000000000000000000000000000000..c87cfe8c990d3d4b562f8dc6a6980a3bcd62387b >--- /dev/null >+++ b/Source/WebKit/UIProcess/API/QtWPE/COPYING.LGPL2 >@@ -0,0 +1,481 @@ >+ GNU LIBRARY GENERAL PUBLIC LICENSE >+ Version 2, June 1991 >+ >+ Copyright (C) 1991 Free Software Foundation, Inc. >+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA >+ Everyone is permitted to copy and distribute verbatim copies >+ of this license document, but changing it is not allowed. >+ >+[This is the first released version of the library GPL. It is >+ numbered 2 because it goes with version 2 of the ordinary GPL.] >+ >+ Preamble >+ >+ The licenses for most software are designed to take away your >+freedom to share and change it. By contrast, the GNU General Public >+Licenses are intended to guarantee your freedom to share and change >+free software--to make sure the software is free for all its users. >+ >+ This license, the Library General Public License, applies to some >+specially designated Free Software Foundation software, and to any >+other libraries whose authors decide to use it. You can use it for >+your libraries, too. >+ >+ When we speak of free software, we are referring to freedom, not >+price. Our General Public Licenses are designed to make sure that you >+have the freedom to distribute copies of free software (and charge for >+this service if you wish), that you receive source code or can get it >+if you want it, that you can change the software or use pieces of it >+in new free programs; and that you know you can do these things. >+ >+ To protect your rights, we need to make restrictions that forbid >+anyone to deny you these rights or to ask you to surrender the rights. >+These restrictions translate to certain responsibilities for you if >+you distribute copies of the library, or if you modify it. >+ >+ For example, if you distribute copies of the library, whether gratis >+or for a fee, you must give the recipients all the rights that we gave >+you. You must make sure that they, too, receive or can get the source >+code. If you link a program with the library, you must provide >+complete object files to the recipients so that they can relink them >+with the library, after making changes to the library and recompiling >+it. And you must show them these terms so they know their rights. >+ >+ Our method of protecting your rights has two steps: (1) copyright >+the library, and (2) offer you this license which gives you legal >+permission to copy, distribute and/or modify the library. >+ >+ Also, for each distributor's protection, we want to make certain >+that everyone understands that there is no warranty for this free >+library. If the library is modified by someone else and passed on, we >+want its recipients to know that what they have is not the original >+version, so that any problems introduced by others will not reflect on >+the original authors' reputations. >+ >+ Finally, any free program is threatened constantly by software >+patents. We wish to avoid the danger that companies distributing free >+software will individually obtain patent licenses, thus in effect >+transforming the program into proprietary software. To prevent this, >+we have made it clear that any patent must be licensed for everyone's >+free use or not licensed at all. >+ >+ Most GNU software, including some libraries, is covered by the ordinary >+GNU General Public License, which was designed for utility programs. This >+license, the GNU Library General Public License, applies to certain >+designated libraries. This license is quite different from the ordinary >+one; be sure to read it in full, and don't assume that anything in it is >+the same as in the ordinary license. >+ >+ The reason we have a separate public license for some libraries is that >+they blur the distinction we usually make between modifying or adding to a >+program and simply using it. Linking a program with a library, without >+changing the library, is in some sense simply using the library, and is >+analogous to running a utility program or application program. However, in >+a textual and legal sense, the linked executable is a combined work, a >+derivative of the original library, and the ordinary General Public License >+treats it as such. >+ >+ Because of this blurred distinction, using the ordinary General >+Public License for libraries did not effectively promote software >+sharing, because most developers did not use the libraries. We >+concluded that weaker conditions might promote sharing better. >+ >+ However, unrestricted linking of non-free programs would deprive the >+users of those programs of all benefit from the free status of the >+libraries themselves. This Library General Public License is intended to >+permit developers of non-free programs to use free libraries, while >+preserving your freedom as a user of such programs to change the free >+libraries that are incorporated in them. (We have not seen how to achieve >+this as regards changes in header files, but we have achieved it as regards >+changes in the actual functions of the Library.) The hope is that this >+will lead to faster development of free libraries. >+ >+ The precise terms and conditions for copying, distribution and >+modification follow. Pay close attention to the difference between a >+"work based on the library" and a "work that uses the library". The >+former contains code derived from the library, while the latter only >+works together with the library. >+ >+ Note that it is possible for a library to be covered by the ordinary >+General Public License rather than by this special one. >+ >+ GNU LIBRARY GENERAL PUBLIC LICENSE >+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION >+ >+ 0. This License Agreement applies to any software library which >+contains a notice placed by the copyright holder or other authorized >+party saying it may be distributed under the terms of this Library >+General Public License (also called "this License"). Each licensee is >+addressed as "you". >+ >+ A "library" means a collection of software functions and/or data >+prepared so as to be conveniently linked with application programs >+(which use some of those functions and data) to form executables. >+ >+ The "Library", below, refers to any such software library or work >+which has been distributed under these terms. A "work based on the >+Library" means either the Library or any derivative work under >+copyright law: that is to say, a work containing the Library or a >+portion of it, either verbatim or with modifications and/or translated >+straightforwardly into another language. (Hereinafter, translation is >+included without limitation in the term "modification".) >+ >+ "Source code" for a work means the preferred form of the work for >+making modifications to it. For a library, complete source code means >+all the source code for all modules it contains, plus any associated >+interface definition files, plus the scripts used to control compilation >+and installation of the library. >+ >+ Activities other than copying, distribution and modification are not >+covered by this License; they are outside its scope. The act of >+running a program using the Library is not restricted, and output from >+such a program is covered only if its contents constitute a work based >+on the Library (independent of the use of the Library in a tool for >+writing it). Whether that is true depends on what the Library does >+and what the program that uses the Library does. >+ >+ 1. You may copy and distribute verbatim copies of the Library's >+complete source code as you receive it, in any medium, provided that >+you conspicuously and appropriately publish on each copy an >+appropriate copyright notice and disclaimer of warranty; keep intact >+all the notices that refer to this License and to the absence of any >+warranty; and distribute a copy of this License along with the >+Library. >+ >+ You may charge a fee for the physical act of transferring a copy, >+and you may at your option offer warranty protection in exchange for a >+fee. >+ >+ 2. You may modify your copy or copies of the Library or any portion >+of it, thus forming a work based on the Library, and copy and >+distribute such modifications or work under the terms of Section 1 >+above, provided that you also meet all of these conditions: >+ >+ a) The modified work must itself be a software library. >+ >+ b) You must cause the files modified to carry prominent notices >+ stating that you changed the files and the date of any change. >+ >+ c) You must cause the whole of the work to be licensed at no >+ charge to all third parties under the terms of this License. >+ >+ d) If a facility in the modified Library refers to a function or a >+ table of data to be supplied by an application program that uses >+ the facility, other than as an argument passed when the facility >+ is invoked, then you must make a good faith effort to ensure that, >+ in the event an application does not supply such function or >+ table, the facility still operates, and performs whatever part of >+ its purpose remains meaningful. >+ >+ (For example, a function in a library to compute square roots has >+ a purpose that is entirely well-defined independent of the >+ application. Therefore, Subsection 2d requires that any >+ application-supplied function or table used by this function must >+ be optional: if the application does not supply it, the square >+ root function must still compute square roots.) >+ >+These requirements apply to the modified work as a whole. If >+identifiable sections of that work are not derived from the Library, >+and can be reasonably considered independent and separate works in >+themselves, then this License, and its terms, do not apply to those >+sections when you distribute them as separate works. But when you >+distribute the same sections as part of a whole which is a work based >+on the Library, the distribution of the whole must be on the terms of >+this License, whose permissions for other licensees extend to the >+entire whole, and thus to each and every part regardless of who wrote >+it. >+ >+Thus, it is not the intent of this section to claim rights or contest >+your rights to work written entirely by you; rather, the intent is to >+exercise the right to control the distribution of derivative or >+collective works based on the Library. >+ >+In addition, mere aggregation of another work not based on the Library >+with the Library (or with a work based on the Library) on a volume of >+a storage or distribution medium does not bring the other work under >+the scope of this License. >+ >+ 3. You may opt to apply the terms of the ordinary GNU General Public >+License instead of this License to a given copy of the Library. To do >+this, you must alter all the notices that refer to this License, so >+that they refer to the ordinary GNU General Public License, version 2, >+instead of to this License. (If a newer version than version 2 of the >+ordinary GNU General Public License has appeared, then you can specify >+that version instead if you wish.) Do not make any other change in >+these notices. >+ >+ Once this change is made in a given copy, it is irreversible for >+that copy, so the ordinary GNU General Public License applies to all >+subsequent copies and derivative works made from that copy. >+ >+ This option is useful when you wish to copy part of the code of >+the Library into a program that is not a library. >+ >+ 4. You may copy and distribute the Library (or a portion or >+derivative of it, under Section 2) in object code or executable form >+under the terms of Sections 1 and 2 above provided that you accompany >+it with the complete corresponding machine-readable source code, which >+must be distributed under the terms of Sections 1 and 2 above on a >+medium customarily used for software interchange. >+ >+ If distribution of object code is made by offering access to copy >+from a designated place, then offering equivalent access to copy the >+source code from the same place satisfies the requirement to >+distribute the source code, even though third parties are not >+compelled to copy the source along with the object code. >+ >+ 5. A program that contains no derivative of any portion of the >+Library, but is designed to work with the Library by being compiled or >+linked with it, is called a "work that uses the Library". Such a >+work, in isolation, is not a derivative work of the Library, and >+therefore falls outside the scope of this License. >+ >+ However, linking a "work that uses the Library" with the Library >+creates an executable that is a derivative of the Library (because it >+contains portions of the Library), rather than a "work that uses the >+library". The executable is therefore covered by this License. >+Section 6 states terms for distribution of such executables. >+ >+ When a "work that uses the Library" uses material from a header file >+that is part of the Library, the object code for the work may be a >+derivative work of the Library even though the source code is not. >+Whether this is true is especially significant if the work can be >+linked without the Library, or if the work is itself a library. The >+threshold for this to be true is not precisely defined by law. >+ >+ If such an object file uses only numerical parameters, data >+structure layouts and accessors, and small macros and small inline >+functions (ten lines or less in length), then the use of the object >+file is unrestricted, regardless of whether it is legally a derivative >+work. (Executables containing this object code plus portions of the >+Library will still fall under Section 6.) >+ >+ Otherwise, if the work is a derivative of the Library, you may >+distribute the object code for the work under the terms of Section 6. >+Any executables containing that work also fall under Section 6, >+whether or not they are linked directly with the Library itself. >+ >+ 6. As an exception to the Sections above, you may also compile or >+link a "work that uses the Library" with the Library to produce a >+work containing portions of the Library, and distribute that work >+under terms of your choice, provided that the terms permit >+modification of the work for the customer's own use and reverse >+engineering for debugging such modifications. >+ >+ You must give prominent notice with each copy of the work that the >+Library is used in it and that the Library and its use are covered by >+this License. You must supply a copy of this License. If the work >+during execution displays copyright notices, you must include the >+copyright notice for the Library among them, as well as a reference >+directing the user to the copy of this License. Also, you must do one >+of these things: >+ >+ a) Accompany the work with the complete corresponding >+ machine-readable source code for the Library including whatever >+ changes were used in the work (which must be distributed under >+ Sections 1 and 2 above); and, if the work is an executable linked >+ with the Library, with the complete machine-readable "work that >+ uses the Library", as object code and/or source code, so that the >+ user can modify the Library and then relink to produce a modified >+ executable containing the modified Library. (It is understood >+ that the user who changes the contents of definitions files in the >+ Library will not necessarily be able to recompile the application >+ to use the modified definitions.) >+ >+ b) Accompany the work with a written offer, valid for at >+ least three years, to give the same user the materials >+ specified in Subsection 6a, above, for a charge no more >+ than the cost of performing this distribution. >+ >+ c) If distribution of the work is made by offering access to copy >+ from a designated place, offer equivalent access to copy the above >+ specified materials from the same place. >+ >+ d) Verify that the user has already received a copy of these >+ materials or that you have already sent this user a copy. >+ >+ For an executable, the required form of the "work that uses the >+Library" must include any data and utility programs needed for >+reproducing the executable from it. However, as a special exception, >+the source code distributed need not include anything that is normally >+distributed (in either source or binary form) with the major >+components (compiler, kernel, and so on) of the operating system on >+which the executable runs, unless that component itself accompanies >+the executable. >+ >+ It may happen that this requirement contradicts the license >+restrictions of other proprietary libraries that do not normally >+accompany the operating system. Such a contradiction means you cannot >+use both them and the Library together in an executable that you >+distribute. >+ >+ 7. You may place library facilities that are a work based on the >+Library side-by-side in a single library together with other library >+facilities not covered by this License, and distribute such a combined >+library, provided that the separate distribution of the work based on >+the Library and of the other library facilities is otherwise >+permitted, and provided that you do these two things: >+ >+ a) Accompany the combined library with a copy of the same work >+ based on the Library, uncombined with any other library >+ facilities. This must be distributed under the terms of the >+ Sections above. >+ >+ b) Give prominent notice with the combined library of the fact >+ that part of it is a work based on the Library, and explaining >+ where to find the accompanying uncombined form of the same work. >+ >+ 8. You may not copy, modify, sublicense, link with, or distribute >+the Library except as expressly provided under this License. Any >+attempt otherwise to copy, modify, sublicense, link with, or >+distribute the Library is void, and will automatically terminate your >+rights under this License. However, parties who have received copies, >+or rights, from you under this License will not have their licenses >+terminated so long as such parties remain in full compliance. >+ >+ 9. You are not required to accept this License, since you have not >+signed it. However, nothing else grants you permission to modify or >+distribute the Library or its derivative works. These actions are >+prohibited by law if you do not accept this License. Therefore, by >+modifying or distributing the Library (or any work based on the >+Library), you indicate your acceptance of this License to do so, and >+all its terms and conditions for copying, distributing or modifying >+the Library or works based on it. >+ >+ 10. Each time you redistribute the Library (or any work based on the >+Library), the recipient automatically receives a license from the >+original licensor to copy, distribute, link with or modify the Library >+subject to these terms and conditions. You may not impose any further >+restrictions on the recipients' exercise of the rights granted herein. >+You are not responsible for enforcing compliance by third parties to >+this License. >+ >+ 11. If, as a consequence of a court judgment or allegation of patent >+infringement or for any other reason (not limited to patent issues), >+conditions are imposed on you (whether by court order, agreement or >+otherwise) that contradict the conditions of this License, they do not >+excuse you from the conditions of this License. If you cannot >+distribute so as to satisfy simultaneously your obligations under this >+License and any other pertinent obligations, then as a consequence you >+may not distribute the Library at all. For example, if a patent >+license would not permit royalty-free redistribution of the Library by >+all those who receive copies directly or indirectly through you, then >+the only way you could satisfy both it and this License would be to >+refrain entirely from distribution of the Library. >+ >+If any portion of this section is held invalid or unenforceable under any >+particular circumstance, the balance of the section is intended to apply, >+and the section as a whole is intended to apply in other circumstances. >+ >+It is not the purpose of this section to induce you to infringe any >+patents or other property right claims or to contest validity of any >+such claims; this section has the sole purpose of protecting the >+integrity of the free software distribution system which is >+implemented by public license practices. Many people have made >+generous contributions to the wide range of software distributed >+through that system in reliance on consistent application of that >+system; it is up to the author/donor to decide if he or she is willing >+to distribute software through any other system and a licensee cannot >+impose that choice. >+ >+This section is intended to make thoroughly clear what is believed to >+be a consequence of the rest of this License. >+ >+ 12. If the distribution and/or use of the Library is restricted in >+certain countries either by patents or by copyrighted interfaces, the >+original copyright holder who places the Library under this License may add >+an explicit geographical distribution limitation excluding those countries, >+so that distribution is permitted only in or among countries not thus >+excluded. In such case, this License incorporates the limitation as if >+written in the body of this License. >+ >+ 13. The Free Software Foundation may publish revised and/or new >+versions of the Library General Public License from time to time. >+Such new versions will be similar in spirit to the present version, >+but may differ in detail to address new problems or concerns. >+ >+Each version is given a distinguishing version number. If the Library >+specifies a version number of this License which applies to it and >+"any later version", you have the option of following the terms and >+conditions either of that version or of any later version published by >+the Free Software Foundation. If the Library does not specify a >+license version number, you may choose any version ever published by >+the Free Software Foundation. >+ >+ 14. If you wish to incorporate parts of the Library into other free >+programs whose distribution conditions are incompatible with these, >+write to the author to ask for permission. For software which is >+copyrighted by the Free Software Foundation, write to the Free >+Software Foundation; we sometimes make exceptions for this. Our >+decision will be guided by the two goals of preserving the free status >+of all derivatives of our free software and of promoting the sharing >+and reuse of software generally. >+ >+ NO WARRANTY >+ >+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO >+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. >+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR >+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY >+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE >+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE >+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME >+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. >+ >+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN >+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY >+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU >+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR >+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE >+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING >+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A >+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF >+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH >+DAMAGES. >+ >+ END OF TERMS AND CONDITIONS >+ >+ Appendix: How to Apply These Terms to Your New Libraries >+ >+ If you develop a new library, and you want it to be of the greatest >+possible use to the public, we recommend making it free software that >+everyone can redistribute and change. You can do so by permitting >+redistribution under these terms (or, alternatively, under the terms of the >+ordinary General Public License). >+ >+ To apply these terms, attach the following notices to the library. It is >+safest to attach them to the start of each source file to most effectively >+convey the exclusion of warranty; and each file should have at least the >+"copyright" line and a pointer to where the full notice is found. >+ >+ <one line to give the library's name and a brief idea of what it does.> >+ Copyright (C) <year> <name of author> >+ >+ 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; if not, write to the Free >+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. >+ >+Also add information on how to contact you by electronic and paper mail. >+ >+You should also get your employer (if you work as a programmer) or your >+school, if any, to sign a "copyright disclaimer" for the library, if >+necessary. Here is a sample; alter the names: >+ >+ Yoyodyne, Inc., hereby disclaims all copyright interest in the >+ library `Frob' (a library for tweaking knobs) written by James Random Hacker. >+ >+ <signature of Ty Coon>, 1 April 1990 >+ Ty Coon, President of Vice >+ >+That's all there is to it! >diff --git a/Source/WebKit/UIProcess/API/QtWPE/QtViewBackend.cpp b/Source/WebKit/UIProcess/API/QtWPE/QtViewBackend.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..2f18028e4b4e77a99f35cccb32f78eeaafb9cea6 >--- /dev/null >+++ b/Source/WebKit/UIProcess/API/QtWPE/QtViewBackend.cpp >@@ -0,0 +1,409 @@ >+/* QtWPE >+ * >+ * Copyright (C) 2018 Igalia S.L >+ * Copyright (C) 2018 Zodiac Inflight Innovations >+ * >+ * 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; if not, write to the >+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ */ >+ >+#include "QtViewBackend.h" >+ >+#include <QGuiApplication> >+#include <QOpenGLFunctions> >+#include <glib.h> >+ >+struct EGLConfigurationData { >+ QOpenGLContext* context; >+ EGLDisplay display; >+ QtViewBackend* backend; >+}; >+ >+static gboolean configureCallback(gpointer data) >+{ >+ EGLConfigurationData* configData = reinterpret_cast<EGLConfigurationData*>(data); >+ configData->backend->configureEglDisplay(configData->context, configData->display); >+ return G_SOURCE_REMOVE; >+} >+ >+static PFNGLEGLIMAGETARGETTEXTURE2DOESPROC imageTargetTexture2DOES; >+ >+QtViewBackend::QtViewBackend(QtViewBackendClient* client, const QRectF& geometry, qreal refreshRate) >+ : m_lockedImage(EGL_NO_IMAGE_KHR) >+ , m_client(client) >+ , m_geometry(geometry) >+ , m_refreshRate(refreshRate) >+ , m_textureId(0) >+{ >+#if defined(WPE_BACKEND_CHECK_VERSION) && WPE_BACKEND_CHECK_VERSION(0, 2, 0) >+ wpe_loader_init("libWPEBackend-fdo-0.1.so"); >+#endif >+} >+ >+void QtViewBackend::configureGlibEglDisplay(QOpenGLContext* context, EGLDisplay display) >+{ >+ EGLConfigurationData* configData = g_new0(EGLConfigurationData, 1); >+ configData->context = context; >+ configData->display = display; >+ configData->backend = this; >+ g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, configureCallback, configData, g_free); >+} >+ >+void QtViewBackend::configureEglDisplay(QOpenGLContext* context, EGLDisplay display) >+{ >+ m_eglDisplay = display; >+ if (!initialize()) >+ return; >+ >+ imageTargetTexture2DOES = reinterpret_cast<PFNGLEGLIMAGETARGETTEXTURE2DOESPROC>(eglGetProcAddress("glEGLImageTargetTexture2DOES")); >+ >+ { >+ static const char* vertexShaderSource = >+ "attribute vec2 pos;\n" >+ "attribute vec2 texture;\n" >+ "varying vec2 v_texture;\n" >+ "void main() {\n" >+ " v_texture = texture;\n" >+ " gl_Position = vec4(pos, 0, 1);\n" >+ "}\n"; >+ static const char* fragmentShaderSource = >+ "precision mediump float;\n" >+ "uniform sampler2D u_texture;\n" >+ "varying vec2 v_texture;\n" >+ "void main() {\n" >+ " gl_FragColor = texture2D(u_texture, v_texture);\n" >+ "}\n"; >+ >+ QOpenGLFunctions* f = context->functions(); >+ >+ GLuint vertexShader = f->glCreateShader(GL_VERTEX_SHADER); >+ f->glShaderSource(vertexShader, 1, &vertexShaderSource, nullptr); >+ f->glCompileShader(vertexShader); >+ >+ GLuint fragmentShader = f->glCreateShader(GL_FRAGMENT_SHADER); >+ f->glShaderSource(fragmentShader, 1, &fragmentShaderSource, nullptr); >+ f->glCompileShader(fragmentShader); >+ >+ m_program = f->glCreateProgram(); >+ f->glAttachShader(m_program, vertexShader); >+ f->glAttachShader(m_program, fragmentShader); >+ f->glLinkProgram(m_program); >+ >+ f->glBindAttribLocation(m_program, 0, "pos"); >+ f->glBindAttribLocation(m_program, 1, "texture"); >+ m_textureUniform = f->glGetUniformLocation(m_program, "u_texture"); >+ } >+ >+ m_client->backendCreated(); >+} >+ >+bool QtViewBackend::initialize() >+{ >+ if (m_eglDisplay == EGL_NO_DISPLAY) >+ return false; >+ >+ eglInitialize(m_eglDisplay, nullptr, nullptr); >+ >+ if (!eglBindAPI(EGL_OPENGL_ES_API)) >+ return false; >+ >+ wpe_fdo_initialize_for_egl_display(m_eglDisplay); >+ >+ static const EGLint configAttributes[13] = { >+ EGL_SURFACE_TYPE, EGL_WINDOW_BIT, >+ EGL_RED_SIZE, 1, >+ EGL_GREEN_SIZE, 1, >+ EGL_BLUE_SIZE, 1, >+ EGL_ALPHA_SIZE, 1, >+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, >+ EGL_NONE >+ }; >+ >+ { >+ EGLint count = 0; >+ if (!eglGetConfigs(m_eglDisplay, nullptr, 0, &count) || count < 1) >+ return false; >+ >+ EGLConfig* configs = g_new0(EGLConfig, count); >+ EGLint matched = 0; >+ if (eglChooseConfig(m_eglDisplay, configAttributes, configs, count, &matched) && !!matched) >+ m_eglConfig = configs[0]; >+ g_free(configs); >+ } >+ >+ static const EGLint contextAttributes[3] = { >+ EGL_CONTEXT_CLIENT_VERSION, 2, >+ EGL_NONE >+ }; >+ >+ m_eglContext = eglCreateContext(m_eglDisplay, m_eglConfig, nullptr, contextAttributes); >+ if (!m_eglContext) >+ return false; >+ >+ static struct wpe_view_backend_exportable_fdo_egl_client exportableClient = { >+ // export_buffer_resource >+ [](void* data, EGLImageKHR image) >+ { >+ static_cast<QtViewBackend*>(data)->displayBuffer(image); >+ }, >+ // padding >+ nullptr, nullptr, nullptr, nullptr >+ }; >+ m_exportable = wpe_view_backend_exportable_fdo_egl_create(&exportableClient, this, m_geometry.size().width(), m_geometry.size().height()); >+ return true; >+} >+ >+struct wpe_view_backend* QtViewBackend::backend() const >+{ >+ return m_exportable ? wpe_view_backend_exportable_fdo_get_view_backend(m_exportable) : nullptr; >+} >+ >+void QtViewBackend::resize(const QRectF& newGeometry) >+{ >+ if (!newGeometry.isValid()) >+ return; >+ >+ m_geometry = newGeometry; >+ >+ if (backend()) >+ wpe_view_backend_dispatch_set_size(backend(), m_geometry.size().width(), m_geometry.size().height()); >+} >+ >+GLuint QtViewBackend::getTexture(QOpenGLContext* context) >+{ >+ if (!m_lockedImage || !hasValidSurface()) >+ return 0; >+ >+ context->makeCurrent(&m_surface); >+ >+ QOpenGLFunctions* f = context->functions(); >+ if (!m_textureId) { >+ f->glGenTextures(1, &m_textureId); >+ f->glBindTexture(GL_TEXTURE_2D, m_textureId); >+ f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); >+ f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); >+ f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); >+ f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); >+ f->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_geometry.size().width(), m_geometry.size().height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); >+ f->glBindTexture(GL_TEXTURE_2D, 0); >+ } >+ >+ f->glClearColor(1, 0, 0, 1); >+ f->glClear(GL_COLOR_BUFFER_BIT); >+ >+ f->glUseProgram(m_program); >+ >+ f->glActiveTexture(GL_TEXTURE0); >+ f->glBindTexture(GL_TEXTURE_2D, m_textureId); >+ imageTargetTexture2DOES(GL_TEXTURE_2D, m_lockedImage); >+ f->glUniform1i(m_textureUniform, 0); >+ >+ static const GLfloat vertices[4][2] = { >+ { -1.0, 1.0 }, >+ { 1.0, 1.0 }, >+ { -1.0, -1.0 }, >+ { 1.0, -1.0 }, >+ }; >+ >+ static const GLfloat texturePos[4][2] = { >+ { 0, 0 }, >+ { 1, 0 }, >+ { 0, 1 }, >+ { 1, 1 }, >+ }; >+ >+ f->glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, vertices); >+ f->glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, texturePos); >+ >+ f->glEnableVertexAttribArray(0); >+ f->glEnableVertexAttribArray(1); >+ >+ f->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); >+ >+ f->glDisableVertexAttribArray(0); >+ f->glDisableVertexAttribArray(1); >+ >+ wpe_view_backend_exportable_fdo_dispatch_frame_complete(m_exportable); >+ wpe_view_backend_exportable_fdo_egl_dispatch_release_image(m_exportable, m_lockedImage); >+ m_lockedImage = EGL_NO_IMAGE_KHR; >+ >+ return m_textureId; >+} >+ >+void QtViewBackend::initSurface(QOpenGLContext* context) >+{ >+ m_surface.setFormat(context->format()); >+ m_surface.create(); >+} >+ >+void QtViewBackend::displayBuffer(EGLImageKHR image) >+{ >+ m_lockedImage = image; >+ m_client->triggerUpdate(); >+} >+ >+uint32_t QtViewBackend::modifiers() const >+{ >+ uint32_t mask = m_keyboardModifiers; >+ if (m_mouseModifiers) >+ mask |= m_mouseModifiers; >+ return mask; >+} >+ >+void QtViewBackend::dispatchHoverEnterEvent(QHoverEvent*) >+{ >+ m_hovering = true; >+ m_mouseModifiers = 0; >+} >+ >+void QtViewBackend::dispatchHoverLeaveEvent(QHoverEvent*) >+{ >+ m_hovering = false; >+} >+ >+void QtViewBackend::dispatchHoverMoveEvent(QHoverEvent* event) >+{ >+ if (!m_hovering) >+ return; >+ >+ uint32_t state = !!m_mousePressedButton; >+ struct wpe_input_pointer_event wpeEvent = { wpe_input_pointer_event_type_motion, >+ static_cast<uint32_t>(event->timestamp()), >+ event->pos().x(), event->pos().y(), >+ m_mousePressedButton, state, modifiers() }; >+ wpe_view_backend_dispatch_pointer_event(backend(), &wpeEvent); >+} >+ >+void QtViewBackend::dispatchMousePressEvent(QMouseEvent* event) >+{ >+ uint32_t button = 0; >+ uint32_t modifier = 0; >+ switch (event->button()) { >+ case Qt::LeftButton: >+ button = 1; >+ modifier = wpe_input_pointer_modifier_button1; >+ break; >+ case Qt::RightButton: >+ button = 2; >+ modifier = wpe_input_pointer_modifier_button2; >+ break; >+ default: >+ break; >+ } >+ m_mousePressedButton = button; >+ uint32_t state = 1; >+ m_mouseModifiers |= modifier; >+ struct wpe_input_pointer_event wpeEvent = { wpe_input_pointer_event_type_button, >+ static_cast<uint32_t>(event->timestamp()), >+ event->x(), event->y(), button, state, modifiers() }; >+ wpe_view_backend_dispatch_pointer_event(backend(), &wpeEvent); >+} >+ >+void QtViewBackend::dispatchMouseReleaseEvent(QMouseEvent* event) >+{ >+ uint32_t button = 0; >+ uint32_t modifier = 0; >+ switch (event->button()) { >+ case Qt::LeftButton: >+ button = 1; >+ modifier = wpe_input_pointer_modifier_button1; >+ break; >+ case Qt::RightButton: >+ button = 2; >+ modifier = wpe_input_pointer_modifier_button2; >+ break; >+ default: >+ break; >+ } >+ m_mousePressedButton = 0; >+ uint32_t state = 0; >+ m_mouseModifiers &= ~modifier; >+ struct wpe_input_pointer_event wpeEvent = { wpe_input_pointer_event_type_button, >+ static_cast<uint32_t>(event->timestamp()), >+ event->x(), event->y(), button, state, modifiers() }; >+ wpe_view_backend_dispatch_pointer_event(backend(), &wpeEvent); >+} >+ >+void QtViewBackend::dispatchWheelEvent(QWheelEvent* event) >+{ >+ QPoint delta = event->angleDelta(); >+ uint32_t axis = delta.y() == event->y(); >+ QPoint numDegrees = delta / 8; >+ QPoint numSteps = numDegrees / 15; >+ int32_t length = numSteps.y() ? numSteps.y() : numSteps.x(); >+ struct wpe_input_axis_event wpeEvent = { wpe_input_axis_event_type_motion, >+ static_cast<uint32_t>(event->timestamp()), >+ event->x(), event->y(), axis, length, modifiers() }; >+ wpe_view_backend_dispatch_axis_event(backend(), &wpeEvent); >+} >+ >+void QtViewBackend::dispatchKeyEvent(QKeyEvent* event, bool state) >+{ >+ uint32_t keysym = event->nativeVirtualKey(); >+ if (!keysym) >+ keysym = wpe_input_xkb_context_get_key_code(wpe_input_xkb_context_get_default(), event->key(), state); >+ >+ uint32_t modifiers = 0; >+ Qt::KeyboardModifiers qtModifiers = event->modifiers(); >+ if (!qtModifiers) >+ qtModifiers = QGuiApplication::keyboardModifiers(); >+ >+ if (qtModifiers & Qt::ShiftModifier) >+ modifiers |= wpe_input_keyboard_modifier_shift; >+ >+ if (qtModifiers & Qt::ControlModifier) >+ modifiers |= wpe_input_keyboard_modifier_control; >+ if (qtModifiers & Qt::MetaModifier) >+ modifiers |= wpe_input_keyboard_modifier_meta; >+ if (qtModifiers & Qt::AltModifier) >+ modifiers |= wpe_input_keyboard_modifier_alt; >+ >+ struct wpe_input_keyboard_event wpeEvent = { static_cast<uint32_t>(event->timestamp()), >+ keysym, event->nativeScanCode(), state, modifiers }; >+ wpe_view_backend_dispatch_keyboard_event(backend(), &wpeEvent); >+} >+ >+void QtViewBackend::dispatchTouchEvent(QTouchEvent* event) >+{ >+ wpe_input_touch_event_type eventType; >+ switch (event->type()) { >+ case QEvent::TouchBegin: >+ eventType = wpe_input_touch_event_type_down; >+ break; >+ case QEvent::TouchUpdate: >+ eventType = wpe_input_touch_event_type_motion; >+ break; >+ case QEvent::TouchEnd: >+ eventType = wpe_input_touch_event_type_up; >+ break; >+ default: >+ eventType = wpe_input_touch_event_type_null; >+ break; >+ } >+ >+ int i = 0; >+ struct wpe_input_touch_event_raw* rawEvents = g_new0(wpe_input_touch_event_raw, event->touchPoints().length()); >+ for (auto& point : event->touchPoints()) { >+ rawEvents[i] = { eventType, static_cast<uint32_t>(event->timestamp()), >+ point.id(), static_cast<int32_t>(point.pos().x()), static_cast<int32_t>(point.pos().y()) }; >+ i++; >+ } >+ >+ struct wpe_input_touch_event wpeEvent = { rawEvents, static_cast<uint64_t>(i), eventType, >+ static_cast<int32_t>(rawEvents[0].id), >+ static_cast<uint32_t>(event->timestamp()), modifiers() }; >+ wpe_view_backend_dispatch_touch_event(backend(), &wpeEvent); >+ g_free(rawEvents); >+} >diff --git a/Source/WebKit/UIProcess/API/QtWPE/QtViewBackend.h b/Source/WebKit/UIProcess/API/QtWPE/QtViewBackend.h >new file mode 100644 >index 0000000000000000000000000000000000000000..47a8a373e6c52160a130323a8b03a42d54e47f6e >--- /dev/null >+++ b/Source/WebKit/UIProcess/API/QtWPE/QtViewBackend.h >@@ -0,0 +1,99 @@ >+/* QtWPE >+ * >+ * Copyright (C) 2018 Igalia S.L >+ * Copyright (C) 2018 Zodiac Inflight Innovations >+ * >+ * 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; if not, write to the >+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ */ >+ >+#pragma once >+ >+// This include order is necessary to enforce the GBM EGL platform. >+#include <gbm.h> >+#include <epoxy/egl.h> >+ >+#include <QHoverEvent> >+#include <QKeyEvent> >+#include <QMouseEvent> >+#include <QOffscreenSurface> >+#include <QOpenGLContext> >+#include <QWheelEvent> >+#include <wpe/fdo-egl.h> >+#include <wpe/fdo.h> >+ >+class QtViewBackendClient { >+public: >+ virtual void triggerUpdate() = 0; >+ virtual void backendCreated() = 0; >+}; >+ >+class Q_DECL_EXPORT QtViewBackend { >+public: >+ QtViewBackend(QtViewBackendClient*, const QRectF& geometry, qreal refreshRate); >+ virtual ~QtViewBackend() = default; >+ >+ void configureGlibEglDisplay(QOpenGLContext*, EGLDisplay); >+ void configureEglDisplay(QOpenGLContext*, EGLDisplay); >+ >+ QSizeF size() const { return m_geometry.size(); }; >+ void resize(const QRectF& newGeometry); >+ >+ GLuint getTexture(QOpenGLContext*); >+ void initSurface(QOpenGLContext*); >+ bool hasValidSurface() const { return m_surface.isValid(); }; >+ >+ void dispatchHoverEnterEvent(QHoverEvent*); >+ void dispatchHoverLeaveEvent(QHoverEvent*); >+ void dispatchHoverMoveEvent(QHoverEvent*); >+ >+ void dispatchMousePressEvent(QMouseEvent*); >+ void dispatchMouseReleaseEvent(QMouseEvent*); >+ void dispatchWheelEvent(QWheelEvent*); >+ >+ void dispatchKeyEvent(QKeyEvent*, bool state); >+ >+ void dispatchTouchEvent(QTouchEvent*); >+ >+ struct wpe_view_backend* backend() const; >+ >+ EGLContext eglContext() const { return m_eglContext; }; >+ >+private: >+ bool initialize(); >+ void displayBuffer(EGLImageKHR); >+ uint32_t modifiers() const; >+ >+ EGLDisplay m_eglDisplay { nullptr }; >+ EGLContext m_eglContext { nullptr }; >+ EGLConfig m_eglConfig; >+ struct wpe_view_backend_exportable_fdo* m_exportable { nullptr }; >+ >+ EGLImageKHR m_lockedImage; >+ >+ QtViewBackendClient* m_client; >+ QOffscreenSurface m_surface; >+ QRectF m_geometry; >+ qreal m_refreshRate { 30 }; >+ GLuint m_textureId { 0 }; >+ >+ unsigned m_program { 0 }; >+ unsigned m_textureUniform { 0 }; >+ >+ bool m_hovering { false }; >+ uint32_t m_mouseModifiers { 0 }; >+ uint32_t m_keyboardModifiers { 0 }; >+ uint32_t m_mousePressedButton { 0 }; >+}; >diff --git a/Source/WebKit/UIProcess/API/QtWPE/qmldir b/Source/WebKit/UIProcess/API/QtWPE/qmldir >new file mode 100644 >index 0000000000000000000000000000000000000000..0d9300a97ca2b04b2ca99e2b0ff1e3b2c458dd0e >--- /dev/null >+++ b/Source/WebKit/UIProcess/API/QtWPE/qmldir >@@ -0,0 +1,2 @@ >+module org.wpewebkit.qtwpe >+plugin qtwpe >diff --git a/Source/WebKit/UIProcess/API/QtWPE/qtwpe.pro b/Source/WebKit/UIProcess/API/QtWPE/qtwpe.pro >new file mode 100644 >index 0000000000000000000000000000000000000000..000345b4b5d090c4f2e02a5b27d55d03516d783a >--- /dev/null >+++ b/Source/WebKit/UIProcess/API/QtWPE/qtwpe.pro >@@ -0,0 +1,47 @@ >+TEMPLATE = lib >+TARGET = qtwpe >+QT += qml quick >+CONFIG += plugin c++14 >+ >+VERSION = 0.1 >+ >+TARGET = $$qtLibraryTarget($$TARGET) >+uri = org.wpewebkit.qtwpe >+ >+QT += gui-private >+ >+# Input >+SOURCES += \ >+ qtwpe_plugin.cpp \ >+ wpeview.cpp \ >+ wpeviewloadrequest.cpp \ >+ QtViewBackend.cpp >+ >+HEADERS += \ >+ qtwpe_plugin.h \ >+ wpeview.h \ >+ wpeviewloadrequest.h \ >+ QtViewBackend.h >+ >+DEFINES += "QT_NO_KEYWORDS=1" >+ >+DISTFILES = qmldir >+ >+!equals(_PRO_FILE_PWD_, $$OUT_PWD) { >+ copy_qmldir.target = $$OUT_PWD/qmldir >+ copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir >+ copy_qmldir.commands = $(COPY_FILE) \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)\" >+ QMAKE_EXTRA_TARGETS += copy_qmldir >+ PRE_TARGETDEPS += $$copy_qmldir.target >+} >+ >+qmldir.files = qmldir >+unix { >+ installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /) >+ qmldir.path = $$installPath >+ target.path = $$installPath >+ INSTALLS += target qmldir >+} >+ >+unix: CONFIG += link_pkgconfig >+unix: PKGCONFIG += wpe-webkit-0.1 wpebackend-fdo-0.1 epoxy >diff --git a/Source/WebKit/UIProcess/API/QtWPE/qtwpe_plugin.cpp b/Source/WebKit/UIProcess/API/QtWPE/qtwpe_plugin.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..73fac91ed1a983c66e7af68f62e58f3851f7f581 >--- /dev/null >+++ b/Source/WebKit/UIProcess/API/QtWPE/qtwpe_plugin.cpp >@@ -0,0 +1,36 @@ >+/* QtWPE >+ * >+ * Copyright (C) 2018 Igalia S.L >+ * Copyright (C) 2018 Zodiac Inflight Innovations >+ * >+ * 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; if not, write to the >+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ */ >+ >+#include "qtwpe_plugin.h" >+#include "wpeview.h" >+#include "wpeviewloadrequest.h" >+ >+#include <qqml.h> >+ >+void QtwpePlugin::registerTypes(const char* uri) >+{ >+ // @uri org.wpewebkit.qtwpe >+ qmlRegisterType<WPEView>(uri, 1, 0, "WPEView"); >+ >+ const QString& msg = QObject::tr("Cannot create separate instance of WPEViewLoadRequest"); >+ qmlRegisterUncreatableType<WPEViewLoadRequest>(uri, 1, 0, "WPEViewLoadRequest", msg); >+} >+ >diff --git a/Source/WebKit/UIProcess/API/QtWPE/qtwpe_plugin.h b/Source/WebKit/UIProcess/API/QtWPE/qtwpe_plugin.h >new file mode 100644 >index 0000000000000000000000000000000000000000..ce90f8ca61031217e77bef83a0fcebc4a8209b07 >--- /dev/null >+++ b/Source/WebKit/UIProcess/API/QtWPE/qtwpe_plugin.h >@@ -0,0 +1,32 @@ >+/* QtWPE >+ * >+ * Copyright (C) 2018 Igalia S.L >+ * Copyright (C) 2018 Zodiac Inflight Innovations >+ * >+ * 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; if not, write to the >+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ */ >+ >+#pragma once >+ >+#include <QQmlExtensionPlugin> >+ >+class QtwpePlugin : public QQmlExtensionPlugin { >+ Q_OBJECT >+ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) >+ >+public: >+ void registerTypes(const char* uri); >+}; >diff --git a/Source/WebKit/UIProcess/API/QtWPE/wpeview.cpp b/Source/WebKit/UIProcess/API/QtWPE/wpeview.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..1a832c357eca9842d0b085005a209c94731e5fef >--- /dev/null >+++ b/Source/WebKit/UIProcess/API/QtWPE/wpeview.cpp >@@ -0,0 +1,367 @@ >+/* QtWPE >+ * >+ * Copyright (C) 2018 Igalia S.L >+ * Copyright (C) 2018 Zodiac Inflight Innovations >+ * >+ * 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; if not, write to the >+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ */ >+ >+#include "wpeview.h" >+#include "wpeviewloadrequest.h" >+ >+#include <QGuiApplication> >+#include <QQmlEngine> >+#include <QQuickWindow> >+#include <QSGSimpleTextureNode> >+#include <QScreen> >+#include <QtPlatformHeaders/QEGLNativeContext> >+#include <qpa/qplatformnativeinterface.h> >+ >+WPEView::WPEView(QQuickItem* parent) >+ : QQuickItem(parent) >+{ >+ connect(this, &QQuickItem::windowChanged, this, &WPEView::configureWindow); >+ setFlag(ItemHasContents, true); >+ setAcceptedMouseButtons(Qt::AllButtons); >+ setAcceptHoverEvents(true); >+ setAcceptTouchEvents(true); >+} >+ >+WPEView::~WPEView() >+{ >+ if (m_webView) >+ g_object_unref(m_webView); >+} >+ >+void WPEView::geometryChanged(const QRectF& newGeometry, const QRectF&) >+{ >+ if (!m_backend) { >+ auto screen = window()->screen(); >+ m_backend = new QtViewBackend(this, newGeometry, screen->refreshRate()); >+ } else >+ m_backend->resize(newGeometry); >+} >+ >+void WPEView::configureWindow() >+{ >+ auto win = window(); >+ if (!win) >+ return; >+ win->setSurfaceType(QWindow::OpenGLSurface); >+ connect(win, &QQuickWindow::sceneGraphInitialized, this, &WPEView::createOffscreen); >+} >+ >+void WPEView::createOffscreen() >+{ >+ if (!m_backend->hasValidSurface()) >+ m_backend->initSurface(window()->openglContext()); >+} >+ >+void WPEView::backendCreated() >+{ >+ struct wpe_view_backend* wpeBackend = m_backend->backend(); >+ if (!wpeBackend) { >+ g_warning("Failed to create WPE view backend"); >+ return; >+ } >+ >+ auto* viewBackend = webkit_web_view_backend_new(wpeBackend, [](gpointer data) { >+ delete static_cast<QtViewBackend*>(data); >+ }, m_backend); >+ >+ auto* settings = webkit_settings_new_with_settings("enable-developer-extras", TRUE, >+ "enable-webgl", TRUE, "enable-mediasource", TRUE, nullptr); >+ >+ m_webView = WEBKIT_WEB_VIEW(g_object_new(WEBKIT_TYPE_WEB_VIEW, >+ "backend", viewBackend, "settings", settings, nullptr)); >+ g_object_unref(settings); >+ >+ g_signal_connect_swapped(m_webView, "notify::uri", G_CALLBACK(notifyUrlChangedCallback), this); >+ g_signal_connect_swapped(m_webView, "notify::title", G_CALLBACK(notifyTitleChangedCallback), this); >+ g_signal_connect_swapped(m_webView, "notify::estimated-load-progress", G_CALLBACK(notifyLoadProgressCallback), this); >+ g_signal_connect(m_webView, "load-changed", G_CALLBACK(notifyLoadChangedCallback), this); >+ g_signal_connect(m_webView, "load-failed", G_CALLBACK(notifyLoadFailedCallback), this); >+ >+ if (!m_url.isEmpty()) >+ webkit_web_view_load_uri(m_webView, m_url.toString().toUtf8().constData()); >+} >+ >+void WPEView::notifyUrlChangedCallback(WPEView* view) >+{ >+ Q_EMIT view->urlChanged(); >+} >+ >+void WPEView::notifyTitleChangedCallback(WPEView* view) >+{ >+ Q_EMIT view->titleChanged(); >+} >+ >+void WPEView::notifyLoadProgressCallback(WPEView* view) >+{ >+ Q_EMIT view->loadProgressChanged(); >+} >+ >+void WPEView::notifyLoadChangedCallback(WebKitWebView*, WebKitLoadEvent event, WPEView* view) >+{ >+ WPEViewLoadRequest* loadRequest = nullptr; >+ switch (event) { >+ case WEBKIT_LOAD_STARTED: >+ loadRequest = new WPEViewLoadRequest(view->url(), WPEView::LoadStatus::LoadStartedStatus, ""); >+ break; >+ case WEBKIT_LOAD_FINISHED: >+ loadRequest = new WPEViewLoadRequest(view->url(), WPEView::LoadStatus::LoadSucceededStatus, ""); >+ break; >+ default: >+ break; >+ } >+ >+ if (loadRequest) { >+ Q_EMIT view->loadingChanged(loadRequest); >+ delete loadRequest; >+ } >+} >+ >+void WPEView::notifyLoadFailedCallback(WebKitWebView*, WebKitLoadEvent, const gchar* failingURI, GError* error, WPEView* view) >+{ >+ WPEViewLoadRequest* loadRequest = new WPEViewLoadRequest(QUrl(QString(failingURI)), WPEView::LoadStatus::LoadFailedStatus, error->message); >+ Q_EMIT view->loadingChanged(loadRequest); >+ delete loadRequest; >+} >+ >+QSGNode* WPEView::updatePaintNode(QSGNode* node, UpdatePaintNodeData*) >+{ >+ if (!m_webView) { >+ QPlatformNativeInterface* native = QGuiApplication::platformNativeInterface(); >+ m_backend->configureGlibEglDisplay(window()->openglContext(), static_cast<EGLDisplay>(native->nativeResourceForIntegration("egldisplay"))); >+ return node; >+ } >+ >+ GLuint textureId = m_backend->getTexture(window()->openglContext()); >+ if (!textureId) >+ return node; >+ >+ QSGSimpleTextureNode* n = static_cast<QSGSimpleTextureNode*>(node); >+ if (!n) >+ n = new QSGSimpleTextureNode(); >+ >+ if (textureId > 0) { >+ QSize size(m_backend->size().width(), m_backend->size().height()); >+ n->setTexture(window()->createTextureFromId(textureId, size, QQuickWindow::TextureHasAlphaChannel)); >+ } >+ n->setRect(boundingRect()); >+ return n; >+} >+ >+QUrl WPEView::url() const >+{ >+ if (!m_webView) >+ return QUrl(""); >+ >+ const gchar* uri = webkit_web_view_get_uri(m_webView); >+ return QUrl(QString(uri ? uri : "")); >+} >+ >+void WPEView::setUrl(const QUrl& url) >+{ >+ if (url == m_url) >+ return; >+ >+ m_url = url; >+ if (m_webView) >+ webkit_web_view_load_uri(m_webView, m_url.toString().toUtf8().constData()); >+} >+ >+int WPEView::loadProgress() const >+{ >+ if (!m_webView) >+ return 0; >+ >+ gdouble estimatedProgress; >+ g_object_get(m_webView, "estimated-load-progress", &estimatedProgress, nullptr); >+ return estimatedProgress * 100; >+} >+ >+QString WPEView::title() const >+{ >+ if (!m_webView) >+ return ""; >+ >+ return webkit_web_view_get_title(m_webView); >+} >+ >+bool WPEView::canGoBack() const >+{ >+ if (!m_webView) >+ return false; >+ >+ return webkit_web_view_can_go_back(m_webView); >+} >+ >+bool WPEView::isLoading() const >+{ >+ if (!m_webView) >+ return false; >+ >+ gboolean isLoading = false; >+ g_object_get(m_webView, "is-loading", &isLoading, nullptr); >+ return isLoading; >+} >+ >+bool WPEView::canGoForward() const >+{ >+ if (!m_webView) >+ return false; >+ >+ return webkit_web_view_can_go_forward(m_webView); >+} >+ >+void WPEView::goBack() >+{ >+ if (m_webView) >+ webkit_web_view_go_back(m_webView); >+} >+ >+void WPEView::goForward() >+{ >+ if (m_webView) >+ webkit_web_view_go_forward(m_webView); >+} >+ >+void WPEView::reload() >+{ >+ if (m_webView) >+ webkit_web_view_reload(m_webView); >+} >+ >+void WPEView::stop() >+{ >+ if (m_webView) >+ webkit_web_view_stop_loading(m_webView); >+} >+ >+void WPEView::loadHtml(const QString& html, const QUrl& baseUrl) >+{ >+ if (m_webView) >+ webkit_web_view_load_html(m_webView, html.toUtf8().constData(), baseUrl.toString().toUtf8().constData()); >+} >+ >+static void jsAsyncReadyCallback(GObject* object, GAsyncResult* result, gpointer userData) >+{ >+ WebKitJavascriptResult* jsResult; >+ GError* error = nullptr; >+ >+ jsResult = webkit_web_view_run_javascript_finish(WEBKIT_WEB_VIEW(object), result, &error); >+ if (!jsResult) { >+ qWarning("Error running javascript: %s", error->message); >+ g_error_free(error); >+ return; >+ } >+ >+ WPEView* view = reinterpret_cast<WPEView*>(userData); >+ view->handleJsResult(jsResult); >+} >+ >+void WPEView::handleJsResult(WebKitJavascriptResult* jsResult) >+{ >+ QQmlEngine* engine = qmlEngine(this); >+ if (!engine) { >+ qWarning("No JavaScript engine, unable to handle JavaScript callback!"); >+ webkit_javascript_result_unref(jsResult); >+ return; >+ } >+ >+ JSCValue* value = webkit_javascript_result_get_js_value(jsResult); >+ QJSValueList args; >+ QVariant variant; >+ // TODO: Handle more value types? >+ if (jsc_value_is_string(value)) { >+ JSCException* exception; >+ gchar* str_value = jsc_value_to_string(value); >+ exception = jsc_context_get_exception(jsc_value_get_context(value)); >+ if (exception) >+ qWarning("Error running javascript: %s", jsc_exception_get_message(exception)); >+ else >+ variant.setValue(QString(g_strdup(str_value))); >+ g_free(str_value); >+ } >+ args.append(engine->toScriptValue(variant)); >+ m_jsCallback.call(args); >+ webkit_javascript_result_unref(jsResult); >+} >+ >+void WPEView::runJavaScript(const QString& script, const QJSValue& callback) >+{ >+ if (!g_cancellable_is_cancelled(m_jsCancellable)) >+ g_cancellable_cancel(m_jsCancellable); >+ >+ m_jsCallback = callback; >+ webkit_web_view_run_javascript(m_webView, script.toUtf8().constData(), m_jsCancellable, jsAsyncReadyCallback, this); >+} >+ >+void WPEView::mousePressEvent(QMouseEvent* event) >+{ >+ forceActiveFocus(); >+ if (m_webView) >+ m_backend->dispatchMousePressEvent(event); >+} >+ >+void WPEView::mouseReleaseEvent(QMouseEvent* event) >+{ >+ if (m_webView) >+ m_backend->dispatchMouseReleaseEvent(event); >+} >+ >+void WPEView::hoverEnterEvent(QHoverEvent* event) >+{ >+ if (m_webView) >+ m_backend->dispatchHoverEnterEvent(event); >+} >+ >+void WPEView::hoverLeaveEvent(QHoverEvent* event) >+{ >+ if (m_webView) >+ m_backend->dispatchHoverLeaveEvent(event); >+} >+ >+void WPEView::hoverMoveEvent(QHoverEvent* event) >+{ >+ if (m_webView) >+ m_backend->dispatchHoverMoveEvent(event); >+} >+ >+void WPEView::wheelEvent(QWheelEvent* event) >+{ >+ if (m_webView) >+ m_backend->dispatchWheelEvent(event); >+} >+ >+void WPEView::keyPressEvent(QKeyEvent* event) >+{ >+ if (m_webView) >+ m_backend->dispatchKeyEvent(event, true); >+} >+ >+void WPEView::keyReleaseEvent(QKeyEvent* event) >+{ >+ if (m_webView) >+ m_backend->dispatchKeyEvent(event, false); >+} >+ >+void WPEView::touchEvent(QTouchEvent* event) >+{ >+ if (m_webView) >+ m_backend->dispatchTouchEvent(event); >+} >diff --git a/Source/WebKit/UIProcess/API/QtWPE/wpeview.h b/Source/WebKit/UIProcess/API/QtWPE/wpeview.h >new file mode 100644 >index 0000000000000000000000000000000000000000..deb491263b876933bd72cc6c5dd4578ea1701652 >--- /dev/null >+++ b/Source/WebKit/UIProcess/API/QtWPE/wpeview.h >@@ -0,0 +1,114 @@ >+/* QtWPE >+ * >+ * Copyright (C) 2018 Igalia S.L >+ * Copyright (C) 2018 Zodiac Inflight Innovations >+ * >+ * 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; if not, write to the >+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ */ >+ >+#pragma once >+ >+#include "QtViewBackend.h" >+ >+#include <QQuickItem> >+#include <QUrl> >+#include <wpe/webkit.h> >+ >+class WPEViewLoadRequest; >+ >+class WPEView : public QQuickItem, public QtViewBackendClient { >+ Q_OBJECT >+ Q_DISABLE_COPY(WPEView) >+ Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) >+ Q_PROPERTY(bool loading READ isLoading NOTIFY loadingChanged) >+ Q_PROPERTY(int loadProgress READ loadProgress NOTIFY loadProgressChanged) >+ Q_PROPERTY(QString title READ title NOTIFY titleChanged) >+ Q_PROPERTY(bool canGoBack READ canGoBack NOTIFY loadingChanged) >+ Q_PROPERTY(bool canGoForward READ canGoForward NOTIFY loadingChanged) >+ Q_ENUMS(LoadStatus) >+ >+public: >+ enum LoadStatus { >+ LoadStartedStatus, >+ LoadStoppedStatus, >+ LoadSucceededStatus, >+ LoadFailedStatus >+ }; >+ >+ WPEView(QQuickItem* parent = nullptr); >+ ~WPEView(); >+ QSGNode* updatePaintNode(QSGNode*, UpdatePaintNodeData*) final; >+ >+ void triggerUpdate() final { QMetaObject::invokeMethod(this, "update"); }; >+ void backendCreated() final; >+ >+ QUrl url() const; >+ void setUrl(const QUrl&); >+ int loadProgress() const; >+ QString title() const; >+ bool canGoBack() const; >+ bool isLoading() const; >+ bool canGoForward() const; >+ >+ void handleJsResult(WebKitJavascriptResult*); >+ >+public Q_SLOTS: >+ void goBack(); >+ void goForward(); >+ void reload(); >+ void stop(); >+ void loadHtml(const QString& html, const QUrl& baseUrl = QUrl()); >+ void runJavaScript(const QString& script, const QJSValue& callback = QJSValue()); >+ >+Q_SIGNALS: >+ void urlChanged(); >+ void titleChanged(); >+ void loadingChanged(WPEViewLoadRequest*); >+ void loadProgressChanged(); >+ >+protected: >+ void geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry) override; >+ >+ void hoverEnterEvent(QHoverEvent*) override; >+ void hoverLeaveEvent(QHoverEvent*) override; >+ void hoverMoveEvent(QHoverEvent*) override; >+ >+ void mousePressEvent(QMouseEvent*) override; >+ void mouseReleaseEvent(QMouseEvent*) override; >+ void wheelEvent(QWheelEvent*) override; >+ >+ void keyPressEvent(QKeyEvent*) override; >+ void keyReleaseEvent(QKeyEvent*) override; >+ >+ void touchEvent(QTouchEvent*) override; >+ >+private Q_SLOTS: >+ void createOffscreen(); >+ void configureWindow(); >+ >+private: >+ static void notifyUrlChangedCallback(WPEView*); >+ static void notifyTitleChangedCallback(WPEView*); >+ static void notifyLoadProgressCallback(WPEView*); >+ static void notifyLoadChangedCallback(WebKitWebView*, WebKitLoadEvent, WPEView*); >+ static void notifyLoadFailedCallback(WebKitWebView*, WebKitLoadEvent, const gchar* failingURI, GError*, WPEView*); >+ >+ WebKitWebView* m_webView { nullptr }; >+ QUrl m_url; >+ QtViewBackend* m_backend { nullptr }; >+ GCancellable* m_jsCancellable; >+ QJSValue m_jsCallback { }; >+}; >diff --git a/Source/WebKit/UIProcess/API/QtWPE/wpeviewloadrequest.cpp b/Source/WebKit/UIProcess/API/QtWPE/wpeviewloadrequest.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..6d9427bace58b443073ba282e46b0496d29feb27 >--- /dev/null >+++ b/Source/WebKit/UIProcess/API/QtWPE/wpeviewloadrequest.cpp >@@ -0,0 +1,50 @@ >+/* QtWPE >+ * >+ * Copyright (C) 2018 Igalia S.L >+ * Copyright (C) 2018 Zodiac Inflight Innovations >+ * >+ * 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; if not, write to the >+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ */ >+ >+#include "wpeviewloadrequest.h" >+ >+WPEViewLoadRequest::WPEViewLoadRequest(const QUrl& url, WPEView::LoadStatus status, const QString &errorString) >+ : m_url(url) >+ , m_status(status) >+ , m_errorString(errorString) >+{ >+ >+} >+ >+WPEViewLoadRequest::~WPEViewLoadRequest() >+{ >+ >+} >+ >+QUrl WPEViewLoadRequest::url() const >+{ >+ return m_url; >+} >+ >+WPEView::LoadStatus WPEViewLoadRequest::status() const >+{ >+ return m_status; >+} >+ >+QString WPEViewLoadRequest::errorString() const >+{ >+ return m_errorString; >+} >diff --git a/Source/WebKit/UIProcess/API/QtWPE/wpeviewloadrequest.h b/Source/WebKit/UIProcess/API/QtWPE/wpeviewloadrequest.h >new file mode 100644 >index 0000000000000000000000000000000000000000..f979dce180130e0c622d7e65700ed7bf9c8e50cf >--- /dev/null >+++ b/Source/WebKit/UIProcess/API/QtWPE/wpeviewloadrequest.h >@@ -0,0 +1,48 @@ >+/* QtWPE >+ * >+ * Copyright (C) 2018 Igalia S.L >+ * Copyright (C) 2018 Zodiac Inflight Innovations >+ * >+ * 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; if not, write to the >+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ */ >+ >+#pragma once >+ >+#include "wpeview.h" >+ >+#include <QObject> >+ >+class WPEViewLoadRequest : public QObject { >+ Q_OBJECT >+ Q_PROPERTY(QUrl url READ url) >+ Q_PROPERTY(WPEView::LoadStatus status READ status) >+ Q_PROPERTY(QString errorString READ errorString) >+ >+public: >+ WPEViewLoadRequest(const QUrl&, WPEView::LoadStatus, const QString &errorString); >+ ~WPEViewLoadRequest(); >+ >+ QUrl url() const; >+ WPEView::LoadStatus status() const; >+ QString errorString() const; >+ >+private: >+ friend class WPEView; >+ >+ QUrl m_url; >+ WPEView::LoadStatus m_status; >+ QString m_errorString; >+}; >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index d4a32b204c6858cfe73f35472c9eb21317a609eb..c0b088fe6405ed673158056fbf1673097cf24c5d 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,32 @@ >+2018-12-06 Philippe Normand <pnormand@igalia.com> >+ >+ [WPE] Add Qt extension >+ https://bugs.webkit.org/show_bug.cgi?id=191464 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Flatpak build infrastructure for QtWPE. To build QtWPE and run its >+ mini-browser the user can exectute: >+ >+ webkit-flatpak --platform=wpe --wpe-extension=qt --release <URL> >+ >+ * CMakeLists.txt: >+ * Scripts/run-qt-wpe-minibrowser: Added. >+ * Scripts/webkitpy/style/checker.py: >+ * flatpak/flatpakutils.py: >+ (WebkitFlatpak.load_from_args): >+ (WebkitFlatpak.__init__): >+ (WebkitFlatpak.clean_args): >+ (WebkitFlatpak.run_in_sandbox): >+ * flatpak/org.webkit.QTWPE.yaml: Added. >+ * flatpak/org.webkit.QtWPEModules.yaml: Added. >+ * wpe/qt-wpe-mini-browser/CMakeLists.txt: Added. >+ * wpe/qt-wpe-mini-browser/COPYING.LGPL2: Added. >+ * wpe/qt-wpe-mini-browser/main.cpp: Added. >+ (main): >+ * wpe/qt-wpe-mini-browser/main.qml: Added. >+ * wpe/qt-wpe-mini-browser/qml.qrc: Added. >+ > 2018-12-05 Wenson Hsieh <wenson_hsieh@apple.com> > > [Cocoa] Share ClassMethodSwizzler and InstanceMethodSwizzler between TestWebKitAPI and WebKitTestRunner >diff --git a/Tools/CMakeLists.txt b/Tools/CMakeLists.txt >index 5d3236733a96dfc2df1ea5681db03f2c12c40349..176ba0e1927747dca39f4ad959ad8d864f8f881a 100644 >--- a/Tools/CMakeLists.txt >+++ b/Tools/CMakeLists.txt >@@ -6,3 +6,7 @@ WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS() > if (ENABLE_API_TESTS) > add_subdirectory(TestWebKitAPI) > endif () >+ >+if ("${PORT}" STREQUAL "WPE") >+ add_subdirectory(wpe/qt-wpe-mini-browser) >+endif () >diff --git a/Tools/Scripts/run-qt-wpe-minibrowser b/Tools/Scripts/run-qt-wpe-minibrowser >new file mode 100755 >index 0000000000000000000000000000000000000000..bdfe7a0009b805f5b0f8ffb7acc82bcde3df8250 >--- /dev/null >+++ b/Tools/Scripts/run-qt-wpe-minibrowser >@@ -0,0 +1,60 @@ >+#!/usr/bin/env perl >+# Copyright (C) 2018 Igalia S.L. >+# >+# This program is free software; you can redistribute it and/or >+# modify it under the terms of the GNU Lesser General Public >+# License as published by the Free Software Foundation; either >+# version 2.1 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 >+# Lesser General Public License for more details. >+# >+# You should have received a copy of the GNU Lesser General Public >+# License along with this program; if not, write to the >+# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, >+# Boston, MA 02110-1301, USA. >+ >+# Simplified "run" script for launching the QtWPE MiniBrowser. >+ >+use strict; >+use warnings; >+use File::Spec::Functions qw/catdir/; >+use FindBin; >+use lib $FindBin::Bin; >+use webkitdirs; >+ >+my $launcherName; >+my $libPath; >+my $launcherPath; >+my @jhbuildWrapper; >+ >+prohibitUnknownPort(); >+setConfiguration(); >+ >+if (isWPE()) { >+ my $configuration = passedConfiguration(); >+ my $productDir = productDir(); >+ my $libPath; >+ $libPath = "/app/webkit/WebKitBuild/$configuration/lib/qml" if $configuration; >+ $ENV{"QML2_IMPORT_PATH"} = "$libPath" if $libPath; >+ runInFlatpakIfAvailable("/app/webkit/Tools/Scripts/run-qt-wpe-minibrowser"); >+ >+ # Check to see that all the frameworks are built. >+ checkFrameworks(); >+ >+ if (!inFlatpakSandbox()) { >+ $libPath = "$productDir/lib/qml" if $productDir; >+ $ENV{"QML2_IMPORT_PATH"} = "$libPath" if $libPath; >+ } >+ >+ $launcherPath = catdir($productDir, "bin", "qt-wpe-mini-browser"); >+ die "Can't find $launcherPath" unless -x $launcherPath; >+ @jhbuildWrapper = wrapperPrefixIfNeeded(); >+ >+ print "Starting MiniBrowser.\n"; >+ exec @jhbuildWrapper, $launcherPath, @ARGV or die; >+} else { >+ die "Unsupported platform." >+} >diff --git a/Tools/Scripts/webkitpy/style/checker.py b/Tools/Scripts/webkitpy/style/checker.py >index 17424934e187fd7dc3118bf2c41d6df6cf2f960a..db862ca4f8f0b603d229f1c8c63e579e3b0ced6e 100644 >--- a/Tools/Scripts/webkitpy/style/checker.py >+++ b/Tools/Scripts/webkitpy/style/checker.py >@@ -214,6 +214,12 @@ _PATH_RULES_SPECIFIER = [ > ["-readability/naming", > "-readability/enum_casing"]), > >+ # For QtWPE the include order doesn't need to comply with WebKit's style >+ # because QtWPE is an API user of WPE, hence it has no config.h header, for >+ # instance. >+ ([os.path.join('Source', 'WebKit', 'UIProcess', 'API', 'QtWPE')], >+ ["-build/include_order"]), >+ > # For third-party code, keep only the following checks-- > # > # No tabs: to avoid having to set the SVN allow-tabs property. >diff --git a/Tools/flatpak/flatpakutils.py b/Tools/flatpak/flatpakutils.py >index 6a8ed54e0d149427962b8088e09f97941135b4d2..c5d0aaf61f70813eddd733599bd450dd688e833e 100644 >--- a/Tools/flatpak/flatpakutils.py >+++ b/Tools/flatpak/flatpakutils.py >@@ -52,6 +52,10 @@ FLATPAK_REQ = [ > ("flatpak-builder", "0.10.0"), > ] > >+WPE_MANIFEST_MAP = { >+ "qt": "org.webkit.QTWPE.yaml", >+} >+ > scriptdir = os.path.abspath(os.path.dirname(__file__)) > _log = logging.getLogger(__name__) > >@@ -504,6 +508,7 @@ class WebkitFlatpak: > dest="user_command") > general.add_argument('--available', action='store_true', dest="check_available", help='Check if required dependencies are available.'), > general.add_argument("--use-icecream", help="Use the distributed icecream (icecc) compiler.", action="store_true") >+ general.add_argument("--wpe-extension", action="store", dest="wpe_extension", help="WPE Extension to enable") > > debugoptions = parser.add_argument_group("Debugging") > debugoptions.add_argument("--gdb", nargs="?", help="Activate gdb, passing extra args to it if wanted.") >@@ -559,6 +564,7 @@ class WebkitFlatpak: > self.app_module = None > self.flatpak_default_args = [] > self.check_available = False >+ self.wpe_extension = None > > # Default application to run in the sandbox > self.command = None >@@ -596,7 +602,13 @@ class WebkitFlatpak: > " --debug" if self.debug else " --release") > > self.name = "org.webkit.%s" % self.platform >- self.manifest_path = os.path.abspath(os.path.join(scriptdir, '../flatpak/org.webkit.WebKit.yaml')) >+ >+ if self.wpe_extension: >+ manifest_filename = WPE_MANIFEST_MAP[self.wpe_extension] >+ else: >+ manifest_filename = "org.webkit.WebKit.yaml" >+ self.manifest_path = os.path.abspath(os.path.join(scriptdir, '../flatpak/') + manifest_filename) >+ > self.build_name = self.name + "-generated" > > build_root = os.path.join(self.source_root, 'WebKitBuild') >@@ -708,6 +720,7 @@ class WebkitFlatpak: > "LANG", > "NUMBER_OF_PROCESSORS", > "CCACHE_PREFIX", >+ "QML2_IMPORT_PATH", > ] > > if self.use_icecream: >diff --git a/Tools/flatpak/org.webkit.QTWPE.yaml b/Tools/flatpak/org.webkit.QTWPE.yaml >new file mode 100644 >index 0000000000000000000000000000000000000000..e6680804e73474420433e1f07f430adfbfee30d8 >--- /dev/null >+++ b/Tools/flatpak/org.webkit.QTWPE.yaml >@@ -0,0 +1,38 @@ >+app-id: org.webkit.QTWPE >+runtime: org.kde.Platform >+runtime-version: "5.11" >+# Control the exact version of the Sdk/Runtime that is being used. >+sdk-hash: 644a9924ee7c600fc569cc1d62e3de6e4f561c6b65cfed1dc7ac8d96b3a31e54 >+runtime-hash: 3a2ca3da3e9d09628426e8165e4eedb25a59063a4a1a344c367037b0ada99230 >+sdk: org.kde.Sdk >+command: %(COMMAND)s >+finish-args: >+ # Basically no sandboxing, the goal here is to make it flexible >+ # for developers, not really to isolate (openning all devices >+ # to allow acces video cameras until we have a portal at least). >+ - --share=ipc >+ - --socket=x11 >+ - --socket=wayland >+ - --device=all >+ - --share=network >+ - --socket=pulseaudio >+ - --system-talk-name=org.freedesktop.GeoClue2 >+ - --filesystem=host >+ - --socket=system-bus >+ - --talk-name=org.freedesktop.Flatpak >+ - --env=GST_PRESET_PATH=/app/share/gstreamer-1.0/presets/ >+build-options: >+ cflags: -O2 -g >+ cxxflags: -O2 -g >+ strip: false >+ no-debuginfo: true >+modules: >+ - org.webkit.CommonModules.yaml >+ - org.webkit.WPEModules.yaml >+ >+ # This module is not actually built. >+ - name: org.webkit.QTWPE >+ buildsystem: qmake >+ sources: >+ - type: dir >+ path: /app/webkit/Source/ThirdParty/WPE/QtWPE/ >diff --git a/Tools/flatpak/org.webkit.QtWPEModules.yaml b/Tools/flatpak/org.webkit.QtWPEModules.yaml >new file mode 100644 >index 0000000000000000000000000000000000000000..dd2a256814b381a9e4f51c85be11115f85b0c64d >--- /dev/null >+++ b/Tools/flatpak/org.webkit.QtWPEModules.yaml >@@ -0,0 +1,12 @@ >+- name: brotli >+ sources: >+ - type: archive >+ url: https://github.com/google/brotli/archive/v1.0.5.tar.gz >+ sha256: 3d5bedd48edb909fe3b87cb99f7d139b987ef6f1616b7e22d74e928270a2fd20 >+ buildsystem: cmake-ninja >+- name: woff2 >+ sources: >+ - type: archive >+ url: https://github.com/google/woff2/archive/v1.0.2.tar.gz >+ sha256: add272bb09e6384a4833ffca4896350fdb16e0ca22df68c0384773c67a175594 >+ buildsystem: cmake-ninja >diff --git a/Tools/wpe/qt-wpe-mini-browser/CMakeLists.txt b/Tools/wpe/qt-wpe-mini-browser/CMakeLists.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..0c7f2c4ccf4a3123bcdbc59df9ec551e9dd80e8f >--- /dev/null >+++ b/Tools/wpe/qt-wpe-mini-browser/CMakeLists.txt >@@ -0,0 +1,18 @@ >+cmake_minimum_required(VERSION 3.1) >+ >+project(qt-wpe-mini-browser LANGUAGES CXX) >+ >+set(CMAKE_INCLUDE_CURRENT_DIR ON) >+set(CMAKE_AUTOMOC ON) >+set(CMAKE_AUTORCC ON) >+set(CMAKE_CXX_STANDARD 11) >+set(CMAKE_CXX_STANDARD_REQUIRED ON) >+ >+find_package(Qt5 QUIET COMPONENTS Core Quick) >+ >+if (Qt5_FOUND) >+ add_executable(${PROJECT_NAME} "main.cpp" "qml.qrc") >+ target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Quick) >+else () >+ message(WARNING "Qt5 development libraries not found. QtWPE's MiniBrowser will not be built") >+endif () >diff --git a/Tools/wpe/qt-wpe-mini-browser/COPYING.LGPL2 b/Tools/wpe/qt-wpe-mini-browser/COPYING.LGPL2 >new file mode 100644 >index 0000000000000000000000000000000000000000..c87cfe8c990d3d4b562f8dc6a6980a3bcd62387b >--- /dev/null >+++ b/Tools/wpe/qt-wpe-mini-browser/COPYING.LGPL2 >@@ -0,0 +1,481 @@ >+ GNU LIBRARY GENERAL PUBLIC LICENSE >+ Version 2, June 1991 >+ >+ Copyright (C) 1991 Free Software Foundation, Inc. >+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA >+ Everyone is permitted to copy and distribute verbatim copies >+ of this license document, but changing it is not allowed. >+ >+[This is the first released version of the library GPL. It is >+ numbered 2 because it goes with version 2 of the ordinary GPL.] >+ >+ Preamble >+ >+ The licenses for most software are designed to take away your >+freedom to share and change it. By contrast, the GNU General Public >+Licenses are intended to guarantee your freedom to share and change >+free software--to make sure the software is free for all its users. >+ >+ This license, the Library General Public License, applies to some >+specially designated Free Software Foundation software, and to any >+other libraries whose authors decide to use it. You can use it for >+your libraries, too. >+ >+ When we speak of free software, we are referring to freedom, not >+price. Our General Public Licenses are designed to make sure that you >+have the freedom to distribute copies of free software (and charge for >+this service if you wish), that you receive source code or can get it >+if you want it, that you can change the software or use pieces of it >+in new free programs; and that you know you can do these things. >+ >+ To protect your rights, we need to make restrictions that forbid >+anyone to deny you these rights or to ask you to surrender the rights. >+These restrictions translate to certain responsibilities for you if >+you distribute copies of the library, or if you modify it. >+ >+ For example, if you distribute copies of the library, whether gratis >+or for a fee, you must give the recipients all the rights that we gave >+you. You must make sure that they, too, receive or can get the source >+code. If you link a program with the library, you must provide >+complete object files to the recipients so that they can relink them >+with the library, after making changes to the library and recompiling >+it. And you must show them these terms so they know their rights. >+ >+ Our method of protecting your rights has two steps: (1) copyright >+the library, and (2) offer you this license which gives you legal >+permission to copy, distribute and/or modify the library. >+ >+ Also, for each distributor's protection, we want to make certain >+that everyone understands that there is no warranty for this free >+library. If the library is modified by someone else and passed on, we >+want its recipients to know that what they have is not the original >+version, so that any problems introduced by others will not reflect on >+the original authors' reputations. >+ >+ Finally, any free program is threatened constantly by software >+patents. We wish to avoid the danger that companies distributing free >+software will individually obtain patent licenses, thus in effect >+transforming the program into proprietary software. To prevent this, >+we have made it clear that any patent must be licensed for everyone's >+free use or not licensed at all. >+ >+ Most GNU software, including some libraries, is covered by the ordinary >+GNU General Public License, which was designed for utility programs. This >+license, the GNU Library General Public License, applies to certain >+designated libraries. This license is quite different from the ordinary >+one; be sure to read it in full, and don't assume that anything in it is >+the same as in the ordinary license. >+ >+ The reason we have a separate public license for some libraries is that >+they blur the distinction we usually make between modifying or adding to a >+program and simply using it. Linking a program with a library, without >+changing the library, is in some sense simply using the library, and is >+analogous to running a utility program or application program. However, in >+a textual and legal sense, the linked executable is a combined work, a >+derivative of the original library, and the ordinary General Public License >+treats it as such. >+ >+ Because of this blurred distinction, using the ordinary General >+Public License for libraries did not effectively promote software >+sharing, because most developers did not use the libraries. We >+concluded that weaker conditions might promote sharing better. >+ >+ However, unrestricted linking of non-free programs would deprive the >+users of those programs of all benefit from the free status of the >+libraries themselves. This Library General Public License is intended to >+permit developers of non-free programs to use free libraries, while >+preserving your freedom as a user of such programs to change the free >+libraries that are incorporated in them. (We have not seen how to achieve >+this as regards changes in header files, but we have achieved it as regards >+changes in the actual functions of the Library.) The hope is that this >+will lead to faster development of free libraries. >+ >+ The precise terms and conditions for copying, distribution and >+modification follow. Pay close attention to the difference between a >+"work based on the library" and a "work that uses the library". The >+former contains code derived from the library, while the latter only >+works together with the library. >+ >+ Note that it is possible for a library to be covered by the ordinary >+General Public License rather than by this special one. >+ >+ GNU LIBRARY GENERAL PUBLIC LICENSE >+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION >+ >+ 0. This License Agreement applies to any software library which >+contains a notice placed by the copyright holder or other authorized >+party saying it may be distributed under the terms of this Library >+General Public License (also called "this License"). Each licensee is >+addressed as "you". >+ >+ A "library" means a collection of software functions and/or data >+prepared so as to be conveniently linked with application programs >+(which use some of those functions and data) to form executables. >+ >+ The "Library", below, refers to any such software library or work >+which has been distributed under these terms. A "work based on the >+Library" means either the Library or any derivative work under >+copyright law: that is to say, a work containing the Library or a >+portion of it, either verbatim or with modifications and/or translated >+straightforwardly into another language. (Hereinafter, translation is >+included without limitation in the term "modification".) >+ >+ "Source code" for a work means the preferred form of the work for >+making modifications to it. For a library, complete source code means >+all the source code for all modules it contains, plus any associated >+interface definition files, plus the scripts used to control compilation >+and installation of the library. >+ >+ Activities other than copying, distribution and modification are not >+covered by this License; they are outside its scope. The act of >+running a program using the Library is not restricted, and output from >+such a program is covered only if its contents constitute a work based >+on the Library (independent of the use of the Library in a tool for >+writing it). Whether that is true depends on what the Library does >+and what the program that uses the Library does. >+ >+ 1. You may copy and distribute verbatim copies of the Library's >+complete source code as you receive it, in any medium, provided that >+you conspicuously and appropriately publish on each copy an >+appropriate copyright notice and disclaimer of warranty; keep intact >+all the notices that refer to this License and to the absence of any >+warranty; and distribute a copy of this License along with the >+Library. >+ >+ You may charge a fee for the physical act of transferring a copy, >+and you may at your option offer warranty protection in exchange for a >+fee. >+ >+ 2. You may modify your copy or copies of the Library or any portion >+of it, thus forming a work based on the Library, and copy and >+distribute such modifications or work under the terms of Section 1 >+above, provided that you also meet all of these conditions: >+ >+ a) The modified work must itself be a software library. >+ >+ b) You must cause the files modified to carry prominent notices >+ stating that you changed the files and the date of any change. >+ >+ c) You must cause the whole of the work to be licensed at no >+ charge to all third parties under the terms of this License. >+ >+ d) If a facility in the modified Library refers to a function or a >+ table of data to be supplied by an application program that uses >+ the facility, other than as an argument passed when the facility >+ is invoked, then you must make a good faith effort to ensure that, >+ in the event an application does not supply such function or >+ table, the facility still operates, and performs whatever part of >+ its purpose remains meaningful. >+ >+ (For example, a function in a library to compute square roots has >+ a purpose that is entirely well-defined independent of the >+ application. Therefore, Subsection 2d requires that any >+ application-supplied function or table used by this function must >+ be optional: if the application does not supply it, the square >+ root function must still compute square roots.) >+ >+These requirements apply to the modified work as a whole. If >+identifiable sections of that work are not derived from the Library, >+and can be reasonably considered independent and separate works in >+themselves, then this License, and its terms, do not apply to those >+sections when you distribute them as separate works. But when you >+distribute the same sections as part of a whole which is a work based >+on the Library, the distribution of the whole must be on the terms of >+this License, whose permissions for other licensees extend to the >+entire whole, and thus to each and every part regardless of who wrote >+it. >+ >+Thus, it is not the intent of this section to claim rights or contest >+your rights to work written entirely by you; rather, the intent is to >+exercise the right to control the distribution of derivative or >+collective works based on the Library. >+ >+In addition, mere aggregation of another work not based on the Library >+with the Library (or with a work based on the Library) on a volume of >+a storage or distribution medium does not bring the other work under >+the scope of this License. >+ >+ 3. You may opt to apply the terms of the ordinary GNU General Public >+License instead of this License to a given copy of the Library. To do >+this, you must alter all the notices that refer to this License, so >+that they refer to the ordinary GNU General Public License, version 2, >+instead of to this License. (If a newer version than version 2 of the >+ordinary GNU General Public License has appeared, then you can specify >+that version instead if you wish.) Do not make any other change in >+these notices. >+ >+ Once this change is made in a given copy, it is irreversible for >+that copy, so the ordinary GNU General Public License applies to all >+subsequent copies and derivative works made from that copy. >+ >+ This option is useful when you wish to copy part of the code of >+the Library into a program that is not a library. >+ >+ 4. You may copy and distribute the Library (or a portion or >+derivative of it, under Section 2) in object code or executable form >+under the terms of Sections 1 and 2 above provided that you accompany >+it with the complete corresponding machine-readable source code, which >+must be distributed under the terms of Sections 1 and 2 above on a >+medium customarily used for software interchange. >+ >+ If distribution of object code is made by offering access to copy >+from a designated place, then offering equivalent access to copy the >+source code from the same place satisfies the requirement to >+distribute the source code, even though third parties are not >+compelled to copy the source along with the object code. >+ >+ 5. A program that contains no derivative of any portion of the >+Library, but is designed to work with the Library by being compiled or >+linked with it, is called a "work that uses the Library". Such a >+work, in isolation, is not a derivative work of the Library, and >+therefore falls outside the scope of this License. >+ >+ However, linking a "work that uses the Library" with the Library >+creates an executable that is a derivative of the Library (because it >+contains portions of the Library), rather than a "work that uses the >+library". The executable is therefore covered by this License. >+Section 6 states terms for distribution of such executables. >+ >+ When a "work that uses the Library" uses material from a header file >+that is part of the Library, the object code for the work may be a >+derivative work of the Library even though the source code is not. >+Whether this is true is especially significant if the work can be >+linked without the Library, or if the work is itself a library. The >+threshold for this to be true is not precisely defined by law. >+ >+ If such an object file uses only numerical parameters, data >+structure layouts and accessors, and small macros and small inline >+functions (ten lines or less in length), then the use of the object >+file is unrestricted, regardless of whether it is legally a derivative >+work. (Executables containing this object code plus portions of the >+Library will still fall under Section 6.) >+ >+ Otherwise, if the work is a derivative of the Library, you may >+distribute the object code for the work under the terms of Section 6. >+Any executables containing that work also fall under Section 6, >+whether or not they are linked directly with the Library itself. >+ >+ 6. As an exception to the Sections above, you may also compile or >+link a "work that uses the Library" with the Library to produce a >+work containing portions of the Library, and distribute that work >+under terms of your choice, provided that the terms permit >+modification of the work for the customer's own use and reverse >+engineering for debugging such modifications. >+ >+ You must give prominent notice with each copy of the work that the >+Library is used in it and that the Library and its use are covered by >+this License. You must supply a copy of this License. If the work >+during execution displays copyright notices, you must include the >+copyright notice for the Library among them, as well as a reference >+directing the user to the copy of this License. Also, you must do one >+of these things: >+ >+ a) Accompany the work with the complete corresponding >+ machine-readable source code for the Library including whatever >+ changes were used in the work (which must be distributed under >+ Sections 1 and 2 above); and, if the work is an executable linked >+ with the Library, with the complete machine-readable "work that >+ uses the Library", as object code and/or source code, so that the >+ user can modify the Library and then relink to produce a modified >+ executable containing the modified Library. (It is understood >+ that the user who changes the contents of definitions files in the >+ Library will not necessarily be able to recompile the application >+ to use the modified definitions.) >+ >+ b) Accompany the work with a written offer, valid for at >+ least three years, to give the same user the materials >+ specified in Subsection 6a, above, for a charge no more >+ than the cost of performing this distribution. >+ >+ c) If distribution of the work is made by offering access to copy >+ from a designated place, offer equivalent access to copy the above >+ specified materials from the same place. >+ >+ d) Verify that the user has already received a copy of these >+ materials or that you have already sent this user a copy. >+ >+ For an executable, the required form of the "work that uses the >+Library" must include any data and utility programs needed for >+reproducing the executable from it. However, as a special exception, >+the source code distributed need not include anything that is normally >+distributed (in either source or binary form) with the major >+components (compiler, kernel, and so on) of the operating system on >+which the executable runs, unless that component itself accompanies >+the executable. >+ >+ It may happen that this requirement contradicts the license >+restrictions of other proprietary libraries that do not normally >+accompany the operating system. Such a contradiction means you cannot >+use both them and the Library together in an executable that you >+distribute. >+ >+ 7. You may place library facilities that are a work based on the >+Library side-by-side in a single library together with other library >+facilities not covered by this License, and distribute such a combined >+library, provided that the separate distribution of the work based on >+the Library and of the other library facilities is otherwise >+permitted, and provided that you do these two things: >+ >+ a) Accompany the combined library with a copy of the same work >+ based on the Library, uncombined with any other library >+ facilities. This must be distributed under the terms of the >+ Sections above. >+ >+ b) Give prominent notice with the combined library of the fact >+ that part of it is a work based on the Library, and explaining >+ where to find the accompanying uncombined form of the same work. >+ >+ 8. You may not copy, modify, sublicense, link with, or distribute >+the Library except as expressly provided under this License. Any >+attempt otherwise to copy, modify, sublicense, link with, or >+distribute the Library is void, and will automatically terminate your >+rights under this License. However, parties who have received copies, >+or rights, from you under this License will not have their licenses >+terminated so long as such parties remain in full compliance. >+ >+ 9. You are not required to accept this License, since you have not >+signed it. However, nothing else grants you permission to modify or >+distribute the Library or its derivative works. These actions are >+prohibited by law if you do not accept this License. Therefore, by >+modifying or distributing the Library (or any work based on the >+Library), you indicate your acceptance of this License to do so, and >+all its terms and conditions for copying, distributing or modifying >+the Library or works based on it. >+ >+ 10. Each time you redistribute the Library (or any work based on the >+Library), the recipient automatically receives a license from the >+original licensor to copy, distribute, link with or modify the Library >+subject to these terms and conditions. You may not impose any further >+restrictions on the recipients' exercise of the rights granted herein. >+You are not responsible for enforcing compliance by third parties to >+this License. >+ >+ 11. If, as a consequence of a court judgment or allegation of patent >+infringement or for any other reason (not limited to patent issues), >+conditions are imposed on you (whether by court order, agreement or >+otherwise) that contradict the conditions of this License, they do not >+excuse you from the conditions of this License. If you cannot >+distribute so as to satisfy simultaneously your obligations under this >+License and any other pertinent obligations, then as a consequence you >+may not distribute the Library at all. For example, if a patent >+license would not permit royalty-free redistribution of the Library by >+all those who receive copies directly or indirectly through you, then >+the only way you could satisfy both it and this License would be to >+refrain entirely from distribution of the Library. >+ >+If any portion of this section is held invalid or unenforceable under any >+particular circumstance, the balance of the section is intended to apply, >+and the section as a whole is intended to apply in other circumstances. >+ >+It is not the purpose of this section to induce you to infringe any >+patents or other property right claims or to contest validity of any >+such claims; this section has the sole purpose of protecting the >+integrity of the free software distribution system which is >+implemented by public license practices. Many people have made >+generous contributions to the wide range of software distributed >+through that system in reliance on consistent application of that >+system; it is up to the author/donor to decide if he or she is willing >+to distribute software through any other system and a licensee cannot >+impose that choice. >+ >+This section is intended to make thoroughly clear what is believed to >+be a consequence of the rest of this License. >+ >+ 12. If the distribution and/or use of the Library is restricted in >+certain countries either by patents or by copyrighted interfaces, the >+original copyright holder who places the Library under this License may add >+an explicit geographical distribution limitation excluding those countries, >+so that distribution is permitted only in or among countries not thus >+excluded. In such case, this License incorporates the limitation as if >+written in the body of this License. >+ >+ 13. The Free Software Foundation may publish revised and/or new >+versions of the Library General Public License from time to time. >+Such new versions will be similar in spirit to the present version, >+but may differ in detail to address new problems or concerns. >+ >+Each version is given a distinguishing version number. If the Library >+specifies a version number of this License which applies to it and >+"any later version", you have the option of following the terms and >+conditions either of that version or of any later version published by >+the Free Software Foundation. If the Library does not specify a >+license version number, you may choose any version ever published by >+the Free Software Foundation. >+ >+ 14. If you wish to incorporate parts of the Library into other free >+programs whose distribution conditions are incompatible with these, >+write to the author to ask for permission. For software which is >+copyrighted by the Free Software Foundation, write to the Free >+Software Foundation; we sometimes make exceptions for this. Our >+decision will be guided by the two goals of preserving the free status >+of all derivatives of our free software and of promoting the sharing >+and reuse of software generally. >+ >+ NO WARRANTY >+ >+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO >+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. >+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR >+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY >+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE >+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE >+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME >+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. >+ >+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN >+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY >+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU >+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR >+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE >+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING >+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A >+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF >+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH >+DAMAGES. >+ >+ END OF TERMS AND CONDITIONS >+ >+ Appendix: How to Apply These Terms to Your New Libraries >+ >+ If you develop a new library, and you want it to be of the greatest >+possible use to the public, we recommend making it free software that >+everyone can redistribute and change. You can do so by permitting >+redistribution under these terms (or, alternatively, under the terms of the >+ordinary General Public License). >+ >+ To apply these terms, attach the following notices to the library. It is >+safest to attach them to the start of each source file to most effectively >+convey the exclusion of warranty; and each file should have at least the >+"copyright" line and a pointer to where the full notice is found. >+ >+ <one line to give the library's name and a brief idea of what it does.> >+ Copyright (C) <year> <name of author> >+ >+ 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; if not, write to the Free >+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. >+ >+Also add information on how to contact you by electronic and paper mail. >+ >+You should also get your employer (if you work as a programmer) or your >+school, if any, to sign a "copyright disclaimer" for the library, if >+necessary. Here is a sample; alter the names: >+ >+ Yoyodyne, Inc., hereby disclaims all copyright interest in the >+ library `Frob' (a library for tweaking knobs) written by James Random Hacker. >+ >+ <signature of Ty Coon>, 1 April 1990 >+ Ty Coon, President of Vice >+ >+That's all there is to it! >diff --git a/Tools/wpe/qt-wpe-mini-browser/main.cpp b/Tools/wpe/qt-wpe-mini-browser/main.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..fc17f582142b06fce3ee813cf65cdd66c45bad1b >--- /dev/null >+++ b/Tools/wpe/qt-wpe-mini-browser/main.cpp >@@ -0,0 +1,55 @@ >+/* QtWPE >+ * >+ * Copyright (C) 2018 Igalia S.L >+ * Copyright (C) 2018 Zodiac Inflight Innovations >+ * >+ * 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; if not, write to the >+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ */ >+ >+#include <QCommandLineOption> >+#include <QCommandLineParser> >+#include <QGuiApplication> >+#include <QQmlApplicationEngine> >+#include <QQmlContext> >+#include <QUrl> >+ >+int main(int argc, char* argv[]) >+{ >+ QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); >+ >+ QGuiApplication app(argc, argv); >+ >+ QCommandLineParser parser; >+ QCoreApplication::setApplicationVersion("0.1"); >+ parser.setApplicationDescription(QGuiApplication::applicationDisplayName()); >+ parser.addHelpOption(); >+ parser.addVersionOption(); >+ parser.addPositionalArgument("initialUrl", "The URL to open."); >+ QStringList arguments = app.arguments(); >+ parser.process(arguments); >+ const QString initialUrl = parser.positionalArguments().isEmpty() ? >+ QStringLiteral("https://wpewebkit.org") : parser.positionalArguments().first(); >+ >+ QQmlApplicationEngine engine; >+ QQmlContext* context = engine.rootContext(); >+ context->setContextProperty(QStringLiteral("initialUrl"), QUrl(initialUrl)); >+ >+ engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); >+ if (engine.rootObjects().isEmpty()) >+ return -1; >+ >+ return app.exec(); >+} >diff --git a/Tools/wpe/qt-wpe-mini-browser/main.qml b/Tools/wpe/qt-wpe-mini-browser/main.qml >new file mode 100644 >index 0000000000000000000000000000000000000000..a405d76c0e43e43bada3f1d0ef1c24bf4cc90951 >--- /dev/null >+++ b/Tools/wpe/qt-wpe-mini-browser/main.qml >@@ -0,0 +1,20 @@ >+import QtQuick 2.11 >+import QtQuick.Window 2.11 >+import org.wpewebkit.qtwpe 1.0 >+ >+Window { >+ id: main_window >+ visible: true >+ width: 1280 >+ height: 720 >+ title: qsTr("Hello WPE!") >+ >+ WPEView { >+ url: initialUrl >+ focus: true >+ anchors.fill: parent >+ onTitleChanged: { >+ main_window.title = title; >+ } >+ } >+} >diff --git a/Tools/wpe/qt-wpe-mini-browser/qml.qrc b/Tools/wpe/qt-wpe-mini-browser/qml.qrc >new file mode 100644 >index 0000000000000000000000000000000000000000..5f6483ac33f1881cc59e080e69bb033ebe2a7829 >--- /dev/null >+++ b/Tools/wpe/qt-wpe-mini-browser/qml.qrc >@@ -0,0 +1,5 @@ >+<RCC> >+ <qresource prefix="/"> >+ <file>main.qml</file> >+ </qresource> >+</RCC>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 191464
:
354328
|
356506
|
356602
|
356609
|
356610
|
356723
|
358693
|
359152
|
359380