[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

weinig at apple.com weinig at apple.com
Fri Jan 21 14:43:45 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit 0d664d0aa06c3225a6152761a6c6e3a37e5ce686
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Dec 28 00:01:08 2010 +0000

    WebKit2: Add API for getting snapshots
    https://bugs.webkit.org/show_bug.cgi?id=51656
    
    Reviewed by Anders Carlsson.
    
    * Shared/API/c/WKBase.h:
    * Shared/API/c/WKImage.cpp: Added.
    (WKImageGetTypeID):
    (WKImageCreate):
    (WKImageGetSize):
    * Shared/API/c/WKImage.h: Added.
    * Shared/WebImage.cpp: Added.
    (WebKit::WebImage::create):
    (WebKit::WebImage::size):
    * Shared/WebImage.h: Added.
    (WebKit::WebImage::backingStore):
    (WebKit::WebImage::WebImage):
    (WebKit::WebImage::type):
    Add a general purpose API image class.
    
    * Shared/API/c/cg: Added.
    * Shared/API/c/cg/WKImageCG.cpp: Added.
    (WKImageCreateCGImage):
    * Shared/API/c/cg/WKImageCG.h: Added.
    Add function to convert a WKImageRef to a CGImageRef for platforms that use CG.
    
    * Shared/API/c/WKSharedAPICast.h:
    (WebKit::toFloatRect):
    (WebKit::toIntSize):
    (WebKit::toIntPoint):
    (WebKit::toIntRect):
    (WebKit::toImageOptions):
    Make conversion functions that are ambiguous more explicit.
    
    * Shared/APIObject.h:
    * Shared/BackingStore.h:
    (WebKit::BackingStore::isBackedBySharedMemory):
    * Shared/ImageOptions.h: Added.
    * Shared/UserMessageCoders.h:
    (WebKit::UserMessageEncoder::baseEncode):
    (WebKit::UserMessageDecoder::baseDecode):
    Allow a WKImageRef to be passed in user messages.  Right now, it only
    works if the image is sharable.
    
    * UIProcess/API/C/WKPage.cpp:
    (WKPageScaleWebView):
    * UIProcess/WebUIClient.cpp:
    (WebKit::WebUIClient::windowFrame):
    Use the more explicit conversion function name.
    
    * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
    (WKBundlePageCreateSnapshotInViewCoordinates):
    (WKBundlePageCreateSnapshotInDocumentCoordinates):
    * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
    * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp:
    (WKBundlePageOverlaySetNeedsDisplay):
    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::WebPage::snapshotInViewCoordinates):
    (WebKit::WebPage::snapshotInDocumentCoordinates):
    Add function to take the snapshot.
    
    * WebProcess/WebPage/WebPage.h:
    * WebKit2.pro:
    * WebKit2.xcodeproj/project.pbxproj:
    * win/WebKit2.vcproj:
    Add new files.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74698 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 1168a6b..66b7cc1 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -2,6 +2,75 @@
 
         Reviewed by Anders Carlsson.
 
+        WebKit2: Add API for getting snapshots
+        https://bugs.webkit.org/show_bug.cgi?id=51656
+
+        * Shared/API/c/WKBase.h:
+        * Shared/API/c/WKImage.cpp: Added.
+        (WKImageGetTypeID):
+        (WKImageCreate):
+        (WKImageGetSize):
+        * Shared/API/c/WKImage.h: Added.
+        * Shared/WebImage.cpp: Added.
+        (WebKit::WebImage::create):
+        (WebKit::WebImage::size):
+        * Shared/WebImage.h: Added.
+        (WebKit::WebImage::backingStore):
+        (WebKit::WebImage::WebImage):
+        (WebKit::WebImage::type):
+        Add a general purpose API image class.
+
+        * Shared/API/c/cg: Added.
+        * Shared/API/c/cg/WKImageCG.cpp: Added.
+        (WKImageCreateCGImage):
+        * Shared/API/c/cg/WKImageCG.h: Added.
+        Add function to convert a WKImageRef to a CGImageRef for platforms that use CG.
+
+        * Shared/API/c/WKSharedAPICast.h:
+        (WebKit::toFloatRect):
+        (WebKit::toIntSize):
+        (WebKit::toIntPoint):
+        (WebKit::toIntRect):
+        (WebKit::toImageOptions):
+        Make conversion functions that are ambiguous more explicit.
+
+        * Shared/APIObject.h:
+        * Shared/BackingStore.h:
+        (WebKit::BackingStore::isBackedBySharedMemory):
+        * Shared/ImageOptions.h: Added.
+        * Shared/UserMessageCoders.h:
+        (WebKit::UserMessageEncoder::baseEncode):
+        (WebKit::UserMessageDecoder::baseDecode):
+        Allow a WKImageRef to be passed in user messages.  Right now, it only
+        works if the image is sharable.
+
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageScaleWebView):
+        * UIProcess/WebUIClient.cpp:
+        (WebKit::WebUIClient::windowFrame):
+        Use the more explicit conversion function name.
+
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
+        (WKBundlePageCreateSnapshotInViewCoordinates):
+        (WKBundlePageCreateSnapshotInDocumentCoordinates):
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
+        * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp:
+        (WKBundlePageOverlaySetNeedsDisplay):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::snapshotInViewCoordinates):
+        (WebKit::WebPage::snapshotInDocumentCoordinates):
+        Add function to take the snapshot.
+
+        * WebProcess/WebPage/WebPage.h:
+        * WebKit2.pro:
+        * WebKit2.xcodeproj/project.pbxproj:
+        * win/WebKit2.vcproj:
+        Add new files.
+
+2010-12-27  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Anders Carlsson.
+
         WebKit2: Add additional API for managing databases
         https://bugs.webkit.org/show_bug.cgi?id=51629
 
diff --git a/WebKit2/Shared/API/c/WKBase.h b/WebKit2/Shared/API/c/WKBase.h
index cf5bb5b..0e7984a 100644
--- a/WebKit2/Shared/API/c/WKBase.h
+++ b/WebKit2/Shared/API/c/WKBase.h
@@ -44,11 +44,12 @@ typedef const struct OpaqueWKDictionary* WKDictionaryRef;
 typedef struct OpaqueWKDictionary* WKMutableDictionaryRef;
 
 typedef const struct OpaqueWKBoolean* WKBooleanRef;
+typedef const struct OpaqueWKCertificateInfo* WKCertificateInfoRef;
 typedef const struct OpaqueWKContextMenuItem* WKContextMenuItemRef;
 typedef const struct OpaqueWKData* WKDataRef;
 typedef const struct OpaqueWKDouble* WKDoubleRef;
 typedef const struct OpaqueWKError* WKErrorRef;
-typedef const struct OpaqueWKCertificateInfo* WKCertificateInfoRef;
+typedef const struct OpaqueWKImage* WKImageRef;
 typedef const struct OpaqueWKSecurityOrigin* WKSecurityOriginRef;
 typedef const struct OpaqueWKSerializedScriptValue* WKSerializedScriptValueRef;
 typedef const struct OpaqueWKString* WKStringRef;
diff --git a/WebKit2/Shared/API/c/WKImage.cpp b/WebKit2/Shared/API/c/WKImage.cpp
new file mode 100644
index 0000000..0bf21df
--- /dev/null
+++ b/WebKit2/Shared/API/c/WKImage.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "WKImage.h"
+
+#include "WKSharedAPICast.h"
+#include "WebImage.h"
+
+using namespace WebKit;
+
+WKTypeID WKImageGetTypeID()
+{
+    return toAPI(WebImage::APIType);
+}
+
+WKImageRef WKImageCreate(WKSize size, WKImageOptions options)
+{
+    RefPtr<WebImage> webImage = WebImage::create(toIntSize(size), toImageOptions(options));
+    return toAPI(webImage.release().leakRef());
+}
+
+WKSize WKImageGetSize(WKImageRef imageRef)
+{
+    return toAPI(toImpl(imageRef)->size());
+}
diff --git a/WebKit2/Shared/API/c/WKImage.h b/WebKit2/Shared/API/c/WKImage.h
new file mode 100644
index 0000000..2797cc5
--- /dev/null
+++ b/WebKit2/Shared/API/c/WKImage.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WKImage_h
+#define WKImage_h
+
+#include <WebKit2/WKBase.h>
+#include <WebKit2/WKGeometry.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum {
+    kWKImageOptionsSharable = 1 << 0,
+};
+typedef uint32_t WKImageOptions;
+
+WK_EXPORT WKTypeID WKImageGetTypeID();
+
+WK_EXPORT WKImageRef WKImageCreate(WKSize size, WKImageOptions options);
+
+WK_EXPORT WKSize WKImageGetSize(WKImageRef image);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKImage_h */
diff --git a/WebKit2/Shared/API/c/WKSharedAPICast.h b/WebKit2/Shared/API/c/WKSharedAPICast.h
index 5047c5d..7af434b 100644
--- a/WebKit2/Shared/API/c/WKSharedAPICast.h
+++ b/WebKit2/Shared/API/c/WKSharedAPICast.h
@@ -26,12 +26,14 @@
 #ifndef WKSharedAPICast_h
 #define WKSharedAPICast_h
 
+#include "ImageOptions.h"
 #include "SameDocumentNavigationType.h"
 #include "WKBase.h"
 #include "WKContextMenuItemTypes.h"
 #include "WKEvent.h"
 #include "WKFindOptions.h"
 #include "WKGeometry.h"
+#include "WKImage.h"
 #include "WKPageLoadTypes.h"
 #include "WebError.h"
 #include "WebEvent.h"
@@ -42,7 +44,6 @@
 #include <WebCore/ContextMenuItem.h>
 #include <WebCore/FloatRect.h>
 #include <WebCore/FrameLoaderTypes.h>
-#include <WebCore/IntPoint.h>
 #include <WebCore/IntRect.h>
 #include <wtf/TypeTraits.h>
 
@@ -55,6 +56,7 @@ class MutableDictionary;
 class WebCertificateInfo;
 class WebContextMenuItem;
 class WebData;
+class WebImage;
 class WebSecurityOrigin;
 class WebSerializedScriptValue;
 class WebURLRequest;
@@ -76,6 +78,7 @@ WK_ADD_API_MAPPING(WKDataRef, WebData)
 WK_ADD_API_MAPPING(WKDictionaryRef, ImmutableDictionary)
 WK_ADD_API_MAPPING(WKDoubleRef, WebDouble)
 WK_ADD_API_MAPPING(WKErrorRef, WebError)
+WK_ADD_API_MAPPING(WKImageRef, WebImage)
 WK_ADD_API_MAPPING(WKMutableArrayRef, MutableArray)
 WK_ADD_API_MAPPING(WKMutableDictionaryRef, MutableDictionary)
 WK_ADD_API_MAPPING(WKSecurityOriginRef, WebSecurityOrigin)
@@ -171,17 +174,28 @@ inline ProxyingRefPtr<WebError> toAPI(const WebCore::ResourceError& error)
 
 /* Geometry conversions */
 
-inline WebCore::FloatRect toImpl(const WKRect& wkRect)
+inline WebCore::FloatRect toFloatRect(const WKRect& wkRect)
 {
     return WebCore::FloatRect(static_cast<float>(wkRect.origin.x), static_cast<float>(wkRect.origin.y),
                               static_cast<float>(wkRect.size.width), static_cast<float>(wkRect.size.height));
 }
 
-inline WebCore::IntPoint toImpl(const WKPoint& wkPoint)
+inline WebCore::IntSize toIntSize(const WKSize& wkSize)
+{
+    return WebCore::IntSize(static_cast<int>(wkSize.width), static_cast<int>(wkSize.height));
+}
+
+inline WebCore::IntPoint toIntPoint(const WKPoint& wkPoint)
 {
     return WebCore::IntPoint(static_cast<int>(wkPoint.x), static_cast<int>(wkPoint.y));
 }
 
+inline WebCore::IntRect toIntRect(const WKRect& wkRect)
+{
+    return WebCore::IntRect(static_cast<int>(wkRect.origin.x), static_cast<int>(wkRect.origin.y),
+                            static_cast<int>(wkRect.size.width), static_cast<int>(wkRect.size.height));
+}
+
 inline WKRect toAPI(const WebCore::FloatRect& rect)
 {
     WKRect wkRect;
@@ -202,6 +216,14 @@ inline WKRect toAPI(const WebCore::IntRect& rect)
     return wkRect;
 }
 
+inline WKSize toAPI(const WebCore::IntSize& size)
+{
+    WKSize wkSize;
+    wkSize.width = size.width();
+    wkSize.height = size.height();
+    return wkSize;
+}
+
 inline WKPoint toAPI(const WebCore::IntPoint& point)
 {
     WKPoint wkPoint;
@@ -698,6 +720,16 @@ inline WKSameDocumentNavigationType toAPI(SameDocumentNavigationType type)
     return wkType;
 }
 
+inline ImageOptions toImageOptions(WKImageOptions wkImageOptions)
+{
+    unsigned imageOptions = 0;
+
+    if (wkImageOptions & kWKImageOptionsSharable)
+        imageOptions |= ImageOptionsSharable;
+
+    return static_cast<ImageOptions>(imageOptions);
+}
+
 } // namespace WebKit
 
 #endif // WKSharedAPICast_h
diff --git a/WebKit2/Shared/API/c/cg/WKImageCG.cpp b/WebKit2/Shared/API/c/cg/WKImageCG.cpp
new file mode 100644
index 0000000..687415c
--- /dev/null
+++ b/WebKit2/Shared/API/c/cg/WKImageCG.cpp
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "WKImageCG.h"
+
+#include "WKSharedAPICast.h"
+#include "WebImage.h"
+#include <WebCore/GraphicsContext.h>
+
+using namespace WebKit;
+using namespace WebCore;
+
+CGImageRef WKImageCreateCGImage(WKImageRef imageRef)
+{
+    OwnPtr<GraphicsContext> sourceContext = toImpl(imageRef)->backingStore()->createGraphicsContext();
+    return CGBitmapContextCreateImage(sourceContext->platformContext());
+}
diff --git a/WebKit2/Shared/API/c/cg/WKImageCG.h b/WebKit2/Shared/API/c/cg/WKImageCG.h
new file mode 100644
index 0000000..7705c31
--- /dev/null
+++ b/WebKit2/Shared/API/c/cg/WKImageCG.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WKImageCG_h
+#define WKImageCG_h
+
+#include <CoreGraphics/CGImage.h>
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT CGImageRef WKImageCreateCGImage(WKImageRef image);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKImageCG_h */
diff --git a/WebKit2/Shared/APIObject.h b/WebKit2/Shared/APIObject.h
index e625b3a..6b402a3 100644
--- a/WebKit2/Shared/APIObject.h
+++ b/WebKit2/Shared/APIObject.h
@@ -44,6 +44,7 @@ public:
         TypeData,
         TypeDictionary,
         TypeError,
+        TypeImage,
         TypeProtectionSpace,
         TypeSecurityOrigin,
         TypeSerializedScriptValue,
diff --git a/WebKit2/Shared/BackingStore.h b/WebKit2/Shared/BackingStore.h
index 7b3c905..f2c580d 100644
--- a/WebKit2/Shared/BackingStore.h
+++ b/WebKit2/Shared/BackingStore.h
@@ -66,11 +66,12 @@ public:
     // Paint the backing store into the given context.
     void paint(WebCore::GraphicsContext&, const WebCore::IntPoint& dstPoint, const WebCore::IntRect& srcRect);
 
+    bool isBackedBySharedMemory() const { return m_sharedMemory; }
+
 private:
     BackingStore(const WebCore::IntSize&, void*);
     BackingStore(const WebCore::IntSize&, PassRefPtr<SharedMemory>);
 
-    bool isBackedBySharedMemory() const { return m_sharedMemory; }
     static size_t numBytesForSize(const WebCore::IntSize& size) { return size.width() * size.height() * 4; }
 
     void* data() const;
diff --git a/WebKit2/Shared/ImageOptions.h b/WebKit2/Shared/ImageOptions.h
new file mode 100644
index 0000000..3acc74a
--- /dev/null
+++ b/WebKit2/Shared/ImageOptions.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ImageOptions_h
+#define ImageOptions_h
+
+namespace WebKit {
+
+enum ImageOptions {
+    ImageOptionsSharable = 1 << 0,
+};
+
+} // namespace WebKit
+
+#endif // ImageOptions_h
diff --git a/WebKit2/Shared/UserMessageCoders.h b/WebKit2/Shared/UserMessageCoders.h
index fff9de7..5cc5a9e 100644
--- a/WebKit2/Shared/UserMessageCoders.h
+++ b/WebKit2/Shared/UserMessageCoders.h
@@ -28,6 +28,7 @@
 #include "ImmutableArray.h"
 #include "ImmutableDictionary.h"
 #include "WebCoreArgumentCoders.h"
+#include "WebImage.h"
 #include "WebNumber.h"
 #include "WebSerializedScriptValue.h"
 #include "WebString.h"
@@ -39,10 +40,11 @@ namespace WebKit {
 //   - Null -> Null
 //   - Array -> Array
 //   - Dictionary -> Dictionary
-//   - String -> String
 //   - SerializedScriptValue -> SerializedScriptValue
+//   - String -> String
 //   - UserContentURLPattern -> UserContentURLPattern
 //   - WebDouble -> WebDouble
+//   - WebImage -> WebImage
 //   - WebUInt64 -> WebUInt64
 //   - WebURL -> WebURL
 
@@ -115,6 +117,23 @@ public:
             encoder->encode(urlPattern->patternString());
             return true;
         }
+        case APIObject::TypeImage: {
+            WebImage* image = static_cast<WebImage*>(m_root);
+            if (!image->backingStore()->isBackedBySharedMemory()) {
+                encoder->encode(false);
+                return true;
+            }
+
+            SharedMemory::Handle handle;
+            if (!image->backingStore()->createHandle(handle))
+                return false;
+
+            encoder->encode(true);
+            
+            encoder->encode(image->size());
+            encoder->encode(handle);
+            return true;
+        }
         default:
             break;
         }
@@ -136,10 +155,11 @@ protected:
 //   - Null -> Null
 //   - Array -> Array
 //   - Dictionary -> Dictionary
-//   - String -> String
 //   - SerializedScriptValue -> SerializedScriptValue
+//   - String -> String
 //   - UserContentURLPattern -> UserContentURLPattern
 //   - WebDouble -> WebDouble
+//   - WebImage -> WebImage
 //   - WebUInt64 -> WebUInt64
 //   - WebURL -> WebURL
 
@@ -245,6 +265,25 @@ public:
             coder.m_root = WebUserContentURLPattern::create(string);
             break;
         }
+        case APIObject::TypeImage: {
+            bool didEncode = false;
+            if (!decoder->decode(didEncode))
+                return false;
+
+            if (!didEncode)
+                break;
+
+            WebCore::IntSize size;
+            if (!decoder->decode(size))
+                return false;
+
+            SharedMemory::Handle handle;
+            if (!decoder->decode(handle))
+                return false;
+
+            coder.m_root = WebImage::create(BackingStore::create(size, handle));
+            return true;
+        }
         default:
             break;
         }
diff --git a/WebKit2/Shared/WebImage.cpp b/WebKit2/Shared/WebImage.cpp
new file mode 100644
index 0000000..81f30fc
--- /dev/null
+++ b/WebKit2/Shared/WebImage.cpp
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "WebImage.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+PassRefPtr<WebImage> WebImage::create(const IntSize& size, ImageOptions options)
+{
+    if (options & ImageOptionsSharable)
+        return WebImage::create(BackingStore::createSharable(size));
+    return WebImage::create(BackingStore::create(size));
+}
+
+PassRefPtr<WebImage> WebImage::create(PassRefPtr<BackingStore> backingStore)
+{
+    return adoptRef(new WebImage(backingStore));
+}
+
+const IntSize& WebImage::size() const
+{
+    return m_backingStore->size();
+}
+
+} // namespace WebKit
diff --git a/WebKit2/Shared/WebImage.h b/WebKit2/Shared/WebImage.h
new file mode 100644
index 0000000..cafbe8d
--- /dev/null
+++ b/WebKit2/Shared/WebImage.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebImage_h
+#define WebImage_h
+
+#include "APIObject.h"
+#include "BackingStore.h"
+#include "ImageOptions.h"
+#include <wtf/Forward.h>
+
+namespace WebKit {
+
+// WebImage - An image type suitable for vending to an API.
+
+class WebImage : public APIObject {
+public:
+    static const Type APIType = TypeImage;
+
+    static PassRefPtr<WebImage> create(const WebCore::IntSize&, ImageOptions);
+    static PassRefPtr<WebImage> create(PassRefPtr<BackingStore>);
+
+    const WebCore::IntSize& size() const;
+
+    BackingStore* backingStore() const { return m_backingStore.get(); }
+
+private:
+    WebImage(PassRefPtr<BackingStore> backingStore)
+        : m_backingStore(backingStore)
+    {
+        ASSERT(m_backingStore);
+    }
+
+    virtual Type type() const { return APIType; }
+
+    RefPtr<BackingStore> m_backingStore;
+};
+
+} // namespace WebKit
+
+#endif // WebImage_h
diff --git a/WebKit2/UIProcess/API/C/WKPage.cpp b/WebKit2/UIProcess/API/C/WKPage.cpp
index 25dede2..22f5298 100644
--- a/WebKit2/UIProcess/API/C/WKPage.cpp
+++ b/WebKit2/UIProcess/API/C/WKPage.cpp
@@ -252,7 +252,7 @@ void WKPageSetPageAndTextZoomFactors(WKPageRef pageRef, double pageZoomFactor, d
 
 void WKPageScaleWebView(WKPageRef pageRef, double scale, WKPoint origin)
 {
-    toImpl(pageRef)->scaleWebView(scale, toImpl(origin));
+    toImpl(pageRef)->scaleWebView(scale, toIntPoint(origin));
 }
 
 double WKPageGetViewScaleFactor(WKPageRef pageRef)
diff --git a/WebKit2/UIProcess/WebUIClient.cpp b/WebKit2/UIProcess/WebUIClient.cpp
index 89c3b5e..661f4b7 100644
--- a/WebKit2/UIProcess/WebUIClient.cpp
+++ b/WebKit2/UIProcess/WebUIClient.cpp
@@ -214,7 +214,7 @@ FloatRect WebUIClient::windowFrame(WebPageProxy* page)
     if (!m_client.getWindowFrame)
         return FloatRect();
 
-    return toImpl(m_client.getWindowFrame(toAPI(page), m_client.clientInfo));
+    return toFloatRect(m_client.getWindowFrame(toAPI(page), m_client.clientInfo));
 }
 
 bool WebUIClient::canRunBeforeUnloadConfirmPanel()
diff --git a/WebKit2/WebKit2.pro b/WebKit2/WebKit2.pro
index 3bda5e6..cb01402 100644
--- a/WebKit2/WebKit2.pro
+++ b/WebKit2/WebKit2.pro
@@ -222,6 +222,7 @@ HEADERS += \
     Shared/API/c/WKContextMenuItem.h \
     Shared/API/c/WKContextMenuItemTypes.h \
     Shared/API/c/WKGeometry.h \
+    Shared/API/c/WKImage.h \
     Shared/API/c/WKNumber.h \
     Shared/API/c/WKPageLoadTypes.h \
     Shared/API/c/WKSecurityOrigin.h \
@@ -239,6 +240,7 @@ HEADERS += \
     Shared/ChildProcess.h \
     Shared/CoreIPCSupport/DrawingAreaMessageKinds.h \
     Shared/CoreIPCSupport/DrawingAreaProxyMessageKinds.h \
+    Shared/ImageOptions.h \
     Shared/ImmutableArray.h \
     Shared/ImmutableDictionary.h \
     Shared/MutableArray.h \
@@ -258,6 +260,7 @@ HEADERS += \
     Shared/WebEvent.h \
     Shared/WebEventConversion.h \
     Shared/WebFindOptions.h \
+    Shared/WebImage.h \
     Shared/WebNavigationDataStore.h \
     Shared/WebNumber.h \
     Shared/WebOpenPanelParameters.h \
@@ -439,6 +442,7 @@ SOURCES += \
     Shared/API/c/WKArray.cpp \
     Shared/API/c/WKCertificateInfo.cpp \
     Shared/API/c/WKContextMenuItem.cpp \
+    Shared/API/c/WKImage.cpp \
     Shared/API/c/WKNumber.cpp \
     Shared/API/c/WKSecurityOrigin.cpp \
     Shared/API/c/WKSerializedScriptValue.cpp \
@@ -465,6 +469,7 @@ SOURCES += \
     Shared/WebEvent.cpp \
     Shared/WebEventConversion.cpp \
     Shared/WebKeyboardEvent.cpp \
+    Shared/WebImage.cpp \
     Shared/WebMouseEvent.cpp \
     Shared/WebOpenPanelParameters.cpp \
     Shared/WebPageCreationParameters.cpp \
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index 5643410..ac7269a 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -524,6 +524,13 @@
 		BCCB75C61203A1CE00222D1B /* WebContextMessageKinds.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCB75C51203A1CE00222D1B /* WebContextMessageKinds.h */; };
 		BCCF672D12C7EDF7008F9C35 /* OriginAndDatabases.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCF672C12C7EDF7008F9C35 /* OriginAndDatabases.h */; };
 		BCCF673312C7F15C008F9C35 /* OriginAndDatabases.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCF673212C7F15C008F9C35 /* OriginAndDatabases.cpp */; };
+		BCCF6ABC12C91EF9008F9C35 /* WebImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCF6ABA12C91EF9008F9C35 /* WebImage.cpp */; };
+		BCCF6ABD12C91EF9008F9C35 /* WebImage.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCF6ABB12C91EF9008F9C35 /* WebImage.h */; };
+		BCCF6AC212C91F34008F9C35 /* WKImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCF6AC012C91F34008F9C35 /* WKImage.cpp */; };
+		BCCF6AC312C91F34008F9C35 /* WKImage.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCF6AC112C91F34008F9C35 /* WKImage.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		BCCF6AC912C91F59008F9C35 /* WKImageCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCF6AC712C91F59008F9C35 /* WKImageCG.cpp */; };
+		BCCF6ACA12C91F59008F9C35 /* WKImageCG.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCF6AC812C91F59008F9C35 /* WKImageCG.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		BCCF6B2512C93E7A008F9C35 /* ImageOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCF6B2312C93E7A008F9C35 /* ImageOptions.h */; };
 		BCD0042D110C1E27003B8A67 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCD0042C110C1E27003B8A67 /* CoreServices.framework */; };
 		BCD0139B110FA420003B8A67 /* WKFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD01397110FA420003B8A67 /* WKFrame.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		BCD0139C110FA420003B8A67 /* WKFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD01398110FA420003B8A67 /* WKFrame.cpp */; };
@@ -1197,6 +1204,13 @@
 		BCCB75C51203A1CE00222D1B /* WebContextMessageKinds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextMessageKinds.h; sourceTree = "<group>"; };
 		BCCF672C12C7EDF7008F9C35 /* OriginAndDatabases.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OriginAndDatabases.h; sourceTree = "<group>"; };
 		BCCF673212C7F15C008F9C35 /* OriginAndDatabases.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OriginAndDatabases.cpp; sourceTree = "<group>"; };
+		BCCF6ABA12C91EF9008F9C35 /* WebImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebImage.cpp; sourceTree = "<group>"; };
+		BCCF6ABB12C91EF9008F9C35 /* WebImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebImage.h; sourceTree = "<group>"; };
+		BCCF6AC012C91F34008F9C35 /* WKImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKImage.cpp; sourceTree = "<group>"; };
+		BCCF6AC112C91F34008F9C35 /* WKImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKImage.h; sourceTree = "<group>"; };
+		BCCF6AC712C91F59008F9C35 /* WKImageCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKImageCG.cpp; sourceTree = "<group>"; };
+		BCCF6AC812C91F59008F9C35 /* WKImageCG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKImageCG.h; sourceTree = "<group>"; };
+		BCCF6B2312C93E7A008F9C35 /* ImageOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageOptions.h; sourceTree = "<group>"; };
 		BCD0042C110C1E27003B8A67 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = /System/Library/Frameworks/CoreServices.framework; sourceTree = "<absolute>"; };
 		BCD01397110FA420003B8A67 /* WKFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFrame.h; sourceTree = "<group>"; };
 		BCD01398110FA420003B8A67 /* WKFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKFrame.cpp; sourceTree = "<group>"; };
@@ -1584,11 +1598,11 @@
 			isa = PBXGroup;
 			children = (
 				BCDDB314124EBCEF0048D13C /* API */,
-				BC111B5F112F635E00337BAB /* CoreIPCSupport */,
-				1AAE058C1279DCD400852418 /* Plugins */,
 				1AAF0C4712B16328008E49E2 /* cf */,
 				C01A25FF12662F2100C9ED55 /* cg */,
+				BC111B5F112F635E00337BAB /* CoreIPCSupport */,
 				BC111B5A112F628200337BAB /* mac */,
+				1AAE058C1279DCD400852418 /* Plugins */,
 				1A3DD205125E5A2F004515E6 /* APIClient.h */,
 				BCF04C8C11FF9B7D00F86A58 /* APIObject.h */,
 				1A043D79124FEFC100FFBFB5 /* BackingStore.cpp */,
@@ -1599,6 +1613,7 @@
 				1A6F9F8E11E13EFC00DB1371 /* CommandLine.h */,
 				0FB659221208B4DB0044816C /* DrawingAreaInfo.h */,
 				762B7481120BBA0100819339 /* FontSmoothingLevel.h */,
+				BCCF6B2312C93E7A008F9C35 /* ImageOptions.h */,
 				BC64696D11DBE603006455B0 /* ImmutableArray.cpp */,
 				BC64696E11DBE603006455B0 /* ImmutableArray.h */,
 				BCBCB0CC1215E33A00DE59CA /* ImmutableDictionary.cpp */,
@@ -1609,6 +1624,8 @@
 				BCB0AEE7122F53E300B1341E /* MutableDictionary.h */,
 				C02BFF1512514FD8009CCBEA /* NativeWebKeyboardEvent.h */,
 				BCC57161115ADB42001CCAF9 /* NotImplemented.h */,
+				BCCF673212C7F15C008F9C35 /* OriginAndDatabases.cpp */,
+				BCCF672C12C7EDF7008F9C35 /* OriginAndDatabases.h */,
 				BCC43AB8127B95DC00317F16 /* PlatformPopupMenuData.cpp */,
 				BCC43AB9127B95DC00317F16 /* PlatformPopupMenuData.h */,
 				BC2D021612AC41CB00E732A3 /* SameDocumentNavigationType.h */,
@@ -1618,14 +1635,12 @@
 				BCB0B0DF12305AB100B1341E /* UserMessageCoders.h */,
 				1A0F29C9120B37160053D1B9 /* VisitedLinkTable.cpp */,
 				1A0F29CA120B37160053D1B9 /* VisitedLinkTable.h */,
-				BC1DD7B1114DC396005ADAF3 /* WebCoreArgumentCoders.h */,
 				BCF50726124329AA005955AE /* WebCertificateInfo.h */,
 				512935D51288D19400A4B695 /* WebContextMenuItem.cpp */,
 				512935D61288D19400A4B695 /* WebContextMenuItem.h */,
 				510FBB981288C95E00AFFDF4 /* WebContextMenuItemData.cpp */,
 				510FBB991288C95E00AFFDF4 /* WebContextMenuItemData.h */,
-				BCCF673212C7F15C008F9C35 /* OriginAndDatabases.cpp */,
-				BCCF672C12C7EDF7008F9C35 /* OriginAndDatabases.h */,
+				BC1DD7B1114DC396005ADAF3 /* WebCoreArgumentCoders.h */,
 				51578B821209ECEF00A37C4A /* WebData.h */,
 				BC575612126E0138006F0F12 /* WebError.cpp */,
 				516A4A5B120A2CCD00C05B7F /* WebError.h */,
@@ -1634,12 +1649,12 @@
 				BC032DB010F4380F0058C15A /* WebEventConversion.cpp */,
 				BC032DB110F4380F0058C15A /* WebEventConversion.h */,
 				1A90C1ED1264FD50003E44D4 /* WebFindOptions.h */,
+				BCCF6ABA12C91EF9008F9C35 /* WebImage.cpp */,
+				BCCF6ABB12C91EF9008F9C35 /* WebImage.h */,
 				C0337DD2127A2A0E008FF4F4 /* WebKeyboardEvent.cpp */,
 				C0337DAF127A28D0008FF4F4 /* WebMouseEvent.cpp */,
 				BCF69F981176CED600471A52 /* WebNavigationDataStore.h */,
 				BC33DD671238464600360F3F /* WebNumber.h */,
-				BC5744ED12638FB3006F0F12 /* WebPopupItem.cpp */,
-				BC5744EE12638FB3006F0F12 /* WebPopupItem.h */,
 				BC857FB412B830E600EDEB2E /* WebOpenPanelParameters.cpp */,
 				BC857FB312B830E600EDEB2E /* WebOpenPanelParameters.h */,
 				C06C6093124C14430001682F /* WebPageCreationParameters.cpp */,
@@ -1647,10 +1662,12 @@
 				BC7B625112A43C9600D174A4 /* WebPageGroupData.cpp */,
 				BC7B625012A43C9600D174A4 /* WebPageGroupData.h */,
 				C0337DDC127A521C008FF4F4 /* WebPlatformTouchPoint.cpp */,
-				BC306823125A6B9400E71278 /* WebProcessCreationParameters.cpp */,
-				BC306822125A6B9400E71278 /* WebProcessCreationParameters.h */,
+				BC5744ED12638FB3006F0F12 /* WebPopupItem.cpp */,
+				BC5744EE12638FB3006F0F12 /* WebPopupItem.h */,
 				BCD598AB112B7FDF00EC8C23 /* WebPreferencesStore.cpp */,
 				BCD598AA112B7FDF00EC8C23 /* WebPreferencesStore.h */,
+				BC306823125A6B9400E71278 /* WebProcessCreationParameters.cpp */,
+				BC306822125A6B9400E71278 /* WebProcessCreationParameters.h */,
 				F634445512A885C8000612D8 /* WebSecurityOrigin.h */,
 				A72D5D7F1236CBA800A88B15 /* WebSerializedScriptValue.h */,
 				BCF04C8E11FF9F6E00F86A58 /* WebString.h */,
@@ -2344,6 +2361,15 @@
 			path = mac;
 			sourceTree = "<group>";
 		};
+		BCCF6AC412C91F3B008F9C35 /* cg */ = {
+			isa = PBXGroup;
+			children = (
+				BCCF6AC712C91F59008F9C35 /* WKImageCG.cpp */,
+				BCCF6AC812C91F59008F9C35 /* WKImageCG.h */,
+			);
+			path = cg;
+			sourceTree = "<group>";
+		};
 		BCDDB314124EBCEF0048D13C /* API */ = {
 			isa = PBXGroup;
 			children = (
@@ -2356,6 +2382,7 @@
 			isa = PBXGroup;
 			children = (
 				BC4075D5124FEFFA0068F20A /* cf */,
+				BCCF6AC412C91F3B008F9C35 /* cg */,
 				BC4075D6124FF0000068F20A /* mac */,
 				BC4075D7124FF0270068F20A /* WKArray.cpp */,
 				BC4075D8124FF0270068F20A /* WKArray.h */,
@@ -2374,6 +2401,8 @@
 				BC40783C1250FADD0068F20A /* WKEvent.h */,
 				37F623B712A57B6200E3FDF6 /* WKFindOptions.h */,
 				BCC8B373125FB69000DE46A4 /* WKGeometry.h */,
+				BCCF6AC012C91F34008F9C35 /* WKImage.cpp */,
+				BCCF6AC112C91F34008F9C35 /* WKImage.h */,
 				BC4075E1124FF0270068F20A /* WKMutableArray.cpp */,
 				BC4075E2124FF0270068F20A /* WKMutableArray.h */,
 				BC4075E3124FF0270068F20A /* WKMutableDictionary.cpp */,
@@ -2787,7 +2816,11 @@
 				1AA417CB12C00CCA002BE67B /* TextChecker.h in Headers */,
 				1AA41AB512C02EC4002BE67B /* SelectionState.h in Headers */,
 				BCCF672D12C7EDF7008F9C35 /* OriginAndDatabases.h in Headers */,
+				BCCF6ABD12C91EF9008F9C35 /* WebImage.h in Headers */,
+				BCCF6AC312C91F34008F9C35 /* WKImage.h in Headers */,
+				BCCF6ACA12C91F59008F9C35 /* WKImageCG.h in Headers */,
 				BCAC111F12C92C1F00B08EEE /* WebDatabaseManagerProxyClient.h in Headers */,
+				BCCF6B2512C93E7A008F9C35 /* ImageOptions.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -3213,6 +3246,9 @@
 				BC858A2112C0357B00EDEB2E /* WebResourceLoadClient.cpp in Sources */,
 				1AA417EF12C00D87002BE67B /* TextCheckerMac.mm in Sources */,
 				BCCF673312C7F15C008F9C35 /* OriginAndDatabases.cpp in Sources */,
+				BCCF6ABC12C91EF9008F9C35 /* WebImage.cpp in Sources */,
+				BCCF6AC212C91F34008F9C35 /* WKImage.cpp in Sources */,
+				BCCF6AC912C91F59008F9C35 /* WKImageCG.cpp in Sources */,
 				BCAC112012C92C1F00B08EEE /* WebDatabaseManagerProxyClient.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
index 6a70b33..79b6ad3 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
@@ -27,11 +27,12 @@
 #include "WKBundlePagePrivate.h"
 
 #include "InjectedBundleBackForwardList.h"
+#include "WKAPICast.h"
+#include "WKBundleAPICast.h"
+#include "WebImage.h"
 #include "WebPage.h"
 #include "WebURL.h"
 #include "WebURLRequest.h"
-#include "WKAPICast.h"
-#include "WKBundleAPICast.h"
 
 #include <WebCore/KURL.h>
 
@@ -166,3 +167,15 @@ bool WKBundlePageFindString(WKBundlePageRef pageRef, WKStringRef target, WKFindO
 {
     return toImpl(pageRef)->findStringFromInjectedBundle(toImpl(target)->string(), toFindOptions(findOptions));
 }
+
+WKImageRef WKBundlePageCreateSnapshotInViewCoordinates(WKBundlePageRef pageRef, WKRect rect, WKImageOptions options)
+{
+    RefPtr<WebImage> webImage = toImpl(pageRef)->snapshotInViewCoordinates(toIntRect(rect), toImageOptions(options));
+    return toAPI(webImage.release().leakRef());
+}
+
+WKImageRef WKBundlePageCreateSnapshotInDocumentCoordinates(WKBundlePageRef pageRef, WKRect rect, WKImageOptions options)
+{
+    RefPtr<WebImage> webImage = toImpl(pageRef)->snapshotInDocumentCoordinates(toIntRect(rect), toImageOptions(options));
+    return toAPI(webImage.release().leakRef());
+}
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
index b4a028f..6c70099 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
@@ -29,6 +29,7 @@
 #include <WebKit2/WKBase.h>
 #include <WebKit2/WKEvent.h>
 #include <WebKit2/WKFindOptions.h>
+#include <WebKit2/WKImage.h>
 #include <WebKit2/WKPageLoadTypes.h>
 
 #ifndef __cplusplus
@@ -214,6 +215,9 @@ WK_EXPORT bool WKBundlePageCanHandleRequest(WKURLRequestRef request);
 
 WK_EXPORT bool WKBundlePageFindString(WKBundlePageRef page, WKStringRef target, WKFindOptions findOptions);
 
+WK_EXPORT WKImageRef WKBundlePageCreateSnapshotInViewCoordinates(WKBundlePageRef page, WKRect rect, WKImageOptions options);
+WK_EXPORT WKImageRef WKBundlePageCreateSnapshotInDocumentCoordinates(WKBundlePageRef page, WKRect rect, WKImageOptions options);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp
index 7e9211e..48fcab4 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp
@@ -134,5 +134,5 @@ WKBundlePageOverlayRef WKBundlePageOverlayCreate(WKBundlePageOverlayClient* wkCl
 
 void WKBundlePageOverlaySetNeedsDisplay(WKBundlePageOverlayRef bundlePageOverlayRef, WKRect rect)
 {
-    toImpl(bundlePageOverlayRef)->setNeedsDisplay(enclosingIntRect(toImpl(rect)));
+    toImpl(bundlePageOverlayRef)->setNeedsDisplay(enclosingIntRect(toFloatRect(rect)));
 }
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index 4df97f1..571321c 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -41,14 +41,15 @@
 #include "WebContextMenuClient.h"
 #include "WebContextMessages.h"
 #include "WebCoreArgumentCoders.h"
-#include "WebOpenPanelResultListener.h"
 #include "WebDragClient.h"
 #include "WebEditorClient.h"
 #include "WebEvent.h"
 #include "WebEventConversion.h"
 #include "WebFrame.h"
+#include "WebImage.h"
 #include "WebInspector.h"
 #include "WebInspectorClient.h"
+#include "WebOpenPanelResultListener.h"
 #include "WebPageCreationParameters.h"
 #include "WebPageGroupProxy.h"
 #include "WebPageProxyMessages.h"
@@ -587,6 +588,44 @@ void WebPage::uninstallPageOverlay(PageOverlay* pageOverlay)
     m_drawingArea->setNeedsDisplay(IntRect(IntPoint(0, 0), m_viewSize));
 }
 
+PassRefPtr<WebImage> WebPage::snapshotInViewCoordinates(const IntRect& rect, ImageOptions options)
+{
+    FrameView* frameView = m_mainFrame->coreFrame()->view();
+    if (!frameView)
+        return 0;
+
+    frameView->updateLayoutAndStyleIfNeededRecursive();
+
+    RefPtr<WebImage> snapshot = WebImage::create(rect.size(), options);
+    OwnPtr<WebCore::GraphicsContext> graphicsContext = snapshot->backingStore()->createGraphicsContext();
+
+    graphicsContext->save();
+    graphicsContext->translate(-rect.x(), -rect.y());
+    frameView->paint(graphicsContext.get(), rect);
+    graphicsContext->restore();
+
+    return snapshot.release();
+}
+
+PassRefPtr<WebImage> WebPage::snapshotInDocumentCoordinates(const IntRect& rect, ImageOptions options)
+{
+    FrameView* frameView = m_mainFrame->coreFrame()->view();
+    if (!frameView)
+        return 0;
+
+    frameView->updateLayoutAndStyleIfNeededRecursive();
+
+    RefPtr<WebImage> snapshot = WebImage::create(rect.size(), options);
+    OwnPtr<WebCore::GraphicsContext> graphicsContext = snapshot->backingStore()->createGraphicsContext();
+
+    graphicsContext->save();
+    graphicsContext->translate(-rect.x(), -rect.y());
+    frameView->paintContents(graphicsContext.get(), rect);
+    graphicsContext->restore();
+
+    return snapshot.release();
+}
+
 void WebPage::pageDidScroll()
 {
     // Hide the find indicator.
diff --git a/WebKit2/WebProcess/WebPage/WebPage.h b/WebKit2/WebProcess/WebPage/WebPage.h
index 1cf257c..797478e 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/WebKit2/WebProcess/WebPage/WebPage.h
@@ -29,6 +29,7 @@
 #include "APIObject.h"
 #include "DrawingArea.h"
 #include "FindController.h"
+#include "ImageOptions.h"
 #include "InjectedBundlePageContextMenuClient.h"
 #include "InjectedBundlePageEditorClient.h"
 #include "InjectedBundlePageFormClient.h"
@@ -75,6 +76,7 @@ class WebContextMenu;
 class WebContextMenuItemData;
 class WebEvent;
 class WebFrame;
+class WebImage;
 class WebInspector;
 class WebKeyboardEvent;
 class WebMouseEvent;
@@ -206,6 +208,9 @@ public:
     void installPageOverlay(PassRefPtr<PageOverlay>);
     void uninstallPageOverlay(PageOverlay*);
 
+    PassRefPtr<WebImage> snapshotInViewCoordinates(const WebCore::IntRect&, ImageOptions);
+    PassRefPtr<WebImage> snapshotInDocumentCoordinates(const WebCore::IntRect&, ImageOptions);
+
     static const WebEvent* currentEvent();
 
     FindController& findController() { return m_findController; }
diff --git a/WebKit2/win/WebKit2.vcproj b/WebKit2/win/WebKit2.vcproj
index 0c88c52..d4fc7d2 100755
--- a/WebKit2/win/WebKit2.vcproj
+++ b/WebKit2/win/WebKit2.vcproj
@@ -567,6 +567,14 @@
 				>
 			</File>
 			<File
+				RelativePath="..\Shared\WebImage.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\Shared\WebImage.h"
+				>
+			</File>
+			<File
 				RelativePath="..\Shared\WebKeyboardEvent.cpp"
 				>
 			</File>
@@ -758,6 +766,14 @@
 					>
 				</File>
 				<File
+					RelativePath="..\Shared\API\c\WKImage.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\Shared\API\c\WKImage.h"
+					>
+				</File>
+				<File
 					RelativePath="..\Shared\API\c\WKMutableArray.cpp"
 					>
 				</File>
@@ -929,6 +945,18 @@
 						>
 					</File>
 				</Filter>
+				<Filter
+					Name="cg"
+					>
+					<File
+						RelativePath="..\Shared\API\c\cg\WKImageCG.cpp"
+						>
+					</File>
+					<File
+						RelativePath="..\Shared\API\c\cg\WKImageCG.h"
+						>
+					</File>
+				</Filter>
 			</Filter>
 			<Filter
 				Name="CoreIPCSupport"

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list