Changeset 62787 in webkit


Ignore:
Timestamp:
Jul 8, 2010 7:37:47 AM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-07-08 Lucas De Marchi <lucas.demarchi@profusion.mobi>

Reviewed by Kenneth Rohde Christiansen.

[EFL] Implement several notification hooks in FrameLoaderClient.
We just notify browser, making the appropriate type conversions about
the events occurring in WebCore.
https://bugs.webkit.org/show_bug.cgi?id=41005

  • efl/WebCoreSupport/FrameLoaderClientEfl.cpp: (WebCore::FrameLoaderClientEfl::dispatchWillSendRequest): alloc 2 new wrapper structures in stack in order to give client the opportunity to change parameters. Then, call the function it defines. (WebCore::FrameLoaderClientEfl::assignIdentifierToInitialRequest): (WebCore::FrameLoaderClientEfl::didPerformFirstNavigation): notify client. (WebCore::FrameLoaderClientEfl::saveViewStateToItem): notify client. (WebCore::FrameLoaderClientEfl::restoreViewState): notify client. (WebCore::FrameLoaderClientEfl::dispatchDidChangeLocationWithinPage): notify browser that the url changed. (WebCore::FrameLoaderClientEfl::dispatchDidReceiveIcon): notify browser. (WebCore::FrameLoaderClientEfl::dispatchDidStartProvisionalLoad): notify browser. (WebCore::FrameLoaderClientEfl::dispatchDidFinishDocumentLoad): notify browser. (WebCore::FrameLoaderClientEfl::dispatchDidFirstLayout): norify browser. (WebCore::FrameLoaderClientEfl::dispatchDidFirstVisuallyNonEmptyLayout): notify browser. (WebCore::FrameLoaderClientEfl::dispatchShow): notify browser.
  • efl/ewk/ewk_frame.cpp: (ewk_frame_request_will_send): emit signal notifying browser. (ewk_frame_request_assign_identifier): emit signal notifying browser. (ewk_frame_did_perform_first_navigation): emit signal notifying browser. (ewk_frame_view_state_save): emit signal notifying browser. (ewk_frame_load_provisional): emit signal notifying browser. (ewk_frame_load_firstlayout_finished): emit signal notifying browser. (ewk_frame_load_firstlayout_nonempty_finished): emit signal notifying browser. (ewk_frame_load_document_finished): emit signal notifying browser.
  • efl/ewk/ewk_frame.h: update documentation about signals being sent and implement wrapper struct for ResourceRequest.
  • efl/ewk/ewk_private.h: export private functions.
Location:
trunk/WebKit
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/ChangeLog

    r62786 r62787  
     12010-07-08  Lucas De Marchi  <lucas.demarchi@profusion.mobi>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [EFL] Implement several notification hooks in FrameLoaderClient.
     6        We just notify browser, making the appropriate type conversions about
     7        the events occurring in WebCore.
     8        https://bugs.webkit.org/show_bug.cgi?id=41005
     9
     10        * efl/WebCoreSupport/FrameLoaderClientEfl.cpp:
     11        (WebCore::FrameLoaderClientEfl::dispatchWillSendRequest): alloc 2 new
     12        wrapper structures in stack in order to give client the opportunity to
     13        change parameters. Then, call the function it defines.
     14        (WebCore::FrameLoaderClientEfl::assignIdentifierToInitialRequest):
     15        (WebCore::FrameLoaderClientEfl::didPerformFirstNavigation): notify
     16        client.
     17        (WebCore::FrameLoaderClientEfl::saveViewStateToItem): notify client.
     18        (WebCore::FrameLoaderClientEfl::restoreViewState): notify client.
     19        (WebCore::FrameLoaderClientEfl::dispatchDidChangeLocationWithinPage):
     20        notify browser that the url changed.
     21        (WebCore::FrameLoaderClientEfl::dispatchDidReceiveIcon): notify
     22        browser.
     23        (WebCore::FrameLoaderClientEfl::dispatchDidStartProvisionalLoad):
     24        notify browser.
     25        (WebCore::FrameLoaderClientEfl::dispatchDidFinishDocumentLoad): notify
     26        browser.
     27        (WebCore::FrameLoaderClientEfl::dispatchDidFirstLayout): norify
     28        browser.
     29        (WebCore::FrameLoaderClientEfl::dispatchDidFirstVisuallyNonEmptyLayout):
     30        notify browser.
     31        (WebCore::FrameLoaderClientEfl::dispatchShow): notify browser.
     32        * efl/ewk/ewk_frame.cpp:
     33        (ewk_frame_request_will_send): emit signal notifying browser.
     34        (ewk_frame_request_assign_identifier): emit signal notifying browser.
     35        (ewk_frame_did_perform_first_navigation): emit signal notifying browser.
     36        (ewk_frame_view_state_save): emit signal notifying browser.
     37        (ewk_frame_load_provisional): emit signal notifying browser.
     38        (ewk_frame_load_firstlayout_finished): emit signal notifying browser.
     39        (ewk_frame_load_firstlayout_nonempty_finished): emit signal notifying browser.
     40        (ewk_frame_load_document_finished): emit signal notifying browser.
     41        * efl/ewk/ewk_frame.h: update documentation about signals being sent
     42        and implement wrapper struct for ResourceRequest.
     43        * efl/ewk/ewk_private.h: export private functions.
     44
    1452010-07-08  Lucas De Marchi  <lucas.demarchi@profusion.mobi>
    246
  • trunk/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp

    r62786 r62787  
    252252}
    253253
    254 void FrameLoaderClientEfl::dispatchWillSendRequest(DocumentLoader*, unsigned long, ResourceRequest&, const ResourceResponse&)
    255 {
    256     notImplemented();
     254void FrameLoaderClientEfl::dispatchWillSendRequest(DocumentLoader* loader, unsigned long identifier, ResourceRequest& coreRequest, const ResourceResponse& coreResponse)
     255{
     256    CString url = coreRequest.url().prettyURL().utf8();
     257    DBG("Resource url=%s", url.data());
     258
     259    Ewk_Frame_Resource_Request request = { 0, identifier };
     260    Ewk_Frame_Resource_Request orig = request; /* Initialize const fields. */
     261
     262    orig.url = request.url = url.data();
     263
     264    ewk_frame_request_will_send(m_frame, &request);
     265
     266    if (request.url != orig.url) {
     267        coreRequest.setURL(KURL(KURL(), request.url));
     268
     269        // Calling client might have changed our url pointer.
     270        // Free the new allocated string.
     271        free(const_cast<char*>(request.url));
     272    }
    257273}
    258274
     
    263279}
    264280
    265 void FrameLoaderClientEfl::assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest&)
    266 {
    267     notImplemented();
     281void FrameLoaderClientEfl::assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest& coreRequest)
     282{
     283    CString url = coreRequest.url().prettyURL().utf8();
     284    DBG("Resource url=%s", url.data());
     285
     286    Ewk_Frame_Resource_Request request = { 0, identifier };
     287    ewk_frame_request_assign_identifier(m_frame, &request);
    268288}
    269289
     
    424444void FrameLoaderClientEfl::didPerformFirstNavigation() const
    425445{
    426     notImplemented();
     446    ewk_frame_did_perform_first_navigation(m_frame);
    427447}
    428448
     
    459479}
    460480
    461 void FrameLoaderClientEfl::saveViewStateToItem(HistoryItem*)
    462 {
    463     notImplemented();
     481void FrameLoaderClientEfl::saveViewStateToItem(HistoryItem* item)
     482{
     483    ewk_frame_view_state_save(m_frame, item);
    464484}
    465485
    466486void FrameLoaderClientEfl::restoreViewState()
    467487{
    468     notImplemented();
     488    ASSERT(m_frame);
     489    ASSERT(m_view);
     490
     491    ewk_view_restore_state(m_view, m_frame);
    469492}
    470493
     
    545568void FrameLoaderClientEfl::dispatchDidChangeLocationWithinPage()
    546569{
    547     notImplemented();
     570    ewk_frame_uri_changed(m_frame);
     571
     572    if (ewk_view_frame_main_get(m_view) != m_frame)
     573        return;
     574    ewk_view_uri_changed(m_view);
    548575}
    549576
     
    555582void FrameLoaderClientEfl::dispatchDidReceiveIcon()
    556583{
     584    /* report received favicon only for main frame. */
     585    if (ewk_view_frame_main_get(m_view) != m_frame)
     586        return;
     587
     588    ewk_view_frame_main_icon_received(m_view);
    557589}
    558590
    559591void FrameLoaderClientEfl::dispatchDidStartProvisionalLoad()
    560592{
     593    ewk_frame_load_provisional(m_frame);
     594    if (ewk_view_frame_main_get(m_view) == m_frame)
     595        ewk_view_load_provisional(m_view);
    561596}
    562597
     
    592627void FrameLoaderClientEfl::dispatchDidFinishDocumentLoad()
    593628{
    594     notImplemented();
     629    ewk_frame_load_document_finished(m_frame);
    595630}
    596631
    597632void FrameLoaderClientEfl::dispatchDidFirstLayout()
    598633{
    599     // emit m_frame->initialLayoutCompleted();
    600634    m_initLayoutCompleted = true;
     635    ewk_frame_load_firstlayout_finished(m_frame);
    601636}
    602637
    603638void FrameLoaderClientEfl::dispatchDidFirstVisuallyNonEmptyLayout()
    604639{
    605     notImplemented();
     640    ewk_frame_load_firstlayout_nonempty_finished(m_frame);
    606641}
    607642
    608643void FrameLoaderClientEfl::dispatchShow()
    609644{
    610     notImplemented();
     645    ewk_view_load_show(m_view);
    611646}
    612647
  • trunk/WebKit/efl/ewk/ewk_frame.cpp

    r62008 r62787  
    3232#include "FrameView.h"
    3333#include "HTMLPlugInElement.h"
     34#include "HistoryItem.h"
    3435#include "HitTestResult.h"
    3536#include "KURL.h"
     
    16341635/**
    16351636 * @internal
     1637 * Reports a resource will be requested. User may override behavior of webkit by
     1638 * changing values in @param request.
     1639 *
     1640 * @param o Frame.
     1641 * @param request Request details that user may override. Whenever values on
     1642 * this struct changes, it must be properly malloc'd as it will be freed
     1643 * afterwards.
     1644 *
     1645 * Emits signal: "resource,request,willsend"
     1646 */
     1647void ewk_frame_request_will_send(Evas_Object *o, Ewk_Frame_Resource_Request *request)
     1648{
     1649    evas_object_smart_callback_call(o, "resource,request,willsend", request);
     1650}
     1651
     1652/**
     1653 * @internal
     1654 * Reports that there's a new resource.
     1655 *
     1656 * @param o Frame.
     1657 * @param request New request details. No changes are allowed to fields.
     1658 *
     1659 * Emits signal: "resource,request,new"
     1660 */
     1661void ewk_frame_request_assign_identifier(Evas_Object *o, const Ewk_Frame_Resource_Request *request)
     1662{
     1663    evas_object_smart_callback_call(o, "resource,request,new", (void *)request);
     1664}
     1665
     1666/**
     1667 * @internal
     1668 * Reports that first navigation occurred
     1669 *
     1670 * @param o Frame.
     1671 *
     1672 * Emits signal: "navigation,first"
     1673 */
     1674void ewk_frame_did_perform_first_navigation(Evas_Object *o)
     1675{
     1676    evas_object_smart_callback_call(o, "navigation,first", 0);
     1677}
     1678
     1679/**
     1680 * @internal
     1681 * Reports frame will be saved to current state
     1682 *
     1683 * @param o Frame.
     1684 * @param item History item to save details to.
     1685 *
     1686 * Emits signal: "state,save"
     1687 */
     1688void ewk_frame_view_state_save(Evas_Object *o, WebCore::HistoryItem* item)
     1689{
     1690    const char *title = ewk_frame_title_get(o);
     1691    const char *uri = ewk_frame_uri_get(o);
     1692
     1693    item->setTitle(WebCore::String::fromUTF8(title));
     1694    item->setURLString(WebCore::String::fromUTF8(uri));
     1695
     1696    evas_object_smart_callback_call(o, "state,save", 0);
     1697}
     1698
     1699/**
     1700 * @internal
    16361701 * Reports the frame started loading something.
    16371702 *
     
    16491714    if (main_frame == o)
    16501715        ewk_view_frame_main_load_started(sd->view);
     1716}
     1717
     1718/**
     1719 * @internal
     1720 * Reports the frame started provisional load.
     1721 *
     1722 * @param o Frame.
     1723 *
     1724 * Emits signal: "load,provisional" with no parameters.
     1725 */
     1726void ewk_frame_load_provisional(Evas_Object* o)
     1727{
     1728    evas_object_smart_callback_call(o, "load,provisional", 0);
     1729}
     1730
     1731/**
     1732 * @internal
     1733 * Reports the frame finished first layout.
     1734 *
     1735 * @param o Frame.
     1736 *
     1737 * Emits signal: "load,firstlayout,finished" with no parameters.
     1738 */
     1739void ewk_frame_load_firstlayout_finished(Evas_Object *o)
     1740{
     1741    evas_object_smart_callback_call(o, "load,firstlayout,finished", 0);
     1742}
     1743
     1744/**
     1745 * @internal
     1746 * Reports the frame finished first non empty layout.
     1747 *
     1748 * @param o Frame.
     1749 *
     1750 * Emits signal: "load,nonemptylayout,finished" with no parameters.
     1751 */
     1752void ewk_frame_load_firstlayout_nonempty_finished(Evas_Object *o)
     1753{
     1754    evas_object_smart_callback_call(o, "load,nonemptylayout,finished", 0);
     1755}
     1756
     1757/**
     1758 * @internal
     1759 * Reports the loading of a document has finished on frame.
     1760 *
     1761 * @param o Frame.
     1762 *
     1763 * Emits signal: "load,document,finished" with no parameters.
     1764 */
     1765void ewk_frame_load_document_finished(Evas_Object *o)
     1766{
     1767    evas_object_smart_callback_call(o, "load,document,finished", 0);
    16511768}
    16521769
  • trunk/WebKit/efl/ewk/ewk_frame.h

    r55958 r62787  
    4949 *  - "title,changed", const char*: title of the main frame changed.
    5050 *  - "uri,changed", const char*: uri of the main frame changed.
     51 *  - "load,document,finished", void: loading of a document has
     52 *    finished on this frame.
     53 *  - "load,nonemptylayout,finished", void: frame finished first
     54 *    non-empty layout.
    5155 *  - "load,started", void: frame started loading.
    5256 *  - "load,progress", double*: load progress changed (overall value
     
    5559 *    finished and as argument @c NULL if successfully or pointer to
    5660 *    structure defining the error.
     61 *  - "load,provisional", void: frame started provisional load.
     62 *  - "load,firstlayout,finished", void: frame finished first layout.
    5763 *  - "load,error", const Ewk_Frame_Load_Error*: reports load failed
    5864 *    and as argument a pointer to structure defining the error.
    5965 *  - "contents,size,changed", Evas_Coord[2]: reports contents size
    6066 *    changed due new layout, script actions or any other events.
     67 *  - "navigation,first", void: first navigation occurred.
     68 *  - "resource,request,new", Ewk_Frame_Resource_Request*: reports that
     69 *    there's a new resource request.
     70 *  - "resource,request,willsend", Ewk_Frame_Resource_Request*: a resource will
     71 *    be requested.
     72 *  - "state,save", void: frame's state will be saved as a history item.
    6173 */
    6274
     
    8092    const char *failing_url; /**< the url that failed to load */
    8193    Evas_Object *frame; /**< frame where the failure happened */
     94};
     95
     96/**
     97 * Structure used to report resource requests
     98 *
     99 * Details given before a resource is loaded on a given frame. It's used by
     100 * ewk_frame_request_will_send() to inform the details of a to-be-loaded
     101 * resource, allowing them to be overridden.
     102 */
     103typedef struct _Ewk_Frame_Resource_Request Ewk_Frame_Resource_Request;
     104struct _Ewk_Frame_Resource_Request {
     105    const char *url; /**< url of this resource */
     106    const unsigned long identifier; /**< resource's identifier. Can not be changed */
    82107};
    83108
  • trunk/WebKit/efl/ewk/ewk_private.h

    r62666 r62787  
    5353void             ewk_view_uri_changed(Evas_Object *o);
    5454void             ewk_view_load_started(Evas_Object *o);
     55void             ewk_view_load_provisional(Evas_Object *o);
    5556void             ewk_view_frame_main_load_started(Evas_Object *o);
     57void             ewk_view_frame_main_cleared(Evas_Object *o);
     58void             ewk_view_frame_main_icon_received(Evas_Object *o);
    5659void             ewk_view_load_finished(Evas_Object *o, const Ewk_Frame_Load_Error *error);
    5760void             ewk_view_load_error(Evas_Object *o, const Ewk_Frame_Load_Error *error);
    5861void             ewk_view_load_progress_changed(Evas_Object *o);
     62void             ewk_view_load_show(Evas_Object* o);
     63void             ewk_view_restore_state(Evas_Object *o, Evas_Object *frame);
    5964Evas_Object     *ewk_view_window_create(Evas_Object *o, Eina_Bool javascript, const WebCore::WindowFeatures* coreFeatures);
    6065
     
    119124
    120125void              ewk_frame_load_started(Evas_Object *o);
     126void              ewk_frame_load_provisional(Evas_Object *o);
     127void              ewk_frame_load_firstlayout_finished(Evas_Object *o);
     128void              ewk_frame_load_firstlayout_nonempty_finished(Evas_Object *o);
     129void              ewk_frame_load_document_finished(Evas_Object *o);
    121130void              ewk_frame_load_finished(Evas_Object *o, const char *error_domain, int error_code, Eina_Bool is_cancellation, const char *error_description, const char *failing_url);
    122131void              ewk_frame_load_error(Evas_Object *o, const char *error_domain, int error_code, Eina_Bool is_cancellation, const char *error_description, const char *failing_url);
    123132void              ewk_frame_load_progress_changed(Evas_Object *o);
     133
     134void              ewk_frame_request_will_send(Evas_Object *o, Ewk_Frame_Resource_Request *request);
     135void              ewk_frame_request_assign_identifier(Evas_Object *o, const Ewk_Frame_Resource_Request *request);
     136void              ewk_frame_view_state_save(Evas_Object *o, WebCore::HistoryItem* item);
     137
     138void              ewk_frame_did_perform_first_navigation(Evas_Object *o);
    124139
    125140void              ewk_frame_contents_size_changed(Evas_Object *o, Evas_Coord w, Evas_Coord h);
Note: See TracChangeset for help on using the changeset viewer.