Documentation moved to Docs/01-content
svn path=/trunk/netsurf/; revision=3050
This commit is contained in:
parent
d9137f99f7
commit
65b356ba75
|
@ -10,94 +10,6 @@
|
|||
* Content handling (interface).
|
||||
*
|
||||
* The content functions manipulate struct contents, which correspond to URLs.
|
||||
*
|
||||
* Each content has a type. The type is used to call a specific implementation
|
||||
* of functions such as content_process_data().
|
||||
*
|
||||
* The source data fetched from the URL is placed in the source_data buffer as
|
||||
* it arrives.
|
||||
*
|
||||
* Contents have an associated set of users, which are informed by a callback
|
||||
* when the state of the content changes or something interesting happens.
|
||||
*
|
||||
* Depending on the type of content, there may be either one content structure
|
||||
* per URL which is shared among all users, or one per URL per user. For
|
||||
* example, CONTENT_JPEGs are shared, while there is one CONTENT_HTML per user
|
||||
* (because each instance of an HTML page may have different parameters such as
|
||||
* window width). This is controlled by no_share in ::handler_map.
|
||||
*
|
||||
* The status of a content follows a fixed order. Certain content functions
|
||||
* change the state, and each change of state results in a message to all users
|
||||
* of the content. The diagram below shows this:
|
||||
* \dot
|
||||
* digraph status {
|
||||
* node [shape=plaintext, fontname=Helvetica, fontsize=9];
|
||||
* edge [fontname=Helvetica, fontsize=9];
|
||||
*
|
||||
* content_create -> TYPE_UNKNOWN [style=bold];
|
||||
* TYPE_UNKNOWN -> content_set_type [style=bold];
|
||||
* content_set_type -> LOADING [label=MSG_LOADING, style=bold];
|
||||
* content_set_type -> LOADING [label="MSG_NEWPTR\nMSG_LOADING"];
|
||||
* content_set_type -> ERROR [label=MSG_ERROR];
|
||||
* LOADING -> content_process_data [style=bold];
|
||||
* content_process_data -> LOADING [style=bold];
|
||||
* content_process_data -> ERROR [label=MSG_ERROR];
|
||||
* LOADING -> content_convert [style=bold];
|
||||
* content_convert -> READY [label=MSG_READY, style=bold];
|
||||
* content_convert -> DONE [label="MSG_READY\nMSG_DONE", style=bold];
|
||||
* content_convert -> ERROR [label=MSG_ERROR];
|
||||
* READY -> READY [style=bold];
|
||||
* READY -> DONE [label=MSG_DONE, style=bold];
|
||||
* READY -> content_stop;
|
||||
* content_stop -> DONE [label=MSG_DONE];
|
||||
*
|
||||
* TYPE_UNKNOWN [shape=ellipse];
|
||||
* LOADING [shape=ellipse];
|
||||
* READY [shape=ellipse];
|
||||
* DONE [shape=ellipse];
|
||||
* ERROR [shape=ellipse];
|
||||
* }
|
||||
* \enddot
|
||||
*
|
||||
* To implement a new content type, implement the following functions:
|
||||
*
|
||||
* - <i>type</i>_create(): called to initialise type-specific fields in the
|
||||
* content structure. Optional.
|
||||
*
|
||||
* - <i>type</i>_process_data(): called when some data arrives. Optional.
|
||||
*
|
||||
* - <i>type</i>_convert(): called when data has finished arriving. The
|
||||
* content needs to be converted for display. Must set the status to one of
|
||||
* CONTENT_STATUS_READY or CONTENT_STATUS_DONE if no error occurs. Optional,
|
||||
* but probably required for non-trivial types.
|
||||
*
|
||||
* - <i>type</i>_reformat(): called when, for example, the window has been
|
||||
* resized, and the content needs reformatting for the new size. Optional.
|
||||
*
|
||||
* - <i>type</i>_destroy(): called when the content is being destroyed. Free all
|
||||
* resources. Optional.
|
||||
*
|
||||
* - <i>type</i>_redraw(): called to plot the content to screen.
|
||||
*
|
||||
* - <i>type</i>_stop(): called when the user interrupts in status
|
||||
* CONTENT_STATUS_READY. Must stop any processing and set the status to
|
||||
* CONTENT_STATUS_DONE. Required iff the status can be CONTENT_STATUS_READY.
|
||||
*
|
||||
* - <i>type</i>_open(): called when a window containing the content is
|
||||
* opened. Probably only makes sense if no_share is set for the content type
|
||||
* in handler_map. Optional.
|
||||
*
|
||||
* - <i>type</i>_close(): called when the window containing the content is
|
||||
* closed. Optional.
|
||||
*
|
||||
* - <i>type</i>_create(), <i>type</i>_process_data(), <i>type</i>_convert():
|
||||
* if an error occurs, must broadcast CONTENT_MSG_ERROR and return false.
|
||||
* Optionally use warn_user() for serious errors. The _destroy function will
|
||||
* be called soon after.
|
||||
*
|
||||
* Each content structure is allocated using talloc, and all data related to a
|
||||
* content should be allocated as a child block of the content structure using
|
||||
* talloc. This will ensure that all memory used by a page is freed.
|
||||
*/
|
||||
|
||||
#ifndef _NETSURF_DESKTOP_CONTENT_H_
|
||||
|
|
Loading…
Reference in New Issue