Changeset 121830 in webkit


Ignore:
Timestamp:
Jul 3, 2012 11:34:49 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[WK2][EFL] Ewk_View should report the load progress
https://bugs.webkit.org/show_bug.cgi?id=90457

Patch by Christophe Dumez <Christophe Dumez> on 2012-07-03
Reviewed by Kenneth Rohde Christiansen.

Source/WebKit2:

The Ewk_View now reports the estimated load progress
of the page via the new "load,progress".
A method is also added to Ewk_View in order to
retrieve the current load progress.

  • UIProcess/API/efl/ewk_view.cpp:

(ewk_view_load_progress_get):
(ewk_view_load_progress_changed):

  • UIProcess/API/efl/ewk_view.h:
  • UIProcess/API/efl/ewk_view_loader_client.cpp:

(didChangeProgress):
(ewk_view_loader_client_attach):

  • UIProcess/API/efl/ewk_view_private.h:

Tools:

Update EFL MiniBrowser so that it listens for the
"load,progress" on the Ewk_View and updates its
window title accordingly.

  • MiniBrowser/efl/main.c:

(title_set):
(on_title_changed):
(on_progress):
(browserCreate):

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r121808 r121830  
     12012-07-03  Christophe Dumez  <christophe.dumez@intel.com>
     2
     3        [WK2][EFL] Ewk_View should report the load progress
     4        https://bugs.webkit.org/show_bug.cgi?id=90457
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        The Ewk_View now reports the estimated load progress
     9        of the page via the new "load,progress".
     10        A method is also added to Ewk_View in order to
     11        retrieve the current load progress.
     12
     13        * UIProcess/API/efl/ewk_view.cpp:
     14        (ewk_view_load_progress_get):
     15        (ewk_view_load_progress_changed):
     16        * UIProcess/API/efl/ewk_view.h:
     17        * UIProcess/API/efl/ewk_view_loader_client.cpp:
     18        (didChangeProgress):
     19        (ewk_view_loader_client_attach):
     20        * UIProcess/API/efl/ewk_view_private.h:
     21
    1222012-07-03  Christophe Dumez  <christophe.dumez@intel.com>
    223
  • trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp

    r121770 r121830  
    570570}
    571571
     572double ewk_view_load_progress_get(const Evas_Object* ewkView)
     573{
     574    EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
     575    EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
     576
     577    return WKPageGetEstimatedProgress(toAPI(priv->pageClient->page()));
     578}
     579
     580/**
     581 * @internal
     582 * Reports load progress changed.
     583 *
     584 * Emits signal: "load,progress" with pointer to a double from 0.0 to 1.0.
     585 */
     586void ewk_view_load_progress_changed(Evas_Object* ewkView, double progress)
     587{
     588    evas_object_smart_callback_call(ewkView, "load,progress", &progress);
     589}
     590
    572591/**
    573592 * @internal
  • trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h

    r121733 r121830  
    2929 * - "intent,request,new", Ewk_Intent_Request*: reports new Web intent request.
    3030 * - "intent,service,register", Ewk_Intent_Service*: reports new Web intent service registration.
     31 * - "load,progress", double*: load progress has changed (value from 0.0 to 1.0).
    3132 * - "title,changed", const char*: title of the main frame was changed.
    3233 */
     
    254255EAPI const char *ewk_view_title_get(const Evas_Object *o);
    255256
     257/**
     258 * Gets the current load progress of page.
     259 *
     260 * The progress estimation from 0.0 to 1.0.
     261 *
     262 * @param o view object to get the current progress
     263 *
     264 * @return the load progres of page, value from 0.0 to 1.0.
     265 */
     266EAPI double ewk_view_load_progress_get(const Evas_Object *o);
     267
    256268#ifdef __cplusplus
    257269}
  • trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client.cpp

    r121732 r121830  
    6666#endif
    6767
     68static void didChangeProgress(WKPageRef page, const void* clientInfo)
     69{
     70    Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo));
     71    ewk_view_load_progress_changed(ewkView, WKPageGetEstimatedProgress(page));
     72}
     73
    6874void ewk_view_loader_client_attach(WKPageRef pageRef, Evas_Object* ewkView)
    6975{
     
    7985    loadClient.registerIntentServiceForFrame = registerIntentServiceForFrame;
    8086#endif
     87    loadClient.didStartProgress = didChangeProgress;
     88    loadClient.didChangeProgress = didChangeProgress;
     89    loadClient.didFinishProgress = didChangeProgress;
    8190    WKPageSetPageLoaderClient(pageRef, &loadClient);
    8291}
  • trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h

    r121732 r121830  
    4040void ewk_view_display(Evas_Object* ewkView, const WebCore::IntRect& rect);
    4141void ewk_view_image_data_set(Evas_Object* ewkView, void* imageData, const WebCore::IntSize& size);
     42void ewk_view_load_progress_changed(Evas_Object* ewkView, double progress);
    4243void ewk_view_title_changed(Evas_Object* ewkView, const char* title);
    4344
  • trunk/Tools/ChangeLog

    r121825 r121830  
     12012-07-03  Christophe Dumez  <christophe.dumez@intel.com>
     2
     3        [WK2][EFL] Ewk_View should report the load progress
     4        https://bugs.webkit.org/show_bug.cgi?id=90457
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Update EFL MiniBrowser so that it listens for the
     9        "load,progress" on the Ewk_View and updates its
     10        window title accordingly.
     11
     12        * MiniBrowser/efl/main.c:
     13        (title_set):
     14        (on_title_changed):
     15        (on_progress):
     16        (browserCreate):
     17
    1182012-07-03  Dirk Pranke  <dpranke@chromium.org>
    219
  • trunk/Tools/MiniBrowser/efl/main.c

    r120442 r121830  
    2727static const int DEFAULT_HEIGHT = 600;
    2828static const char DEFAULT_URL[] = "http://www.google.com/";
     29static const char APP_NAME[] = "EFL MiniBrowser";
    2930
    3031#define info(format, args...)       \
     
    8889
    8990static void
     91title_set(Ecore_Evas *ee, const char *title, int progress)
     92{
     93    Eina_Strbuf* buffer;
     94
     95    if (!title || !*title) {
     96        ecore_evas_title_set(ee, APP_NAME);
     97        return;
     98    }
     99
     100    buffer = eina_strbuf_new();
     101    if (progress < 100)
     102        eina_strbuf_append_printf(buffer, "%s (%d%%) - %s", title, progress, APP_NAME);
     103    else
     104        eina_strbuf_append_printf(buffer, "%s - %s", title, APP_NAME);
     105
     106    ecore_evas_title_set(ee, eina_strbuf_string_get(buffer));
     107    eina_strbuf_free(buffer);
     108}
     109
     110static void
    90111on_title_changed(void *user_data, Evas_Object *webview, void *event_info)
    91112{
     
    93114    const char *title = (const char *)event_info;
    94115
    95     ecore_evas_title_set(app->ee, title);
     116    title_set(app->ee, title, 100);
     117}
     118
     119static void
     120on_progress(void *user_data, Evas_Object *webview, void *event_info)
     121{
     122    MiniBrowser *app = (MiniBrowser *)user_data;
     123    double progress = *(double *)event_info;
     124
     125    title_set(app->ee, ewk_view_title_get(app->browser), progress * 100);
    96126}
    97127
     
    102132    app->ee = ecore_evas_new(0, 0, 0, DEFAULT_WIDTH, DEFAULT_HEIGHT, 0);
    103133
    104     ecore_evas_title_set(app->ee, "EFL MiniBrowser");
     134    ecore_evas_title_set(app->ee, APP_NAME);
    105135    ecore_evas_callback_resize_set(app->ee, on_ecore_evas_resize);
    106136    ecore_evas_borderless_set(app->ee, 0);
     
    122152    evas_object_name_set(app->browser, "browser");
    123153
     154    evas_object_smart_callback_add(app->browser, "load,progress", on_progress, app);
    124155    evas_object_smart_callback_add(app->browser, "title,changed", on_title_changed, app);
    125156
Note: See TracChangeset for help on using the changeset viewer.