Bug 65975 - [Qt/WK2] Add initial support for viewport meta tag
Summary: [Qt/WK2] Add initial support for viewport meta tag
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kenneth Rohde Christiansen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-10 05:14 PDT by Kenneth Rohde Christiansen
Modified: 2011-08-11 08:33 PDT (History)
4 users (show)

See Also:


Attachments
Patch (13.11 KB, patch)
2011-08-10 05:16 PDT, Kenneth Rohde Christiansen
no flags Details | Formatted Diff | Diff
Patch 2 (14.52 KB, patch)
2011-08-11 06:13 PDT, Kenneth Rohde Christiansen
benjamin: review-
Details | Formatted Diff | Diff
Patch 3 (13.95 KB, patch)
2011-08-11 07:03 PDT, Kenneth Rohde Christiansen
benjamin: review+
Details | Formatted Diff | Diff
Patch for landing (13.80 KB, patch)
2011-08-11 07:18 PDT, Kenneth Rohde Christiansen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kenneth Rohde Christiansen 2011-08-10 05:14:59 PDT
SSIA
Comment 1 Kenneth Rohde Christiansen 2011-08-10 05:16:46 PDT
Created attachment 103465 [details]
Patch
Comment 2 WebKit Review Bot 2011-08-10 05:19:29 PDT
Attachment 103465 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebKit2/ChangeLog', u'Source/WebKit..." exit_code: 1

Source/WebKit2/UIProcess/qt/ViewInterface.h:42:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
Total errors found: 1 in 9 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Benjamin Poulain 2011-08-10 07:34:21 PDT
Comment on attachment 103465 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=103465&action=review

> Source/WebKit2/ChangeLog:8
> +        Redirect the viewport arguments thru to the view.

You might want to be more informal than "thru"?

"Redirect da viewport stuff thru da view, yo." ;)

> Source/WebKit2/UIProcess/API/qt/qtouchwebview.cpp:75
> +        d->viewInterface.updateViewportState();

If the viewport is handling the state, this call would not be done on the view interface but on this. I think that would be more right, the viewport handle...the viewport state :)

> Source/WebKit2/UIProcess/qt/TouchViewInterface.cpp:108
> +    // FIXME: Make these properties on the view?

You can remove that, we'll modify that when the time come.
I would rather have
// FIXME: adapt those value dynamically to the target device.

> Source/WebKit2/UIProcess/qt/TouchViewInterface.cpp:116
> +    viewport.layoutSize = QSize(attr.layoutSize);

Why does the viewport needs that information? Shouldn't it only rely on the item size?

> Source/WebKit2/UIProcess/qt/TouchViewInterface.h:68
> +    struct ViewportState {
> +        ViewportState()
> +            : layoutSize(QSize())
> +            , initialScale(1.0)
> +            , minimumScale(0.25)
> +            , maximumScale(1.8)
> +            , pixelRatio(1.0)
> +            , isUserScalable(true)
> +        { }
> +
> +        QSize layoutSize;
> +        qreal initialScale;
> +        qreal minimumScale;
> +        qreal maximumScale;
> +        qreal pixelRatio;
> +        bool isUserScalable;
> +    } viewport;
> +
> +    void updateViewportState();
> +

I wonder if the right place for this is not QTouchWebView.
The viewport is the class responsible for enforcing this state.
Comment 4 Kenneth Rohde Christiansen 2011-08-11 06:13:06 PDT
Created attachment 103609 [details]
Patch 2
Comment 5 Benjamin Poulain 2011-08-11 06:36:31 PDT
Comment on attachment 103609 [details]
Patch 2

View in context: https://bugs.webkit.org/attachment.cgi?id=103609&action=review

All good for me appart from the comment.
I don't r+ because I would like to see the final version :-D

> Source/WebKit2/UIProcess/API/qt/qtouchwebview.cpp:63
> +    WebPreferences* wkPrefs = wkPage->pageGroup()->preferences();
> +
> +    WebCore::ViewportAttributes attr = WebCore::computeViewportAttributes(rawViewportData, wkPrefs->layoutFallbackWidth(), wkPrefs->deviceWidth(), wkPrefs->deviceHeight(), wkPrefs->deviceDPI(), availableSize);

Nice change, using wkPref

> Source/WebKit2/UIProcess/API/qt/qtouchwebview.h:51
> +    friend class QTouchWebViewPrivate;

That is pretty uncommon. Like very very very uncommon :)
Why do you need that?

> Source/WebKit2/UIProcess/API/qt/qtouchwebview_p.h:52
> +        QSize layoutSize;

I think that is too much info for the viewport. It would be better if the viewport can be written without knowing that.

> Source/WebKit2/UIProcess/API/qt/qtouchwebview_p.h:65
> +    WebCore::ViewportArguments rawViewportData;

I am not a fan of the name. pageViewportArguments?

> Source/WebKit2/UIProcess/qt/TouchViewInterface.cpp:152
> +    viewPrivate->rawViewportData = args;
> +    viewPrivate->updateViewportState();

I would prefer a ->setRawViewportData(args); and its implementation would call updateViewportState(). That way you cannot forget to call updateViewportState.
Comment 6 Kenneth Rohde Christiansen 2011-08-11 07:03:19 PDT
Created attachment 103616 [details]
Patch 3
Comment 7 Benjamin Poulain 2011-08-11 07:10:35 PDT
Comment on attachment 103616 [details]
Patch 3

View in context: https://bugs.webkit.org/attachment.cgi?id=103616&action=review

Simple, clean...awesome :)

> Source/WebKit2/UIProcess/API/qt/qtouchwebview_p.h:63
> +
> +    WebCore::ViewportArguments viewportArguments;

Could be private I guess but that does not help much.

> Source/WebKit2/UIProcess/qt/TouchViewInterface.cpp:28
> +#include <WebCore/ViewportArguments.h>

I think you can get away with forward declaration.

> Source/WebKit2/UIProcess/qt/TouchViewInterface.h:25
> +#include <WebCore/ViewportArguments.h>

You have a forward declaration in ViewInterface.
Comment 8 Kenneth Rohde Christiansen 2011-08-11 07:18:57 PDT
Created attachment 103618 [details]
Patch for landing
Comment 9 WebKit Review Bot 2011-08-11 08:33:40 PDT
Comment on attachment 103618 [details]
Patch for landing

Clearing flags on attachment: 103618

Committed r92851: <http://trac.webkit.org/changeset/92851>
Comment 10 WebKit Review Bot 2011-08-11 08:33:45 PDT
All reviewed patches have been landed.  Closing bug.