summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2017-04-11 10:25:14 (GMT)
committer Michael Drake <tlsa@netsurf-browser.org>2017-04-11 10:28:19 (GMT)
commit617c559accc02deb3e956b592dc22d7891e28369 (patch)
tree9cc947174ebc75ed97cb5a087c2bebbe2b0862aa
parentf18b7ad86fe25e32cac7d9bca1abe92c46437535 (diff)
downloadlibnslayout-617c559accc02deb3e956b592dc22d7891e28369.tar.gz
libnslayout-617c559accc02deb3e956b592dc22d7891e28369.tar.bz2
Client API: Various changes due to new thinking about responsibilities.
-rw-r--r--include/libnslayout/nslayout.h76
1 files changed, 66 insertions, 10 deletions
diff --git a/include/libnslayout/nslayout.h b/include/libnslayout/nslayout.h
index b486cba..62ce584 100644
--- a/include/libnslayout/nslayout.h
+++ b/include/libnslayout/nslayout.h
@@ -22,8 +22,8 @@ extern "C"
#include <libnslayout/error.h>
-/** An opaque client-owned replaced element */
-typedef void nslayout_replaced;
+/** A client-defined replaced element structure */
+typedef struct nslayout_replaced nslayout_replaced;
/** A rectangle */
typedef struct nslayout_rect {
@@ -33,15 +33,25 @@ typedef struct nslayout_rect {
int h; /**< Height of rect in px */
} nslayout_rect;
+/***/
+enum nslayout_dom_node_event_type {
+ NSLAYOUT_DOM_NODE_INSERTED,
+ NSLAYOUT_DOM_NODE_MODIFIED,
+ NSLAYOUT_DOM_NODE_REMOVED,
+ NSLAYOUT_DOM_NODE__COUNT,
+};
+
/** Render list */
typedef struct nslayout_render_list {
} nslayout_render_list;
-/** Render list */
+/** Opaque layout tree object */
typedef struct nslayout_layout nslayout_layout;
+
/**
* A LibNSLayout request
+ * Client calls to set replaced element intrinsic dimensions.
*
* Passed to the client via nslayout_callback
*/
@@ -49,7 +59,6 @@ typedef struct nslayout_request {
/** Request type */
enum {
NSLAYOUT_GET_RESOURCE,
- NSLAYOUT_CREATE_REPLACED,
NSLAYOUT_RENDER,
NSLAYOUT_SET_EXTENTS,
NSLAYOUT_GET_INTRINSIC_SIZE
@@ -60,9 +69,6 @@ typedef struct nslayout_request {
const char *url; /**< Absolute URL */
} get_resource;
struct {
- dom_element *element; /**< DOM element */
- } create_replaced;
- struct {
nslayout_render_list *list; /**< Render list */
} render;
struct {
@@ -79,9 +85,6 @@ typedef struct nslayout_request {
nslayout_replaced **replaced; /** Replacement object */
} get_resource;
struct {
- nslayout_replaced **replaced; /** Replacement object */
- } create_replaced;
- struct {
unsigned int *width; /** Replacement object's width */
unsigned int *height; /** Replacement object's height */
} get_intrinsic_size;
@@ -90,6 +93,59 @@ typedef struct nslayout_request {
/**
+ * Client calls for DOM tree change events.
+ *
+ * \param[in] layout The layout requiring update for DOM change.
+ * \param[in] node The DOM node which is concerned in the event.
+ * \param[in] type The type of DOM change event.
+ * \return NSLAYOUT_OK on success, appropriate error otherwise.
+ */
+nslayout_error nslayout_dom_node_event(
+ nslayout_layout *layout,
+ dom_event_target *node,
+ enum nslayout_dom_node_event_type type);
+
+/**
+ * Client calls to set node as client-replaced.
+ *
+ * \param[in] layout The layout to replace an element in.
+ * \param[in] node The DOM node which is to be replaced.
+ * \param[in] replaced The client's replacement object to register with node.
+ * \return NSLAYOUT_OK on success, appropriate error otherwise.
+ */
+nslayout_error nslayout_node_event_set_replaced(
+ nslayout_layout *layout,
+ dom_event_target *node,
+ nslayout_replaced *replaced);
+
+
+/**
+ * Client calls to set replaced element intrinsic dimensions.
+ *
+ * \param[in] layout The layout to replace an element in.
+ * \param[in] node The DOM node which is to be replaced.
+ * \param[in] width Width in pixels.
+ * \param[in] height Height in pixels.
+ * \return NSLAYOUT_OK on success, appropriate error otherwise.
+ */
+nslayout_error nslayout_node_event_set_intrinsic_dimensions(
+ nslayout_layout *layout,
+ dom_event_target *node,
+ unsigned int width,
+ unsigned int height);
+
+
+/**
+ * Client calls to tell NSLayout that everything requires reselection.
+ *
+ * \param[in]layout The layout to who's selection context has changed.
+ * \return NSLAYOUT_OK on success, appropriate error otherwise.
+ */
+nslayout_error nslayout_selection_context_updated(
+ nslayout_layout *layout);
+
+
+/**
* Initialise LibNSLayout
*
* \return NSLAYOUT_OK on success, appropriate error otherwise.