Changeset 38097 in webkit
- Timestamp:
- Nov 4, 2008 8:22:05 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r38094 r38097 1 2008-11-03 Yael Aharon <yael.aharon@nokia.com> 2 3 Reviewed by Simon Hausmann. 4 5 Add methods for getting and setting user data on History Item. 6 This change is limited to QT port only. Tests were added in 7 the patch for https://bugs.webkit.org/show_bug.cgi?id=21864. 8 9 Minor change by Simon: made the functions inline and added a missing 10 const. 11 12 * history/HistoryItem.h: 13 1 14 2008-11-01 Alexey Proskuryakov <ap@webkit.org> 2 15 -
trunk/WebCore/history/HistoryItem.h
r34432 r38097 38 38 #include <wtf/Vector.h> 39 39 40 #if PLATFORM(QT) 41 #include <QVariant> 42 #endif 43 40 44 #if PLATFORM(MAC) 41 45 #import <wtf/RetainPtr.h> … … 149 153 #endif 150 154 155 #if PLATFORM(QT) 156 QVariant userData() const { return m_userData; } 157 void setUserData(const QVariant& userData) { m_userData = userData; } 158 #endif 159 151 160 #ifndef NDEBUG 152 161 int showTree() const; … … 197 206 OwnPtr<HashMap<String, RetainPtr<id> > > m_transientProperties; 198 207 #endif 208 #if PLATFORM(QT) 209 QVariant m_userData; 210 #endif 199 211 }; //class HistoryItem 200 212 -
trunk/WebKit/qt/Api/qwebframe.cpp
r37845 r38097 961 961 962 962 /*! 963 \since 4.5 964 \fn void QWebFrame::aboutToUpdateHistory(QWebHistoryItem* item); 965 966 This signal is emitted shortly before the history of navigated pages 967 is changed, for example when navigating back in the history. 968 969 A potential use-case for this signal is to store custom data in 970 the QWebHistoryItem associated to the frame, using QWebHistoryItem::setUserData(). 971 */ 972 973 /*! 963 974 \class QWebHitTestResult 964 975 \since 4.4 -
trunk/WebKit/qt/Api/qwebframe.h
r37787 r38097 47 47 class QWebPage; 48 48 class QWebHitTestResult; 49 class QWebHistoryItem; 49 50 50 51 namespace WebCore { … … 185 186 void iconChanged(); 186 187 188 void aboutToUpdateHistory(QWebHistoryItem* item); 189 187 190 private: 188 191 friend class QWebPage; -
trunk/WebKit/qt/Api/qwebhistory.cpp
r37843 r38097 48 48 \row \o lastVisited() \o The date and time of the user's last visit to the page. 49 49 \row \o icon() \o The icon associated with the page that was provided by the server. 50 \row \o userData() \o The user specific data that was stored with the history item. 50 51 \endtable 51 52 … … 145 146 146 147 /*! 148 \since 4.5 149 Returns the user specific data that was stored with the history item. 150 151 \sa setUserData() 152 */ 153 QVariant QWebHistoryItem::userData() const 154 { 155 if (d->item) 156 return d->item->userData(); 157 return QVariant(); 158 } 159 160 /*! 161 \since 4.5 162 163 Stores user specific data with the history item. 164 165 \sa userData() 166 */ 167 void QWebHistoryItem::setUserData(const QVariant& userData) 168 { 169 if (d->item) 170 d->item->setUserData(userData); 171 } 172 173 /*!* 147 174 \internal 148 175 */ … … 365 392 366 393 /*! 394 \since 4.5 395 Returns the index of the current item in history. 396 */ 397 int QWebHistory::currentItemIndex() const 398 { 399 return d->lst->backListCount(); 400 } 401 402 /*! 367 403 Returns the item at index \a i in the history. 368 404 */ … … 383 419 } 384 420 421 /*! 422 \since 4.5 423 Returns the maximum number of items in the history. 424 425 \sa setMaximumItemCount() 426 */ 427 int QWebHistory::maximumItemCount() const 428 { 429 return d->lst->capacity(); 430 } 431 432 /*! 433 \since 4.5 434 Sets the maximum number of items in the history. 435 436 \sa maximumItemCount() 437 */ 438 void QWebHistory::setMaximumItemCount(int count) 439 { 440 d->lst->setCapacity(count); 441 } 442 -
trunk/WebKit/qt/Api/qwebhistory.h
r37843 r38097 31 31 class QWebPage; 32 32 33 namespace WebCore { 34 class FrameLoaderClientQt; 35 }; 36 33 37 class QWebHistoryItemPrivate; 34 38 class QWEBKIT_EXPORT QWebHistoryItem … … 47 51 QIcon icon() const; 48 52 53 QVariant userData() const; 54 void setUserData(const QVariant& userData); 55 49 56 bool isValid() const; 50 57 … … 53 60 friend class QWebHistory; 54 61 friend class QWebPage; 62 friend class WebCore::FrameLoaderClientQt; 55 63 QExplicitlySharedDataPointer<QWebHistoryItemPrivate> d; 56 64 }; … … 78 86 QWebHistoryItem itemAt(int i) const; 79 87 88 int currentItemIndex() const; 89 80 90 int count() const; 91 92 int maximumItemCount() const; 93 void setMaximumItemCount(int count); 81 94 82 95 private: -
trunk/WebKit/qt/ChangeLog
r38087 r38097 1 2008-10-24 Yael Aharon <yael.aharon@nokia.com> 2 3 Reviewed by Simon Hausmann. 4 5 Add userData() and setUserData() to QWebHistoryItem. 6 Add setMaximumItemCount() and maximumItemCount() to QWebHistory. 7 Add currentItemIndex() to QWebHistory. 8 9 See also https://bugs.webkit.org/show_bug.cgi?id=21864 10 11 Small cleanup by Simon (docs and forward declaration of QWebHistoryItem in qwebframe.h) 12 13 * Api/qwebframe.h: 14 * Api/qwebhistory.cpp: 15 (QWebHistoryItem::userData): 16 (QWebHistoryItem::setUserData): 17 (QWebHistory::currentItemIndex): 18 (QWebHistory::maximumItemCount): 19 (QWebHistory::setMaximumItemCount): 20 * Api/qwebhistory.h: 21 * WebCoreSupport/FrameLoaderClientQt.cpp: 22 (WebCore::FrameLoaderClientQt::saveViewStateToItem): 23 * tests/qwebpage/tst_qwebpage.cpp: 24 (tst_QWebPage::modified): 25 1 26 2008-11-03 Cameron Zwarich <zwarich@apple.com> 2 27 -
trunk/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
r37754 r38097 67 67 #include "qwebnetworkinterface_p.h" 68 68 #endif 69 #include "qwebhistory_p.h" 69 70 70 71 static bool dumpFrameLoaderCallbacks = false; … … 633 634 } 634 635 635 void FrameLoaderClientQt::saveViewStateToItem(WebCore::HistoryItem*) 636 { 636 void FrameLoaderClientQt::saveViewStateToItem(WebCore::HistoryItem* item) 637 { 638 QWebHistoryItem historyItem(new QWebHistoryItemPrivate(item)); 639 emit m_webFrame->aboutToUpdateHistory(&historyItem); 637 640 } 638 641 -
trunk/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
r37843 r38097 305 305 306 306 QVERIFY(!m_page->isModified()); 307 308 QVERIFY(m_page->history()->currentItemIndex() == 0); 309 310 m_page->history()->setMaximumItemCount(3); 311 QVERIFY(m_page->history()->maximumItemCount() == 3); 312 313 QVariant variant("string test"); 314 m_page->history()->currentItem().setUserData(variant); 315 QVERIFY(m_page->history()->currentItem().userData().toString() == "string test"); 316 317 m_page->mainFrame()->setUrl(QUrl("data:text/html,<body>This is second page")); 318 m_page->mainFrame()->setUrl(QUrl("data:text/html,<body>This is third page")); 319 QVERIFY(m_page->history()->count() == 2); 320 m_page->mainFrame()->setUrl(QUrl("data:text/html,<body>This is fourth page")); 321 QVERIFY(m_page->history()->count() == 2); 322 m_page->mainFrame()->setUrl(QUrl("data:text/html,<body>This is fifth page")); 323 QVERIFY(::waitForSignal(m_page->mainFrame(), SIGNAL(aboutToUpdateHistory(QWebHistoryItem*)))); 307 324 } 308 325
Note: See TracChangeset
for help on using the changeset viewer.