diff options
Diffstat (limited to 'include/libnslayout/nslayout.h')
-rw-r--r-- | include/libnslayout/nslayout.h | 74 |
1 files changed, 40 insertions, 34 deletions
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@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( |