[webkit-qt] API for viewport meta tag support

Jesus Sanchez-Palencia jesus.palencia at openbossa.org
Thu Jun 17 14:18:30 PDT 2010


The patch was landed in https://trac.webkit.org/changeset/61342 .

I'm not sure if it will be cherry-picked to QtWebKit 2.0 branch or if it
will have to wait until 2.1, but it's in trunk already.


Useful links to understand the viewport meta tag and related concepts:

http://developer.apple.com/safari/library/documentation/appleapplications/reference/safarihtmlref/articles/metatags.html
https://developer.mozilla.org/en/Mobile/Viewport_meta_tag
http://www.quirksmode.org/blog/archives/2010/04/a_pixel_is_not.html
http://hacks.mozilla.org/2010/05/upcoming-changes-to-the-viewport-meta-tag-for-firefox-mobile/


Hope that it proves itself useful for everyone. :)

Best regards,
jesus


2010/6/7 <steve.lewontin at nokia.com>

> Sorry, what I meant is when will the patch go in?
>
> --Steve
>
>
> -----Original Message-----
> From: ext Kenneth Christiansen [mailto:kenneth.christiansen at openbossa.org]
> Sent: Friday, June 04, 2010 3:06 PM
> To: Lewontin Steve (Nokia-D/Boston)
> Cc: Hausmann Simon (Nokia-D-Qt/Oslo); webkit-qt at lists.webkit.org
> Subject: Re: [webkit-qt] API for viewport meta tag support
>
> 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/appleapplicati
> > ons/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/appleappl
> > + ic
> > + 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
> _______________________________________________
> webkit-qt mailing list
> webkit-qt at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-qt
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-qt/attachments/20100617/e319ef83/attachment.html>


More information about the webkit-qt mailing list