Bug 88320 - [Qt][WK2] Make viewport related experimental.test properties encapsulated.
Summary: [Qt][WK2] Make viewport related experimental.test properties encapsulated.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: zalan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-05 04:27 PDT by zalan
Modified: 2012-08-24 04:27 PDT (History)
7 users (show)

See Also:


Attachments
Patch (10.75 KB, patch)
2012-08-23 09:14 PDT, Michael Brüning
no flags Details | Formatted Diff | Diff
Patch (10.26 KB, patch)
2012-08-24 02:23 PDT, Michael Brüning
no flags Details | Formatted Diff | Diff
Patch (10.25 KB, patch)
2012-08-24 03:04 PDT, Michael Brüning
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description zalan 2012-06-05 04:27:32 PDT
instead of having multiple properties such as

QVariant contentsScale() const;
QVariant devicePixelRatio() const;
QVariant initialScale() const;
QVariant isScalable() const;
QVariant layoutSize() const;
QVariant maximumScale() const;
QVariant minimumScale() const;

use experimental.test.viewport and expose it as an QJsonObject (list of key-value pairs)

and consolidate experimental API as follows:
experimental.test.contentsScale
experimental.test.viewport 
experimental.devicePixelRatio (as the result of removing target-densitydpi from viewport meta)
Comment 1 Michael Brüning 2012-08-23 08:15:13 PDT
I'll take this one if you don't mind, Zalan.
Comment 2 Michael Brüning 2012-08-23 09:14:54 PDT
Created attachment 160181 [details]
Patch
Comment 3 Andras Becsi 2012-08-23 09:53:44 PDT
Comment on attachment 160181 [details]
Patch

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

LGTM, just a few comments

> Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp:140
> +static QJsonObject qSizeFToJsonObject(const QSizeF& sizeF)

inline maybe?

> Source/WebKit2/UIProcess/qt/QtViewportHandler.cpp:237
> +    float devicePixelRatio = m_devicePixelRatio;
> +    if (!qFuzzyCompare(devicePixelRatio, m_rawAttributes.devicePixelRatio)) {

Why not compare to m_devicePixelRatio directly instead of creating a temporary variable?

> Tools/MiniBrowser/qt/qml/ViewportInfoItem.qml:87
> -                        text: "Initial scale: " + formatScale(test.initialScale)
> +                        text: "Initial scale: " + formatScale(test.viewport.initialScale)

I think having m_rawAttributes.initialScale in the info item makes not much sense since it is almost always -1 as soon as it is applied in the viewport handler.
We could either remove it from the info item or change the way it is marked as used when applied.
Comment 4 Michael Brüning 2012-08-23 11:40:29 PDT
(In reply to comment #3)
> (From update of attachment 160181 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=160181&action=review
> 
> LGTM, just a few comments
> 
> > Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp:140
> > +static QJsonObject qSizeFToJsonObject(const QSizeF& sizeF)
> 
> inline maybe?

Good idea :).

> 
> > Source/WebKit2/UIProcess/qt/QtViewportHandler.cpp:237
> > +    float devicePixelRatio = m_devicePixelRatio;
> > +    if (!qFuzzyCompare(devicePixelRatio, m_rawAttributes.devicePixelRatio)) {
> 
> Why not compare to m_devicePixelRatio directly instead of creating a temporary variable?

Basically, I was following a pattern that was used further down because the two data types are different (float and qreal), but realized that that place calls a method to store in the temporary variable. I'll replace it with a cast. 

> 
> > Tools/MiniBrowser/qt/qml/ViewportInfoItem.qml:87
> > -                        text: "Initial scale: " + formatScale(test.initialScale)
> > +                        text: "Initial scale: " + formatScale(test.viewport.initialScale)
> 
> I think having m_rawAttributes.initialScale in the info item makes not much sense since it is almost always -1 as soon as it is applied in the viewport handler.
> We could either remove it from the info item or change the way it is marked as used when applied.

True. I have no strong opinion on whether it should stay or not, maybe one of the others on cc (Kenneth? :)) has an opinion on this?
Comment 5 Michael Brüning 2012-08-24 02:23:17 PDT
Created attachment 160365 [details]
Patch
Comment 6 Kenneth Rohde Christiansen 2012-08-24 02:32:10 PDT
Comment on attachment 160365 [details]
Patch

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

> Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp:140
> +static inline QJsonObject qSizeFToJsonObject(const QSizeF& sizeF)

you could just call it toJSonObject() as you might have more of these in the future.

toJsonObject(QSizeF()) is pretty clear
Comment 7 Michael Brüning 2012-08-24 03:04:35 PDT
Created attachment 160372 [details]
Patch
Comment 8 WebKit Review Bot 2012-08-24 04:03:29 PDT
Comment on attachment 160372 [details]
Patch

Rejecting attachment 160372 [details] from commit-queue.

michaelbruening@gmail.com does not have committer permissions according to http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/common/config/committers.py.

- If you do not have committer rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags.

- If you have committer rights please correct the error in Tools/Scripts/webkitpy/common/config/committers.py by adding yourself to the file (no review needed).  The commit-queue restarts itself every 2 hours.  After restart the commit-queue will correctly respect your committer rights.
Comment 9 WebKit Review Bot 2012-08-24 04:27:28 PDT
Comment on attachment 160372 [details]
Patch

Clearing flags on attachment: 160372

Committed r126570: <http://trac.webkit.org/changeset/126570>
Comment 10 WebKit Review Bot 2012-08-24 04:27:31 PDT
All reviewed patches have been landed.  Closing bug.