[webkit-reviews] review denied: [Bug 25144] [patch] Adding QWebHistory::addItem : [Attachment 29417] patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Apr 11 20:32:01 PDT 2009


Holger Freyther <zecke at selfish.org> has denied Mohammed Sameer
<msameer at foolab.org>'s request for review:
Bug 25144: [patch] Adding QWebHistory::addItem
https://bugs.webkit.org/show_bug.cgi?id=25144

Attachment 29417: patch
https://bugs.webkit.org/attachment.cgi?id=29417&action=review

------- Additional Comments from Holger Freyther <zecke at selfish.org>
First of all welcome and a '-' is not as bad as it might seem like. There are
some beginner issues though.


I think the API addition does make sense, so it is about technical issues as
this point. The comments are inline with the patch.




> Index: WebKit/qt/ChangeLog
> ===================================================================
> --- WebKit/qt/ChangeLog	(revision 42423)
> +++ WebKit/qt/ChangeLog	(working copy)
> @@ -1,3 +1,14 @@
> +2009-04-11  Mohammed Sameer	<set EMAIL_ADDRESS environment variable>

You should set EMAIL_ADDRESS in your environment or change it here.


> +
> +	   Reviewed by NOBODY (OOPS!).
> +
> +	[Qt] Added QWebHistory::addItem that allows adding history items
> +	to the page BackForwardList

Please use the eight spaces, tabs will be rejected by a post commit hook.



>  /*!
> +  Adds an item to the history.
> +
> +  Please note that this will "trash" any forward items

Some more documentation is needed. E.g. a @since 4.6 tag, description of the
parameters (e.g. what timezone is lastVisited), and maybe even a unit test,
showing the behavior (specially the trashing one).

> +*/
> +void QWebHistory::addItem(const QString &url, const QString &title, const
QDateTime &lastVisited)
> +{
> +  QByteArray utf8 = url.toUtf8();
> +  WebCore::String Url(utf8.constData(), utf8.length());
> +  utf8 = title.toUtf8();
> +  WebCore::String Title(utf8.constData(), utf8.length());
> +  d->lst->addItem(WebCore::HistoryItem::create(Url, Title,
lastVisited.toTime_t()));
> +}
>

You can write all this as:

d->lst->addItem(WebCore::HistoryItem::create(String(url), String(title),
last...);

Why this approach is better:
    - Less code
    - The conversion to Utf8 takes time and extra allocations and your import
into String is not losless... This c'tor is ascii only and will lose any non
ascii charachters.

Style:
    - Please use 4 spaces as of our CodingStyle guidelines on webkit.org
    - Please use a lowercase letter for the start of variable names


More information about the webkit-reviews mailing list