[webkit-qt] API for viewport meta tag support
Kenneth Christiansen
kenneth.christiansen at openbossa.org
Fri Jun 4 12:05:31 PDT 2010
Hi Steve,
What do you mean with 'when do you think this can be done'?
The patch provides a working implementation, and Jesus and me have
further tested the usability of the API by implementing support for
adjusting the viewport and scale in the yberbrowser, by hooking it up
with Antti's tiling support.
As the feature is not known my most developers, not deeply involved in
web development, we concentrated a lot on providing an easy to use
API, together with some good documentation.
When the patch goes in, and we have settled on the API, the idea is
that Jesus will improve the documentation further, by adding some
snippet code, showing how to actually use the API.
Cheers,
Kenneth
On Fri, Jun 4, 2010 at 12:52 PM, <steve.lewontin at nokia.com> wrote:
> Hi:
>
> This is exactly what browser needs to cleanly implement tiling! When do you think this could be done?
>
> --Steve
>
>
> -----Original Message-----
> From: webkit-qt-bounces at lists.webkit.org [mailto:webkit-qt-bounces at lists.webkit.org] On Behalf Of Hausmann Simon (Nokia-D-Qt/Oslo)
> Sent: Friday, June 04, 2010 8:54 AM
> To: webkit-qt at lists.webkit.org
> Subject: [webkit-qt] API for viewport meta tag support
>
> Hi,
>
> WebCore itself has support for Apple's viewport meta tag:
>
> http://developer.apple.com/safari/library/documentation/appleapplications/reference/safarihtmlref/articles/metatags.html
>
> which can look like this in HTML:
>
> <meta name = "viewport" content = "width = 320,
> initial-scale = 2.3, user-scalable = no">
>
> The tag allows the web page to influence the sacl and geometry of the viewport on mobile browsers. WebCore has support for parsing all these attributes and passing them to the ChromeClient layer as soon as they're available. It is then the job of the WebKit API layer to propagate the information to the mobile browser application.
>
> Jesus has been working on that in bug
>
> https://bugs.webkit.org/show_bug.cgi?id=39902
>
> and has come up with a nice API where QWebPage emits a signal as soon as WebCore processes this tag:
>
> /*!
> + \since 4.7
> + \fn void QWebPage::viewportChangeRequested(const ViewportHints&
> + hints)
> +
> + This signal is emitted before any layout of the contents, giving you the viewport \a arguments
> + the web page would like you to use when laying out its contents, including elements fixed to the
> + viewport. This viewport might be larger that your actual viewport, meaning that a initialScale
> + should be applied. When no scale is given (-1.0), it is assumed that the contents should be scaled
> + such that the width of the scaled contents fits within the actual viewport.
> +
> + The minimum and maximum allowed scale represents the min and max values that the page
> + allows for scaling, and thus, affects the ability to zoom in on the page.
> +
> + Invalid values are supplied for the values not explicitly set by the web author; thus an
> + invalid viewport size, and values equal to -1.0 for scale factor and limits. The boolean
> + ViewportHints::isUserScalable is set to true.
> +
> + Page authors can provide the supplied values by using the viewport meta tag. More information
> + about this can be found at
> + \l{http://developer.apple.com/safari/library/documentation/appleapplic
> + ations/reference/safariwebcontent/usingtheviewport/usingtheviewport.ht
> + ml}{Safari Reference Library: Using the
> Viewport Meta Tag}.
> +
> + \sa QWebPage::ViewportHints, setPreferredContentsSize(),
> +QGraphicsWebView::setScale() */
>
> In order to avoid having a signal in the API that has lots of arguments, the parameters are instead collected in a structure:
>
> + struct ViewportHints {
> +
> + ViewportHints()
> + : initialScale(-1.0)
> + , minAllowedScale(-1.0)
> + , maxAllowedScale(-1.0)
> + , isUserScalable(true)
> + {
> + }
> +
> + QSize size;
> + qreal initialScale;
> + qreal minAllowedScale;
> + qreal maxAllowedScale;
> +
> + bool isUserScalable;
> + };
> +
>
> What do you guys think about this API?
>
> Please give feedback on https://bugs.webkit.org/show_bug.cgi?id=39902 :-)
>
>
> Simon
> _______________________________________________
> webkit-qt mailing list
> webkit-qt at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-qt
>
--
Kenneth Rohde Christiansen
Technical Lead / Senior Software Engineer
Qt Labs Americas, Nokia Technology Institute, INdT
Phone +55 81 8895 6002 / E-mail kenneth.christiansen at openbossa.org
More information about the webkit-qt
mailing list