RESOLVED FIXED72161
[Qt][WK2] Implement loadHtml API for QQuickWebView
https://bugs.webkit.org/show_bug.cgi?id=72161
Summary [Qt][WK2] Implement loadHtml API for QQuickWebView
Jesus Sanchez-Palencia
Reported 2011-11-11 11:40:43 PST
QQuickWebView needs QQuickWebView::setHtml(const QString &html, const QUrl& baseUrl) .
Attachments
Patch (7.12 KB, patch)
2011-11-11 11:48 PST, Jesus Sanchez-Palencia
no flags
Patch (8.33 KB, patch)
2011-11-16 05:54 PST, Jesus Sanchez-Palencia
no flags
Patch (8.40 KB, patch)
2011-11-16 06:11 PST, Jesus Sanchez-Palencia
no flags
Jesus Sanchez-Palencia
Comment 1 2011-11-11 11:48:45 PST
Caio Marcelo de Oliveira Filho
Comment 2 2011-11-11 12:07:01 PST
Comment on attachment 114749 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=114749&action=review > Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp:718 > + WKRetainPtr<WKStringRef> wkHtmlString(WKStringCreateWithUTF8CString(html.toUtf8().constData())); I think we have a WKStringCreateWithQString in WKStringQt.h or similar.
Jesus Sanchez-Palencia
Comment 3 2011-11-11 12:23:06 PST
(In reply to comment #2) > (From update of attachment 114749 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=114749&action=review > > > Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp:718 > > + WKRetainPtr<WKStringRef> wkHtmlString(WKStringCreateWithUTF8CString(html.toUtf8().constData())); > > I think we have a WKStringCreateWithQString in WKStringQt.h or similar. We do, but I was unsure of the conversions...
Simon Hausmann
Comment 4 2011-11-13 11:13:20 PST
Comment on attachment 114749 [details] Patch <bikeshed> I feel that perhaps we should change our "tactics" and use loadHTML instead of setHTML to emphasize the fact that this function is very async in its behavior. Also it would be nice to start introducing documentation for newly added functions :)
Caio Marcelo de Oliveira Filho
Comment 5 2011-11-14 06:02:54 PST
(In reply to comment #4) > (From update of attachment 114749 [details]) > <bikeshed> I feel that perhaps we should change our "tactics" and use loadHTML instead of setHTML to emphasize the fact that this function is very async in its behavior. That's a good idea, Simon.
Caio Marcelo de Oliveira Filho
Comment 6 2011-11-14 06:15:23 PST
Comment on attachment 114749 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=114749&action=review >>> Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp:718 >>> + WKRetainPtr<WKStringRef> wkHtmlString(WKStringCreateWithUTF8CString(html.toUtf8().constData())); >> >> I think we have a WKStringCreateWithQString in WKStringQt.h or similar. > > We do, but I was unsure of the conversions... It is fine to use WKStringCreateWithQString here. Because of the internal representation of wtf String (can use 16 bit char, WKString/WebString are wrappers to wtf String) and QString (uses 16 bit char) we'll even do less conversions. :-)
Jesus Sanchez-Palencia
Comment 7 2011-11-16 05:54:39 PST
Caio Marcelo de Oliveira Filho
Comment 8 2011-11-16 05:59:06 PST
Comment on attachment 115362 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=115362&action=review LGTM with a few style comments. > Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp:506 > +void QQuickWebView::loadHtml(const QString &html, const QUrl& baseUrl) Style. > Source/WebKit2/UIProcess/API/qt/qquickwebview.h:99 > + void loadHtml(const QString &html, const QUrl& baseUrl = QUrl()); Style. > Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_loadHtml.qml:20 > + id: spy Minor: "linkSpy"? "linkHoveredSpy"? > Source/WebKit2/UIProcess/API/qt/tests/qmltests/qmltests.pro:29 > + DesktopBehavior/tst_loadHtml.qml Do we need tests for both cases? I think WebView one suffices. > Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp:716 > +void QtWebPageProxy::loadHTMLString(const QString &html, const QUrl &baseUrl) Style. > Source/WebKit2/UIProcess/qt/QtWebPageProxy.h:164 > + void loadHTMLString(const QString &html, const QUrl &baseUrl); Style.
Caio Marcelo de Oliveira Filho
Comment 9 2011-11-16 06:00:45 PST
Comment on attachment 115362 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=115362&action=review >> Source/WebKit2/UIProcess/API/qt/tests/qmltests/qmltests.pro:29 >> + DesktopBehavior/tst_loadHtml.qml > > Do we need tests for both cases? I think WebView one suffices. Ignore this. Jesus just explained me here that link hovered is only available when using Desktop Behaviour.
Jesus Sanchez-Palencia
Comment 10 2011-11-16 06:11:42 PST
Jesus Sanchez-Palencia
Comment 11 2011-11-16 06:13:04 PST
(In reply to comment #8) > Style. Fixed. Fooled by check-webkit-style... =/ > Do we need tests for both cases? I think WebView one suffices. > Ignore this. Jesus just explained me here that link hovered is only available when using Desktop Behaviour. Ditto!
Simon Hausmann
Comment 12 2011-11-18 00:03:39 PST
Comment on attachment 115365 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=115365&action=review r=me > Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp:502 > + The \a html is loaded immediately; external objects are loaded asynchronously. Hmm, how do we quantify immediately? It starts with an async message to the web process :) I'd rather leave that part out from the documentation tbh.
Jesus Sanchez-Palencia
Comment 13 2011-11-21 09:16:23 PST
Note You need to log in before you can comment on or make changes to this bug.