4 ms·
"What I don't get, is why couldn't a dev team just embed WebKit directly - what does this really give? Can it put a browser in game in 3D, or is it a 2D overlay
by ensiferum 6y ago
"What I don't get, is why couldn't a dev team just embed WebKit directly - what does this really give? Can it put a browser in game in 3D, or is it a 2D overlay? Will it work with VR / AR?"
It really is not that simple. Rendering a modern webpage or webapp requires a lot of components. You can't just take webkit and call it a day. For example in the chromium engine Blink which is the Webkit fork doesn't event render pages. It consumes HTML and CSS and produces "display lists" i.e lists of drawing commands. Those are fed to a rasterizer engine that must maintain a whole stack of trandormable layers which are managed in various render trees. Finally pages are radterized in tiles and then composited together for the final image that is show in the viewport. All of this covers millions of lines of code on top of Blink! And we're not even talking about things such as executing JS or syncing JS input handlers with the rendering or doing the actual page loads over HTTP/S or handling windowing and platform APIs and user input etc. All of which are really more or less essential in order to make anything that is actually useful.
- jakearmitage 6y agoUh... yes you can: Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(""); Gtk::Window window; window.set_default_size(1366, 768); WebKitWebContext* context = webkit_web_context_new_ephemeral(); WebKitCookieManager* cookies = webkit_web_context_get_cookie_manager(context); WebKitWebView* widget = WEBKIT_WEB_VIEW(webkit_web_view_new_with_context(context)); Gtk::Widget* wrapper = Glib::wrap(GTK_WIDGET(widget)); WebKitSettings* settings = webkit_web_view_get_settings(widget); Gtk::Box layout(Gtk::ORIENTATION_VERTICAL); window.add(layout); webkit_web_view_load_uri(widget, parse_address(argv[1]).c_str()); window.show_all(); app->run(window); exit(0); Done.
- adamjs 6y agoFWIW Ultralight isn't tied to GTK or any windowing system (API is platform-agnostic), also the core Renderer API doesn't even require a run loop (this is vitally important if you're integrating HTML UI into complex environments like games and headless apps).