wxWebView with Chromium backend

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 2240
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxWebView with Chromium backend

Post by PB » Tue Apr 02, 2019 4:41 pm

(I am talking about CMake build as described in my previous post)

So I just checked the chromium build. The webview chromium sample is a separate project in generated wxWidgets solution, however, the source file is just the webview sample where the webviewsample_chromium project has wxWEBVIEW_SAMPLE_CHROMIUM defined.

String wxWebViewBackendChromium is defined at line 50 in src/common/webview_chromium.cpp

Code: Select all

extern WXDLLIMPEXP_DATA_WEBVIEW_CHROMIUM(const char) wxWebViewBackendChromium[] = "wxWebViewChromium";
but this file should have been compiled and linked and the necessary defines set by CMake.

If you cannot build the chromium PR out of the box the same way I could, I think it's because you're are mixing files from different sources. As oneeyeman wrote, just use the GIT: it's really simple with a suitable tool. Even I could do it with only few drops of blood, sweat, and tears shed! Since wxWidgets switched to submodules for 3rd party libraries, you cannot just download the zip from GitHub, the submodules are not in that .ZIP.

As for statically linked CMake generated projects, there was a bug in the CMake project with static CRT linkage which was fixed after chromium PR. Due to this error, I could not build the static version with statically linked CRT either. However, I do not think it would be that great idea in this case, when you already have to ship a bunch of huge Chromium DLLs anyway....

Natulux
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 223
Joined: Thu Aug 03, 2017 12:20 pm

Re: wxWebView with Chromium backend

Post by Natulux » Wed Apr 03, 2019 6:43 am

ONEEYEMAN wrote:
Tue Apr 02, 2019 3:30 pm
Hi,
Because PB just cloned TcT2K repository and switched the branch appropriately. ;-)

BTW, I believe the actual WebView code is able to do RunScript() with return value. It just a Chromium that doesn't support it (yet?).
I thought I did that aswell, but whenever I fork TcT2k's wxWidgets, github just shows me "my" wxWidgets that I allready forked from wxWidgets. Thats why I checked it out several other ways. My last attempt is actually a real clone:

GitBash:

Code: Select all

$ git clone https://github.com/TcT2k/wxWidgets --recurse-submodules             
Cloning into 'wxWidgets'...
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 780929 (delta 0), reused 0 (delta 0), pack-reused 780928
Receiving objects: 100% (780929/780929), 305.80 MiB | 8.88 MiB/s, done.
Resolving deltas: 100% (651384/651384), done.
Checking out files: 100% (7696/7696), done.
But I am hesitant to try this, because I think it is missing some files again. Eg., I cant find the "wxmsw31u_webviewchromium.lib" in that repo...
ONEEYEMAN wrote:
Tue Apr 02, 2019 3:30 pm
BTW, I believe the actual WebView code is able to do RunScript() with return value. It just a Chromium that doesn't support it (yet?).
You are right to believe that. If I remember correctly, this was introduced (properly) to wxW with the merging of the GSoc2017 branch which became wxW311.
But the chromium backend API started prior to that and as PB said earlier, it was too difficult to adapt.

Cheers
Natu

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2240
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxWebView with Chromium backend

Post by PB » Wed Apr 03, 2019 7:13 am

Natulux wrote:
Wed Apr 03, 2019 6:43 am
But I am hesitant to try this, because I think it is missing some files again. Eg., I cant find the "wxmsw31u_webviewchromium.lib" in that repo...
What do you mean? No repository should contain built libraries.

I would make sure to clone TcT2k's fork to a new folder to prevent mixing files from different sources.

Natulux
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 223
Joined: Thu Aug 03, 2017 12:20 pm

Re: wxWebView with Chromium backend

Post by Natulux » Wed Apr 03, 2019 8:24 am

PB wrote:
Wed Apr 03, 2019 7:13 am
Natulux wrote:
Wed Apr 03, 2019 6:43 am
But I am hesitant to try this, because I think it is missing some files again. Eg., I cant find the "wxmsw31u_webviewchromium.lib" in that repo...
What do you mean? No repository should contain built libraries.
Silly me! You are right.

[EDIT]:
But why I was so focused on this thing: I still can't compile the sample webview because this lib is missing.
Also my sample includes "vc_lib" instead of "vc_dll" where the actual data for this build is.
Been there before ... :-/

PB wrote:
Wed Apr 03, 2019 7:13 am
I would make sure to clone TcT2k's fork to a new folder to prevent mixing files from different sources.
This is now a complete new directory and it feels easier with the git bash actually.
git clone https://github.com/TcT2k/wxWidgets --recurse-submodules
//cd into it
git checkout chromium
git submodule update --init
There are so many possible screws to adjust. But it feels like Im getting somewhere. Im learning a lot in this process, I didn't even know how narrow my understanding of git was before.

After all this, if I succeed, the real question is of course, if this code can be used productively. Im not to fond about having experimental wxWidget versions, used for productive building. I'd much rather have it as library that I can include in my widgets version of my choice (like miniblink does).
I wished this became part of wxWidgets. :-)

Cheers Natu

User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2292
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania
Contact:

Re: wxWebView with Chromium backend

Post by evstevemd » Wed Apr 03, 2019 9:07 am

Natulux wrote:
Wed Apr 03, 2019 8:24 am
I wished this became part of wxWidgets. :-)

Cheers Natu
The problem is maintenance. Once included in wxWidgets, it will require core dev to make sure that it always works. But there are many wxWidgets library (wxSQLite3 for example) that have maintainer(s) but aren't part of wx and we use them extensively. So if anyone picks the project, am sure community will follow.

One must be willing to lead a way as main developer.
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
[Ubuntu 19.04/Windows 10 Pro/MacOS 10.13 - GCC/MinGW/Clang, CodeLite IDE]

Natulux
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 223
Joined: Thu Aug 03, 2017 12:20 pm

Re: wxWebView with Chromium backend

Post by Natulux » Wed Apr 03, 2019 9:17 am

evstevemd wrote:
Wed Apr 03, 2019 9:07 am
The problem is maintenance. Once included in wxWidgets, it will require core dev to make sure that it always works. But there are many wxWidgets library (wxSQLite3 for example) that have maintainer(s) but aren't part of wx and we use them extensively. So if anyone picks the project, am sure community will follow.

One must be willing to lead a way as main developer.
True. And wxSQLite3 is a good third party, UTelle does an awesome job supporting and updating his code.
So maybe I should rather wish for an chromium third party backend, that is just as easily imported and used? But it seems that the original party dissolved, the whole project was meant to be included in the master (pull request). And, to be fair, I'd much rather have chromium as default backend, than trident. If trident was an option at all, I wouldn't even bother finding a suitable backend for the webview.

Cheers
Natu

User avatar
doublemax
Moderator
Moderator
Posts: 14628
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxWebView with Chromium backend

Post by doublemax » Wed Apr 03, 2019 10:18 am

BTW: Have you tried the prebuild binaries for CEF?
http://opensource.spotify.com/cefbuilds/index.html

If that would work, it would make the whole process much easier.
Use the source, Luke!

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2240
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxWebView with Chromium backend

Post by PB » Wed Apr 03, 2019 10:36 am

doublemax wrote:
Wed Apr 03, 2019 10:18 am
BTW: Have you tried the prebuild binaries for CEF?
Actually, wxWidgets's CMake project downloads the binary from the very same site. It is like magic and one of the reasons I tested that PR with CMake only. From what I read, building CEF3 is quite demanding process and it would not be wise to integrate it with wxWidgets build...

Natulux
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 223
Joined: Thu Aug 03, 2017 12:20 pm

Re: wxWebView with Chromium backend

Post by Natulux » Wed Apr 03, 2019 12:31 pm

PB wrote:
Wed Apr 03, 2019 10:36 am
doublemax wrote:
Wed Apr 03, 2019 10:18 am
BTW: Have you tried the prebuild binaries for CEF?
Actually, wxWidgets's CMake project downloads the binary from the very same site. It is like magic and one of the reasons I tested that PR with CMake only. From what I read, building CEF3 is quite demanding process and it would not be wise to integrate it with wxWidgets build...
Before I got CMake to download CEF automatically, I worked with the prebuild binaries manually. That works really fine, just as well as the samples of cef.
The problem is solely the compilation of the wxWebView-Chromium API.

It seems to me, that cef is not easy to integrate, given how many errors I already made with a project, that is supposed to work out of the box.
If I wouldn't want to use wxWebview, I'd much rather try to include the working cefsimple example. But I like to inject some JS and to catch window.open events via webview.

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2240
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxWebView with Chromium backend

Post by PB » Wed Apr 03, 2019 1:11 pm

Natulux wrote:
Wed Apr 03, 2019 12:31 pm
It seems to me, that cef is not easy to integrate, given how many errors I already made with a project, that is supposed to work out of the box.
If you believe there are bugs/issues with the PR (aside the already-fixed wxWidgets-wide CMake issue with static CRT linkage), I believe you are welcome to report them (concretely, how to reproduce) in the PR's comment section. To me, it seemed the error stemmed of yours not setting the wxWidgets branch properly, but I guess i was wrong.

Perhaps you should also ask in the wx-users mailing list what exactly prevents the PR from merging (aside from the lack of time of the core dev(s)): The PR submitter stated he is done with it and cannot figure out the three remaining issues, none of which looks to be too difficult. The project started in 2014 and I cannot really imagine it aging like wine, Internet Explorer may be for some close to unusable these days too...

User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2292
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania
Contact:

Re: wxWebView with Chromium backend

Post by evstevemd » Wed Apr 03, 2019 1:18 pm

If my opinion ever counted on this, I would abolish other backend and focus on this one. On this case, nativeness isn't that advantageous!
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
[Ubuntu 19.04/Windows 10 Pro/MacOS 10.13 - GCC/MinGW/Clang, CodeLite IDE]

Post Reply