mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-23 04:26:50 +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 object_params;
|
||||||
struct rect;
|
struct rect;
|
||||||
struct redraw_context;
|
struct redraw_context;
|
||||||
|
struct llcache_query_msg;
|
||||||
|
|
||||||
/** Status of a content */
|
/** Status of a content */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -58,6 +59,8 @@ typedef enum {
|
|||||||
/** Used in callbacks to indicate what has occurred. */
|
/** Used in callbacks to indicate what has occurred. */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CONTENT_MSG_LOG, /**< Content wishes to log something */
|
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_LOADING, /**< fetching or converting */
|
||||||
CONTENT_MSG_READY, /**< may be displayed */
|
CONTENT_MSG_READY, /**< may be displayed */
|
||||||
CONTENT_MSG_DONE, /**< finished */
|
CONTENT_MSG_DONE, /**< finished */
|
||||||
@ -105,6 +108,10 @@ union content_msg_data {
|
|||||||
size_t msglen; /**< The length of that message */
|
size_t msglen; /**< The length of that message */
|
||||||
browser_window_console_flags flags; /**< The flags of the logging */
|
browser_window_console_flags flags; /**< The flags of the logging */
|
||||||
} log;
|
} 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 */
|
/** CONTENT_MSG_ERROR - Error message */
|
||||||
const char *error;
|
const char *error;
|
||||||
/** CONTENT_MSG_ERRORCODE - Error code */
|
/** CONTENT_MSG_ERRORCODE - Error code */
|
||||||
|
@ -519,18 +519,26 @@ static nserror hlcache_llcache_callback(llcache_handle *handle,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LLCACHE_EVENT_QUERY:
|
case LLCACHE_EVENT_QUERY:
|
||||||
if (hlcache->params.llcache.cb != NULL) {
|
if (ctx->handle->cb != NULL) {
|
||||||
return hlcache->params.llcache.cb(
|
hlcache_event hlevent;
|
||||||
event->data.query.query,
|
|
||||||
hlcache->params.llcache.cb_ctx,
|
hlevent.type = CONTENT_MSG_QUERY;
|
||||||
event->data.query.cb,
|
hlevent.data.query_msg = &event->data.query;
|
||||||
event->data.query.cb_pw);
|
|
||||||
|
ctx->handle->cb(ctx->handle, &hlevent, ctx->handle->pw);
|
||||||
} else {
|
} else {
|
||||||
return NSERROR_NOT_IMPLEMENTED;
|
return NSERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LLCACHE_EVENT_QUERY_FINISHED:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user