[webkit-qt] Adding a "view source" API for WebView [feedback needed!]

Jesus Sanchez-Palencia jesus at webkit.org
Tue May 8 09:09:39 PDT 2012


On Tue, May 8, 2012 at 11:59 AM, Hugo Parente Lima <hugo.pl at gmail.com>wrote:

> On Tuesday, May 08, 2012 11:52:32 AM Jesus Sanchez-Palencia wrote:
> > Hi,
> >
> > At https://bugs.webkit.org/show_bug.cgi?id=84953 we have been discussing
> > about implementing a "View Source" API for QQuickWebView (WebView for
> > QtQuick2).
>
> You are talking about display the source code rendered into the browser
> window
> or have access to the raw HTML source as a QString?
>


Sorry, it's about displaying the source code (view source, not getHtml...).
Type view-source:http://www.foo.com on Chromium and you will _exactly_ what
I'm talking about.

It looks nice (with highlighting and so on) due
to Source/WebCore/html/HTMLViewSourceDocument.h which is used
by DOMImplementation::createDocument() when you set inViewSourceMode to a
WebCore::Page.


Cheers!
jesus



>
> > Three approaches were suggested so far:
> >
> > 1- Implementing support to "view-source:http://www.foo.com" directly on
> the
> > webView.url property, following view-source uri scheme [1] [2];
> > *Pros: straight-forward API, follows other browsers implementations [2];
> > *Cons: adds complexity to the url property, adds complexity to browser
> > implementation for handling multiple url schemes (discussion about this
> on
> > the bug).
> > *!* Personal Pros: me gusta.
> >
> >
> > 2- Implementing a bool webView.experimental.viewInSourceMode property.
> > *Pros: straight-forward API, doesn't add any complexity to the url
> property;
> > *Cons: transfers the entire decision on how to enable this to the browser
> > implementation.
> > *!* Personal Cons: no me gusta.
> >
> >
> > 3- Implementing a WebViewSource { }, that inherits from WebView.
> > *Pros: a specialized and separate component, doesn't add any complexity
> to
> > the url property;
> > *Cons: not that straight-forward API (?!?), transfers the entire decision
> > on how to enable this to the browser implementation.
> > *!* Personal Pros: me gusta mucho.
> >
> >
> > Since this came up quite late on the entire API design for the brand new
> > QtWebKit, I would like to hear from you guys what you think.
> >
> > Cheers and thanks in advance,
> > jesus
> >
> >
> > [1] http://www.iana.org/assignments/uri-schemes/prov/view-source
> > [2] http://en.wikipedia.org/wiki/View-source_URI_scheme
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-qt/attachments/20120508/cd20d665/attachment.html>


More information about the webkit-qt mailing list