Title: [94673] trunk/Source/WebKit2
Revision
94673
Author
[email protected]
Date
2011-09-07 09:40:36 -0700 (Wed, 07 Sep 2011)

Log Message

[Qt][WK2] Make sure that the visible content rect and the content scale get to the web process in one single message.
https://bugs.webkit.org/show_bug.cgi?id=67189

Reviewed by Kenneth Rohde Christiansen.

The TiledBackingStore needs to know the screen size of the viewport to know how many tiles to
create, and since the visible content rect is given in page coordinates, the contents scale is
necessary to calculate the viewport size.
Both the rect and the scale then need to arrive to the web process at the same time to prevent
picking the new visible rect with the old scale or vice-versa which can produce a huge viewport size
and create/render an insane amount of tiles.

Things this patch does:
- Merge the visible contents rect and content scale handling together.
- Make QTouchWebView responsible for telling those viewport values to the web process instead of QTouchWebPage.
- Prevent updating the viewport in ViewportInteractionEngine while a pinch is in progress and update the viewport at the end.

* UIProcess/API/qt/qtouchwebpage.cpp:
* UIProcess/API/qt/qtouchwebpage.h:
* UIProcess/API/qt/qtouchwebpage_p.h:
* UIProcess/API/qt/qtouchwebview.cpp:
(QTouchWebViewPrivate::QTouchWebViewPrivate):
(QTouchWebViewPrivate::_q_viewportUpdated):
(QTouchWebView::geometryChanged):
* UIProcess/API/qt/qtouchwebview.h:
* UIProcess/API/qt/qtouchwebview_p.h:
* UIProcess/TiledDrawingAreaProxy.cpp:
(WebKit::TiledDrawingAreaProxy::setVisibleContentRectAndScale):
* UIProcess/TiledDrawingAreaProxy.h:
* UIProcess/qt/ViewportInteractionEngine.cpp:
(WebKit::ViewportInteractionEngine::ViewportInteractionEngine):
(WebKit::ViewportInteractionEngine::~ViewportInteractionEngine): Allows OwnPtr with the forward declaration of ViewportUpdateGuard.
(WebKit::ViewportInteractionEngine::setConstraints):
(WebKit::ViewportInteractionEngine::pinchGestureStarted):
(WebKit::ViewportInteractionEngine::pinchGestureEnded):
(WebKit::ViewportInteractionEngine::contentViewportChanged):
* UIProcess/qt/ViewportInteractionEngine.h:
* UIProcess/qt/qtouchwebpageproxy.cpp:
(QTouchWebPageProxy::setVisibleContentRectAndScale):
* UIProcess/qt/qtouchwebpageproxy.h:
* WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::setVisibleContentRectAndScale):
* WebProcess/WebPage/DrawingArea.messages.in:
* WebProcess/WebPage/TiledDrawingArea.cpp:
(WebKit::TiledDrawingArea::setVisibleContentRectAndScale):
* WebProcess/WebPage/TiledDrawingArea.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (94672 => 94673)


--- trunk/Source/WebKit2/ChangeLog	2011-09-07 15:54:33 UTC (rev 94672)
+++ trunk/Source/WebKit2/ChangeLog	2011-09-07 16:40:36 UTC (rev 94673)
@@ -1,3 +1,52 @@
+2011-08-30  Jocelyn Turcotte  <[email protected]>
+
+        [Qt][WK2] Make sure that the visible content rect and the content scale get to the web process in one single message.
+        https://bugs.webkit.org/show_bug.cgi?id=67189
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        The TiledBackingStore needs to know the screen size of the viewport to know how many tiles to
+        create, and since the visible content rect is given in page coordinates, the contents scale is
+        necessary to calculate the viewport size.
+        Both the rect and the scale then need to arrive to the web process at the same time to prevent
+        picking the new visible rect with the old scale or vice-versa which can produce a huge viewport size
+        and create/render an insane amount of tiles.
+
+        Things this patch does:
+        - Merge the visible contents rect and content scale handling together.
+        - Make QTouchWebView responsible for telling those viewport values to the web process instead of QTouchWebPage.
+        - Prevent updating the viewport in ViewportInteractionEngine while a pinch is in progress and update the viewport at the end.
+
+        * UIProcess/API/qt/qtouchwebpage.cpp:
+        * UIProcess/API/qt/qtouchwebpage.h:
+        * UIProcess/API/qt/qtouchwebpage_p.h:
+        * UIProcess/API/qt/qtouchwebview.cpp:
+        (QTouchWebViewPrivate::QTouchWebViewPrivate):
+        (QTouchWebViewPrivate::_q_viewportUpdated):
+        (QTouchWebView::geometryChanged):
+        * UIProcess/API/qt/qtouchwebview.h:
+        * UIProcess/API/qt/qtouchwebview_p.h:
+        * UIProcess/TiledDrawingAreaProxy.cpp:
+        (WebKit::TiledDrawingAreaProxy::setVisibleContentRectAndScale):
+        * UIProcess/TiledDrawingAreaProxy.h:
+        * UIProcess/qt/ViewportInteractionEngine.cpp:
+        (WebKit::ViewportInteractionEngine::ViewportInteractionEngine):
+        (WebKit::ViewportInteractionEngine::~ViewportInteractionEngine): Allows OwnPtr with the forward declaration of ViewportUpdateGuard.
+        (WebKit::ViewportInteractionEngine::setConstraints):
+        (WebKit::ViewportInteractionEngine::pinchGestureStarted):
+        (WebKit::ViewportInteractionEngine::pinchGestureEnded):
+        (WebKit::ViewportInteractionEngine::contentViewportChanged):
+        * UIProcess/qt/ViewportInteractionEngine.h:
+        * UIProcess/qt/qtouchwebpageproxy.cpp:
+        (QTouchWebPageProxy::setVisibleContentRectAndScale):
+        * UIProcess/qt/qtouchwebpageproxy.h:
+        * WebProcess/WebPage/DrawingArea.h:
+        (WebKit::DrawingArea::setVisibleContentRectAndScale):
+        * WebProcess/WebPage/DrawingArea.messages.in:
+        * WebProcess/WebPage/TiledDrawingArea.cpp:
+        (WebKit::TiledDrawingArea::setVisibleContentRectAndScale):
+        * WebProcess/WebPage/TiledDrawingArea.h:
+
 2011-08-29  Jocelyn Turcotte  <[email protected]>
 
         [Qt][WK2] Rename SGAgent to SGUpdateQueue to sharpen it's responsability.

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebpage.cpp (94672 => 94673)


--- trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebpage.cpp	2011-09-07 15:54:33 UTC (rev 94672)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebpage.cpp	2011-09-07 16:40:36 UTC (rev 94673)
@@ -159,16 +159,6 @@
 {
 }
 
-void QTouchWebPagePrivate::_q_commitScaleChange()
-{
-    commitScaleChange();
-}
-
-void QTouchWebPagePrivate::commitScaleChange()
-{
-    page->setContentsScale(q->scale());
-}
-
 void QTouchWebPagePrivate::setPage(QTouchWebPageProxy* page)
 {
     ASSERT(!this->page);
@@ -176,10 +166,4 @@
     this->page = page;
 }
 
-void QTouchWebPagePrivate::setViewportRect(const QRectF& viewportRect)
-{
-    const QRectF visibleContentRect = q->boundingRect().intersected(viewportRect);
-    page->setVisibleContentRect(visibleContentRect);
-}
-
 #include "moc_qtouchwebpage.cpp"

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebpage.h (94672 => 94673)


--- trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebpage.h	2011-09-07 15:54:33 UTC (rev 94672)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebpage.h	2011-09-07 16:40:36 UTC (rev 94673)
@@ -78,8 +78,6 @@
     virtual void geometryChanged(const QRectF&, const QRectF&);
 
 private:
-    Q_PRIVATE_SLOT(d, void _q_commitScaleChange());
-
     QTouchWebPagePrivate* d;
     friend class QTouchWebViewPrivate;
     friend class WebKit::TouchViewInterface;

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebpage_p.h (94672 => 94673)


--- trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebpage_p.h	2011-09-07 15:54:33 UTC (rev 94672)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebpage_p.h	2011-09-07 16:40:36 UTC (rev 94673)
@@ -38,10 +38,6 @@
 
     void setPage(QTouchWebPageProxy*);
 
-    void setViewportRect(const QRectF&);
-    void _q_commitScaleChange();
-    void commitScaleChange();
-
     QTouchWebPage* const q;
     QTouchWebPageProxy* page;
     QWebNavigationController* navigationController;

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview.cpp (94672 => 94673)


--- trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview.cpp	2011-09-07 15:54:33 UTC (rev 94672)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview.cpp	2011-09-07 16:40:36 UTC (rev 94673)
@@ -39,8 +39,7 @@
     QTouchWebPagePrivate* const pageViewPrivate = pageView.data()->d;
     pageViewPrivate->setPage(&page);
 
-    QObject::connect(&interactionEngine, SIGNAL(viewportUpdateRequested()), q, SLOT(_q_viewportRectUpdated()));
-    QObject::connect(&interactionEngine, SIGNAL(commitScaleChange()), pageView.data(), SLOT(_q_commitScaleChange()));
+    QObject::connect(&interactionEngine, SIGNAL(viewportUpdateRequested()), q, SLOT(_q_viewportUpdated()));
 }
 
 void QTouchWebViewPrivate::loadDidCommit()
@@ -48,11 +47,11 @@
     interactionEngine.reset();
 }
 
-void QTouchWebViewPrivate::_q_viewportRectUpdated()
+void QTouchWebViewPrivate::_q_viewportUpdated()
 {
-    QTouchWebPagePrivate* const pageViewPrivate = pageView.data()->d;
-    const QRectF viewportRectInPageViewCoordinate = q->mapRectToItem(pageView.data(), q->boundingRect());
-    pageViewPrivate->setViewportRect(viewportRectInPageViewCoordinate);
+    const QRectF visibleRectInPageViewCoordinate = q->mapRectToItem(pageView.data(), q->boundingRect()).intersected(pageView->boundingRect());
+    float scale = pageView->scale();
+    page.setVisibleContentRectAndScale(visibleRectInPageViewCoordinate, scale);
 }
 
 void QTouchWebViewPrivate::updateViewportConstraints()
@@ -110,7 +109,7 @@
     QSGItem::geometryChanged(newGeometry, oldGeometry);
     if (newGeometry.size() != oldGeometry.size()) {
         d->updateViewportConstraints();
-        d->_q_viewportRectUpdated();
+        d->_q_viewportUpdated();
     }
 }
 

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview.h (94672 => 94673)


--- trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview.h	2011-09-07 15:54:33 UTC (rev 94672)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview.h	2011-09-07 16:40:36 UTC (rev 94673)
@@ -47,7 +47,7 @@
     virtual void geometryChanged(const QRectF&, const QRectF&);
 
 private:
-    Q_PRIVATE_SLOT(d, void _q_viewportRectUpdated());
+    Q_PRIVATE_SLOT(d, void _q_viewportUpdated());
 
     friend class WebKit::TouchViewInterface;
     QTouchWebViewPrivate *d;

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview_p.h (94672 => 94673)


--- trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview_p.h	2011-09-07 15:54:33 UTC (rev 94672)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview_p.h	2011-09-07 16:40:36 UTC (rev 94673)
@@ -35,7 +35,7 @@
     QTouchWebViewPrivate(QTouchWebView* q);
 
     void loadDidCommit();
-    void _q_viewportRectUpdated();
+    void _q_viewportUpdated();
     void updateViewportConstraints();
 
     void setViewportArguments(const WebCore::ViewportArguments& args);

Modified: trunk/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp (94672 => 94673)


--- trunk/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp	2011-09-07 15:54:33 UTC (rev 94672)
+++ trunk/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp	2011-09-07 16:40:36 UTC (rev 94673)
@@ -56,20 +56,11 @@
 {
 }
 
-void TiledDrawingAreaProxy::setVisibleContentRect(const WebCore::IntRect& visibleContentsRect)
+void TiledDrawingAreaProxy::setVisibleContentRectAndScale(const WebCore::IntRect& visibleContentRect, float scale)
 {
-    // FIXME: Throttle those message enough not to flood the IPC queue and get a good tile creation responsiveness.
-    page()->process()->send(Messages::DrawingArea::SetVisibleContentRect(visibleContentsRect), page()->pageID());
+    page()->process()->send(Messages::DrawingArea::SetVisibleContentRectAndScale(visibleContentRect, scale), page()->pageID());
 }
 
-void TiledDrawingAreaProxy::setContentsScale(float scale)
-{
-    // FIXME: Since the visibleContentRect size depends on the scale, they should get to the web process in
-    // one single message to avoid unecessary tile rendering because of a possibly very
-    // oversized calculated visible rect.
-    page()->process()->send(Messages::DrawingArea::SetContentsScale(scale), page()->pageID());
-}
-
 void TiledDrawingAreaProxy::renderNextFrame()
 {
     page()->process()->send(Messages::DrawingArea::RenderNextFrame(), page()->pageID());

Modified: trunk/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h (94672 => 94673)


--- trunk/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h	2011-09-07 15:54:33 UTC (rev 94672)
+++ trunk/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h	2011-09-07 16:40:36 UTC (rev 94673)
@@ -71,8 +71,7 @@
     TiledDrawingAreaProxy(PlatformWebView*, WebPageProxy*);
     virtual ~TiledDrawingAreaProxy();
 
-    void setVisibleContentRect(const WebCore::IntRect&);
-    void setContentsScale(float);
+    void setVisibleContentRectAndScale(const WebCore::IntRect&, float);
     void renderNextFrame();
 
 #if USE(ACCELERATED_COMPOSITING)

Modified: trunk/Source/WebKit2/UIProcess/qt/ViewportInteractionEngine.cpp (94672 => 94673)


--- trunk/Source/WebKit2/UIProcess/qt/ViewportInteractionEngine.cpp	2011-09-07 15:54:33 UTC (rev 94672)
+++ trunk/Source/WebKit2/UIProcess/qt/ViewportInteractionEngine.cpp	2011-09-07 16:40:36 UTC (rev 94673)
@@ -18,8 +18,10 @@
  *
  */
 
+#include "config.h"
 #include "ViewportInteractionEngine.h"
 
+#include "PassOwnPtr.h"
 #include <QPointF>
 #include <QtDeclarative/qsgitem.h>
 
@@ -42,6 +44,8 @@
 // to them when we are the one changing the content.
 //
 // The guard make sure the signal viewportUpdateRequested() is sent if necessary.
+// When multiple guards are alive, their lifetime must be perfectly imbricated (e.g. if used ouside stack frames).
+// We rely on the first one to trigger the update at the end since it only uses one bool internally.
 //
 // The public methods should create the guard if they might update content.
 class ViewportUpdateGuard {
@@ -83,13 +87,17 @@
     , m_pinchStartScale(1.f)
 {
     reset();
-    connect(m_content, SIGNAL(xChanged()), this, SLOT(contentGeometryChanged()), Qt::DirectConnection);
-    connect(m_content, SIGNAL(yChanged()), this, SLOT(contentGeometryChanged()), Qt::DirectConnection);
-    connect(m_content, SIGNAL(widthChanged()), this, SLOT(contentGeometryChanged()), Qt::DirectConnection);
-    connect(m_content, SIGNAL(heightChanged()), this, SLOT(contentGeometryChanged()), Qt::DirectConnection);
-    connect(m_content, SIGNAL(scaleChanged()), this, SLOT(contentScaleChanged()), Qt::DirectConnection);
+    connect(m_content, SIGNAL(xChanged()), this, SLOT(contentViewportChanged()), Qt::DirectConnection);
+    connect(m_content, SIGNAL(yChanged()), this, SLOT(contentViewportChanged()), Qt::DirectConnection);
+    connect(m_content, SIGNAL(widthChanged()), this, SLOT(contentViewportChanged()), Qt::DirectConnection);
+    connect(m_content, SIGNAL(heightChanged()), this, SLOT(contentViewportChanged()), Qt::DirectConnection);
+    connect(m_content, SIGNAL(scaleChanged()), this, SLOT(contentViewportChanged()), Qt::DirectConnection);
 }
 
+ViewportInteractionEngine::~ViewportInteractionEngine()
+{
+}
+
 void ViewportInteractionEngine::reset()
 {
     ViewportUpdateGuard guard(this);
@@ -111,14 +119,9 @@
     // -animate the page back in viewport if necessary (if the page is fully in
     //  viewport, it does not pan horizontally anymore).
 
-    const qreal previousScale = m_content->scale();
-    {
-        ViewportUpdateGuard guard(this);
-        m_constraints = constraints;
-        updateContentIfNeeded();
-    }
-    if (m_content->scale() != previousScale)
-        emit commitScaleChange();
+    ViewportUpdateGuard guard(this);
+    m_constraints = constraints;
+    updateContentIfNeeded();
 }
 
 void ViewportInteractionEngine::panGestureStarted()
@@ -156,6 +159,8 @@
     if (!m_constraints.isUserScalable)
         return;
 
+    m_pinchViewportUpdateDeferrer = adoptPtr(new ViewportUpdateGuard(this));
+
     m_userInteractionFlags |= UserHasScaledContent;
     m_userInteractionFlags |= UserHasMovedContent;
     m_pinchStartScale = m_content->scale();
@@ -187,11 +192,10 @@
         // FIXME: resume the engine after the animation.
         animateContentIntoBoundariesIfNeeded();
     }
-    if (m_pinchStartScale != m_content->scale())
-        emit commitScaleChange();
+    m_pinchViewportUpdateDeferrer.clear();
 }
 
-void ViewportInteractionEngine::contentGeometryChanged()
+void ViewportInteractionEngine::contentViewportChanged()
 {
     if (m_isUpdatingContent)
         return;
@@ -203,19 +207,6 @@
     emit viewportUpdateRequested();
 }
 
-void ViewportInteractionEngine::contentScaleChanged()
-{
-    if (m_isUpdatingContent)
-        return;
-
-    ViewportUpdateGuard guard(this);
-    updateContentIfNeeded();
-
-    // We must notify the change so the client can rely on us for all change of Geometry.
-    emit viewportUpdateRequested();
-    emit commitScaleChange();
-}
-
 void ViewportInteractionEngine::updateContentIfNeeded()
 {
     updateContentScaleIfNeeded();

Modified: trunk/Source/WebKit2/UIProcess/qt/ViewportInteractionEngine.h (94672 => 94673)


--- trunk/Source/WebKit2/UIProcess/qt/ViewportInteractionEngine.h	2011-09-07 15:54:33 UTC (rev 94672)
+++ trunk/Source/WebKit2/UIProcess/qt/ViewportInteractionEngine.h	2011-09-07 16:40:36 UTC (rev 94673)
@@ -21,6 +21,7 @@
 #ifndef ViewportInteractionEngine_h
 #define ViewportInteractionEngine_h
 
+#include "OwnPtr.h"
 #include "qwebkitglobal.h"
 #include <QtCore/QObject>
 
@@ -31,11 +32,14 @@
 
 namespace WebKit {
 
+class ViewportUpdateGuard;
+
 class ViewportInteractionEngine : public QObject {
     Q_OBJECT
 
 public:
     ViewportInteractionEngine(const QSGItem*, QSGItem*);
+    ~ViewportInteractionEngine();
 
     struct Constraints {
         Constraints()
@@ -66,12 +70,9 @@
 Q_SIGNALS:
     void viewportUpdateRequested();
 
-    void commitScaleChange();
-
 private Q_SLOTS:
     // Respond to changes of content that are not driven by us, like the page resizing itself.
-    void contentGeometryChanged();
-    void contentScaleChanged();
+    void contentViewportChanged();
 
 private:
     void updateContentIfNeeded();
@@ -91,6 +92,7 @@
 
     Constraints m_constraints;
     bool m_isUpdatingContent;
+    OwnPtr<ViewportUpdateGuard> m_pinchViewportUpdateDeferrer;
     enum UserInteractionFlag {
         UserHasNotInteractedWithContent = 0,
         UserHasMovedContent = 1,

Modified: trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.cpp (94672 => 94673)


--- trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.cpp	2011-09-07 15:54:33 UTC (rev 94672)
+++ trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.cpp	2011-09-07 16:40:36 UTC (rev 94673)
@@ -77,11 +77,10 @@
     return QtWebPageProxy::handleEvent(ev);
 }
 
-void QTouchWebPageProxy::setVisibleContentRect(const QRectF& visibleContentRect)
+void QTouchWebPageProxy::setVisibleContentRectAndScale(const QRectF& visibleContentRect, float scale)
 {
-    TiledDrawingAreaProxy* tiledDrawingArea = static_cast<TiledDrawingAreaProxy*>(m_webPageProxy->drawingArea());
     QRect alignedVisibleContentRect = visibleContentRect.toAlignedRect();
-    tiledDrawingArea->setVisibleContentRect(alignedVisibleContentRect);
+    drawingArea()->setVisibleContentRectAndScale(alignedVisibleContentRect, scale);
 
     // FIXME: Once we support suspend and resume, this should be delayed until the page is active if the page is suspended.
     m_webPageProxy->setFixedVisibleContentRect(alignedVisibleContentRect);
@@ -108,11 +107,6 @@
     m_webPageProxy->findZoomableAreaForPoint(point);
 }
 
-void QTouchWebPageProxy::setContentsScale(qreal scale)
-{
-    drawingArea()->setContentsScale(scale);
-}
-
 void QTouchWebPageProxy::renderNextFrame()
 {
     drawingArea()->renderNextFrame();

Modified: trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.h (94672 => 94673)


--- trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.h	2011-09-07 15:54:33 UTC (rev 94672)
+++ trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.h	2011-09-07 16:40:36 UTC (rev 94673)
@@ -43,10 +43,9 @@
 
     virtual bool handleEvent(QEvent*);
 
-    void setVisibleContentRect(const QRectF&);
+    void setVisibleContentRectAndScale(const QRectF&, float);
     void setResizesToContentsUsingLayoutSize(const QSize& targetLayoutSize);
     void findZoomableAreaForPoint(const QPoint&);
-    void setContentsScale(qreal);
     void renderNextFrame();
 
 protected:

Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h (94672 => 94673)


--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h	2011-09-07 15:54:33 UTC (rev 94672)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h	2011-09-07 16:40:36 UTC (rev 94673)
@@ -99,7 +99,7 @@
 
 #if ENABLE(TILED_BACKING_STORE)
     virtual void setSize(const WebCore::IntSize& viewSize) { }
-    virtual void setVisibleContentRect(const WebCore::IntRect&) { }
+    virtual void setVisibleContentRectAndScale(const WebCore::IntRect&, float) { }
     virtual void setContentsScale(float scale) { }
     virtual void renderNextFrame() { }
     virtual void takeSnapshot(const WebCore::IntSize& targetSize, const WebCore::IntRect& contentsRect) { }

Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in (94672 => 94673)


--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in	2011-09-07 15:54:33 UTC (rev 94672)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in	2011-09-07 16:40:36 UTC (rev 94673)
@@ -28,8 +28,7 @@
 
 #if ENABLE(TILED_BACKING_STORE)
     SetSize(WebCore::IntSize viewSize)
-    SetVisibleContentRect(WebCore::IntRect visibleContentRect)
-    SetContentsScale(float scale)
+    SetVisibleContentRectAndScale(WebCore::IntRect visibleContentRect, float scale)
     RenderNextFrame()
     TakeSnapshot(WebCore::IntSize size, WebCore::IntRect contentsRect)
 #endif

Modified: trunk/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp (94672 => 94673)


--- trunk/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp	2011-09-07 15:54:33 UTC (rev 94672)
+++ trunk/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp	2011-09-07 16:40:36 UTC (rev 94673)
@@ -70,17 +70,16 @@
     m_webPage->setSize(viewSize);
 }
 
-void TiledDrawingArea::setVisibleContentRect(const WebCore::IntRect& visibleContentsRect)
+void TiledDrawingArea::setVisibleContentRectAndScale(const WebCore::IntRect& visibleContentsRect, float scale)
 {
     m_visibleContentRect = visibleContentsRect;
-    m_mainBackingStore->adjustVisibleRect();
-}
 
-void TiledDrawingArea::setContentsScale(float scale)
-{
-    m_previousBackingStore = m_mainBackingStore.release();
-    m_mainBackingStore = adoptPtr(new TiledBackingStore(this, TiledBackingStoreRemoteTileBackend::create(this)));
-    m_mainBackingStore->setContentsScale(scale);
+    if (scale != m_mainBackingStore->contentsScale()) {
+        m_previousBackingStore = m_mainBackingStore.release();
+        m_mainBackingStore = adoptPtr(new TiledBackingStore(this, TiledBackingStoreRemoteTileBackend::create(this)));
+        m_mainBackingStore->setContentsScale(scale);
+    } else
+        m_mainBackingStore->adjustVisibleRect();
 }
 
 void TiledDrawingArea::renderNextFrame()

Modified: trunk/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.h (94672 => 94673)


--- trunk/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.h	2011-09-07 15:54:33 UTC (rev 94672)
+++ trunk/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.h	2011-09-07 16:40:36 UTC (rev 94673)
@@ -54,8 +54,7 @@
 private:
     // CoreIPC message handlers.
     virtual void setSize(const WebCore::IntSize& viewSize);
-    virtual void setVisibleContentRect(const WebCore::IntRect&);
-    virtual void setContentsScale(float);
+    virtual void setVisibleContentRectAndScale(const WebCore::IntRect&, float);
     virtual void renderNextFrame();
     virtual void suspendPainting();
     virtual void resumePainting();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to