diff -rp -u8 webkit-orig/Source/WebCore/loader/icon/IconDatabaseBase.h webkit-1.8.1/Source/WebCore/loader/icon/IconDatabaseBase.h
--- webkit-orig/Source/WebCore/loader/icon/IconDatabaseBase.h	2012-12-28 14:16:16.660092358 +0100
+++ webkit-1.8.1/Source/WebCore/loader/icon/IconDatabaseBase.h	2012-12-28 14:21:18.740106467 +0100
@@ -21,23 +21,24 @@
  * 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 IconDatabaseBase_h
 #define IconDatabaseBase_h
 
+#include "ImageSource.h"
 #include "SharedBuffer.h"
 
 #include <wtf/Forward.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/PassRefPtr.h>
 
-namespace WebCore { 
+namespace WebCore {
 
 class DocumentLoader;
 class IconDatabaseClient;
 class Image;
 class IntSize;
 
 enum IconLoadDecision {
     IconLoadYes,
@@ -173,17 +174,18 @@ public:
     virtual void setIconDataForIconURL(PassRefPtr<SharedBuffer>, const String&) { }
 
     // Synchronous calls used internally by WebCore.
     // Usage should be replaced by asynchronous calls.
     virtual String synchronousIconURLForPageURL(const String&);
     virtual bool synchronousIconDataKnownForIconURL(const String&) { return false; }
     virtual IconLoadDecision synchronousLoadDecisionForIconURL(const String&, DocumentLoader*) { return IconLoadNo; }
     virtual Image* synchronousIconForPageURL(const String&, const IntSize&) { return 0; }
-    
+    virtual NativeImagePtr synchronousNativeIconForPageURL(const String&, const IntSize&) { return 0; }
+
     // Asynchronous calls we should use to replace the above when supported.
     virtual bool supportsAsynchronousMode() { return false; }
     virtual void loadDecisionForIconURL(const String&, PassRefPtr<IconLoadDecisionCallback>) { }
     virtual void iconDataForIconURL(const String&, PassRefPtr<IconDataCallback>) { }
     
 
     // Used within one or more WebKit ports.
     // We should try to remove these dependencies from the IconDatabaseBase class.
diff -rp -u8 webkit-orig/Source/WebCore/loader/icon/IconDatabase.cpp webkit-1.8.1/Source/WebCore/loader/icon/IconDatabase.cpp
--- webkit-orig/Source/WebCore/loader/icon/IconDatabase.cpp	2012-12-28 14:16:16.660092358 +0100
+++ webkit-1.8.1/Source/WebCore/loader/icon/IconDatabase.cpp	2012-12-28 14:21:18.740106467 +0100
@@ -29,16 +29,17 @@
 
 #if ENABLE(ICONDATABASE)
 
 #include "AutodrainedPool.h"
 #include "DocumentLoader.h"
 #include "FileSystem.h"
 #include "IconDatabaseClient.h"
 #include "IconRecord.h"
+#include "Image.h"
 #include "IntSize.h"
 #include "Logging.h"
 #include "SQLiteStatement.h"
 #include "SQLiteTransaction.h"
 #include "SuddenTermination.h"
 #include <wtf/CurrentTime.h>
 #include <wtf/MainThread.h>
 #include <wtf/StdLibExtras.h>
@@ -285,16 +286,26 @@ Image* IconDatabase::synchronousIconForP
     // representation out of it?
     // If an image is read in from the icondatabase, we do *not* overwrite any image data that exists in the in-memory cache.  
     // This is because we make the assumption that anything in memory is newer than whatever is in the database.
     // So the only time the data will be set from the second thread is when it is INITIALLY being read in from the database, but we would never 
     // delete the image on the secondary thread if the image already exists.
     return iconRecord->image(size);
 }
 
+NativeImagePtr IconDatabase::synchronousNativeIconForPageURL(const String& pageURLOriginal, const IntSize& size)
+{
+    Image* icon = synchronousIconForPageURL(pageURLOriginal, size);
+    if (!icon)
+        return 0;
+
+    MutexLocker locker(m_urlAndIconLock);
+    return icon->nativeImageForCurrentFrame();
+}
+
 void IconDatabase::readIconForPageURLFromDisk(const String& pageURL)
 {
     // The effect of asking for an Icon for a pageURL automatically queues it to be read from disk
     // if it hasn't already been set in memory.  The special IntSize (0, 0) is a special way of telling 
     // that method "I don't care about the actual Image, i just want you to make sure you're getting it from disk.
     synchronousIconForPageURL(pageURL, IntSize(0, 0));
 }
 
diff -rp -u8 webkit-orig/Source/WebCore/loader/icon/IconDatabase.h webkit-1.8.1/Source/WebCore/loader/icon/IconDatabase.h
--- webkit-orig/Source/WebCore/loader/icon/IconDatabase.h	2012-12-28 14:16:16.660092358 +0100
+++ webkit-1.8.1/Source/WebCore/loader/icon/IconDatabase.h	2012-12-28 14:21:18.736106468 +0100
@@ -88,16 +88,17 @@ public:
     virtual Image* defaultIcon(const IntSize&);
 
     virtual void retainIconForPageURL(const String&);
     virtual void releaseIconForPageURL(const String&);
     virtual void setIconDataForIconURL(PassRefPtr<SharedBuffer> data, const String&);
     virtual void setIconURLForPageURL(const String& iconURL, const String& pageURL);
 
     virtual Image* synchronousIconForPageURL(const String&, const IntSize&);
+    virtual NativeImagePtr synchronousNativeIconForPageURL(const String& pageURLOriginal, const IntSize&);
     virtual String synchronousIconURLForPageURL(const String&);
     virtual bool synchronousIconDataKnownForIconURL(const String&);
     virtual IconLoadDecision synchronousLoadDecisionForIconURL(const String&, DocumentLoader*);    
     
     virtual void setEnabled(bool);
     virtual bool isEnabled() const;
     
     virtual void setPrivateBrowsingEnabled(bool flag);
diff -rp -u8 webkit-orig/Source/WebKit/gtk/webkit/webkitfavicondatabase.cpp webkit-1.8.1/Source/WebKit/gtk/webkit/webkitfavicondatabase.cpp
--- webkit-orig/Source/WebKit/gtk/webkit/webkitfavicondatabase.cpp	2012-12-28 14:16:16.808092362 +0100
+++ webkit-1.8.1/Source/WebKit/gtk/webkit/webkitfavicondatabase.cpp	2012-12-28 14:21:18.736106468 +0100
@@ -19,16 +19,17 @@
  */
 
 #include "config.h"
 #include "webkitfavicondatabase.h"
 
 #include "DatabaseDetails.h"
 #include "DatabaseTracker.h"
 #include "FileSystem.h"
+#include "GdkCairoUtilities.h"
 #include "GRefPtr.h"
 #include "IconDatabase.h"
 #include "IconDatabaseClient.h"
 #include "Image.h"
 #include "IntSize.h"
 #include "webkitfavicondatabaseprivate.h"
 #include "webkitglobals.h"
 #include "webkitglobalsprivate.h"
@@ -389,26 +390,28 @@ gchar* webkit_favicon_database_get_favic
 }
 
 static GdkPixbuf* getIconPixbufSynchronously(WebKitFaviconDatabase* database, const String& pageURL, const IntSize& iconSize)
 {
     ASSERT(isMainThread());
 
     // The exact size we pass is irrelevant to the iconDatabase code.
     // We must pass something greater than 0x0 to get a pixbuf.
-    Image* icon = iconDatabase().synchronousIconForPageURL(pageURL, !iconSize.isZero() ? iconSize : IntSize(1, 1));
+    NativeImagePtr icon = iconDatabase().synchronousNativeIconForPageURL(pageURL, !iconSize.isZero() ? iconSize : IntSize(1, 1));
     if (!icon)
         return 0;
 
-    GRefPtr<GdkPixbuf> pixbuf = adoptGRef(icon->getGdkPixbuf());
+    GRefPtr<GdkPixbuf> pixbuf = adoptGRef(cairoImageSurfaceToGdkPixbuf(icon));
     if (!pixbuf)
         return 0;
 
     // A size of (0, 0) means the maximum available size.
-    if (!iconSize.isZero() && (icon->width() != iconSize.width() || icon->height() != iconSize.height()))
+    int pixbufWidth = gdk_pixbuf_get_width(pixbuf.get());
+    int pixbufHeight = gdk_pixbuf_get_height(pixbuf.get());
+    if (!iconSize.isZero() && (pixbufWidth != iconSize.width() || pixbufHeight != iconSize.height()))
         pixbuf = gdk_pixbuf_scale_simple(pixbuf.get(), iconSize.width(), iconSize.height(), GDK_INTERP_BILINEAR);
     return pixbuf.leakRef();
 }
 
 /**
  * webkit_favicon_database_try_get_favicon_pixbuf:
  * @database: a #WebKitFaviconDatabase
  * @page_uri: URI of the page containing the icon
diff -rp -u8 webkit-orig/Source/WebKit2/UIProcess/WebIconDatabase.cpp webkit-1.8.1/Source/WebKit2/UIProcess/WebIconDatabase.cpp
--- webkit-orig/Source/WebKit2/UIProcess/WebIconDatabase.cpp	2012-12-28 14:16:16.680092356 +0100
+++ webkit-1.8.1/Source/WebKit2/UIProcess/WebIconDatabase.cpp	2012-12-28 14:21:18.740106467 +0100
@@ -185,16 +185,24 @@ Image* WebIconDatabase::imageForPageURL(
     if (!m_webContext || !m_iconDatabaseImpl || !m_iconDatabaseImpl->isOpen() || pageURL.isEmpty())
         return 0;    
 
     // The WebCore IconDatabase ignores the passed in size parameter.
     // If that changes we'll need to rethink how this API is exposed.
     return m_iconDatabaseImpl->synchronousIconForPageURL(pageURL, iconSize);
 }
 
+WebCore::NativeImagePtr WebIconDatabase::nativeImageForPageURL(const String& pageURL, const WebCore::IntSize& iconSize)
+{
+    if (!m_webContext || !m_iconDatabaseImpl || !m_iconDatabaseImpl->isOpen() || pageURL.isEmpty())
+        return 0;
+
+    return m_iconDatabaseImpl->synchronousNativeIconForPageURL(pageURL, iconSize);
+}
+
 void WebIconDatabase::removeAllIcons()
 {
     m_iconDatabaseImpl->removeAllIcons();   
 }
 
 void WebIconDatabase::checkIntegrityBeforeOpening()
 {
     IconDatabase::checkIntegrityBeforeOpening();
diff -rp -u8 webkit-orig/Source/WebKit2/UIProcess/WebIconDatabase.h webkit-1.8.1/Source/WebKit2/UIProcess/WebIconDatabase.h
--- webkit-orig/Source/WebKit2/UIProcess/WebIconDatabase.h	2012-12-28 14:16:16.696092358 +0100
+++ webkit-1.8.1/Source/WebKit2/UIProcess/WebIconDatabase.h	2012-12-28 14:21:18.740106467 +0100
@@ -26,16 +26,17 @@
 #ifndef WebIconDatabase_h
 #define WebIconDatabase_h
 
 #include "APIObject.h"
 
 #include "Connection.h"
 #include "WebIconDatabaseClient.h"
 #include <WebCore/IconDatabaseClient.h>
+#include <WebCore/ImageSource.h>
 #include <WebCore/IntSize.h>
 #include <wtf/Forward.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
 #include <wtf/Vector.h>
 #include <wtf/text/StringHash.h>
 
 namespace CoreIPC {
@@ -73,16 +74,17 @@ public:
     void synchronousIconDataForPageURL(const String&, CoreIPC::DataReference&);
     void synchronousIconURLForPageURL(const String&, String&);
     void synchronousIconDataKnownForIconURL(const String&, bool&) const;
     void synchronousLoadDecisionForIconURL(const String&, int&) const;
     
     void getLoadDecisionForIconURL(const String&, uint64_t callbackID);
 
     WebCore::Image* imageForPageURL(const String&, const WebCore::IntSize& iconSize = WebCore::IntSize(32, 32));
+    WebCore::NativeImagePtr nativeImageForPageURL(const String&, const WebCore::IntSize& iconSize = WebCore::IntSize(32, 32));
     
     void removeAllIcons();
     void checkIntegrityBeforeOpening();
     void close();
 
     void initializeIconDatabaseClient(const WKIconDatabaseClient*);
 
     // WebCore::IconDatabaseClient
