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

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 15:36:16 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit ce484f7dbee75fe7910bf72470f28d6d731b3a14
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 9 02:48:21 2010 +0000

    2010-11-08  Juha Savolainen  <juha.savolainen at weego.fi>
    
            Reviewed by Andreas Kling.
    
            [Qt] Added new methods to QWKHistory and made QWKHistoryItemPrivate to shared object.
            https://bugs.webkit.org/show_bug.cgi?id=49063
    
            Added more functionality to the QWKHistory and changed QWKHistoryItemPrivate to shared object.
            This is needed because we cannot delete the QWKHistoryItemPrivate pointer in destructor of QWKHistoryItem,
            there may have other history instances which share same private implementation.
    
            * UIProcess/API/qt/qwkhistory.cpp:
            (QWKHistoryItemPrivate::~QWKHistoryItemPrivate):
            (QWKHistoryItem::QWKHistoryItem):
            (QWKHistoryItem::QWKHistoryItem::operator=):
            (QWKHistory::currentItem): Added
            (QWKHistory::backItem): Added
            (QWKHistory::forwardItem): Added
            (QWKHistory::itemAt): Added
            (QWKHistory::backItems): Added
            (QWKHistory::forwardItems): Added
            * UIProcess/API/qt/qwkhistory.h:
            * UIProcess/API/qt/qwkhistory_p.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71596 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 9d8311f..18031f3 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,27 @@
+2010-11-08  Juha Savolainen  <juha.savolainen at weego.fi>
+
+        Reviewed by Andreas Kling.
+
+        [Qt] Added new methods to QWKHistory and made QWKHistoryItemPrivate to shared object.
+        https://bugs.webkit.org/show_bug.cgi?id=49063
+
+        Added more functionality to the QWKHistory and changed QWKHistoryItemPrivate to shared object.
+        This is needed because we cannot delete the QWKHistoryItemPrivate pointer in destructor of QWKHistoryItem,
+        there may have other history instances which share same private implementation.
+
+        * UIProcess/API/qt/qwkhistory.cpp:
+        (QWKHistoryItemPrivate::~QWKHistoryItemPrivate):
+        (QWKHistoryItem::QWKHistoryItem):
+        (QWKHistoryItem::QWKHistoryItem::operator=):
+        (QWKHistory::currentItem): Added
+        (QWKHistory::backItem): Added
+        (QWKHistory::forwardItem): Added
+        (QWKHistory::itemAt): Added
+        (QWKHistory::backItems): Added
+        (QWKHistory::forwardItems): Added
+        * UIProcess/API/qt/qwkhistory.h:
+        * UIProcess/API/qt/qwkhistory_p.h:
+
 2010-11-08  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/WebKit2/UIProcess/API/qt/qwkhistory.cpp b/WebKit2/UIProcess/API/qt/qwkhistory.cpp
index b0318c9..3ac0fe3 100644
--- a/WebKit2/UIProcess/API/qt/qwkhistory.cpp
+++ b/WebKit2/UIProcess/API/qt/qwkhistory.cpp
@@ -25,16 +25,17 @@
 #include "config.h"
 #include "qwkhistory.h"
 
+#include <QSharedData>
+#include <QString>
+#include <QUrl>
+#include "qwkhistory_p.h"
+#include "WebBackForwardList.h"
+#include <WebKit2/WKArray.h>
+#include <WebKit2/WKRetainPtr.h>
 #include "WKBackForwardList.h"
-#include "WKBackForwardListItem.h"
 #include "WKStringQt.h"
 #include "WKURL.h"
 #include "WKURLQt.h"
-#include "WebBackForwardList.h"
-#include "qwkhistory_p.h"
-#include <QString>
-#include <QUrl>
-#include <WebKit2/WKRetainPtr.h>
 
 using namespace WebKit;
 
@@ -43,7 +44,23 @@ QWKHistoryItemPrivate::QWKHistoryItemPrivate(WKBackForwardListItemRef listItem)
 {
 }
 
-QWKHistoryItem::QWKHistoryItem()
+QWKHistoryItemPrivate::~QWKHistoryItemPrivate()
+{
+}
+
+QWKHistoryItem::QWKHistoryItem(const QWKHistoryItem& other)
+    : d(other.d) 
+{
+}
+
+QWKHistoryItem& QWKHistoryItem::QWKHistoryItem::operator=(const QWKHistoryItem& other) 
+{ 
+    d = other.d;
+    return *this; 
+}
+
+QWKHistoryItem::QWKHistoryItem(WKBackForwardListItemRef item)
+    : d(new QWKHistoryItemPrivate(item))
 {
 }
 
@@ -115,3 +132,59 @@ int QWKHistory::count() const
     return backListCount() + forwardListCount();
 }
 
+QWKHistoryItem QWKHistory::currentItem() const
+{
+    WKRetainPtr<WKBackForwardListItemRef> itemRef = WKBackForwardListGetCurrentItem(toAPI(d->m_backForwardList));
+    QWKHistoryItem item(itemRef.get());
+    return item;
+}
+
+QWKHistoryItem QWKHistory::backItem() const
+{
+    WKRetainPtr<WKBackForwardListItemRef> itemRef = WKBackForwardListGetBackItem(toAPI(d->m_backForwardList));
+    QWKHistoryItem item(itemRef.get());
+    return item;
+}
+
+QWKHistoryItem QWKHistory::forwardItem() const
+{
+    WKRetainPtr<WKBackForwardListItemRef> itemRef = WKBackForwardListGetForwardItem(toAPI(d->m_backForwardList));
+    QWKHistoryItem item(itemRef.get());
+    return item;
+}
+
+QWKHistoryItem QWKHistory::itemAt(int index) const
+{
+    WKRetainPtr<WKBackForwardListItemRef> itemRef = WKBackForwardListGetItemAtIndex(toAPI(d->m_backForwardList), index);
+    QWKHistoryItem item(itemRef.get());
+    return item;
+}
+
+QList<QWKHistoryItem> QWKHistory::backItems(int maxItems) const
+{
+    WKArrayRef arrayRef = WKBackForwardListCopyBackListWithLimit(toAPI(d->m_backForwardList), maxItems);
+    int size = WKArrayGetSize(arrayRef);
+    QList<QWKHistoryItem> itemList;
+    for (int i = 0; i < size; ++i) {
+        WKTypeRef wkHistoryItem = WKArrayGetItemAtIndex(arrayRef, i);
+        WKBackForwardListItemRef itemRef = static_cast<WKBackForwardListItemRef>(wkHistoryItem);
+        QWKHistoryItem item(itemRef);
+        itemList.append(item);
+    }
+    return itemList;
+}
+
+QList<QWKHistoryItem> QWKHistory::forwardItems(int maxItems) const
+{
+    WKArrayRef arrayRef = WKBackForwardListCopyForwardListWithLimit(toAPI(d->m_backForwardList), maxItems);
+    int size = WKArrayGetSize(arrayRef);
+    QList<QWKHistoryItem> itemList;
+    for (int i = 0; i < size; ++i) {
+        WKTypeRef wkHistoryItem = WKArrayGetItemAtIndex(arrayRef, i);
+        WKBackForwardListItemRef itemRef = static_cast<WKBackForwardListItemRef>(wkHistoryItem);
+        QWKHistoryItem item(itemRef);
+        itemList.append(item);
+    }
+    return itemList;
+}
+
diff --git a/WebKit2/UIProcess/API/qt/qwkhistory.h b/WebKit2/UIProcess/API/qt/qwkhistory.h
index 8eabcd0..e99dd15 100644
--- a/WebKit2/UIProcess/API/qt/qwkhistory.h
+++ b/WebKit2/UIProcess/API/qt/qwkhistory.h
@@ -27,6 +27,8 @@
 
 #include "qwebkitglobal.h"
 #include <QObject>
+#include <QSharedData>
+#include "WKBackForwardListItem.h"
 
 class QWKHistoryPrivate;
 class QWKHistoryItemPrivate;
@@ -39,15 +41,18 @@ class WebBackForwardList;
 
 class QWEBKIT_EXPORT QWKHistoryItem {
 public:
+    QWKHistoryItem(const QWKHistoryItem& other);
+    QWKHistoryItem &operator=(const QWKHistoryItem& other);
+
     ~QWKHistoryItem();
     QString title() const;
     QUrl url() const;
     QUrl originalUrl() const;
 
 private:
-    QWKHistoryItem();
+    QWKHistoryItem(WKBackForwardListItemRef item);
 
-    QWKHistoryItemPrivate* d;
+    QExplicitlySharedDataPointer<QWKHistoryItemPrivate> d;
 
     friend class QWKHistory;
     friend class QWKHistoryItemPrivate;
@@ -59,6 +64,12 @@ public:
     int backListCount() const;
     int forwardListCount() const;
     int count() const;
+    QWKHistoryItem currentItem() const;
+    QWKHistoryItem backItem() const;
+    QWKHistoryItem forwardItem() const;
+    QWKHistoryItem itemAt(int index) const;
+    QList<QWKHistoryItem> backItems(int maxItems) const;
+    QList<QWKHistoryItem> forwardItems(int maxItems) const;
 
 private:
     QWKHistory();
@@ -68,5 +79,4 @@ private:
     friend class QWKHistoryPrivate;
     friend class QWKPagePrivate;
 };
-
 #endif /* qwkhistory_h */
diff --git a/WebKit2/UIProcess/API/qt/qwkhistory_p.h b/WebKit2/UIProcess/API/qt/qwkhistory_p.h
index 10d088a..dd1d696 100644
--- a/WebKit2/UIProcess/API/qt/qwkhistory_p.h
+++ b/WebKit2/UIProcess/API/qt/qwkhistory_p.h
@@ -25,6 +25,7 @@
 #ifndef qwkhistory_p_h
 #define qwkhistory_p_h
 
+#include <QSharedData>
 #include "qwebkitglobal.h"
 #include <WebKit2/WKBase.h>
 #include <WebKit2/WKRetainPtr.h>
@@ -36,10 +37,11 @@ class WebBackForwardList;
 
 class QWKHistory;
 
-class QWEBKIT_EXPORT QWKHistoryItemPrivate {
+class QWEBKIT_EXPORT QWKHistoryItemPrivate : public QSharedData {
+public:
+       ~QWKHistoryItemPrivate();
 private:
     QWKHistoryItemPrivate(WKBackForwardListItemRef listItem);
-
     WKRetainPtr<WKBackForwardListItemRef> m_backForwardListItem;
 
     friend class QWKHistory;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list