mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-22 20:16:54 +03:00
content, hlcache: Propagate query events upward
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
This commit is contained in:
parent
f59a726f68
commit
b48e462f0f
@ -43,6 +43,7 @@ struct hlcache_handle;
|
||||
struct object_params;
|
||||
struct rect;
|
||||
struct redraw_context;
|
||||
struct llcache_query_msg;
|
||||
|
||||
/** Status of a content */
|
||||
typedef enum {
|
||||
@ -58,6 +59,8 @@ typedef enum {
|
||||
/** Used in callbacks to indicate what has occurred. */
|
||||
typedef enum {
|
||||
CONTENT_MSG_LOG, /**< Content wishes to log something */
|
||||
CONTENT_MSG_QUERY, /**< Something under the content has a query */
|
||||
CONTENT_MSG_QUERY_FINISHED, /**< Something under the content finished its query */
|
||||
CONTENT_MSG_LOADING, /**< fetching or converting */
|
||||
CONTENT_MSG_READY, /**< may be displayed */
|
||||
CONTENT_MSG_DONE, /**< finished */
|
||||
@ -105,6 +108,10 @@ union content_msg_data {
|
||||
size_t msglen; /**< The length of that message */
|
||||
browser_window_console_flags flags; /**< The flags of the logging */
|
||||
} log;
|
||||
/** CONTENT_MSG_QUERY - Query from underlying object somewhere */
|
||||
const struct llcache_query_msg *query_msg;
|
||||
/** CONTENT_MSG_QUERY_FINISHED - Query from underlying object finished */
|
||||
void *query_finished_pw;
|
||||
/** CONTENT_MSG_ERROR - Error message */
|
||||
const char *error;
|
||||
/** CONTENT_MSG_ERRORCODE - Error code */
|
||||
|
@ -519,18 +519,26 @@ static nserror hlcache_llcache_callback(llcache_handle *handle,
|
||||
}
|
||||
break;
|
||||
case LLCACHE_EVENT_QUERY:
|
||||
if (hlcache->params.llcache.cb != NULL) {
|
||||
return hlcache->params.llcache.cb(
|
||||
event->data.query.query,
|
||||
hlcache->params.llcache.cb_ctx,
|
||||
event->data.query.cb,
|
||||
event->data.query.cb_pw);
|
||||
if (ctx->handle->cb != NULL) {
|
||||
hlcache_event hlevent;
|
||||
|
||||
hlevent.type = CONTENT_MSG_QUERY;
|
||||
hlevent.data.query_msg = &event->data.query;
|
||||
|
||||
ctx->handle->cb(ctx->handle, &hlevent, ctx->handle->pw);
|
||||
} else {
|
||||
return NSERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
break;
|
||||
case LLCACHE_EVENT_QUERY_FINISHED:
|
||||
/* Currently nothing to do */
|
||||
if (ctx->handle->cb != NULL) {
|
||||
hlcache_event hlevent;
|
||||
|
||||
hlevent.type = CONTENT_MSG_QUERY_FINISHED;
|
||||
hlevent.data.query_finished_pw = event->data.query.cb_pw;
|
||||
|
||||
ctx->handle->cb(ctx->handle, &hlevent, ctx->handle->pw);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user