[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373
kenneth at webkit.org
kenneth at webkit.org
Wed Apr 7 23:12:55 UTC 2010
The following commit has been merged in the webkit-1.2 branch:
commit 89830b3b11dca07685b63d96f92138e5cd74b536
Author: kenneth at webkit.org <kenneth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Oct 28 18:00:55 2009 +0000
[Qt] QWebHistory::saveState() is inconsistent with the Qt API
https://bugs.webkit.org/show_bug.cgi?id=30710
Patch by Kenneth Rohde Christiansen <kenneth at webkit.org> on 2009-10-28
Reviewed by Tor Arne Vestbø.
WebCore:
Enforce the versioning, by ignoring any version different
from 1.
* history/qt/HistoryItemQt.cpp:
(WebCore::HistoryItem::restoreState):
(WebCore::HistoryItem::saveState):
WebKit/qt:
Make the versioning internal and enforce it in the WebCore
part. Adjust the comments, as well as remove now dead code.
* Api/qwebhistory.cpp:
(operator<<):
(operator>>):
* Api/qwebhistory.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50224 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 2717586..8ad464c 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2009-10-28 Kenneth Rohde Christiansen <kenneth at webkit.org>
+
+ Reviewed by Tor Arne Vestbø.
+
+ [Qt] QWebHistory::saveState() is inconsistent with the Qt API
+ https://bugs.webkit.org/show_bug.cgi?id=30710
+
+ Enforce the versioning, by ignoring any version different
+ from 1.
+
+ * history/qt/HistoryItemQt.cpp:
+ (WebCore::HistoryItem::restoreState):
+ (WebCore::HistoryItem::saveState):
+
2009-10-28 Pavel Feldman <pfeldman at chromium.org>
Not reviewed: follow up fix to InspectorControllerStub.
diff --git a/WebCore/history/qt/HistoryItemQt.cpp b/WebCore/history/qt/HistoryItemQt.cpp
index 098a786..c5fb069 100644
--- a/WebCore/history/qt/HistoryItemQt.cpp
+++ b/WebCore/history/qt/HistoryItemQt.cpp
@@ -23,10 +23,13 @@
#include "CString.h"
#include "FormData.h"
-bool WebCore::HistoryItem::restoreState(QDataStream& in, int /*version*/)
+bool WebCore::HistoryItem::restoreState(QDataStream& in, int version)
{
- // there is no different version right now
- // switch (version) {
+ // we only support version 1 for now
+
+ if (version != 1)
+ return false;
+
WebCore::String url;
WebCore::String title;
WebCore::String altTitle;
@@ -87,10 +90,12 @@ bool WebCore::HistoryItem::restoreState(QDataStream& in, int /*version*/)
return in.status() == QDataStream::Ok;
}
-QDataStream& WebCore::HistoryItem::saveState(QDataStream& out, int /*version*/) const
+QDataStream& WebCore::HistoryItem::saveState(QDataStream& out, int version) const
{
- // there is no different version right now
- // switch (version) {
+ // we only support version 1 for now.
+ if (version != 1)
+ return out;
+
out << urlString() << title() << alternateTitle() << lastVisitedTime();
out << originalURLString() << referrer() << target() << parent();
out << lastVisitWasHTTPNonGet() << lastVisitWasFailure() << isTargetItem();
diff --git a/WebKit/qt/Api/qwebhistory.cpp b/WebKit/qt/Api/qwebhistory.cpp
index 3df58fc..f765daa 100644
--- a/WebKit/qt/Api/qwebhistory.cpp
+++ b/WebKit/qt/Api/qwebhistory.cpp
@@ -31,6 +31,11 @@
#include <QSharedData>
#include <QDebug>
+enum {
+ InitialHistoryVersion = 1,
+ DefaultHistoryVersion = InitialHistoryVersion
+};
+
/*!
\class QWebHistoryItem
\since 4.4
@@ -476,13 +481,6 @@ void QWebHistory::setMaximumItemCount(int count)
}
/*!
- \enum QWebHistory::HistoryStateVersion
-
- \value HistoryVersion_1 Version 1 (Qt 4.6)
- \value DefaultHistoryVersion The current default version in 1.
-*/
-
-/*!
\since 4.6
\fn QDataStream& operator<<(QDataStream& stream, const QWebHistory& history)
\relates QWebHistory
@@ -498,24 +496,18 @@ QDataStream& operator<<(QDataStream& target, const QWebHistory& history)
QByteArray buffer;
QDataStream stream(&buffer, QIODevice::WriteOnly);
- int version = QWebHistory::DefaultHistoryVersion;
- stream << version;
- switch (version) {
- case QWebHistory::HistoryVersion_1: {
- stream << history.count() << history.currentItemIndex();
+ int version = DefaultHistoryVersion;
- const WebCore::HistoryItemVector &items = d->lst->entries();
- for (unsigned i = 0; i < items.size(); i++)
- items[i].get()->saveState(stream, version);
+ stream << version;
+ stream << history.count() << history.currentItemIndex();
- if (stream.status() != QDataStream::Ok)
- buffer = QByteArray(); // make buffer isNull()==true and isEmpty()==true
- break;
- }
- default:
- buffer.clear();
- }
+ const WebCore::HistoryItemVector &items = d->lst->entries();
+ for (unsigned i = 0; i < items.size(); i++)
+ items[i].get()->saveState(stream, version);
+
+ if (stream.status() != QDataStream::Ok)
+ buffer = QByteArray(); // make buffer isNull()==true and isEmpty()==true
return target << buffer;
}
@@ -539,11 +531,10 @@ QDataStream& operator>>(QDataStream& source, QWebHistory& history)
QDataStream stream(buffer);
int version;
- bool result = false;
+
stream >> version;
- switch (version) {
- case QWebHistory::HistoryVersion_1: {
+ if (version == 1) {
int count;
int currentIndex;
stream >> count >> currentIndex;
@@ -560,11 +551,7 @@ QDataStream& operator>>(QDataStream& source, QWebHistory& history)
}
d->lst->removeItem(nullItem);
history.goToItem(history.itemAt(currentIndex));
- result = stream.status() == QDataStream::Ok;
}
- break;
- }
- default: {} // result is false;
}
d->page()->updateNavigationActions();
diff --git a/WebKit/qt/Api/qwebhistory.h b/WebKit/qt/Api/qwebhistory.h
index 854a278..cce4553 100644
--- a/WebKit/qt/Api/qwebhistory.h
+++ b/WebKit/qt/Api/qwebhistory.h
@@ -70,12 +70,6 @@ private:
class QWebHistoryPrivate;
class QWEBKIT_EXPORT QWebHistory {
public:
- enum HistoryStateVersion {
- HistoryVersion_1,
- /*, HistoryVersion_2, */
- DefaultHistoryVersion = HistoryVersion_1
- };
-
void clear();
QList<QWebHistoryItem> items() const;
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index 25ccb22..de1ca5f 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -9,6 +9,21 @@
2009-10-28 Kenneth Rohde Christiansen <kenneth at webkit.org>
+ Reviewed by Tor Arne Vestbø.
+
+ [Qt] QWebHistory::saveState() is inconsistent with the Qt API
+ https://bugs.webkit.org/show_bug.cgi?id=30710
+
+ Make the versioning internal and enforce it in the WebCore
+ part. Adjust the comments, as well as remove now dead code.
+
+ * Api/qwebhistory.cpp:
+ (operator<<):
+ (operator>>):
+ * Api/qwebhistory.h:
+
+2009-10-28 Kenneth Rohde Christiansen <kenneth at webkit.org>
+
Reviewed by Holger Freyther.
[Qt] QWebHistory::saveState() is inconsistent with the Qt API
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list