Unreviewed cleanup fix.
authoralexis.menard@openbossa.org <alexis.menard@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Dec 2011 18:10:22 +0000 (18:10 +0000)
committeralexis.menard@openbossa.org <alexis.menard@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Dec 2011 18:10:22 +0000 (18:10 +0000)
Add missing files from https://bugs.webkit.org/show_bug.cgi?id=73016

Also remove the files that should be removed.

* UIProcess/API/qt/tests/qmltests/WebView/tst_navigationHistory.qml: Added.
* UIProcess/qt/qwkhistory.cpp: Removed.
* UIProcess/qt/qwkhistory.h: Removed.
* UIProcess/qt/qwkhistory_p.h: Removed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@102597 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_navigationHistory.qml [new file with mode: 0644]
Source/WebKit2/UIProcess/qt/qwkhistory.cpp [deleted file]
Source/WebKit2/UIProcess/qt/qwkhistory.h [deleted file]
Source/WebKit2/UIProcess/qt/qwkhistory_p.h [deleted file]

index 4f051af..dd8091a 100644 (file)
@@ -1,3 +1,16 @@
+2011-12-12  Alexis Menard  <alexis.menard@openbossa.org>
+
+        Unreviewed cleanup fix.
+
+        Add missing files from https://bugs.webkit.org/show_bug.cgi?id=73016
+
+        Also remove the files that should be removed.
+
+        * UIProcess/API/qt/tests/qmltests/WebView/tst_navigationHistory.qml: Added.
+        * UIProcess/qt/qwkhistory.cpp: Removed.
+        * UIProcess/qt/qwkhistory.h: Removed.
+        * UIProcess/qt/qwkhistory_p.h: Removed.
+
 2011-12-12  Michael Bruning  <michael.bruning@nokia.com>
 
         [qt][wk2] Postpone scroll effects when page transition is ongoing.
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_navigationHistory.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_navigationHistory.qml
new file mode 100644 (file)
index 0000000..68aeeb5
--- /dev/null
@@ -0,0 +1,108 @@
+import QtQuick 2.0
+import QtTest 1.0
+import QtWebKit 3.0
+import QtWebKit.experimental 3.0
+
+WebView {
+    id: webView
+    width: 400
+    height: 300
+
+    SignalSpy {
+        id: spy
+        target: webView
+        signalName: "loadSucceeded"
+    }
+
+    ListView {
+        id: backItemsList
+        anchors.fill: parent
+        model: webView.experimental.navigationHistory.backItems
+        delegate:
+            Text {
+                color:"black"
+                text: "title : " + title
+            }
+    }
+
+    ListView {
+        id: forwardItemsList
+        anchors.fill: parent
+        model: webView.experimental.navigationHistory.forwardItems
+        delegate:
+            Text {
+                color:"black"
+                text: "title : " + title
+            }
+    }
+
+    TestCase {
+        name: "WebViewNavigationHistory"
+
+        function test_navigationHistory() {
+            compare(spy.count, 0)
+            compare(webView.loadProgress, 0)
+            webView.load(Qt.resolvedUrl("../common/test1.html"))
+            spy.wait()
+            compare(webView.canGoBack, false)
+            compare(webView.canGoForward, false)
+            compare(backItemsList.count, 0)
+            compare(forwardItemsList.count, 0)
+            spy.clear()
+            webView.load(Qt.resolvedUrl("../common/test2.html"))
+            spy.wait()
+            compare(webView.url, Qt.resolvedUrl("../common/test2.html"))
+            compare(webView.canGoBack, true)
+            compare(webView.canGoForward, false)
+            compare(backItemsList.count, 1)
+            spy.clear()
+            webView.experimental.goBackTo(0)
+            spy.wait()
+            compare(webView.url, Qt.resolvedUrl("../common/test1.html"))
+            compare(webView.canGoBack, false)
+            compare(webView.canGoForward, true)
+            compare(backItemsList.count, 0)
+            compare(forwardItemsList.count, 1)
+            spy.clear()
+            webView.goForward()
+            spy.wait()
+            compare(webView.url, Qt.resolvedUrl("../common/test2.html"))
+            compare(webView.canGoBack, true)
+            compare(webView.canGoForward, false)
+            compare(backItemsList.count, 1)
+            compare(forwardItemsList.count, 0)
+            spy.clear()
+            webView.load(Qt.resolvedUrl("../common/javascript.html"))
+            spy.wait()
+            compare(webView.url, Qt.resolvedUrl("../common/javascript.html"))
+            compare(webView.canGoBack, true)
+            compare(webView.canGoForward, false)
+            compare(backItemsList.count, 2)
+            compare(forwardItemsList.count, 0)
+            spy.clear()
+            webView.experimental.goBackTo(1)
+            spy.wait()
+            compare(webView.url, Qt.resolvedUrl("../common/test1.html"))
+            compare(webView.canGoBack, false)
+            compare(webView.canGoForward, true)
+            compare(backItemsList.count, 0)
+            compare(forwardItemsList.count, 2)
+            spy.clear()
+            webView.experimental.goForwardTo(1)
+            spy.wait()
+            compare(webView.url, Qt.resolvedUrl("../common/javascript.html"))
+            compare(webView.canGoBack, true)
+            compare(webView.canGoForward, false)
+            compare(backItemsList.count, 2)
+            compare(forwardItemsList.count, 0)
+            spy.clear()
+            webView.goBack()
+            spy.wait()
+            compare(webView.url, Qt.resolvedUrl("../common/test2.html"))
+            compare(webView.canGoBack, true)
+            compare(webView.canGoForward, true)
+            compare(backItemsList.count, 1)
+            compare(forwardItemsList.count, 1)
+        }
+    }
+}
diff --git a/Source/WebKit2/UIProcess/qt/qwkhistory.cpp b/Source/WebKit2/UIProcess/qt/qwkhistory.cpp
deleted file mode 100644 (file)
index 6c1425f..0000000
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Copyright (C) 2010 Juha Savolainen (juha.savolainen@weego.fi)
- *
- * 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 "config.h"
-#include "qwkhistory.h"
-
-#include <QSharedData>
-#include <QString>
-#include <QUrl>
-#include "QtWebPageProxy.h"
-#include "qwkhistory_p.h"
-#include "WebBackForwardList.h"
-#include <WebKit2/WKArray.h>
-#include <WebKit2/WKRetainPtr.h>
-#include "WKBackForwardList.h"
-#include "WKStringQt.h"
-#include "WKURL.h"
-#include "WKURLQt.h"
-
-using namespace WebKit;
-
-QWKHistoryItemPrivate::QWKHistoryItemPrivate(WKBackForwardListItemRef listItem)
-    : m_backForwardListItem(listItem)
-{
-}
-
-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))
-{
-}
-
-QWKHistoryItem::~QWKHistoryItem()
-{
-}
-
-QString QWKHistoryItem::title() const
-{
-    if (!d->m_backForwardListItem)
-        return QString();
-    WKRetainPtr<WKStringRef> title(AdoptWK, WKBackForwardListItemCopyTitle(d->m_backForwardListItem.get()));
-    return WKStringCopyQString(title.get());
-}
-
-QUrl QWKHistoryItem::url() const
-{
-    if (!d->m_backForwardListItem)
-        return QUrl();
-    WKRetainPtr<WKURLRef> url(AdoptWK, WKBackForwardListItemCopyURL(d->m_backForwardListItem.get()));
-    return WKURLCopyQUrl(url.get());
-}
-
-QWKHistoryPrivate::QWKHistoryPrivate(QtWebPageProxy* page, WebKit::WebBackForwardList* list)
-    : m_page(page)
-    , m_backForwardList(list)
-{
-}
-
-QWKHistory* QWKHistoryPrivate::createHistory(QtWebPageProxy* page, WebKit::WebBackForwardList* list)
-{
-    QWKHistory* history = new QWKHistory();
-    history->d = new QWKHistoryPrivate(page, list);
-    return history;
-}
-
-QWKHistoryPrivate::~QWKHistoryPrivate()
-{
-}
-
-QWKHistory::QWKHistory()
-{
-}
-
-QWKHistory::~QWKHistory()
-{
-    delete d;
-}
-
-int QWKHistory::backListCount() const
-{
-    return WKBackForwardListGetBackListCount(toAPI(d->m_backForwardList));
-}
-
-int QWKHistory::forwardListCount() const
-{
-    return WKBackForwardListGetForwardListCount(toAPI(d->m_backForwardList));
-}
-
-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;
-}
-
-void QWKHistory::goToItemAt(int index) const
-{
-    WKRetainPtr<WKBackForwardListItemRef> itemRef = WKBackForwardListGetItemAtIndex(toAPI(d->m_backForwardList), index);
-    if (itemRef && d->m_page) {
-        QWKHistoryItem item(itemRef.get());
-        WKPageGoToBackForwardListItem(d->m_page->pageRef(), item.d->m_backForwardListItem.get());
-    }
-}
-
-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/Source/WebKit2/UIProcess/qt/qwkhistory.h b/Source/WebKit2/UIProcess/qt/qwkhistory.h
deleted file mode 100644 (file)
index e03513f..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2010 Juha Savolainen (juha.savolainen@weego.fi)
- *
- * 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 qwkhistory_h
-#define qwkhistory_h
-
-#include "WebKit2/WKBackForwardListItem.h"
-#include "qwebkitglobal.h"
-#include <QObject>
-#include <QSharedData>
-
-class QWKHistoryPrivate;
-class QWKHistoryItemPrivate;
-class QUrl;
-class QString;
-
-namespace WebKit {
-class WebBackForwardList;
-}
-
-class QWEBKIT_EXPORT QWKHistoryItem {
-public:
-    QWKHistoryItem(const QWKHistoryItem& other);
-    QWKHistoryItem &operator=(const QWKHistoryItem& other);
-
-    ~QWKHistoryItem();
-    QString title() const;
-    QUrl url() const;
-
-private:
-    QWKHistoryItem(WKBackForwardListItemRef);
-
-    QExplicitlySharedDataPointer<QWKHistoryItemPrivate> d;
-
-    friend class QWKHistory;
-    friend class QWKHistoryItemPrivate;
-};
-
-class QWEBKIT_EXPORT QWKHistory : public QObject {
-    Q_OBJECT
-public:
-    int backListCount() const;
-    int forwardListCount() const;
-    int count() const;
-    QWKHistoryItem currentItem() const;
-    QWKHistoryItem backItem() const;
-    QWKHistoryItem forwardItem() const;
-    QWKHistoryItem itemAt(int index) const;
-    void goToItemAt(int index) const;
-    QList<QWKHistoryItem> backItems(int maxItems) const;
-    QList<QWKHistoryItem> forwardItems(int maxItems) const;
-
-private:
-    QWKHistory();
-    ~QWKHistory();
-
-    QWKHistoryPrivate* d;
-    friend class QWKHistoryPrivate;
-    friend class QtWebPageProxy;
-};
-#endif /* qwkhistory_h */
diff --git a/Source/WebKit2/UIProcess/qt/qwkhistory_p.h b/Source/WebKit2/UIProcess/qt/qwkhistory_p.h
deleted file mode 100644 (file)
index 0ef143e..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2010 Juha Savolainen (juha.savolainen@weego.fi)
- *
- * 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 qwkhistory_p_h
-#define qwkhistory_p_h
-
-#include <QSharedData>
-#include "qwebkitglobal.h"
-#include <WebKit2/WKBase.h>
-#include <WebKit2/WKRetainPtr.h>
-#include <wtf/PassRefPtr.h>
-
-namespace WebKit {
-class WebBackForwardList;
-}
-
-class QWKHistory;
-class QtWebPageProxy;
-
-class QWEBKIT_EXPORT QWKHistoryItemPrivate : public QSharedData {
-public:
-       ~QWKHistoryItemPrivate();
-private:
-    QWKHistoryItemPrivate(WKBackForwardListItemRef listItem);
-    WKRetainPtr<WKBackForwardListItemRef> m_backForwardListItem;
-
-    friend class QWKHistory;
-    friend class QWKHistoryItem;
-};
-
-class QWEBKIT_EXPORT QWKHistoryPrivate {
-public:
-    static QWKHistory* createHistory(QtWebPageProxy*, WebKit::WebBackForwardList*);
-
-private:
-    QWKHistoryPrivate(QtWebPageProxy*, WebKit::WebBackForwardList*);
-    ~QWKHistoryPrivate();
-
-    QtWebPageProxy* m_page;
-    WebKit::WebBackForwardList* m_backForwardList;
-
-    friend class QWKHistory;
-};
-
-#endif /* qwkhistory_p_h */