Bug 58937 - [Qt][WK2] Initial support for favicons.
Summary: [Qt][WK2] Initial support for favicons.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Andreas Kling
URL:
Keywords: Qt, QtTriaged
Depends on:
Blocks:
 
Reported: 2011-04-19 16:00 PDT by Andreas Kling
Modified: 2011-05-17 12:01 PDT (History)
6 users (show)

See Also:


Attachments
Proposed patch (8.55 KB, patch)
2011-04-19 16:20 PDT, Andreas Kling
hausmann: review-
Details | Formatted Diff | Diff
Proposed patch v2 (8.45 KB, patch)
2011-05-17 11:08 PDT, Andreas Kling
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Kling 2011-04-19 16:00:41 PDT
In WebKit1, we have this API for favicons:

- static void QWebSettings::setIconDatabasePath(QString)
- void QWebFrame::iconChanged() [signal]
- QIcon QWebFrame::icon() const

In WebKit2, the WebContext has a WebIconDatabase, so the most straightforward thing approach to expose the favicons through QWKContext. This patch adds the following API:

- void QWKContext::setIconDatabasePath(QString)
- void QWKContext::iconChangedForPageURL(QUrl) [signal]
- QPixmap QWKContext::iconForPageURL(QUrl)

This could be hooked into internally by QWKPage to provide e.g QWKPage::iconChanged() [signal] and QPixmap QWKPage::icon(), but I'd prefer to do that later as "convenience API".
Comment 1 Andreas Kling 2011-04-19 16:20:54 PDT
Created attachment 90273 [details]
Proposed patch

Proposed patch.

This does not cover the case where an icon is in already in the cache, though this could be added in a follow-up patch. QWebFrame::iconChanged() didn't work like that until very recently either.. :)

@Brady: In Qt's WebKit1 API, we always emit the iconChanged() signal, also after an icon is retrieved from cache. Do you have any suggestions how to accomplish this in WebKit2?
Comment 2 WebKit Review Bot 2011-04-19 16:22:30 PDT
Attachment 90273 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebKit2/ChangeLog', u'Source/WebKit..." exit_code: 1

Source/WebKit2/UIProcess/API/qt/qwkcontext.cpp:25:  Alphabetical sorting problem.  [build/include_order] [4]
Source/WebKit2/UIProcess/API/qt/qwkcontext.cpp:30:  Alphabetical sorting problem.  [build/include_order] [4]
Source/WebKit2/UIProcess/API/qt/qwkcontext.cpp:32:  Alphabetical sorting problem.  [build/include_order] [4]
Source/WebKit2/UIProcess/API/qt/qwkcontext.cpp:57:  One space before end of line comments  [whitespace/comments] [5]
Source/WebKit2/UIProcess/API/qt/qwkcontext.cpp:58:  One space before end of line comments  [whitespace/comments] [5]
Source/WebKit2/UIProcess/API/qt/ClientImpl.h:56:  The parameter name "iconDatabase" adds no information, so it should be removed.  [readability/parameter_name] [5]
Source/WebKit2/UIProcess/API/qt/ClientImpl.h:57:  The parameter name "iconDatabase" adds no information, so it should be removed.  [readability/parameter_name] [5]
Total errors found: 7 in 7 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Simon Hausmann 2011-04-26 16:37:09 PDT
Comment on attachment 90273 [details]
Proposed patch

View in context: https://bugs.webkit.org/attachment.cgi?id=90273&action=review

Looks good to me, as discussed. r- because of the nitpicks :)

> Source/WebKit2/UIProcess/API/qt/qwkcontext.cpp:86
> +    // FIXME: Should we disable the icon database if path.isEmpty() (like the WebKit1 API does?)

Yes :)

> Source/WebKit2/UIProcess/API/qt/qwkcontext.h:41
> +    QPixmap iconForPageURL(const QUrl&) const;

This should be a QIcon, as discussed at the Review-a-thon.
Comment 4 Andreas Kling 2011-05-17 11:08:10 PDT
Created attachment 93799 [details]
Proposed patch v2

Same patch with QIcon instead of QPixmap as discussed.
We're still missing a way to disable the icon database once enabled, so I've left a FIXME about that.
Comment 5 WebKit Review Bot 2011-05-17 11:11:42 PDT
Attachment 93799 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebKit2/ChangeLog', u'Source/WebKit..." exit_code: 1

Source/WebKit2/UIProcess/API/qt/qwkcontext.cpp:25:  Alphabetical sorting problem.  [build/include_order] [4]
Source/WebKit2/UIProcess/API/qt/qwkcontext.cpp:30:  Alphabetical sorting problem.  [build/include_order] [4]
Source/WebKit2/UIProcess/API/qt/qwkcontext.cpp:32:  Alphabetical sorting problem.  [build/include_order] [4]
Source/WebKit2/UIProcess/API/qt/qwkcontext.cpp:57:  One space before end of line comments  [whitespace/comments] [5]
Source/WebKit2/UIProcess/API/qt/qwkcontext.cpp:58:  One space before end of line comments  [whitespace/comments] [5]
Total errors found: 5 in 7 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 6 Kenneth Rohde Christiansen 2011-05-17 11:46:57 PDT
Comment on attachment 93799 [details]
Proposed patch v2

View in context: https://bugs.webkit.org/attachment.cgi?id=93799&action=review

> Source/WebKit2/UIProcess/API/qt/ClientImpl.cpp:208
> +void qt_wk_didRemoveAllIcons(WKIconDatabaseRef iconDatabase, const void* clientInfo)
> +{
> +}

notImplemented() ?
Comment 7 Andreas Kling 2011-05-17 12:00:57 PDT
Comment on attachment 93799 [details]
Proposed patch v2

Clearing flags on attachment: 93799

Committed r86694: <http://trac.webkit.org/changeset/86694>
Comment 8 Andreas Kling 2011-05-17 12:01:06 PDT
All reviewed patches have been landed.  Closing bug.