[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

andreas.kling at nokia.com andreas.kling at nokia.com
Wed Dec 22 15:51:58 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 5c4bb54d07877e44f65997a661aa9c857e616c21
Author: andreas.kling at nokia.com <andreas.kling at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Nov 15 19:08:24 2010 +0000

    2010-11-15  Andreas Kling  <kling at webkit.org>
    
            Reviewed by Kenneth Rohde Christiansen.
    
            [WK2][Qt] Add "page snapshot" functionality to tiled backing store
    
            Original patch by Antti Koivisto.
    
            Add a way to take a snapshot of a specific part of the page, at a specific scale.
            Only implemented for the tiled drawing area.
    
            * Shared/CoreIPCSupport/DrawingAreaMessageKinds.h:
            New message: TakeSnapshot.
    
            * Shared/CoreIPCSupport/DrawingAreaProxyMessageKinds.h:
            New message: SnapshotTaken.
    
            * UIProcess/API/qt/qgraphicswkview.h:
            * UIProcess/API/qt/qgraphicswkview.cpp:
            (QGraphicsWKView::takeSnapshot):
            Expose the snapshot functionality.
    
            * UIProcess/TiledDrawingAreaProxy.cpp:
            (WebKit::TiledDrawingAreaProxy::didReceiveMessage):
            (WebKit::TiledDrawingAreaProxy::takeSnapshot):
            * UIProcess/TiledDrawingAreaProxy.h:
            * UIProcess/qt/TiledDrawingAreaProxyQt.cpp:
            (WebKit::TiledDrawingAreaProxy::snapshotTaken):
            * WebProcess/WebPage/TiledDrawingArea.cpp:
            (WebKit::TiledDrawingArea::didReceiveMessage):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72016 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index ed41d6c..21e54cc 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,34 @@
+2010-11-15  Andreas Kling  <kling at webkit.org>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        [WK2][Qt] Add "page snapshot" functionality to tiled backing store
+
+        Original patch by Antti Koivisto.
+
+        Add a way to take a snapshot of a specific part of the page, at a specific scale.
+        Only implemented for the tiled drawing area.
+
+        * Shared/CoreIPCSupport/DrawingAreaMessageKinds.h:
+        New message: TakeSnapshot.
+
+        * Shared/CoreIPCSupport/DrawingAreaProxyMessageKinds.h:
+        New message: SnapshotTaken.
+
+        * UIProcess/API/qt/qgraphicswkview.h:
+        * UIProcess/API/qt/qgraphicswkview.cpp:
+        (QGraphicsWKView::takeSnapshot):
+        Expose the snapshot functionality.
+
+        * UIProcess/TiledDrawingAreaProxy.cpp:
+        (WebKit::TiledDrawingAreaProxy::didReceiveMessage):
+        (WebKit::TiledDrawingAreaProxy::takeSnapshot):
+        * UIProcess/TiledDrawingAreaProxy.h:
+        * UIProcess/qt/TiledDrawingAreaProxyQt.cpp:
+        (WebKit::TiledDrawingAreaProxy::snapshotTaken):
+        * WebProcess/WebPage/TiledDrawingArea.cpp:
+        (WebKit::TiledDrawingArea::didReceiveMessage):
+
 2010-11-15  Andreas Kling  <andreas.kling at nokia.com>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebKit2/Shared/CoreIPCSupport/DrawingAreaMessageKinds.h b/WebKit2/Shared/CoreIPCSupport/DrawingAreaMessageKinds.h
index 0d2ec26..e88e0cd 100644
--- a/WebKit2/Shared/CoreIPCSupport/DrawingAreaMessageKinds.h
+++ b/WebKit2/Shared/CoreIPCSupport/DrawingAreaMessageKinds.h
@@ -52,6 +52,9 @@ enum Kind {
 
     // Called to cancel a requested tile update.
     CancelTileUpdate,
+
+    // Called to take a snapshot of the page contents.
+    TakeSnapshot,
 #endif
 };
 
diff --git a/WebKit2/Shared/CoreIPCSupport/DrawingAreaProxyMessageKinds.h b/WebKit2/Shared/CoreIPCSupport/DrawingAreaProxyMessageKinds.h
index 254a9ce..dfba437 100644
--- a/WebKit2/Shared/CoreIPCSupport/DrawingAreaProxyMessageKinds.h
+++ b/WebKit2/Shared/CoreIPCSupport/DrawingAreaProxyMessageKinds.h
@@ -42,6 +42,7 @@ enum Kind {
     Invalidate,
     TileUpdated,
     AllTileUpdatesProcessed,
+    SnapshotTaken,
 #endif
 };
 
diff --git a/WebKit2/UIProcess/API/qt/qgraphicswkview.cpp b/WebKit2/UIProcess/API/qt/qgraphicswkview.cpp
index 2a8a880..33f4194 100644
--- a/WebKit2/UIProcess/API/qt/qgraphicswkview.cpp
+++ b/WebKit2/UIProcess/API/qt/qgraphicswkview.cpp
@@ -286,6 +286,17 @@ void QGraphicsWKView::focusOutEvent(QFocusEvent*)
     page()->d->page->setActive(false);
 }
 
+void QGraphicsWKView::takeSnapshot(const QSize& size, const QRect& contentsRect)
+{
+#if ENABLE(TILED_BACKING_STORE)
+    DrawingAreaProxy* drawingArea = page()->d->page->drawingArea();
+    if (drawingArea->info().type != DrawingAreaProxy::TiledDrawingAreaType)
+        return;
+    TiledDrawingAreaProxy* tiledDrawingArea = static_cast<TiledDrawingAreaProxy*>(drawingArea);
+    tiledDrawingArea->takeSnapshot(size, contentsRect);
+#endif
+}
+
 QGraphicsWKViewPrivate::QGraphicsWKViewPrivate(QGraphicsWKView* view)
     : q(view)
     , m_scaleCommitTimer(RunLoop::current(), this, &QGraphicsWKViewPrivate::commitScale)
diff --git a/WebKit2/UIProcess/API/qt/qgraphicswkview.h b/WebKit2/UIProcess/API/qt/qgraphicswkview.h
index dd24ac1..6281018 100644
--- a/WebKit2/UIProcess/API/qt/qgraphicswkview.h
+++ b/WebKit2/UIProcess/API/qt/qgraphicswkview.h
@@ -45,6 +45,8 @@ public:
     virtual QSizeF sizeHint(Qt::SizeHint, const QSizeF&) const;
     virtual QVariant inputMethodQuery(Qt::InputMethodQuery) const;
 
+    void takeSnapshot(const QSize& size, const QRect& documentRect);
+
     // FIXME: should not be public
     virtual QRectF visibleRect() const;
 
@@ -58,6 +60,7 @@ public:
     Q_SIGNAL void loadProgress(int progress);
     Q_SIGNAL void initialLayoutCompleted();
     Q_SIGNAL void urlChanged(const QUrl&);
+    Q_SIGNAL void snapshotTaken(const QImage&);
 
 public Q_SLOTS:
     void back();
diff --git a/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp b/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp
index 9b22637..73a86b2 100644
--- a/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp
+++ b/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp
@@ -157,6 +157,13 @@ void TiledDrawingAreaProxy::didReceiveMessage(CoreIPC::Connection*, CoreIPC::Mes
         tileBufferUpdateComplete();
         break;
     }
+    case DrawingAreaProxyMessage::SnapshotTaken: {
+        UpdateChunk chunk;
+        if (!arguments->decode(CoreIPC::Out(chunk)))
+            return;
+        snapshotTaken(chunk);
+        break;
+    }
     default:
         ASSERT_NOT_REACHED();
     }
@@ -221,6 +228,12 @@ void TiledDrawingAreaProxy::setKeepAndCoverAreaMultipliers(const FloatSize& keep
     startTileCreationTimer();
 }
 
+void TiledDrawingAreaProxy::takeSnapshot(const IntSize& size, const IntRect& contentsRect)
+{
+    WebPageProxy* page = this->page();
+    page->process()->send(DrawingAreaMessage::TakeSnapshot, page->pageID(), CoreIPC::Out(size, contentsRect));
+}
+
 void TiledDrawingAreaProxy::invalidate(const IntRect& contentsDirtyRect)
 {
     IntRect dirtyRect(mapFromContents(contentsDirtyRect));
diff --git a/WebKit2/UIProcess/TiledDrawingAreaProxy.h b/WebKit2/UIProcess/TiledDrawingAreaProxy.h
index 7aa26d4..3b9a558 100644
--- a/WebKit2/UIProcess/TiledDrawingAreaProxy.h
+++ b/WebKit2/UIProcess/TiledDrawingAreaProxy.h
@@ -75,6 +75,8 @@ public:
 
     void waitUntilUpdatesComplete();
 
+    void takeSnapshot(const WebCore::IntSize& size, const WebCore::IntRect& contentsRect);
+
 #if USE(ACCELERATED_COMPOSITING)
     virtual void attachCompositingContext(uint32_t /* contextID */) { }
     virtual void detachCompositingContext() { }
@@ -108,6 +110,8 @@ private:
     WebCore::IntRect webViewVisibleRect();
     void updateWebView(const Vector<WebCore::IntRect>& paintedArea);
 
+    void snapshotTaken(UpdateChunk&);
+
     // DrawingAreaProxy
     virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
     virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, CoreIPC::ArgumentEncoder&);
diff --git a/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp b/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp
index f9471c0..73519da 100644
--- a/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp
+++ b/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp
@@ -59,4 +59,9 @@ WebPageProxy* TiledDrawingAreaProxy::page()
     return toImpl(m_webView->page()->pageRef());
 }
 
+void TiledDrawingAreaProxy::snapshotTaken(UpdateChunk& chunk)
+{
+    emit m_webView->snapshotTaken(chunk.createImage());
+}
+
 } // namespace WebKit
diff --git a/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp b/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp
index 87af668..19a7198 100644
--- a/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp
+++ b/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp
@@ -219,6 +219,25 @@ void TiledDrawingArea::didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageI
         }
         break;
     }
+    case DrawingAreaMessage::TakeSnapshot: {
+        IntSize targetSize;
+        IntRect contentsRect;
+
+        if (!arguments->decode(CoreIPC::Out(targetSize, contentsRect)))
+            return;
+
+        m_webPage->layoutIfNeeded();
+
+        contentsRect.intersect(IntRect(IntPoint::zero(), m_webPage->mainFrame()->coreFrame()->view()->contentsSize()));
+
+        float targetScale = float(targetSize.width()) / contentsRect.width();
+
+        UpdateChunk updateChunk(IntRect(IntPoint(contentsRect.x() * targetScale, contentsRect.y() * targetScale), targetSize));
+        paintIntoUpdateChunk(&updateChunk, targetScale);
+
+        WebProcess::shared().connection()->send(DrawingAreaProxyMessage::SnapshotTaken, m_webPage->pageID(), CoreIPC::In(updateChunk));
+        break;
+    }
     default:
         ASSERT_NOT_REACHED();
         break;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list