Bug 99087 - [EFL][WK2] Implement Favicons API
Summary: [EFL][WK2] Implement Favicons API
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit EFL (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords:
Depends on:
Blocks: 61838 99265 101182
  Show dependency treegraph
 
Reported: 2012-10-11 10:51 PDT by Chris Dumez
Modified: 2012-11-04 22:49 PST (History)
11 users (show)

See Also:


Attachments
Patch (55.23 KB, patch)
2012-10-13 06:30 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (57.89 KB, patch)
2012-10-15 01:02 PDT, Chris Dumez
kenneth: review+
Details | Formatted Diff | Diff
Patch for landing (57.96 KB, patch)
2012-10-15 02:17 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2012-10-11 10:51:16 PDT
We should implement the Favicons API so that clients can retrieve icons for specific URLs.

The GTK port added it recently via Bug 96476.
Comment 1 Jinwoo Song 2012-10-12 07:36:23 PDT
Chris, did you already work for a patch? AFAIK, Jaehun has been refactoring and prepared upstream the internal code.
Comment 2 Chris Dumez 2012-10-12 08:06:18 PDT
(In reply to comment #1)
> Chris, did you already work for a patch? AFAIK, Jaehun has been refactoring and prepared upstream the internal code.

Yes, sorry. I have it implemented and I'm in the middle of unit tests.
Comment 3 Chris Dumez 2012-10-12 08:10:11 PDT
(In reply to comment #1)
> Chris, did you already work for a patch? AFAIK, Jaehun has been refactoring and prepared upstream the internal code.

In the future, please file a bug upstream to indicate that you are working on it. This would minimize the risk of overlapping work.
Comment 4 Jinwoo Song 2012-10-12 08:56:07 PDT
(In reply to comment #3)
> (In reply to comment #1)
> > Chris, did you already work for a patch? AFAIK, Jaehun has been refactoring and prepared upstream the internal code.
> 
> In the future, please file a bug upstream to indicate that you are working on it. This would minimize the risk of overlapping work.

I see and I hope the overlapping work should not happen anymore. :)
Comment 5 Chris Dumez 2012-10-13 06:30:04 PDT
Created attachment 168551 [details]
Patch
Comment 6 Kenneth Rohde Christiansen 2012-10-15 00:10:00 PDT
Comment on attachment 168551 [details]
Patch

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

Just a general question; favicons can be animated and include multiple images (or be generated). Do we support this? and do we have a limit (there can be infinite new images which can fill up memory) I know this could be a security issue and other ports have limits.

> Source/WebCore/platform/graphics/efl/EvasCairoUtilities.cpp:28
> +#include "config.h"
> +#include "EvasCairoUtilities.h"
> +
> +Evas_Object* cairoImageSurfaceToEvasObject(Evas* canvas, cairo_surface_t* surface)
> +{
> +    EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
> +    EINA_SAFETY_ON_NULL_RETURN_VAL(surface, 0);
> +

We have similar methods (create cairo surface for edje object etc) in RenderThemeEfl, maybe they should be moved.

> Source/WebKit/efl/ewk/ewk_history.cpp:358
> +    return surface ? cairoImageSurfaceToEvasObject(canvas, surface) : 0;

wouldn't evasObjectFromCairoImageSurface not be a better name?
Comment 7 Chris Dumez 2012-10-15 00:33:32 PDT
(In reply to comment #6)
> (From update of attachment 168551 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=168551&action=review
> 
> Just a general question; favicons can be animated and include multiple images (or be generated). Do we support this? and do we have a limit (there can be infinite new images which can fill up memory) I know this could be a security issue and other ports have limits.

We don't support animated favicons at this point (neither does GTK port). We always return the first frame in the Image.

I cannot find the limit you are talking about in GTK or Qt port. Could you point me in the right direction? They do have functions to clear the icon database though (I'm planning to add this as well but in a later patch for size reasons).


> > Source/WebCore/platform/graphics/efl/EvasCairoUtilities.cpp:28
> > +#include "config.h"
> > +#include "EvasCairoUtilities.h"
> > +
> > +Evas_Object* cairoImageSurfaceToEvasObject(Evas* canvas, cairo_surface_t* surface)
> > +{
> > +    EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, 0);
> > +    EINA_SAFETY_ON_NULL_RETURN_VAL(surface, 0);
> > +
> 
> We have similar methods (create cairo surface for edje object etc) in RenderThemeEfl, maybe they should be moved.

Ok, I'll take a look, thanks. I'll probably rename the file to CairoUtilitiesEfl.cpp then.

> 
> > Source/WebKit/efl/ewk/ewk_history.cpp:358
> > +    return surface ? cairoImageSurfaceToEvasObject(canvas, surface) : 0;
> 
> wouldn't evasObjectFromCairoImageSurface not be a better name?

Why not. I will change it.
Comment 8 Chris Dumez 2012-10-15 01:02:30 PDT
Created attachment 168643 [details]
Patch

Take Kenneth's feedback into consideration except for limiting the number of icons.

I cannot find similar icon limiting API in other ports and there is already a mechanism in WebCore's IconDatabase to expire icons after 4 days.
Comment 9 Kenneth Rohde Christiansen 2012-10-15 01:51:26 PDT
> We don't support animated favicons at this point (neither does GTK port). We always return the first frame in the Image.
> 
> I cannot find the limit you are talking about in GTK or Qt port. Could you point me in the right direction? They do have functions to clear the icon database though (I'm planning to add this as well but in a later patch for size reasons).

Maybe it was never added, but I remember the bugzilla discussions. I think Jesus Sanchez-Palencia worked on it, but I might be wrong.
Comment 10 Kenneth Rohde Christiansen 2012-10-15 01:58:57 PDT
Comment on attachment 168643 [details]
Patch

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

> Source/WebKit2/UIProcess/API/efl/ewk_favicon_database.cpp:205
> +    Evas_Object* icon = response->surface ? WebCore::evasObjectFromCairoImageSurface(response->callbackData.evas, response->surface.get()) : 0;

RefPtr? Evas_Object should support it

> Source/WebKit2/UIProcess/API/efl/ewk_favicon_database.cpp:229
> +    // If there's not a valid icon, but there's an iconURL registered,

If there is no valid icon?

> Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_favicon_database.cpp:100
> +    while (!iconChanged)
> +        ecore_main_loop_iterate();

newline after this

> Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_favicon_database.cpp:156
> +    while (!data.icon)
> +        ecore_main_loop_iterate();

newline

> Source/WebKit2/UIProcess/efl/WebContextEfl.cpp:57
> +    return String::fromUTF8(efreet_data_home_get()) + "/WebKitEfl/IconDatabase";

so I suppose this is a hidden dir?
Comment 11 Chris Dumez 2012-10-15 02:01:44 PDT
Comment on attachment 168643 [details]
Patch

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

>> Source/WebKit2/UIProcess/efl/WebContextEfl.cpp:57
>> +    return String::fromUTF8(efreet_data_home_get()) + "/WebKitEfl/IconDatabase";
> 
> so I suppose this is a hidden dir?

Yes. By default, efreet_data_home_get() (or XDG_DATA_HOME) is ~/.local/share
Comment 12 Chris Dumez 2012-10-15 02:17:42 PDT
Created attachment 168654 [details]
Patch for landing

Take Kenneth's feedback into consideration.

Using RefPtr to Evas_Object looks much better indeed, thanks.
Comment 13 Jesus Sanchez-Palencia 2012-10-15 07:13:15 PDT
(In reply to comment #9)
> > We don't support animated favicons at this point (neither does GTK port). We always return the first frame in the Image.
> > 
> > I cannot find the limit you are talking about in GTK or Qt port. Could you point me in the right direction? They do have functions to clear the icon database though (I'm planning to add this as well but in a later patch for size reasons).
> 
> Maybe it was never added, but I remember the bugzilla discussions. I think Jesus Sanchez-Palencia worked on it, but I might be wrong.

It was Rafael who worked on it, Kenneth. He is now CC'ed here.
Comment 14 WebKit Review Bot 2012-10-15 12:44:11 PDT
Comment on attachment 168654 [details]
Patch for landing

Clearing flags on attachment: 168654

Committed r131337: <http://trac.webkit.org/changeset/131337>
Comment 15 WebKit Review Bot 2012-10-15 12:44:16 PDT
All reviewed patches have been landed.  Closing bug.