| 1 | == Disclaimer == |
| 2 | |
| 3 | This is my scratch-pad for thoughts about QtWebKit for Qt 5. After spending plenty of time talking to different people, I'm |
| 4 | slowly exceeding the capacity of my brain and it is time to digest, summarize and write down some content :) |
| 5 | |
| 6 | Please feel free to edit right away or add comments with prefix between the paragraphs ("JoeDoe: I think this is all complete rubbish.") |
| 7 | |
| 8 | == QtWebKit for Qt 5 == |
| 9 | |
| 10 | We have learned a lot about WebKit2 in the past months, as well as mobile web development. With QtWebKit for |
| 11 | Qt 5 it is time to bring this experience to the main line: |
| 12 | |
| 13 | * QtWebKit for Qt 5 should make it easy to write great mobile web browsers. |
| 14 | * QtWebKit for Qt 5 provides convenient APIs for creating Qt applications that embed and closely integrate with web content. |
| 15 | |
| 16 | == Design == |
| 17 | |
| 18 | Qt5 will be an interesting foundation for QtWebKit. The changes in Qt 5 that affect QtWebKit the most are the move of |
| 19 | QWidget and related classes into a separate library as well as the introduction of Qt Quick 2 and the Qt Scene Graph as |
| 20 | the primary graphics/UI API. |
| 21 | |
| 22 | Consequently the QtWebKit API should change: |
| 23 | |
| 24 | * The primary interface to the web engine should be through WebKit2. |
| 25 | * A QML based UI component offers built-in handling for gestures, touch events and scrollbars (viewport). |
| 26 | * Features like accelerated compositing, WebGL, inline video, etc. should work out of the box, without extra settings or configuration flags. |
| 27 | * A minimal C++ API allows for fine-tuning certain parameters and potentially low-level hooks (for example controlling the web process creation) |
| 28 | * The QWidget/QGraphicsView based WebKit1 API moves into a separate shared library that links against QtWebKit. |
| 29 | |
| 30 | == Implementation Details == |
| 31 | |
| 32 | Let's look a bit closer into possible solutions to implement the proposed design: |
| 33 | |
| 34 | === WebKit2, Scene Graph, Tiling and Accelerated Compositing === |
| 35 | |
| 36 | The QML WebView should support tiling and AC out of the box and AC should not be anymore an afterthought |
| 37 | "on top of tiling" but we should be in a permanent state of accelerated compositing. Layers should support |
| 38 | tiling and the root tile set should just be a layer, to avoid expensive switching between AC and non-AC mode. |
| 39 | |
| 40 | We need to determine the best way to integrate tiling / AC with the Qt scene graph. An initial pragmatic solution |
| 41 | would be to render the tiles and AC layers into an FBO first. |
| 42 | |
| 43 | Another option would be to separate scene graph rendering from WebKit by rendering WebKit2 with raw OpenGL through |
| 44 | the Texture Mapper first and then the entire QML scene on top. |
| 45 | |
| 46 | The approach requiring probably the most effort is to essentially re-implement WebKit2 UI-process sided AC on top of |
| 47 | the scene graph, i.e. let the web process serialize the layer & animation information to the UI process where the layer |
| 48 | tree is replicated in terms of scene graph geometry nodes and texture materials that are subject to animation. |
| 49 | |
| 50 | === Library split === |
| 51 | |
| 52 | Ideally the main QtWebKit library as well as the QtWebProcess won't link against the Qt widgets library. We should investigate |
| 53 | the option of moving all QWidget dependencies (like the old plugin code) out of WebCore and into a secondary QtWebKitWidgets |
| 54 | library that interfaces with WebCore through a platform plugin alike mechanism and hooks up top to implement QWebView/QGraphicsWebView. |
| 55 | In such a design, WebCore would paint primarily with the raster paint engine and load all images in QImage objects instead of QPixmaps. |
| 56 | |
| 57 | === WebGL === |
| 58 | |
| 59 | For an efficient WebGL implementation we could either |
| 60 | |
| 61 | 1) Use OpenGL directly in the web process, render into an FBO and implement cross-process texture sharing for AC |
| 62 | |
| 63 | or |
| 64 | |
| 65 | 2) Serialize the OpenGL commands and execute them on the UI process side |
| 66 | |
| 67 | Some research is needed here, but option 1) would have the additional benefit of also simplifying the video implementation |
| 68 | due to the texture sharing. |
| 69 | |
| 70 | === Video === |
| 71 | |
| 72 | In order to render embedded videos efficiently and provide seamless transitions to fullscreen playback, we require from the platform |
| 73 | the ability to render video into textures. For fullscreen playback we should piggy-back on the fullscreen element feature in WebCore/WebKit2 |
| 74 | that integrates with AC. The video texture becomes the root layer and the controls live in their own layer on top. |
| 75 | |