Bug 42597 - [Qt] Add API to define device-width and height for use with the viewport meta tag
Summary: [Qt] Add API to define device-width and height for use with the viewport meta...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC All
: P3 Normal
Assignee: Kenneth Rohde Christiansen
URL:
Keywords: Qt, QtTriaged
Depends on:
Blocks: 31552
  Show dependency treegraph
 
Reported: 2010-07-19 15:02 PDT by Kenneth Rohde Christiansen
Modified: 2010-08-04 05:44 PDT (History)
4 users (show)

See Also:


Attachments
Patch (5.34 KB, patch)
2010-07-19 15:10 PDT, Kenneth Rohde Christiansen
no flags Details | Formatted Diff | Diff
Patch 2 (5.60 KB, patch)
2010-07-19 15:26 PDT, Kenneth Rohde Christiansen
tonikitoo: review+
tonikitoo: commit-queue-
Details | Formatted Diff | Diff
Patch for landing (5.90 KB, patch)
2010-07-20 04:43 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 2010-07-19 15:02:40 PDT
This is needed by applications making use of our viewport metatag API, to change the size to fit best with the app and to update it on rotation.
Comment 1 Kenneth Rohde Christiansen 2010-07-19 15:10:35 PDT
Created attachment 61997 [details]
Patch
Comment 2 WebKit Review Bot 2010-07-19 15:12:46 PDT
Attachment 61997 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style']" exit_code: 1
WARNING: File exempt from style guide. Skipping: "WebKit/qt/Api/qgraphicswebview.cpp"
WARNING: File exempt from style guide. Skipping: "WebKit/qt/Api/qgraphicswebview.h"
WebKit/qt/WebCoreSupport/PageClientQt.h:33:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 1 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Kenneth Rohde Christiansen 2010-07-19 15:26:12 PDT
Created attachment 62002 [details]
Patch 2
Comment 4 Antonio Gomes 2010-07-19 18:03:20 PDT
Comment on attachment 62002 [details]
Patch 2

Looks good.

You are missing the \since 4.x below.
>  /*!
> +    \property QGraphicsWebView::deviceSize
> +    \brief the size of the device using the web view
> +
> +    The device size is used by the DOM window object methods
> +    otherHeight(), otherWidth() as well as a page for the viewport
> +    meta tag attributes device-width and device-height.
> +*/
> +void QGraphicsWebView::setDeviceSize(QSize size)

const QSize&

> +QSize QGraphicsWebView::deviceSize()

const it, please.

> +    QSize deviceSize();
const.

> +    void setDeviceSize(QSize);
const QSize&
Comment 5 Antonio Gomes 2010-07-19 18:05:03 PDT
blocking bug 31552 for further API discussion/review on qtwebkit2.1.
Comment 6 Kenneth Rohde Christiansen 2010-07-20 04:43:47 PDT
Created attachment 62054 [details]
Patch for landing
Comment 7 WebKit Commit Bot 2010-07-20 05:12:09 PDT
Comment on attachment 62054 [details]
Patch for landing

Clearing flags on attachment: 62054

Committed r63740: <http://trac.webkit.org/changeset/63740>
Comment 8 WebKit Commit Bot 2010-07-20 05:12:14 PDT
All reviewed patches have been landed.  Closing bug.
Comment 9 Simon Hausmann 2010-08-04 03:39:22 PDT
Why do application developers have to care about this? Can't we retrieve this information automatically from the system?
Comment 10 Kenneth Rohde Christiansen 2010-08-04 05:44:03 PDT
(In reply to comment #9)
> Why do application developers have to care about this? Can't we retrieve this information automatically from the system?

There is no simple/consistent way to always get it from the system.

You can try to get the screen resolution but that might interfer with things on mobiles such as always present status bar (phone signal etc)

For use with the viewport meta tag is also HAS TO be given in portrait. Actually 
width == width of device when in portrait, height = width of device when in landscape.

When testing your app on a desktop it would get the width/height of the desktop, making it hard to test the viewport meta stuff without using something like Xephyr.

Another point is that if the app will do DPI adjustment like Firefox Mobile does, you need to set an adjusted device size.

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/