Gitweb links:
...log
http://git.netsurf-browser.org/libnslayout.git/shortlog/9b0852e12713b44d4...
...commit
http://git.netsurf-browser.org/libnslayout.git/commit/9b0852e12713b44d4dd...
...tree
http://git.netsurf-browser.org/libnslayout.git/tree/9b0852e12713b44d4dd82...
The branch, master has been updated
via 9b0852e12713b44d4dd82ff67496c84a19af84b3 (commit)
via b4ef9675d824597a2d1bfc2c0a2c0e3b29ee17a6 (commit)
from 91366856f641dc74b6ad05168b65e4c38976d48a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/libnslayout.git/commit/?id=9b0852e12713b44...
commit 9b0852e12713b44d4dd82ff67496c84a19af84b3
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Add request callback wrappers.
diff --git a/src/request.h b/src/request.h
new file mode 100644
index 0000000..c28468e
--- /dev/null
+++ b/src/request.h
@@ -0,0 +1,141 @@
+/*
+ * This file is part of LibNSLayout
+ * Licensed under the ISC License,
http://opensource.org/licenses/ISC
+ * Copyright 2015 Michael Drake <tlsa(a)netsurf-browser.org>
+ */
+
+/** \file src/request.h
+ * Client callback wrappers
+ */
+
+#ifndef nslayout_request_h_
+#define nslayout_request_h_
+
+#include <libnslayout/nslayout.h>
+
+/**
+ * Perform GET_RESOURCE client callback
+ *
+ * \param[in] layout Layout object that the request concerns.
+ * \param[in] url Absolute URL to request replaced object handle for.
+ * \param[out] replaced Returns the replaced element content handle.
+ * \return NSLAYOUT_OK on success, appropriate error otherwise.
+ */
+static inline nslayout_error nsl_request_get_resource(
+ nslayout_layout *layout,
+ const char *url,
+ nslayout_replaced **replaced)
+{
+ nslayout_error err;
+ nslayout_request req;
+
+ req.type = NSLAYOUT_GET_RESOURCE;
+ req.request.get_resource.url = url;
+
+ err = layout->cb(layout, layout->pw, &req);
+
+ *replaced = *req.response.get_resource.replaced;
+ return err;
+}
+
+/**
+ * Perform CREATE_REPLACED client callback
+ *
+ * \param[in] layout Layout object that the request concerns.
+ * \param[in] element DOM element that needs replacement object.
+ * \param[out] replaced Returns the replaced element content handle.
+ * \return NSLAYOUT_OK on success, appropriate error otherwise.
+ */
+static inline nslayout_error nsl_request_create_replaced(
+ nslayout_layout *layout,
+ dom_element *element,
+ nslayout_replaced **replaced)
+{
+ nslayout_error err;
+ nslayout_request req;
+
+ req.type = NSLAYOUT_CREATE_REPLACED;
+ req.request.create_replaced.element = element;
+
+ err = layout->cb(layout, layout->pw, &req);
+
+ *replaced = *req.response.create_replaced.replaced;
+ return err;
+}
+
+/**
+ * Perform RENDER client callback
+ *
+ * \param[in] layout Layout object being rendered.
+ * \param[in] list Render list to render.
+ * \return NSLAYOUT_OK on success, appropriate error otherwise.
+ */
+static inline nslayout_error nsl_request_render(
+ nslayout_layout *layout,
+ nslayout_render_list *list)
+{
+ nslayout_error err;
+ nslayout_request req;
+
+ req.type = NSLAYOUT_RENDER;
+ req.request.render.list = list;
+
+ err = layout->cb(layout, layout->pw, &req);
+
+ return err;
+}
+
+/**
+ * Perform SET_EXTENTS client callback
+ *
+ * \param[in] layout Layout object that the request concerns.
+ * \param[in] width The layout's full width.
+ * \param[in] height The layout's full height.
+ * \return NSLAYOUT_OK on success, appropriate error otherwise.
+ */
+static inline nslayout_error nsl_request_set_extents(
+ nslayout_layout *layout,
+ unsigned int width,
+ unsigned int height)
+{
+ nslayout_error err;
+ nslayout_request req;
+
+ req.type = NSLAYOUT_SET_EXTENTS;
+ req.request.set_extents.width = width;
+ req.request.set_extents.height = height;
+
+ err = layout->cb(layout, layout->pw, &req);
+
+ return err;
+}
+
+/**
+ * Perform GET_INTRINSIC_SIZE client callback
+ *
+ * \param[in] layout Layout object that the request concerns.
+ * \param[in] replaced Replaced object to get intrinsic size of.
+ * \param[out] width Returns the replaced object's width.
+ * \param[out] height Returns the replaced object's height.
+ * \return NSLAYOUT_OK on success, appropriate error otherwise.
+ */
+static inline nslayout_error nsl_request_get_intrinsic_size(
+ nslayout_layout *layout,
+ nslayout_replaced *replaced,
+ unsigned int *width,
+ unsigned int *height)
+{
+ nslayout_error err;
+ nslayout_request req;
+
+ req.type = NSLAYOUT_GET_INTRINSIC_SIZE;
+ req.request.get_intrinsic_size.replaced = replaced;
+
+ err = layout->cb(layout, layout->pw, &req);
+
+ *width = *req.response.get_intrinsic_size.width;
+ *height = *req.response.get_intrinsic_size.height;
+ return err;
+}
+
+#endif
commitdiff
http://git.netsurf-browser.org/libnslayout.git/commit/?id=b4ef9675d824597...
commit b4ef9675d824597a2d1bfc2c0a2c0e3b29ee17a6
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Update documentation and minor fixes.
diff --git a/docs/Doxyfile b/docs/Doxyfile
new file mode 100644
index 0000000..56c3433
--- /dev/null
+++ b/docs/Doxyfile
@@ -0,0 +1,261 @@
+DOXYFILE_ENCODING = UTF-8
+PROJECT_NAME = "LibNSLayout"
+PROJECT_NUMBER =
+PROJECT_BRIEF = "The NetSurf Browser Layout Engine"
+PROJECT_LOGO =
+OUTPUT_DIRECTORY = docs/
+CREATE_SUBDIRS = NO
+ALLOW_UNICODE_NAMES = NO
+OUTPUT_LANGUAGE = English
+BRIEF_MEMBER_DESC = YES
+REPEAT_BRIEF = YES
+ABBREVIATE_BRIEF =
+ALWAYS_DETAILED_SEC = NO
+INLINE_INHERITED_MEMB = NO
+FULL_PATH_NAMES = YES
+STRIP_FROM_PATH =
+STRIP_FROM_INC_PATH =
+SHORT_NAMES = NO
+JAVADOC_AUTOBRIEF = NO
+QT_AUTOBRIEF = NO
+MULTILINE_CPP_IS_BRIEF = NO
+INHERIT_DOCS = YES
+SEPARATE_MEMBER_PAGES = NO
+TAB_SIZE = 8
+ALIASES =
+TCL_SUBST =
+OPTIMIZE_OUTPUT_FOR_C = NO
+OPTIMIZE_OUTPUT_JAVA = NO
+OPTIMIZE_FOR_FORTRAN = NO
+OPTIMIZE_OUTPUT_VHDL = NO
+EXTENSION_MAPPING =
+MARKDOWN_SUPPORT = YES
+AUTOLINK_SUPPORT = YES
+BUILTIN_STL_SUPPORT = NO
+CPP_CLI_SUPPORT = NO
+SIP_SUPPORT = NO
+IDL_PROPERTY_SUPPORT = YES
+DISTRIBUTE_GROUP_DOC = NO
+SUBGROUPING = YES
+INLINE_GROUPED_CLASSES = NO
+INLINE_SIMPLE_STRUCTS = NO
+TYPEDEF_HIDES_STRUCT = NO
+LOOKUP_CACHE_SIZE = 0
+EXTRACT_ALL = NO
+EXTRACT_PRIVATE = NO
+EXTRACT_PACKAGE = NO
+EXTRACT_STATIC = YES
+EXTRACT_LOCAL_CLASSES = YES
+EXTRACT_LOCAL_METHODS = NO
+EXTRACT_ANON_NSPACES = NO
+HIDE_UNDOC_MEMBERS = NO
+HIDE_UNDOC_CLASSES = NO
+HIDE_FRIEND_COMPOUNDS = NO
+HIDE_IN_BODY_DOCS = NO
+INTERNAL_DOCS = NO
+CASE_SENSE_NAMES = YES
+HIDE_SCOPE_NAMES = NO
+SHOW_INCLUDE_FILES = YES
+SHOW_GROUPED_MEMB_INC = NO
+FORCE_LOCAL_INCLUDES = NO
+INLINE_INFO = YES
+SORT_MEMBER_DOCS = YES
+SORT_BRIEF_DOCS = NO
+SORT_MEMBERS_CTORS_1ST = NO
+SORT_GROUP_NAMES = NO
+SORT_BY_SCOPE_NAME = NO
+STRICT_PROTO_MATCHING = NO
+GENERATE_TODOLIST = YES
+GENERATE_TESTLIST = YES
+GENERATE_BUGLIST = YES
+ENABLED_SECTIONS =
+MAX_INITIALIZER_LINES = 30
+SHOW_USED_FILES = YES
+SHOW_FILES = YES
+SHOW_NAMESPACES = YES
+FILE_VERSION_FILTER =
+LAYOUT_FILE =
+CITE_BIB_FILES =
+QUIET = NO
+WARNINGS = YES
+WARN_IF_UNDOCUMENTED = YES
+WARN_IF_DOC_ERROR = YES
+WARN_NO_PARAMDOC = NO
+WARN_FORMAT = "$file:$line: $text"
+WARN_LOGFILE =
+INPUT =
+INPUT_ENCODING = UTF-8
+FILE_PATTERNS =
+RECURSIVE = YES
+EXCLUDE = test/
+EXCLUDE_SYMLINKS = NO
+EXCLUDE_PATTERNS =
+EXCLUDE_SYMBOLS =
+EXAMPLE_PATH =
+EXAMPLE_PATTERNS =
+EXAMPLE_RECURSIVE = YES
+IMAGE_PATH =
+INPUT_FILTER =
+FILTER_PATTERNS =
+FILTER_SOURCE_FILES = NO
+FILTER_SOURCE_PATTERNS =
+USE_MDFILE_AS_MAINPAGE =
+SOURCE_BROWSER = NO
+INLINE_SOURCES = NO
+STRIP_CODE_COMMENTS = YES
+REFERENCED_BY_RELATION = NO
+REFERENCES_RELATION = NO
+REFERENCES_LINK_SOURCE = YES
+SOURCE_TOOLTIPS = YES
+USE_HTAGS = NO
+VERBATIM_HEADERS = YES
+CLANG_ASSISTED_PARSING = NO
+CLANG_OPTIONS =
+ALPHABETICAL_INDEX = YES
+COLS_IN_ALPHA_INDEX = 5
+IGNORE_PREFIX =
+GENERATE_HTML = YES
+HTML_OUTPUT = html
+HTML_FILE_EXTENSION = .html
+HTML_HEADER =
+HTML_FOOTER =
+HTML_STYLESHEET =
+HTML_EXTRA_STYLESHEET =
+HTML_EXTRA_FILES =
+HTML_COLORSTYLE_HUE = 220
+HTML_COLORSTYLE_SAT = 100
+HTML_COLORSTYLE_GAMMA = 80
+HTML_TIMESTAMP = YES
+HTML_DYNAMIC_SECTIONS = NO
+HTML_INDEX_NUM_ENTRIES = 100
+GENERATE_DOCSET = NO
+DOCSET_FEEDNAME = "Doxygen generated docs"
+DOCSET_BUNDLE_ID = org.doxygen.Project
+DOCSET_PUBLISHER_ID = org.doxygen.Publisher
+DOCSET_PUBLISHER_NAME = Publisher
+GENERATE_HTMLHELP = NO
+CHM_FILE =
+HHC_LOCATION =
+GENERATE_CHI = NO
+CHM_INDEX_ENCODING =
+BINARY_TOC = NO
+TOC_EXPAND = NO
+GENERATE_QHP = NO
+QCH_FILE =
+QHP_NAMESPACE = org.doxygen.Project
+QHP_VIRTUAL_FOLDER = doc
+QHP_CUST_FILTER_NAME =
+QHP_CUST_FILTER_ATTRS =
+QHP_SECT_FILTER_ATTRS =
+QHG_LOCATION =
+GENERATE_ECLIPSEHELP = NO
+ECLIPSE_DOC_ID = org.doxygen.Project
+DISABLE_INDEX = NO
+GENERATE_TREEVIEW = NO
+ENUM_VALUES_PER_LINE = 4
+TREEVIEW_WIDTH = 250
+EXT_LINKS_IN_WINDOW = NO
+FORMULA_FONTSIZE = 10
+FORMULA_TRANSPARENT = YES
+USE_MATHJAX = NO
+MATHJAX_FORMAT = HTML-CSS
+MATHJAX_RELPATH =
http://cdn.mathjax.org/mathjax/latest
+MATHJAX_EXTENSIONS =
+MATHJAX_CODEFILE =
+SEARCHENGINE = YES
+SERVER_BASED_SEARCH = NO
+EXTERNAL_SEARCH = NO
+SEARCHENGINE_URL =
+SEARCHDATA_FILE = searchdata.xml
+EXTERNAL_SEARCH_ID =
+EXTRA_SEARCH_MAPPINGS =
+GENERATE_LATEX = NO
+LATEX_OUTPUT = latex
+LATEX_CMD_NAME = latex
+MAKEINDEX_CMD_NAME = makeindex
+COMPACT_LATEX = NO
+PAPER_TYPE = a4
+EXTRA_PACKAGES =
+LATEX_HEADER =
+LATEX_FOOTER =
+LATEX_EXTRA_STYLESHEET =
+LATEX_EXTRA_FILES =
+PDF_HYPERLINKS = YES
+USE_PDFLATEX = YES
+LATEX_BATCHMODE = NO
+LATEX_HIDE_INDICES = NO
+LATEX_SOURCE_CODE = NO
+LATEX_BIB_STYLE = plain
+GENERATE_RTF = NO
+RTF_OUTPUT = rtf
+COMPACT_RTF = NO
+RTF_HYPERLINKS = NO
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
+RTF_SOURCE_CODE = NO
+GENERATE_MAN = NO
+MAN_OUTPUT = man
+MAN_EXTENSION = .3
+MAN_SUBDIR =
+MAN_LINKS = NO
+GENERATE_XML = NO
+XML_OUTPUT = xml
+XML_PROGRAMLISTING = YES
+GENERATE_DOCBOOK = NO
+DOCBOOK_OUTPUT = docbook
+DOCBOOK_PROGRAMLISTING = NO
+GENERATE_AUTOGEN_DEF = NO
+GENERATE_PERLMOD = NO
+PERLMOD_LATEX = NO
+PERLMOD_PRETTY = YES
+PERLMOD_MAKEVAR_PREFIX =
+ENABLE_PREPROCESSING = YES
+MACRO_EXPANSION = NO
+EXPAND_ONLY_PREDEF = NO
+SEARCH_INCLUDES = YES
+INCLUDE_PATH =
+INCLUDE_FILE_PATTERNS =
+PREDEFINED =
+EXPAND_AS_DEFINED =
+SKIP_FUNCTION_MACROS = YES
+TAGFILES =
+GENERATE_TAGFILE =
+ALLEXTERNALS = NO
+EXTERNAL_GROUPS = YES
+EXTERNAL_PAGES = YES
+PERL_PATH = /usr/bin/perl
+CLASS_DIAGRAMS = YES
+MSCGEN_PATH =
+DIA_PATH =
+HIDE_UNDOC_RELATIONS = YES
+HAVE_DOT = YES
+DOT_NUM_THREADS = 0
+DOT_FONTNAME = Helvetica
+DOT_FONTSIZE = 10
+DOT_FONTPATH =
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = YES
+GROUP_GRAPHS = YES
+UML_LOOK = NO
+UML_LIMIT_NUM_FIELDS = 10
+TEMPLATE_RELATIONS = NO
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = YES
+CALL_GRAPH = NO
+CALLER_GRAPH = NO
+GRAPHICAL_HIERARCHY = YES
+DIRECTORY_GRAPH = YES
+DOT_IMAGE_FORMAT = png
+INTERACTIVE_SVG = NO
+DOT_PATH =
+DOTFILE_DIRS =
+MSCFILE_DIRS =
+DIAFILE_DIRS =
+PLANTUML_JAR_PATH =
+PLANTUML_INCLUDE_PATH =
+DOT_GRAPH_MAX_NODES = 50
+MAX_DOT_GRAPH_DEPTH = 0
+DOT_TRANSPARENT = NO
+DOT_MULTI_TARGETS = NO
+GENERATE_LEGEND = YES
+DOT_CLEANUP = YES
diff --git a/include/libnslayout/nslayout.h b/include/libnslayout/nslayout.h
index f42bed7..2610e42 100644
--- a/include/libnslayout/nslayout.h
+++ b/include/libnslayout/nslayout.h
@@ -5,6 +5,10 @@
* Copyright 2015 John-Mark Bell <jmb(a)netsurf-browser.org>
*/
+/** \file include/libnslayout/nslayout.h
+ * Layout object handling
+ */
+
#ifndef nslayout_nslayout_h_
#define nslayout_nslayout_h_
@@ -21,10 +25,10 @@ typedef void nslayout_replaced;
/** A rectangle */
typedef struct nslayout_rect {
- int x;
- int y;
- int w;
- int h;
+ int x; /**< X position of left of rect in px */
+ int y; /**< Y position of top of rect in px */
+ int w; /**< Width of rect in px */
+ int h; /**< Height of rect in px */
} nslayout_rect;
/** Render list */
@@ -41,7 +45,7 @@ typedef struct nslayout_layout nslayout_layout;
*/
typedef struct nslayout_request {
/** Request type */
- enum type {
+ enum {
NSLAYOUT_GET_RESOURCE,
NSLAYOUT_CREATE_REPLACED,
NSLAYOUT_RENDER,
@@ -105,25 +109,25 @@ nslayout_error nslayout_fini(void);
/**
* LibNSLayout client callback function
*
- * \param req The request details.
- * \param layout The layout we're making a request for.
- * \param pw The client's private data for this layout.
+ * \param[in] layout The layout we're making a request for.
+ * \param[in] pw The client's private data for this layout.
+ * \param[in,out] req The request details.
* \return NSLAYOUT_OK on success, appropriate error otherwise.
*/
typedef nslayout_error (*nslayout_callback)(
- nslayout_request *req,
nslayout_layout *layout,
- void *pw);
+ void *pw,
+ nslayout_request *req);
/**
* Create a Layout object for a given DOM
*
- * \param doc The LibDOM document to build a layout for.
- * \param css_ctx The LibCSS selection context for the document.
- * \param media The LibCSS media to use when selecting for this layout.
- * \param cb The client's private data for this layout.
- * \param pw The client's private data for this layout.
- * \param layout Returns a pointer to the created layout object.
+ * \param[in] doc The LibDOM document to build a layout for.
+ * \param[in] css_ctx The LibCSS selection context for the document.
+ * \param[in] media The LibCSS media to use when selecting.
+ * \param[in] cb The client's private data for this layout.
+ * \param[in] pw The client's private data for this layout.
+ * \param[out] layout Returns a pointer to the created layout object.
* \return NSLAYOUT_OK on success, appropriate error otherwise.
*/
nslayout_error nslayout_layout_create(
@@ -137,7 +141,7 @@ nslayout_error nslayout_layout_create(
/**
* Destroy a Layout object
*
- * \param layout Returns a pointer to the created layout object.
+ * \param[in] layout Returns a pointer to the created layout object.
* \return NSLAYOUT_OK on success, appropriate error otherwise.
*/
nslayout_error nslayout_layout_destroy(
@@ -150,10 +154,10 @@ nslayout_error nslayout_layout_destroy(
* data structures for the document, but will not start to position
* things and will not emit render lists.
*
- * \param layout Layout to set viewport for.
- * \param viewport Viewport dimensions and offset.
- * \param scale Rendering scale.
- * \param dpi DPI of render target with viewport.
+ * \param[in] layout Layout to set viewport for.
+ * \param[in] viewport Viewport dimensions and offset.
+ * \param[in] scale Rendering scale.
+ * \param[in] dpi DPI of render target with viewport.
* \return NSLAYOUT_OK on success, appropriate error otherwise.
*/
nslayout_error nslayout_update_viewport(
@@ -163,23 +167,25 @@ nslayout_error nslayout_update_viewport(
unsigned int dpi);
/**
- * Find the top-most element at a given point, in terms of z-order.
+ * Find the area occupied by element.
*
- * \param layout Layout to locate an element in.
- * \param element Updated to area with position relative to viewport.
+ * \param[in] layout Layout to locate an element in.
+ * \param[in] element Element to get area of.
+ * \param[out] area Returns area with position relative to viewport.
* \return NSLAYOUT_OK on success, appropriate error otherwise.
*/
nslayout_error nslayout_element_get_location(
nslayout_layout *layout,
+ dom_element *element,
nslayout_rect *area);
/**
* Find the top-most element at a given point, in terms of z-order.
*
- * \param layout Layout to find an element in.
- * \param x Mouse x-coordinate (viewport relative).
- * \param y Mouse y-coordinate (viewport relative).
- * \param element Updated to point at the element we found.
+ * \param[in] layout Layout to find an element in.
+ * \param[in] x Mouse x-coordinate (viewport relative).
+ * \param[in] y Mouse y-coordinate (viewport relative).
+ * \param[out] element Returns the element we found.
* \return NSLAYOUT_OK on success, appropriate error otherwise.
*/
nslayout_error nslayout_element_at_point(
@@ -191,10 +197,10 @@ nslayout_error nslayout_element_at_point(
/**
* Mark an element (or part of it) as needing redraw.
*
- * \param layout Layout to indicate redraw is required for.
- * \param element Element to mark as needing redraw.
- * \param rel_area Area of element to redraw relative to object's top-left.
- * May be NULL, to redraw whole element.
+ * \param[in] layout Layout to indicate redraw is required for.
+ * \param[in] element Element to mark as needing redraw.
+ * \param[in] rel_area Area of element to redraw relative to object's top-left.
+ * May be NULL, to redraw whole element.
* \return NSLAYOUT_OK on success, appropriate error otherwise.
*/
nslayout_error nslayout_layout_dirty_element(
@@ -205,8 +211,8 @@ nslayout_error nslayout_layout_dirty_element(
/**
* Mark an area as needing redraw.
*
- * \param layout Layout to indicate redraw is required for.
- * \param area Area to redraw relative to viewport's top-left.
+ * \param[in] layout Layout to indicate redraw is required for.
+ * \param[in] area Area to redraw relative to viewport's top-left.
* \return NSLAYOUT_OK on success, appropriate error otherwise.
*/
nslayout_error nslayout_layout_dirty_area(
diff --git a/src/layout.c b/src/layout.c
index 43570fb..915475b 100644
--- a/src/layout.c
+++ b/src/layout.c
@@ -4,6 +4,10 @@
* Copyright 2015 Michael Drake <tlsa(a)netsurf-browser.org>
*/
+/** \file src/layout.c
+ * Layout object handling
+ */
+
#include <assert.h>
#include <stdlib.h>
diff --git a/src/layout.h b/src/layout.h
index 6e8f4c9..9946663 100644
--- a/src/layout.h
+++ b/src/layout.h
@@ -4,6 +4,10 @@
* Copyright 2015 Michael Drake <tlsa(a)netsurf-browser.org>
*/
+/** \file src/layout.h
+ * Layout object handling
+ */
+
#ifndef nslayout_layout_h_
#define nslayout_layout_h_
diff --git a/test/basic-layout-tests.c b/test/basic-layout-tests.c
index 6dec991..cdaf5e2 100644
--- a/test/basic-layout-tests.c
+++ b/test/basic-layout-tests.c
@@ -17,9 +17,9 @@
int pw;
static nslayout_error nslayout_test_callback(
- nslayout_request *req,
nslayout_layout *layout,
- void *pw)
+ void *pw,
+ nslayout_request *req)
{
UNUSED(req);
UNUSED(layout);
-----------------------------------------------------------------------
Summary of changes:
docs/Doxyfile | 261 ++++++++++++++++++++++++++++++++++++++++
include/libnslayout/nslayout.h | 74 ++++++------
src/layout.c | 4 +
src/layout.h | 4 +
src/request.h | 141 ++++++++++++++++++++++
test/basic-layout-tests.c | 4 +-
6 files changed, 452 insertions(+), 36 deletions(-)
create mode 100644 docs/Doxyfile
create mode 100644 src/request.h
diff --git a/docs/Doxyfile b/docs/Doxyfile
new file mode 100644
index 0000000..56c3433
--- /dev/null
+++ b/docs/Doxyfile
@@ -0,0 +1,261 @@
+DOXYFILE_ENCODING = UTF-8
+PROJECT_NAME = "LibNSLayout"
+PROJECT_NUMBER =
+PROJECT_BRIEF = "The NetSurf Browser Layout Engine"
+PROJECT_LOGO =
+OUTPUT_DIRECTORY = docs/
+CREATE_SUBDIRS = NO
+ALLOW_UNICODE_NAMES = NO
+OUTPUT_LANGUAGE = English
+BRIEF_MEMBER_DESC = YES
+REPEAT_BRIEF = YES
+ABBREVIATE_BRIEF =
+ALWAYS_DETAILED_SEC = NO
+INLINE_INHERITED_MEMB = NO
+FULL_PATH_NAMES = YES
+STRIP_FROM_PATH =
+STRIP_FROM_INC_PATH =
+SHORT_NAMES = NO
+JAVADOC_AUTOBRIEF = NO
+QT_AUTOBRIEF = NO
+MULTILINE_CPP_IS_BRIEF = NO
+INHERIT_DOCS = YES
+SEPARATE_MEMBER_PAGES = NO
+TAB_SIZE = 8
+ALIASES =
+TCL_SUBST =
+OPTIMIZE_OUTPUT_FOR_C = NO
+OPTIMIZE_OUTPUT_JAVA = NO
+OPTIMIZE_FOR_FORTRAN = NO
+OPTIMIZE_OUTPUT_VHDL = NO
+EXTENSION_MAPPING =
+MARKDOWN_SUPPORT = YES
+AUTOLINK_SUPPORT = YES
+BUILTIN_STL_SUPPORT = NO
+CPP_CLI_SUPPORT = NO
+SIP_SUPPORT = NO
+IDL_PROPERTY_SUPPORT = YES
+DISTRIBUTE_GROUP_DOC = NO
+SUBGROUPING = YES
+INLINE_GROUPED_CLASSES = NO
+INLINE_SIMPLE_STRUCTS = NO
+TYPEDEF_HIDES_STRUCT = NO
+LOOKUP_CACHE_SIZE = 0
+EXTRACT_ALL = NO
+EXTRACT_PRIVATE = NO
+EXTRACT_PACKAGE = NO
+EXTRACT_STATIC = YES
+EXTRACT_LOCAL_CLASSES = YES
+EXTRACT_LOCAL_METHODS = NO
+EXTRACT_ANON_NSPACES = NO
+HIDE_UNDOC_MEMBERS = NO
+HIDE_UNDOC_CLASSES = NO
+HIDE_FRIEND_COMPOUNDS = NO
+HIDE_IN_BODY_DOCS = NO
+INTERNAL_DOCS = NO
+CASE_SENSE_NAMES = YES
+HIDE_SCOPE_NAMES = NO
+SHOW_INCLUDE_FILES = YES
+SHOW_GROUPED_MEMB_INC = NO
+FORCE_LOCAL_INCLUDES = NO
+INLINE_INFO = YES
+SORT_MEMBER_DOCS = YES
+SORT_BRIEF_DOCS = NO
+SORT_MEMBERS_CTORS_1ST = NO
+SORT_GROUP_NAMES = NO
+SORT_BY_SCOPE_NAME = NO
+STRICT_PROTO_MATCHING = NO
+GENERATE_TODOLIST = YES
+GENERATE_TESTLIST = YES
+GENERATE_BUGLIST = YES
+ENABLED_SECTIONS =
+MAX_INITIALIZER_LINES = 30
+SHOW_USED_FILES = YES
+SHOW_FILES = YES
+SHOW_NAMESPACES = YES
+FILE_VERSION_FILTER =
+LAYOUT_FILE =
+CITE_BIB_FILES =
+QUIET = NO
+WARNINGS = YES
+WARN_IF_UNDOCUMENTED = YES
+WARN_IF_DOC_ERROR = YES
+WARN_NO_PARAMDOC = NO
+WARN_FORMAT = "$file:$line: $text"
+WARN_LOGFILE =
+INPUT =
+INPUT_ENCODING = UTF-8
+FILE_PATTERNS =
+RECURSIVE = YES
+EXCLUDE = test/
+EXCLUDE_SYMLINKS = NO
+EXCLUDE_PATTERNS =
+EXCLUDE_SYMBOLS =
+EXAMPLE_PATH =
+EXAMPLE_PATTERNS =
+EXAMPLE_RECURSIVE = YES
+IMAGE_PATH =
+INPUT_FILTER =
+FILTER_PATTERNS =
+FILTER_SOURCE_FILES = NO
+FILTER_SOURCE_PATTERNS =
+USE_MDFILE_AS_MAINPAGE =
+SOURCE_BROWSER = NO
+INLINE_SOURCES = NO
+STRIP_CODE_COMMENTS = YES
+REFERENCED_BY_RELATION = NO
+REFERENCES_RELATION = NO
+REFERENCES_LINK_SOURCE = YES
+SOURCE_TOOLTIPS = YES
+USE_HTAGS = NO
+VERBATIM_HEADERS = YES
+CLANG_ASSISTED_PARSING = NO
+CLANG_OPTIONS =
+ALPHABETICAL_INDEX = YES
+COLS_IN_ALPHA_INDEX = 5
+IGNORE_PREFIX =
+GENERATE_HTML = YES
+HTML_OUTPUT = html
+HTML_FILE_EXTENSION = .html
+HTML_HEADER =
+HTML_FOOTER =
+HTML_STYLESHEET =
+HTML_EXTRA_STYLESHEET =
+HTML_EXTRA_FILES =
+HTML_COLORSTYLE_HUE = 220
+HTML_COLORSTYLE_SAT = 100
+HTML_COLORSTYLE_GAMMA = 80
+HTML_TIMESTAMP = YES
+HTML_DYNAMIC_SECTIONS = NO
+HTML_INDEX_NUM_ENTRIES = 100
+GENERATE_DOCSET = NO
+DOCSET_FEEDNAME = "Doxygen generated docs"
+DOCSET_BUNDLE_ID = org.doxygen.Project
+DOCSET_PUBLISHER_ID = org.doxygen.Publisher
+DOCSET_PUBLISHER_NAME = Publisher
+GENERATE_HTMLHELP = NO
+CHM_FILE =
+HHC_LOCATION =
+GENERATE_CHI = NO
+CHM_INDEX_ENCODING =
+BINARY_TOC = NO
+TOC_EXPAND = NO
+GENERATE_QHP = NO
+QCH_FILE =
+QHP_NAMESPACE = org.doxygen.Project
+QHP_VIRTUAL_FOLDER = doc
+QHP_CUST_FILTER_NAME =
+QHP_CUST_FILTER_ATTRS =
+QHP_SECT_FILTER_ATTRS =
+QHG_LOCATION =
+GENERATE_ECLIPSEHELP = NO
+ECLIPSE_DOC_ID = org.doxygen.Project
+DISABLE_INDEX = NO
+GENERATE_TREEVIEW = NO
+ENUM_VALUES_PER_LINE = 4
+TREEVIEW_WIDTH = 250
+EXT_LINKS_IN_WINDOW = NO
+FORMULA_FONTSIZE = 10
+FORMULA_TRANSPARENT = YES
+USE_MATHJAX = NO
+MATHJAX_FORMAT = HTML-CSS
+MATHJAX_RELPATH =
http://cdn.mathjax.org/mathjax/latest
+MATHJAX_EXTENSIONS =
+MATHJAX_CODEFILE =
+SEARCHENGINE = YES
+SERVER_BASED_SEARCH = NO
+EXTERNAL_SEARCH = NO
+SEARCHENGINE_URL =
+SEARCHDATA_FILE = searchdata.xml
+EXTERNAL_SEARCH_ID =
+EXTRA_SEARCH_MAPPINGS =
+GENERATE_LATEX = NO
+LATEX_OUTPUT = latex
+LATEX_CMD_NAME = latex
+MAKEINDEX_CMD_NAME = makeindex
+COMPACT_LATEX = NO
+PAPER_TYPE = a4
+EXTRA_PACKAGES =
+LATEX_HEADER =
+LATEX_FOOTER =
+LATEX_EXTRA_STYLESHEET =
+LATEX_EXTRA_FILES =
+PDF_HYPERLINKS = YES
+USE_PDFLATEX = YES
+LATEX_BATCHMODE = NO
+LATEX_HIDE_INDICES = NO
+LATEX_SOURCE_CODE = NO
+LATEX_BIB_STYLE = plain
+GENERATE_RTF = NO
+RTF_OUTPUT = rtf
+COMPACT_RTF = NO
+RTF_HYPERLINKS = NO
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
+RTF_SOURCE_CODE = NO
+GENERATE_MAN = NO
+MAN_OUTPUT = man
+MAN_EXTENSION = .3
+MAN_SUBDIR =
+MAN_LINKS = NO
+GENERATE_XML = NO
+XML_OUTPUT = xml
+XML_PROGRAMLISTING = YES
+GENERATE_DOCBOOK = NO
+DOCBOOK_OUTPUT = docbook
+DOCBOOK_PROGRAMLISTING = NO
+GENERATE_AUTOGEN_DEF = NO
+GENERATE_PERLMOD = NO
+PERLMOD_LATEX = NO
+PERLMOD_PRETTY = YES
+PERLMOD_MAKEVAR_PREFIX =
+ENABLE_PREPROCESSING = YES
+MACRO_EXPANSION = NO
+EXPAND_ONLY_PREDEF = NO
+SEARCH_INCLUDES = YES
+INCLUDE_PATH =
+INCLUDE_FILE_PATTERNS =
+PREDEFINED =
+EXPAND_AS_DEFINED =
+SKIP_FUNCTION_MACROS = YES
+TAGFILES =
+GENERATE_TAGFILE =
+ALLEXTERNALS = NO
+EXTERNAL_GROUPS = YES
+EXTERNAL_PAGES = YES
+PERL_PATH = /usr/bin/perl
+CLASS_DIAGRAMS = YES
+MSCGEN_PATH =
+DIA_PATH =
+HIDE_UNDOC_RELATIONS = YES
+HAVE_DOT = YES
+DOT_NUM_THREADS = 0
+DOT_FONTNAME = Helvetica
+DOT_FONTSIZE = 10
+DOT_FONTPATH =
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = YES
+GROUP_GRAPHS = YES
+UML_LOOK = NO
+UML_LIMIT_NUM_FIELDS = 10
+TEMPLATE_RELATIONS = NO
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = YES
+CALL_GRAPH = NO
+CALLER_GRAPH = NO
+GRAPHICAL_HIERARCHY = YES
+DIRECTORY_GRAPH = YES
+DOT_IMAGE_FORMAT = png
+INTERACTIVE_SVG = NO
+DOT_PATH =
+DOTFILE_DIRS =
+MSCFILE_DIRS =
+DIAFILE_DIRS =
+PLANTUML_JAR_PATH =
+PLANTUML_INCLUDE_PATH =
+DOT_GRAPH_MAX_NODES = 50
+MAX_DOT_GRAPH_DEPTH = 0
+DOT_TRANSPARENT = NO
+DOT_MULTI_TARGETS = NO
+GENERATE_LEGEND = YES
+DOT_CLEANUP = YES
diff --git a/include/libnslayout/nslayout.h b/include/libnslayout/nslayout.h
index f42bed7..2610e42 100644
--- a/include/libnslayout/nslayout.h
+++ b/include/libnslayout/nslayout.h
@@ -5,6 +5,10 @@
* Copyright 2015 John-Mark Bell <jmb(a)netsurf-browser.org>
*/
+/** \file include/libnslayout/nslayout.h
+ * Layout object handling
+ */
+
#ifndef nslayout_nslayout_h_
#define nslayout_nslayout_h_
@@ -21,10 +25,10 @@ typedef void nslayout_replaced;
/** A rectangle */
typedef struct nslayout_rect {
- int x;
- int y;
- int w;
- int h;
+ int x; /**< X position of left of rect in px */
+ int y; /**< Y position of top of rect in px */
+ int w; /**< Width of rect in px */
+ int h; /**< Height of rect in px */
} nslayout_rect;
/** Render list */
@@ -41,7 +45,7 @@ typedef struct nslayout_layout nslayout_layout;
*/
typedef struct nslayout_request {
/** Request type */
- enum type {
+ enum {
NSLAYOUT_GET_RESOURCE,
NSLAYOUT_CREATE_REPLACED,
NSLAYOUT_RENDER,
@@ -105,25 +109,25 @@ nslayout_error nslayout_fini(void);
/**
* LibNSLayout client callback function
*
- * \param req The request details.
- * \param layout The layout we're making a request for.
- * \param pw The client's private data for this layout.
+ * \param[in] layout The layout we're making a request for.
+ * \param[in] pw The client's private data for this layout.
+ * \param[in,out] req The request details.
* \return NSLAYOUT_OK on success, appropriate error otherwise.
*/
typedef nslayout_error (*nslayout_callback)(
- nslayout_request *req,
nslayout_layout *layout,
- void *pw);
+ void *pw,
+ nslayout_request *req);
/**
* Create a Layout object for a given DOM
*
- * \param doc The LibDOM document to build a layout for.
- * \param css_ctx The LibCSS selection context for the document.
- * \param media The LibCSS media to use when selecting for this layout.
- * \param cb The client's private data for this layout.
- * \param pw The client's private data for this layout.
- * \param layout Returns a pointer to the created layout object.
+ * \param[in] doc The LibDOM document to build a layout for.
+ * \param[in] css_ctx The LibCSS selection context for the document.
+ * \param[in] media The LibCSS media to use when selecting.
+ * \param[in] cb The client's private data for this layout.
+ * \param[in] pw The client's private data for this layout.
+ * \param[out] layout Returns a pointer to the created layout object.
* \return NSLAYOUT_OK on success, appropriate error otherwise.
*/
nslayout_error nslayout_layout_create(
@@ -137,7 +141,7 @@ nslayout_error nslayout_layout_create(
/**
* Destroy a Layout object
*
- * \param layout Returns a pointer to the created layout object.
+ * \param[in] layout Returns a pointer to the created layout object.
* \return NSLAYOUT_OK on success, appropriate error otherwise.
*/
nslayout_error nslayout_layout_destroy(
@@ -150,10 +154,10 @@ nslayout_error nslayout_layout_destroy(
* data structures for the document, but will not start to position
* things and will not emit render lists.
*
- * \param layout Layout to set viewport for.
- * \param viewport Viewport dimensions and offset.
- * \param scale Rendering scale.
- * \param dpi DPI of render target with viewport.
+ * \param[in] layout Layout to set viewport for.
+ * \param[in] viewport Viewport dimensions and offset.
+ * \param[in] scale Rendering scale.
+ * \param[in] dpi DPI of render target with viewport.
* \return NSLAYOUT_OK on success, appropriate error otherwise.
*/
nslayout_error nslayout_update_viewport(
@@ -163,23 +167,25 @@ nslayout_error nslayout_update_viewport(
unsigned int dpi);
/**
- * Find the top-most element at a given point, in terms of z-order.
+ * Find the area occupied by element.
*
- * \param layout Layout to locate an element in.
- * \param element Updated to area with position relative to viewport.
+ * \param[in] layout Layout to locate an element in.
+ * \param[in] element Element to get area of.
+ * \param[out] area Returns area with position relative to viewport.
* \return NSLAYOUT_OK on success, appropriate error otherwise.
*/
nslayout_error nslayout_element_get_location(
nslayout_layout *layout,
+ dom_element *element,
nslayout_rect *area);
/**
* Find the top-most element at a given point, in terms of z-order.
*
- * \param layout Layout to find an element in.
- * \param x Mouse x-coordinate (viewport relative).
- * \param y Mouse y-coordinate (viewport relative).
- * \param element Updated to point at the element we found.
+ * \param[in] layout Layout to find an element in.
+ * \param[in] x Mouse x-coordinate (viewport relative).
+ * \param[in] y Mouse y-coordinate (viewport relative).
+ * \param[out] element Returns the element we found.
* \return NSLAYOUT_OK on success, appropriate error otherwise.
*/
nslayout_error nslayout_element_at_point(
@@ -191,10 +197,10 @@ nslayout_error nslayout_element_at_point(
/**
* Mark an element (or part of it) as needing redraw.
*
- * \param layout Layout to indicate redraw is required for.
- * \param element Element to mark as needing redraw.
- * \param rel_area Area of element to redraw relative to object's top-left.
- * May be NULL, to redraw whole element.
+ * \param[in] layout Layout to indicate redraw is required for.
+ * \param[in] element Element to mark as needing redraw.
+ * \param[in] rel_area Area of element to redraw relative to object's top-left.
+ * May be NULL, to redraw whole element.
* \return NSLAYOUT_OK on success, appropriate error otherwise.
*/
nslayout_error nslayout_layout_dirty_element(
@@ -205,8 +211,8 @@ nslayout_error nslayout_layout_dirty_element(
/**
* Mark an area as needing redraw.
*
- * \param layout Layout to indicate redraw is required for.
- * \param area Area to redraw relative to viewport's top-left.
+ * \param[in] layout Layout to indicate redraw is required for.
+ * \param[in] area Area to redraw relative to viewport's top-left.
* \return NSLAYOUT_OK on success, appropriate error otherwise.
*/
nslayout_error nslayout_layout_dirty_area(
diff --git a/src/layout.c b/src/layout.c
index 43570fb..915475b 100644
--- a/src/layout.c
+++ b/src/layout.c
@@ -4,6 +4,10 @@
* Copyright 2015 Michael Drake <tlsa(a)netsurf-browser.org>
*/
+/** \file src/layout.c
+ * Layout object handling
+ */
+
#include <assert.h>
#include <stdlib.h>
diff --git a/src/layout.h b/src/layout.h
index 6e8f4c9..9946663 100644
--- a/src/layout.h
+++ b/src/layout.h
@@ -4,6 +4,10 @@
* Copyright 2015 Michael Drake <tlsa(a)netsurf-browser.org>
*/
+/** \file src/layout.h
+ * Layout object handling
+ */
+
#ifndef nslayout_layout_h_
#define nslayout_layout_h_
diff --git a/src/request.h b/src/request.h
new file mode 100644
index 0000000..c28468e
--- /dev/null
+++ b/src/request.h
@@ -0,0 +1,141 @@
+/*
+ * This file is part of LibNSLayout
+ * Licensed under the ISC License,
http://opensource.org/licenses/ISC
+ * Copyright 2015 Michael Drake <tlsa(a)netsurf-browser.org>
+ */
+
+/** \file src/request.h
+ * Client callback wrappers
+ */
+
+#ifndef nslayout_request_h_
+#define nslayout_request_h_
+
+#include <libnslayout/nslayout.h>
+
+/**
+ * Perform GET_RESOURCE client callback
+ *
+ * \param[in] layout Layout object that the request concerns.
+ * \param[in] url Absolute URL to request replaced object handle for.
+ * \param[out] replaced Returns the replaced element content handle.
+ * \return NSLAYOUT_OK on success, appropriate error otherwise.
+ */
+static inline nslayout_error nsl_request_get_resource(
+ nslayout_layout *layout,
+ const char *url,
+ nslayout_replaced **replaced)
+{
+ nslayout_error err;
+ nslayout_request req;
+
+ req.type = NSLAYOUT_GET_RESOURCE;
+ req.request.get_resource.url = url;
+
+ err = layout->cb(layout, layout->pw, &req);
+
+ *replaced = *req.response.get_resource.replaced;
+ return err;
+}
+
+/**
+ * Perform CREATE_REPLACED client callback
+ *
+ * \param[in] layout Layout object that the request concerns.
+ * \param[in] element DOM element that needs replacement object.
+ * \param[out] replaced Returns the replaced element content handle.
+ * \return NSLAYOUT_OK on success, appropriate error otherwise.
+ */
+static inline nslayout_error nsl_request_create_replaced(
+ nslayout_layout *layout,
+ dom_element *element,
+ nslayout_replaced **replaced)
+{
+ nslayout_error err;
+ nslayout_request req;
+
+ req.type = NSLAYOUT_CREATE_REPLACED;
+ req.request.create_replaced.element = element;
+
+ err = layout->cb(layout, layout->pw, &req);
+
+ *replaced = *req.response.create_replaced.replaced;
+ return err;
+}
+
+/**
+ * Perform RENDER client callback
+ *
+ * \param[in] layout Layout object being rendered.
+ * \param[in] list Render list to render.
+ * \return NSLAYOUT_OK on success, appropriate error otherwise.
+ */
+static inline nslayout_error nsl_request_render(
+ nslayout_layout *layout,
+ nslayout_render_list *list)
+{
+ nslayout_error err;
+ nslayout_request req;
+
+ req.type = NSLAYOUT_RENDER;
+ req.request.render.list = list;
+
+ err = layout->cb(layout, layout->pw, &req);
+
+ return err;
+}
+
+/**
+ * Perform SET_EXTENTS client callback
+ *
+ * \param[in] layout Layout object that the request concerns.
+ * \param[in] width The layout's full width.
+ * \param[in] height The layout's full height.
+ * \return NSLAYOUT_OK on success, appropriate error otherwise.
+ */
+static inline nslayout_error nsl_request_set_extents(
+ nslayout_layout *layout,
+ unsigned int width,
+ unsigned int height)
+{
+ nslayout_error err;
+ nslayout_request req;
+
+ req.type = NSLAYOUT_SET_EXTENTS;
+ req.request.set_extents.width = width;
+ req.request.set_extents.height = height;
+
+ err = layout->cb(layout, layout->pw, &req);
+
+ return err;
+}
+
+/**
+ * Perform GET_INTRINSIC_SIZE client callback
+ *
+ * \param[in] layout Layout object that the request concerns.
+ * \param[in] replaced Replaced object to get intrinsic size of.
+ * \param[out] width Returns the replaced object's width.
+ * \param[out] height Returns the replaced object's height.
+ * \return NSLAYOUT_OK on success, appropriate error otherwise.
+ */
+static inline nslayout_error nsl_request_get_intrinsic_size(
+ nslayout_layout *layout,
+ nslayout_replaced *replaced,
+ unsigned int *width,
+ unsigned int *height)
+{
+ nslayout_error err;
+ nslayout_request req;
+
+ req.type = NSLAYOUT_GET_INTRINSIC_SIZE;
+ req.request.get_intrinsic_size.replaced = replaced;
+
+ err = layout->cb(layout, layout->pw, &req);
+
+ *width = *req.response.get_intrinsic_size.width;
+ *height = *req.response.get_intrinsic_size.height;
+ return err;
+}
+
+#endif
diff --git a/test/basic-layout-tests.c b/test/basic-layout-tests.c
index 6dec991..cdaf5e2 100644
--- a/test/basic-layout-tests.c
+++ b/test/basic-layout-tests.c
@@ -17,9 +17,9 @@
int pw;
static nslayout_error nslayout_test_callback(
- nslayout_request *req,
nslayout_layout *layout,
- void *pw)
+ void *pw,
+ nslayout_request *req)
{
UNUSED(req);
UNUSED(layout);
--
NetSurf Layout Engine