Bug 21863 - Add userData and setUserData methods to History Item
Summary: Add userData and setUserData methods to History Item
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 21864
  Show dependency treegraph
 
Reported: 2008-10-24 13:41 PDT by Yael
Modified: 2008-11-04 08:23 PST (History)
2 users (show)

See Also:


Attachments
Add setUserData() and userData() methods. (3.28 KB, patch)
2008-10-24 13:45 PDT, Yael
beidson: review+
Details | Formatted Diff | Diff
Updated the copyright as requested. (3.23 KB, patch)
2008-11-03 05:25 PST, Yael
hausmann: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yael 2008-10-24 13:41:27 PDT
Add userData() and setUserData() methods to History Item, under QT flag only.
Comment 1 Yael 2008-10-24 13:45:28 PDT
Created attachment 24648 [details]
Add setUserData() and userData() methods.

Add setUserData() and userData() methods to HistoryItem under QT flag only.
Comment 2 Brady Eidson 2008-10-27 11:16:20 PDT
Comment on attachment 24648 [details]
Add setUserData() and userData() methods.

> Index: WebCore/WebCore.pro
> ===================================================================
> --- WebCore/WebCore.pro	(revision 37851)
> +++ WebCore/WebCore.pro	(working copy)
> @@ -1006,6 +1006,7 @@
>      bridge/qt/qt_class.cpp \
>      bridge/qt/qt_instance.cpp \
>      bridge/qt/qt_runtime.cpp \
> +    history/qt/HistoryItemQt.cpp \
>      page/qt/AccessibilityObjectQt.cpp \
>      page/qt/DragControllerQt.cpp \
>      page/qt/EventHandlerQt.cpp \
> Index: WebCore/ChangeLog
> ===================================================================
> --- WebCore/ChangeLog	(revision 37853)
> +++ WebCore/ChangeLog	(working copy)
> @@ -1,3 +1,16 @@
> +2008-10-24  Yael Aharon <yael.aharon@nokia.com>
> +
> +        Reviewed by NOBODY (OOPS!).
> +
> +        Add methods for getting and setting user data on History Item.
> +        This change is limited to QT port only. Tests will be added shortly.
> +
> +        * WebCore.pro:
> +        * history/HistoryItem.h:
> +        * history/qt/HistoryItemQt.cpp: Added.
> +        (WebCore::HistoryItem::userData):
> +        (WebCore::HistoryItem::setUserData):
> +
>  2008-10-24  Simon Fraser  <simon.fraser@apple.com>
>  
>          Reviewed by Darin Adler
> Index: WebCore/history/qt/HistoryItemQt.cpp
> ===================================================================
> --- WebCore/history/qt/HistoryItemQt.cpp	(revision 0)
> +++ WebCore/history/qt/HistoryItemQt.cpp	(revision 0)
> @@ -0,0 +1,35 @@
> +/*
> +    Copyright (C) 2008 Trolltech ASA
> +
> +    This library is free software; you can redistribute it and/or
> +    modify it under the terms of the GNU Library General Public
> +    License as published by the Free Software Foundation; either
> +    version 2 of the License, or (at your option) any later version.
> +
> +    This library is distributed in the hope that it will be useful,
> +    but WITHOUT ANY WARRANTY; without even the implied warranty of
> +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +    Library General Public License for more details.
> +
> +    You should have received a copy of the GNU Library General Public License
> +    along with this library; see the file COPYING.LIB.  If not, write to
> +    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
> +    Boston, MA 02110-1301, USA.
> +*/
> +
> +#include "HistoryItem.h"
> +#include <QVariant>
> +
> +namespace WebCore {
> +
> +QVariant HistoryItem::userData()
> +{
> +    return m_userData;
> +}
> +
> +void HistoryItem::setUserData(QVariant& userData)
> +{
> +    m_userData = userData;
> +}
> +
> +}; // namespace WebCore
> Index: WebCore/history/HistoryItem.h
> ===================================================================
> --- WebCore/history/HistoryItem.h	(revision 37851)
> +++ WebCore/history/HistoryItem.h	(working copy)
> @@ -41,7 +41,9 @@
>  #import <wtf/RetainPtr.h>
>  typedef struct objc_object* id;
>  #endif
> -
> +#if PLATFORM(QT)
> +#include <QVariant>
> +#endif
>  namespace WebCore {
>  
>  class Document;
> @@ -147,6 +149,10 @@
>      id getTransientProperty(const String&) const;
>      void setTransientProperty(const String&, id);
>  #endif
> +#if PLATFORM(QT)
> +    QVariant userData();
> +    void setUserData(QVariant& userData);
> +#endif
>  
>  #ifndef NDEBUG
>      int showTree() const;
> @@ -196,6 +202,9 @@
>      RetainPtr<id> m_viewState;
>      OwnPtr<HashMap<String, RetainPtr<id> > > m_transientProperties;
>  #endif
> +#if PLATFORM(QT)
> +    QVariant m_userData;
> +#endif
>  }; //class HistoryItem
>  
>  } //namespace WebCore
Comment 3 Holger Freyther 2008-11-02 14:39:16 PST
Trolltech ASA is gone? Please update the copyright notice to something more appropriate.

The implementation is not including "config.h" as it should do and I still don't understand the need for that change.
Comment 4 Yael 2008-11-03 05:25:38 PST
Created attachment 24858 [details]
Updated the copyright as requested.

Applications may need to store data with the history that is not currently supported by WebCore. In my case, my application needs to store a thumbnail of the page for each history item.
Without this patch, every application that needs to add more data would have to keeps a second copy of the history, and make sure it is always in sync. While it is doable, I don't think it is the best approach. thanks!
Comment 5 Simon Hausmann 2008-11-04 07:10:14 PST
(In reply to comment #3)
> Trolltech ASA is gone? Please update the copyright notice to something more
> appropriate.
> 
> The implementation is not including "config.h" as it should do and I still
> don't understand the need for that change.

This is related to #21864, which makes it possible to implement things like thumbnails for pages and store them in the history.
Comment 6 Simon Hausmann 2008-11-04 08:20:11 PST
Comment on attachment 24648 [details]
Add setUserData() and userData() methods.

Obsoleted by updated patch
Comment 7 Simon Hausmann 2008-11-04 08:22:26 PST
Comment on attachment 24858 [details]
Updated the copyright as requested.

> Index: WebCore.pro
> ===================================================================
> --- WebCore.pro	(revision 38068)
> +++ WebCore.pro	(working copy)
> @@ -1019,6 +1019,7 @@
>      bridge/qt/qt_class.cpp \
>      bridge/qt/qt_instance.cpp \
>      bridge/qt/qt_runtime.cpp \
> +    history/qt/HistoryItemQt.cpp \
>      page/qt/AccessibilityObjectQt.cpp \
>      page/qt/DragControllerQt.cpp \
>      page/qt/EventHandlerQt.cpp \
> Index: ChangeLog
> ===================================================================
> --- ChangeLog	(revision 38068)
> +++ ChangeLog	(working copy)
> @@ -1,3 +1,17 @@
> +2008-11-03  yael  <yael.aharon@nokia.com>
> +
> +        Reviewed by Brady Eidson.
> +
> +        Add methods for getting and setting user data on History Item.
> +        This change is limited to QT port only. Tests were added in 
> +        the patch for https://bugs.webkit.org/show_bug.cgi?id=21864.
> +
> +        * WebCore.pro:
> +        * history/HistoryItem.h:
> +        * history/qt/HistoryItemQt.cpp: Added.
> +        (WebCore::HistoryItem::userData):
> +        (WebCore::HistoryItem::setUserData):
> +
>  2008-11-02  Xan Lopez  <xan@gnome.org>
>  
>          Reviewed by Holger Freyther.
> Index: history/qt/HistoryItemQt.cpp
> ===================================================================
> --- history/qt/HistoryItemQt.cpp	(revision 0)
> +++ history/qt/HistoryItemQt.cpp	(revision 0)
> @@ -0,0 +1,35 @@
> +/*
> +    Copyright (C) 2008 Nokia
> +
> +    This library is free software; you can redistribute it and/or
> +    modify it under the terms of the GNU Library General Public
> +    License as published by the Free Software Foundation; either
> +    version 2 of the License, or (at your option) any later version.
> +
> +    This library is distributed in the hope that it will be useful,
> +    but WITHOUT ANY WARRANTY; without even the implied warranty of
> +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +    Library General Public License for more details.
> +
> +    You should have received a copy of the GNU Library General Public License
> +    along with this library; see the file COPYING.LIB.  If not, write to
> +    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
> +    Boston, MA 02110-1301, USA.
> +*/
> +
> +#include "HistoryItem.h"
> +#include <QVariant>
> +
> +namespace WebCore {
> +
> +QVariant HistoryItem::userData()
> +{
> +    return m_userData;
> +}
> +
> +void HistoryItem::setUserData(QVariant& userData)
> +{
> +    m_userData = userData;
> +}
> +
> +}; // namespace WebCore
> Index: history/HistoryItem.h
> ===================================================================
> --- history/HistoryItem.h	(revision 38068)
> +++ history/HistoryItem.h	(working copy)
> @@ -41,7 +41,9 @@
>  #import <wtf/RetainPtr.h>
>  typedef struct objc_object* id;
>  #endif
> -
> +#if PLATFORM(QT)
> +#include <QVariant>
> +#endif
>  namespace WebCore {
>  
>  class Document;
> @@ -147,6 +149,10 @@
>      id getTransientProperty(const String&) const;
>      void setTransientProperty(const String&, id);
>  #endif
> +#if PLATFORM(QT)
> +    QVariant userData();
> +    void setUserData(QVariant& userData);
> +#endif
>  
>  #ifndef NDEBUG
>      int showTree() const;
> @@ -196,6 +202,9 @@
>      RetainPtr<id> m_viewState;
>      OwnPtr<HashMap<String, RetainPtr<id> > > m_transientProperties;
>  #endif
> +#if PLATFORM(QT)
> +    QVariant m_userData;
> +#endif
>  }; //class HistoryItem
>  
>  } //namespace WebCore

Looks good. I'm doing some minor cleanups before applying, such as making the methods inline.
Comment 8 Simon Hausmann 2008-11-04 08:23:37 PST
Landed in r38097