Bug 42597

Summary: [Qt] Add API to define device-width and height for use with the viewport meta tag
Product: WebKit Reporter: Kenneth Rohde Christiansen <kenneth>
Component: WebKit QtAssignee: Kenneth Rohde Christiansen <kenneth>
Severity: Normal CC: commit-queue, hausmann, tonikitoo, webkit.review.bot
Priority: P3 Keywords: Qt, QtTriaged
Version: 528+ (Nightly build)   
Hardware: PC   
OS: All   
Bug Depends on:    
Bug Blocks: 31552    
Description Flags
Patch 2
tonikitoo: review+, tonikitoo: commit-queue-
Patch for landing none

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]
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();

> +    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.