Diff
Modified: trunk/Source/WebKit2/ChangeLog (124012 => 124013)
--- trunk/Source/WebKit2/ChangeLog 2012-07-30 11:31:27 UTC (rev 124012)
+++ trunk/Source/WebKit2/ChangeLog 2012-07-30 11:33:41 UTC (rev 124013)
@@ -1,5 +1,46 @@
2012-07-27 Jocelyn Turcotte <jocelyn.turco...@nokia.com>
+ [Qt] Remove accurateVisibleContentsPosition and use a FloatRect for visibleContentsRect instead
+ https://bugs.webkit.org/show_bug.cgi?id=92536
+
+ Reviewed by Noam Rosenthal.
+
+ AccurateVisibleContentsPosition carries the same information as visibleContentsRect.location() and
+ is needed for fixed layer position updates.
+ This patch instead uses a FloatRect for the visible contents rect from the web view down to the
+ LayerCoordinatorProxy, and converts it to an IntRect at this moment, before sending it to the
+ web process.
+ This also moves the check to prevent sending the same rect to the moment of the conversion
+ in LayerTreeCoordinatorProxy to fix a bug where the fixed layer deltas wouldn't be updated
+ unless the integer part of position components changed.
+
+ * UIProcess/API/qt/qquickwebview.cpp:
+ (QQuickWebViewLegacyPrivate::updateViewportSize):
+ * UIProcess/DrawingAreaProxy.h:
+ (WebKit::DrawingAreaProxy::setVisibleContentsRect):
+ * UIProcess/DrawingAreaProxyImpl.cpp:
+ (WebKit::DrawingAreaProxyImpl::setVisibleContentsRect):
+ * UIProcess/DrawingAreaProxyImpl.h:
+ (DrawingAreaProxyImpl):
+ * UIProcess/LayerTreeCoordinatorProxy.cpp:
+ (WebKit::LayerTreeCoordinatorProxy::LayerTreeCoordinatorProxy):
+ (WebKit::LayerTreeCoordinatorProxy::setVisibleContentsRect):
+ * UIProcess/LayerTreeCoordinatorProxy.h:
+ (LayerTreeCoordinatorProxy):
+ * UIProcess/WebLayerTreeRenderer.cpp:
+ (WebKit::WebLayerTreeRenderer::WebLayerTreeRenderer):
+ (WebKit::WebLayerTreeRenderer::setVisibleContentsRect):
+ (WebKit::WebLayerTreeRenderer::adjustPositionForFixedLayers):
+ * UIProcess/WebLayerTreeRenderer.h:
+ (WebLayerTreeRenderer):
+ * UIProcess/qt/QtViewportHandler.cpp:
+ (WebKit::QtViewportHandler::visibleContentsRect):
+ (WebKit::QtViewportHandler::informVisibleContentChange):
+ * UIProcess/qt/QtViewportHandler.h:
+ (QtViewportHandler):
+
+2012-07-27 Jocelyn Turcotte <jocelyn.turco...@nokia.com>
+
[Qt] Fix issues remaining with fixed positioned layers
https://bugs.webkit.org/show_bug.cgi?id=92528
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp (124012 => 124013)
--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp 2012-07-30 11:31:27 UTC (rev 124012)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp 2012-07-30 11:33:41 UTC (rev 124013)
@@ -777,15 +777,15 @@
void QQuickWebViewLegacyPrivate::updateViewportSize()
{
Q_Q(QQuickWebView);
- QSize viewportSize = q->boundingRect().size().toSize();
+ QSizeF viewportSize = q->boundingRect().size();
if (viewportSize.isEmpty())
return;
pageView->setContentsSize(viewportSize);
// 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, IntSize());
- webPageProxy->drawingArea()->setVisibleContentsRect(IntRect(IntPoint(), viewportSize), 1, FloatPoint());
+ webPageProxy->drawingArea()->setSize(viewportSize.toSize(), IntSize());
+ webPageProxy->drawingArea()->setVisibleContentsRect(FloatRect(FloatPoint(), viewportSize), 1, FloatPoint());
}
void QQuickWebViewLegacyPrivate::enableMouseEvents()
Modified: trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h (124012 => 124013)
--- trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h 2012-07-30 11:31:27 UTC (rev 124012)
+++ trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h 2012-07-30 11:33:41 UTC (rev 124013)
@@ -96,7 +96,7 @@
virtual WebCore::IntRect contentsRect() const;
virtual bool isBackingStoreReady() const { return true; }
LayerTreeCoordinatorProxy* layerTreeCoordinatorProxy() const { return m_layerTreeCoordinatorProxy.get(); }
- virtual void setVisibleContentsRect(const WebCore::IntRect& visibleContentsRect, float scale, const WebCore::FloatPoint& trajectoryVector, const WebCore::FloatPoint& accurateVisibleContentsPosition = WebCore::FloatPoint()) { }
+ virtual void setVisibleContentsRect(const WebCore::FloatRect& visibleContentsRect, float scale, const WebCore::FloatPoint& trajectoryVector) { }
virtual void createTileForLayer(int layerID, int tileID, const WebKit::UpdateInfo&) { }
virtual void updateTileForLayer(int layerID, int tileID, const WebKit::UpdateInfo&) { }
virtual void removeTileForLayer(int layerID, int tileID) { }
Modified: trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp (124012 => 124013)
--- trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp 2012-07-30 11:31:27 UTC (rev 124012)
+++ trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp 2012-07-30 11:33:41 UTC (rev 124013)
@@ -366,10 +366,10 @@
m_layerTreeCoordinatorProxy->didReceiveLayerTreeCoordinatorProxyMessage(connection, messageID, arguments);
}
-void DrawingAreaProxyImpl::setVisibleContentsRect(const WebCore::IntRect& visibleContentsRect, float scale, const WebCore::FloatPoint& trajectoryVector, const WebCore::FloatPoint& accurateVisibleContentsPosition)
+void DrawingAreaProxyImpl::setVisibleContentsRect(const WebCore::FloatRect& visibleContentsRect, float scale, const WebCore::FloatPoint& trajectoryVector)
{
if (m_layerTreeCoordinatorProxy)
- m_layerTreeCoordinatorProxy->setVisibleContentsRect(visibleContentsRect, scale, trajectoryVector, accurateVisibleContentsPosition);
+ m_layerTreeCoordinatorProxy->setVisibleContentsRect(visibleContentsRect, scale, trajectoryVector);
}
#endif
Modified: trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h (124012 => 124013)
--- trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h 2012-07-30 11:31:27 UTC (rev 124012)
+++ trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h 2012-07-30 11:33:41 UTC (rev 124013)
@@ -82,7 +82,7 @@
bool isInAcceleratedCompositingMode() const { return !m_layerTreeContext.isEmpty(); }
#if USE(UI_SIDE_COMPOSITING)
- virtual void setVisibleContentsRect(const WebCore::IntRect& visibleContentsRect, float scale, const WebCore::FloatPoint& trajectory, const WebCore::FloatPoint& accurateVisibleContentsPosition = WebCore::FloatPoint());
+ virtual void setVisibleContentsRect(const WebCore::FloatRect& visibleContentsRect, float scale, const WebCore::FloatPoint& trajectory);
void didReceiveLayerTreeCoordinatorProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
#endif
#else
Modified: trunk/Source/WebKit2/UIProcess/LayerTreeCoordinatorProxy.cpp (124012 => 124013)
--- trunk/Source/WebKit2/UIProcess/LayerTreeCoordinatorProxy.cpp 2012-07-30 11:31:27 UTC (rev 124012)
+++ trunk/Source/WebKit2/UIProcess/LayerTreeCoordinatorProxy.cpp 2012-07-30 11:33:41 UTC (rev 124013)
@@ -37,6 +37,7 @@
LayerTreeCoordinatorProxy::LayerTreeCoordinatorProxy(DrawingAreaProxy* drawingAreaProxy)
: m_drawingAreaProxy(drawingAreaProxy)
, m_renderer(adoptRef(new WebLayerTreeRenderer(this)))
+ , m_lastSentScale(0)
{
}
@@ -137,10 +138,20 @@
dispatchUpdate(bind(&WebLayerTreeRenderer::setContentsSize, m_renderer.get(), contentsSize));
}
-void LayerTreeCoordinatorProxy::setVisibleContentsRect(const IntRect& rect, float scale, const FloatPoint& trajectoryVector, const WebCore::FloatPoint& accurateVisibleContentsPosition)
+void LayerTreeCoordinatorProxy::setVisibleContentsRect(const FloatRect& rect, float scale, const FloatPoint& trajectoryVector)
{
- dispatchUpdate(bind(&WebLayerTreeRenderer::setVisibleContentsRect, m_renderer.get(), rect, scale, accurateVisibleContentsPosition));
- m_drawingAreaProxy->page()->process()->send(Messages::LayerTreeCoordinator::SetVisibleContentsRect(rect, scale, trajectoryVector), m_drawingAreaProxy->page()->pageID());
+ // Inform the renderer to adjust viewport-fixed layers.
+ dispatchUpdate(bind(&WebLayerTreeRenderer::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)
+ return;
+
+ m_drawingAreaProxy->page()->process()->send(Messages::LayerTreeCoordinator::SetVisibleContentsRect(roundedRect, scale, trajectoryVector), m_drawingAreaProxy->page()->pageID());
+ m_lastSentVisibleRect = roundedRect;
+ m_lastSentScale = scale;
+ m_lastSentTrajectoryVector = trajectoryVector;
}
void LayerTreeCoordinatorProxy::renderNextFrame()
Modified: trunk/Source/WebKit2/UIProcess/LayerTreeCoordinatorProxy.h (124012 => 124013)
--- trunk/Source/WebKit2/UIProcess/LayerTreeCoordinatorProxy.h 2012-07-30 11:31:27 UTC (rev 124012)
+++ trunk/Source/WebKit2/UIProcess/LayerTreeCoordinatorProxy.h 2012-07-30 11:33:41 UTC (rev 124013)
@@ -60,7 +60,7 @@
void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
void purgeGLResources();
void setContentsSize(const WebCore::FloatSize&);
- void setVisibleContentsRect(const WebCore::IntRect&, float scale, const WebCore::FloatPoint& trajectory, const WebCore::FloatPoint& accurateVisibleContentsPosition);
+ void setVisibleContentsRect(const WebCore::FloatRect&, float scale, const WebCore::FloatPoint& trajectoryVector);
void didRenderFrame();
void createTileForLayer(int layerID, int tileID, const WebCore::IntRect&, const SurfaceUpdateInfo&);
void updateTileForLayer(int layerID, int tileID, const WebCore::IntRect&, const SurfaceUpdateInfo&);
@@ -80,6 +80,9 @@
DrawingAreaProxy* m_drawingAreaProxy;
RefPtr<WebLayerTreeRenderer> m_renderer;
+ WebCore::IntRect m_lastSentVisibleRect;
+ float m_lastSentScale;
+ WebCore::FloatPoint m_lastSentTrajectoryVector;
#if USE(GRAPHICS_SURFACE)
HashMap<uint32_t, RefPtr<ShareableSurface> > m_surfaces;
#endif
Modified: trunk/Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp (124012 => 124013)
--- trunk/Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp 2012-07-30 11:31:27 UTC (rev 124012)
+++ trunk/Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp 2012-07-30 11:33:41 UTC (rev 124013)
@@ -85,8 +85,7 @@
}
WebLayerTreeRenderer::WebLayerTreeRenderer(LayerTreeCoordinatorProxy* layerTreeCoordinatorProxy)
- : m_contentsScale(1)
- , m_layerTreeCoordinatorProxy(layerTreeCoordinatorProxy)
+ : m_layerTreeCoordinatorProxy(layerTreeCoordinatorProxy)
, m_rootLayerID(InvalidWebLayerID)
, m_isActive(false)
{
@@ -159,11 +158,9 @@
m_contentsSize = contentsSize;
}
-void WebLayerTreeRenderer::setVisibleContentsRect(const IntRect& rect, float scale, const WebCore::FloatPoint& accurateVisibleContentsPosition)
+void WebLayerTreeRenderer::setVisibleContentsRect(const FloatRect& rect)
{
m_visibleContentsRect = rect;
- m_contentsScale = scale;
- m_accurateVisibleContentsPosition = accurateVisibleContentsPosition;
}
void WebLayerTreeRenderer::updateViewport()
@@ -180,7 +177,7 @@
// Fixed layer positions are updated by the web process when we update the visible contents rect / scroll position.
// If we want those layers to follow accurately the viewport when we move between the web process updates, we have to offset
// them by the delta between the current position and the position of the viewport used for the last layout.
- FloatPoint scrollPosition = boundedScrollPosition(FloatPoint(m_accurateVisibleContentsPosition.x() / m_contentsScale, m_accurateVisibleContentsPosition.y() / m_contentsScale), m_visibleContentsRect, m_contentsSize);
+ FloatPoint scrollPosition = boundedScrollPosition(m_visibleContentsRect.location(), m_visibleContentsRect, m_contentsSize);
FloatPoint renderedScrollPosition = boundedScrollPosition(m_renderedContentsScrollPosition, m_visibleContentsRect, m_contentsSize);
FloatSize delta = scrollPosition - renderedScrollPosition;
Modified: trunk/Source/WebKit2/UIProcess/WebLayerTreeRenderer.h (124012 => 124013)
--- trunk/Source/WebKit2/UIProcess/WebLayerTreeRenderer.h 2012-07-30 11:31:27 UTC (rev 124012)
+++ trunk/Source/WebKit2/UIProcess/WebLayerTreeRenderer.h 2012-07-30 11:33:41 UTC (rev 124013)
@@ -66,7 +66,7 @@
void paintToGraphicsContext(BackingStore::PlatformGraphicsContext);
void syncRemoteContent();
void setContentsSize(const WebCore::FloatSize&);
- void setVisibleContentsRect(const WebCore::IntRect&, float scale, const WebCore::FloatPoint& accurateVisibleContentsPosition);
+ void setVisibleContentsRect(const WebCore::FloatRect&);
void didChangeScrollPosition(const WebCore::IntPoint& position);
void syncCanvas(uint32_t id, const WebCore::IntSize& canvasSize, uint32_t graphicsSurfaceToken);
@@ -107,9 +107,7 @@
typedef HashMap<WebLayerID, WebCore::GraphicsLayer*> LayerMap;
WebCore::FloatSize m_contentsSize;
- WebCore::IntRect m_visibleContentsRect;
- WebCore::FloatPoint m_accurateVisibleContentsPosition;
- float m_contentsScale;
+ WebCore::FloatRect m_visibleContentsRect;
// Render queue can be accessed ony from main thread or updatePaintNode call stack!
Vector<Function<void()> > m_renderQueue;
Modified: trunk/Source/WebKit2/UIProcess/qt/QtViewportHandler.cpp (124012 => 124013)
--- trunk/Source/WebKit2/UIProcess/qt/QtViewportHandler.cpp 2012-07-30 11:31:27 UTC (rev 124012)
+++ trunk/Source/WebKit2/UIProcess/qt/QtViewportHandler.cpp 2012-07-30 11:33:41 UTC (rev 124013)
@@ -694,13 +694,10 @@
m_scaleUpdateDeferrer.clear();
}
-QRect QtViewportHandler::visibleContentsRect() const
+QRectF QtViewportHandler::visibleContentsRect() const
{
const QRectF visibleRect(m_viewportItem->boundingRect().intersected(m_pageItem->boundingRect()));
-
- // We avoid using toAlignedRect() because it produces inconsistent width and height.
- QRectF mappedRect(m_viewportItem->mapRectToWebContent(visibleRect));
- return QRect(floor(mappedRect.x()), floor(mappedRect.y()), floor(mappedRect.width()), floor(mappedRect.height()));
+ return m_viewportItem->mapRectToWebContent(visibleRect);
}
void QtViewportHandler::informVisibleContentChange(const QPointF& trajectoryVector)
@@ -709,17 +706,13 @@
if (!drawingArea)
return;
- if (m_lastVisibleContentsRect == visibleContentsRect())
- return;
-
qreal scale = m_pageItem->contentsScale();
if (scale != m_lastCommittedScale)
emit m_viewportItem->experimental()->test()->contentsScaleCommitted();
m_lastCommittedScale = scale;
- m_lastVisibleContentsRect = visibleContentsRect();
- drawingArea->setVisibleContentsRect(visibleContentsRect(), scale, trajectoryVector, m_viewportItem->contentPos());
+ drawingArea->setVisibleContentsRect(visibleContentsRect(), scale, trajectoryVector);
// Ensure that updatePaintNode is always called before painting.
m_pageItem->update();
Modified: trunk/Source/WebKit2/UIProcess/qt/QtViewportHandler.h (124012 => 124013)
--- trunk/Source/WebKit2/UIProcess/qt/QtViewportHandler.h 2012-07-30 11:31:27 UTC (rev 124012)
+++ trunk/Source/WebKit2/UIProcess/qt/QtViewportHandler.h 2012-07-30 11:33:41 UTC (rev 124013)
@@ -116,7 +116,7 @@
void setPageItemRectVisible(const QRectF&);
void animatePageItemRectVisible(const QRectF&);
- QRect visibleContentsRect() const;
+ QRectF visibleContentsRect() const;
QRectF initialRect() const;
QRectF nearestValidBounds() const;
@@ -169,7 +169,6 @@
QPointF m_lastScrollPosition;
qreal m_pinchStartScale;
qreal m_lastCommittedScale;
- QRectF m_lastVisibleContentsRect;
qreal m_zoomOutScale;
QList<ScaleStackItem> m_scaleStack;
};