mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-02-17 15:04:18 +03:00
Introduction to content structures.
svn path=/trunk/netsurf/; revision=2978
This commit is contained in:
parent
265db19c26
commit
bac1be667a
@ -4,21 +4,38 @@ Fetching, managing, and converting content
|
||||
The modules in the content directory provide the infrastructure for fetching
|
||||
data, managing it in memory, and converting it for display.
|
||||
|
||||
Struct Content
|
||||
--------------
|
||||
Each URL is stored in a struct ::content. This structure contains the
|
||||
content_type and a union with fields for each type of data (HTML, CSS,
|
||||
images). The content_* functions provide a general interface for handling these
|
||||
structures. For example, content_redraw() calls html_redraw() or
|
||||
nsjpeg_redraw(), etc., depending on the type of content. See content.h and
|
||||
content.c.
|
||||
|
||||
Fetching
|
||||
Contents
|
||||
--------
|
||||
The data related to each URL used by NetSurf is stored in a 'struct content'
|
||||
(known as a "content"). A content contains
|
||||
|
||||
* a 'content type' which corresponds to the MIME type of the URL (for example
|
||||
CONTENT_HTML, CONTENT_JPEG, or CONTENT_OTHER)
|
||||
* type independent data such as the URL and raw source bytes
|
||||
* a union of structs for type dependent data (for example 'struct
|
||||
content_html_data')
|
||||
|
||||
Contents are stored in a global linked list 'content_list', also known as the
|
||||
"memory cache".
|
||||
|
||||
The content_* functions provide a general interface for handling these
|
||||
structures. They use a table of handlers to call type-specific code. For
|
||||
example, content_redraw() may call html_redraw() or nsjpeg_redraw() depending on
|
||||
the type of content.
|
||||
|
||||
Each content has a list of users. A user is a callback function which is called
|
||||
when something interesting happens to the content (for example, it's ready to be
|
||||
displayed). Examples of users are browser windows (of HTML contents) and HTML
|
||||
contents (of JPEG contents).
|
||||
|
||||
Some content types may not be shared among users: an HTML content is dependent
|
||||
on the width of the window, so sharing by two or more windows wouldn't work.
|
||||
Thus there may be more than one content with the same URL in memory.
|
||||
|
||||
Creating and fetching contents
|
||||
------------------------------
|
||||
A high-level interface to starting the process of fetching and converting an URL
|
||||
is provided by the fetchcache functions, which check the memory cache for a url
|
||||
and fetch, convert, and cache it if not present. See fetchcache.h and
|
||||
fetchcache.c.
|
||||
and fetch, convert, and cache it if not present.
|
||||
|
||||
The fetch module provides a low-level URL fetching interface. See fetch.h and
|
||||
fetch.c.
|
||||
The fetch module provides a low-level URL fetching interface.
|
||||
|
Loading…
x
Reference in New Issue
Block a user