summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/CoordinatedGraphics
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/CoordinatedGraphics
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/CoordinatedGraphics')
-rw-r--r--Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp14
-rw-r--r--Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h4
2 files changed, 13 insertions, 5 deletions
diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp
index 8fb12b902..9cb2c1bc5 100644
--- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp
+++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp
@@ -56,6 +56,11 @@ void LayerTreeCoordinatorProxy::updateViewport()
m_drawingAreaProxy->updateViewport();
}
+float LayerTreeCoordinatorProxy::deviceScaleFactor() const
+{
+ return m_drawingAreaProxy->page()->deviceScaleFactor();
+}
+
void LayerTreeCoordinatorProxy::dispatchUpdate(const Function<void()>& function)
{
m_renderer->appendUpdate(function);
@@ -178,19 +183,20 @@ void LayerTreeCoordinatorProxy::setAnimationsLocked(bool locked)
dispatchUpdate(bind(&LayerTreeRenderer::setAnimationsLocked, m_renderer.get(), locked));
}
-void LayerTreeCoordinatorProxy::setVisibleContentsRect(const FloatRect& rect, float scale, const FloatPoint& trajectoryVector)
+void LayerTreeCoordinatorProxy::setVisibleContentsRect(const FloatRect& rect, float pageScaleFactor, const FloatPoint& trajectoryVector)
{
// Inform the renderer to adjust viewport-fixed layers.
dispatchUpdate(bind(&LayerTreeRenderer::setVisibleContentsRect, m_renderer.get(), rect));
// Round the rect instead of enclosing it to make sure that its size stays the same while panning. This can have nasty effects on layout.
IntRect roundedRect = roundedIntRect(rect);
- if (roundedRect == m_lastSentVisibleRect && scale == m_lastSentScale && trajectoryVector == m_lastSentTrajectoryVector)
+ const float effectiveScale = deviceScaleFactor() * pageScaleFactor;
+ if (roundedRect == m_lastSentVisibleRect && effectiveScale == m_lastSentScale && trajectoryVector == m_lastSentTrajectoryVector)
return;
- m_drawingAreaProxy->page()->process()->send(Messages::LayerTreeCoordinator::SetVisibleContentsRect(roundedRect, scale, trajectoryVector), m_drawingAreaProxy->page()->pageID());
+ m_drawingAreaProxy->page()->process()->send(Messages::LayerTreeCoordinator::SetVisibleContentsRect(roundedRect, effectiveScale, trajectoryVector), m_drawingAreaProxy->page()->pageID());
m_lastSentVisibleRect = roundedRect;
- m_lastSentScale = scale;
+ m_lastSentScale = effectiveScale;
m_lastSentTrajectoryVector = trajectoryVector;
}
diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h
index fb58b1ae7..a3961ffef 100644
--- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h
+++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h
@@ -64,7 +64,7 @@ public:
void deleteCompositingLayer(WebLayerID);
void setRootCompositingLayer(WebLayerID);
void setContentsSize(const WebCore::FloatSize&);
- void setVisibleContentsRect(const WebCore::FloatRect&, float scale, const WebCore::FloatPoint& trajectoryVector);
+ void setVisibleContentsRect(const WebCore::FloatRect&, float pageScaleFactor, const WebCore::FloatPoint& trajectoryVector);
void didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect);
void createTileForLayer(int layerID, int tileID, const WebCore::IntRect&, const SurfaceUpdateInfo&);
void updateTileForLayer(int layerID, int tileID, const WebCore::IntRect&, const SurfaceUpdateInfo&);
@@ -94,6 +94,8 @@ public:
#endif
void setBackgroundColor(const WebCore::Color&);
+ float deviceScaleFactor() const;
+
protected:
void dispatchUpdate(const Function<void()>&);