summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
diff options
context:
space:
mode:
authorAndras Becsi <andras.becsi@digia.com>2012-12-13 20:15:30 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-12-13 22:07:16 +0100
commit69e9b8736f2410fc33db62b432cf5210b50331e9 (patch)
tree5d5a85c871cad42f8b95361ccb1c119371afc277 /Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
parent5423dd08373bb58f0d469d52cde49f128b49ddf2 (diff)
downloadqtwebkit-69e9b8736f2410fc33db62b432cf5210b50331e9.tar.gz
[Qt][WK2] Fix painting on Mac with retina display
https://bugs.webkit.org/show_bug.cgi?id=104574 Reviewed by Kenneth Rohde Christiansen. Since HiDPI support has been added and enabled in Qt we ended up painting incorrectly scaled content on high-resolution screens. Because the intrinsic device pixel ratio is always taken into account by Qt when painting to high-resolution screens we should automatically obtain the scale ratio from the window in which the item is rendered instead of setting it in QML. Qt does not make it possible to override the device pixel ratio of the native window, therefore our experimental QML API for setting a custom value is of no use any more and should be removed. This patch fixes the scaling issue on Mac retina display by querying the underlying window for the device scale factor and applying it to the backing store and the scene-graph rendering of the content node. Additionally removes the experimental API and related API tests. Change-Id: I04f23059147773ca279a89ae8976ccd3d9bef292 git-svn-id: http://svn.webkit.org/repository/webkit/trunk@137597 268f45cc-cd09-0410-ab3c-d52691b4dbfc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp')
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp62
1 files changed, 4 insertions, 58 deletions
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
index 0e33f116f..437d08b94 100644
--- a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
@@ -826,16 +826,15 @@ void QQuickWebViewLegacyPrivate::updateViewportSize()
if (viewportSize.isEmpty())
return;
- float devicePixelRatio = webPageProxy->deviceScaleFactor();
pageView->setContentsSize(viewportSize);
- // Make sure that our scale matches the one passed to setVisibleContentsRect.
- pageView->setContentsScale(devicePixelRatio);
// The fixed layout is handled by the FrameView and the drawing area doesn't behave differently
// whether its fixed or not. We still need to tell the drawing area which part of it
// has to be rendered on tiles, and in desktop mode it's all of it.
- webPageProxy->drawingArea()->setSize((viewportSize / devicePixelRatio).toSize(), IntSize());
- webPageProxy->drawingArea()->setVisibleContentsRect(FloatRect(FloatPoint(), FloatSize(viewportSize / devicePixelRatio)), devicePixelRatio, FloatPoint());
+ webPageProxy->drawingArea()->setSize(viewportSize.toSize(), IntSize());
+ // The backing store scale factor should already be set to the device pixel ratio
+ // of the underlying window, thus we set the effective scale to 1 here.
+ webPageProxy->drawingArea()->setVisibleContentsRect(FloatRect(FloatPoint(), FloatSize(viewportSize)), 1, FloatPoint());
}
qreal QQuickWebViewLegacyPrivate::zoomFactor() const
@@ -1194,59 +1193,6 @@ void QQuickWebViewExperimental::setUserAgent(const QString& userAgent)
/*!
\internal
- \qmlproperty real WebViewExperimental::devicePixelRatio
- \brief The ratio between the CSS units and device pixels when the content is unscaled.
-
- When designing touch-friendly contents, knowing the approximated target size on a device
- is important for contents providers in order to get the intented layout and element
- sizes.
-
- As most first generation touch devices had a PPI of approximately 160, this became a
- de-facto value, when used in conjunction with the viewport meta tag.
-
- Devices with a higher PPI learning towards 240 or 320, applies a pre-scaling on all
- content, of either 1.5 or 2.0, not affecting the CSS scale or pinch zooming.
-
- This value can be set using this property and it is exposed to CSS media queries using
- the -webkit-device-pixel-ratio query.
-
- For instance, if you want to load an image without having it upscaled on a web view
- using a device pixel ratio of 2.0 it can be done by loading an image of say 100x100
- pixels but showing it at half the size.
-
- FIXME: Move documentation example out in separate files
-
- @media (-webkit-min-device-pixel-ratio: 1.5) {
- .icon {
- width: 50px;
- height: 50px;
- url: "/images/icon@2x.png"; // This is actually a 100x100 image
- }
- }
-
- If the above is used on a device with device pixel ratio of 1.5, it will be scaled
- down but still provide a better looking image.
-*/
-
-qreal QQuickWebViewExperimental::devicePixelRatio() const
-{
- Q_D(const QQuickWebView);
- return d->webPageProxy->deviceScaleFactor();
-}
-
-void QQuickWebViewExperimental::setDevicePixelRatio(qreal devicePixelRatio)
-{
- Q_D(QQuickWebView);
- if (0 >= devicePixelRatio || devicePixelRatio == this->devicePixelRatio())
- return;
-
- d->webPageProxy->setIntrinsicDeviceScaleFactor(devicePixelRatio);
- emit devicePixelRatioChanged();
-}
-
-/*!
- \internal
-
\qmlproperty int WebViewExperimental::deviceWidth
\brief The device width used by the viewport calculations.