summaryrefslogtreecommitdiff
path: root/Docs
diff options
context:
space:
mode:
Diffstat (limited to 'Docs')
-rw-r--r--Docs/01-content45
1 files changed, 31 insertions, 14 deletions
diff --git a/Docs/01-content b/Docs/01-content
index 4db4bade8..3cfc47d86 100644
--- a/Docs/01-content
+++ b/Docs/01-content
@@ -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.