30#include <nsutils/time.h>
139 switch (event->
type) {
169 switch (event->
type) {
251 css_fixed hpos = 0, vpos = 0;
252 css_unit hunit = CSS_UNIT_PX;
253 css_unit vunit = CSS_UNIT_PX;
261 css_computed_background_position(
box->
style,
262 &hpos, &hunit, &vpos, &vunit);
265 if (hunit == CSS_UNIT_PCT) {
266 l = (
width - w) * hpos / INTTOFIX(100);
268 l = FIXTOINT(css_unit_len2device_px(
275 if (vunit == CSS_UNIT_PCT) {
276 t = (
height - h) * vpos / INTTOFIX(100);
278 t = FIXTOINT(css_unit_len2device_px(
285 switch (css_computed_background_repeat(
287 case CSS_BACKGROUND_REPEAT_REPEAT:
294 case CSS_BACKGROUND_REPEAT_REPEAT_X:
300 case CSS_BACKGROUND_REPEAT_REPEAT_Y:
306 case CSS_BACKGROUND_REPEAT_NO_REPEAT:
369 *(
event->data.jsthread) = NULL;
373 *(
event->data.getdims.viewport_width) =
375 *(
event->data.getdims.viewport_height) =
395 event->data.dragsave.content;
416 case CONTENT_CARET_REMOVE:
417 case CONTENT_CARET_HIDE:
419 true, 0, 0, 0, NULL);
421 case CONTENT_CARET_SET_POS:
439 case CONTENT_DRAG_NONE:
443 case CONTENT_DRAG_SCROLL:
446 case CONTENT_DRAG_SELECTION:
465 sel_owner.
none =
true;
498 nsu_getmonotonic_ms(&ms_now);
530 assert(
object != NULL);
531 assert(object->
box != NULL);
542 NSLOG(netsurf, INFO,
"%d fetches active",
547 object->content = NULL;
549 object->box->object = NULL;
562 for (page = c; page != NULL; page = page->
page) {
586 if (refresh_url == NULL)
605 if (object->
content == NULL || object->
box == NULL)
627 object = object->
next) {
647 object->content = NULL;
648 if (object->
box != NULL) {
650 NSLOG(netsurf, INFO,
"%d fetches active",
670 if (object->
content == NULL || object->
box == NULL)
729 if (
object == NULL) {
739 object->parent = (
struct content *) c;
741 object->content = NULL;
743 object->permitted_types = permitted_types;
#define UNKNOWN_MAX_WIDTH
void box_coords(struct box *box, int *x, int *y)
Find the absolute coordinates of a box.
bool box_visible(struct box *box)
Determine if a box is visible when the tree is rendered.
HTML Box tree inspection interface.
static void html_object_refresh(void *p)
schedule callback for object refresh
bool html_fetch_object(html_content *c, nsurl *url, struct box *box, content_type permitted_types, bool background)
Start a fetch for an object required by a page.
nserror html_object_abort_objects(html_content *htmlc)
abort any content objects that have not completed fetching.
static bool html_replace_object(struct content_html_object *object, nsurl *url)
Start a fetch for an object required by a page, replacing an existing object.
nserror html_object_close_objects(html_content *html)
close content of content objects associated with a HTML content
static void html_object_done(struct box *box, hlcache_handle *object, bool background)
Update a box whose content has completed rendering.
static nserror html_object_callback(hlcache_handle *object, const hlcache_event *event, void *pw)
Callback for hlcache_handle_retrieve() for objects with a box.
struct content_html_object * html_get_objects(hlcache_handle *h, unsigned int *n)
Retrieve objects used by HTML document.
static void html_object_failed(struct box *box, html_content *content, bool background)
Handle object fetching or loading failure.
static nserror html_object_nobox_callback(hlcache_handle *object, const hlcache_event *event, void *pw)
Callback for hlcache_handle_retrieve() for objects with no box.
nserror html_object_free_objects(html_content *html)
release memory of content objects associated with a HTML content
nserror html_object_open_objects(html_content *html, struct browser_window *bw)
open content of content objects associated with a HTML content
HTML content object interface.
void content__reformat(struct content *c, bool background, int width, int height)
cause a content to be reformatted.
void content_broadcast(struct content *c, content_msg msg, const union content_msg_data *data)
Send a message to all users.
int content__get_height(struct content *c)
Retrieve height of content.
nserror content_close(hlcache_handle *h)
The window containing the content has been closed.
void content_set_done(struct content *c)
Put a content in status CONTENT_STATUS_DONE.
int content__get_width(struct content *c)
Retrieve width of content.
nsurl * content_get_url(struct content *c)
Retrieve URL associated with content.
bool content_can_reformat(hlcache_handle *h)
Get whether a content can reformat.
void content_reformat(hlcache_handle *h, bool background, int width, int height)
Reformat to new size.
nsurl * content_get_refresh_url(hlcache_handle *h)
Retrieve the refresh URL for a content.
nserror content_open(hlcache_handle *h, struct browser_window *bw, struct content *page, struct object_params *params)
A window containing the content has been opened.
content_status content_get_status(hlcache_handle *h)
Retrieve status of content.
@ CONTENT_STATUS_READY
Some parts of content still being loaded, but can be displayed.
@ CONTENT_STATUS_DONE
Content has completed all processing.
@ CONTENT_STATUS_LOADING
Content is being fetched or converted and is not safe to display.
content_type
The type of a content.
@ CONTENT_NONE
no type for content
@ CONTENT_HTML
content is HTML
@ CONTENT_MSG_LINK
RFC5988 link.
@ CONTENT_MSG_SELECTMENU
Create a select menu.
@ CONTENT_MSG_REFRESH
wants refresh
@ CONTENT_MSG_GETDIMS
Get viewport dimensions.
@ CONTENT_MSG_GADGETCLICK
A gadget has been clicked on (mainly for file)
@ CONTENT_MSG_SCROLL
Request to scroll content.
@ CONTENT_MSG_DONE
content has finished processing
@ CONTENT_MSG_LOADING
fetching or converting
@ CONTENT_MSG_ERROR
error occurred
@ CONTENT_MSG_DRAGSAVE
Allow drag saving of content.
@ CONTENT_MSG_POINTER
Wants a specific mouse pointer set.
@ CONTENT_MSG_SELECTION
A selection made or cleared.
@ CONTENT_MSG_DRAG
A drag started or ended.
@ CONTENT_MSG_GETTHREAD
Javascript thread.
@ CONTENT_MSG_REDRAW
needs redraw (eg.
@ CONTENT_MSG_READY
may be displayed
@ CONTENT_MSG_SAVELINK
Allow URL to be saved.
@ CONTENT_MSG_CARET
Caret movement / hiding.
Useful interned string pointers (interface).
nserror
Enumeration of error codes.
@ NSERROR_NOMEM
Memory exhaustion.
struct netsurf_table * guit
The global interface table.
Interface to core interface table.
struct content * hlcache_handle_get_content(const hlcache_handle *handle)
Retrieve a content object from a cache handle.
nserror hlcache_handle_abort(hlcache_handle *handle)
Abort a high-level cache fetch.
nserror hlcache_handle_release(hlcache_handle *handle)
Release a high-level cache handle.
nserror hlcache_handle_retrieve(nsurl *url, uint32_t flags, nsurl *referer, llcache_post_data *post, hlcache_handle_callback cb, void *pw, hlcache_child_context *child, content_type accepted_types, hlcache_handle **result)
Retrieve a high-level cache handle for an object.
High-level resource cache interface.
nserror(* hlcache_handle_callback)(hlcache_handle *handle, const hlcache_event *event, void *pw)
Client callback for high-level cache events.
@ HLCACHE_RETRIEVE_SNIFF_TYPE
Interface to text/html content handler.
Public content interface.
int content_get_height(struct hlcache_handle *h)
Retrieve height of content.
int content_get_width(struct hlcache_handle *h)
Retrieve width of content.
void content_invalidate_reuse_data(struct hlcache_handle *h)
Invalidate content reuse data.
content_type content_get_type(struct hlcache_handle *h)
Retrieve computed type of content.
Interface to platform-specific miscellaneous browser operation table.
void html_set_drag_type(html_content *html, html_drag_type drag_type, union html_drag_owner drag_owner, const struct rect *rect)
Set our drag status, and inform whatever owns the content.
void html_set_focus(html_content *html, html_focus_type focus_type, union html_focus_owner focus_owner, bool hide_caret, int x, int y, int height, const struct rect *clip)
Set our input focus, and inform whatever owns the content.
void html_set_selection(html_content *html, html_selection_type selection_type, union html_selection_owner selection_owner, bool read_only)
Set our selection status, and inform whatever owns the content.
HTML content user interaction handling.
#define NSLOG(catname, level, logmsg, args...)
struct nsurl nsurl
NetSurf URL object.
Private data for text/html content.
@ HTML_DRAG_CONTENT_SELECTION
Not own; drag in textarea widget.
@ HTML_DRAG_CONTENT_SCROLL
Not own; drag in child content.
@ HTML_FOCUS_CONTENT
Focus belongs to child content.
@ HTML_SELECTION_CONTENT
Selection in this html content.
Interface to utility string handling.
int width
Width of content box (excluding padding etc.).
struct box * parent
Parent box, or NULL.
struct scrollbar * scroll_x
Horizontal scroll.
int height
Height of content box (excluding padding etc.).
struct hlcache_handle * background
Background image for this box, or NULL if none.
int max_width
Width that would be taken with no line breaks.
struct box * next
Next sibling box, or NULL.
struct scrollbar * scroll_y
Vertical scroll.
box_type type
Type of box.
css_computed_style * style
Style for this box.
struct object_params * object_params
Parameters for the object, or NULL.
struct hlcache_handle * object
Object in this box (usually an image), or NULL if none.
int padding[4]
Padding: TOP, RIGHT, BOTTOM, LEFT.
box_flags flags
Box flags.
An object (img, object, etc.
bool background
This object is a background image.
struct content_html_object * next
Next in chain.
content_type permitted_types
Bitmap of acceptable content types.
struct box * box
Node in box tree containing it.
struct content * parent
Parent document.
struct hlcache_handle * content
Content, or 0.
Content which corresponds to a single URL.
bool quirks
Content is in quirks mode.
unsigned int active
Number of child fetches or conversions currently in progress.
int available_height
Viewport height.
content_status status
Current status.
uint64_t reformat_time
Earliest time to attempt a period reflow while fetching a page's objects.
int available_width
Viewport width.
nserror(* schedule)(int t, void(*callback)(void *p), void *p)
Schedule a callback.
Context for retrieving a child object.
bool quirks
Whether parent is quirky.
const char * charset
Charset of parent.
content_msg type
Event type.
union content_msg_data data
Event data.
Data specific to CONTENT_HTML.
struct content_html_object * object_list
List of objects.
char * encoding
Encoding of source, NULL if unknown.
struct browser_window * bw
Browser window containing this document, or NULL if not open.
unsigned int num_objects
Number of entries in object_list.
struct html_content * page
Content of type CONTENT_HTML containing this, or NULL if not an object within a page.
bool aborted
Content has been aborted in the LOADING state.
bool had_initial_layout
Whether an initial layout has been done.
css_unit_ctx unit_len_ctx
CSS length conversion context for document.
struct gui_misc_table * misc
Browser table.
Extra data for some content_msg messages.
struct content_msg_data::@103 scroll
CONTENT_MSG_SCROLL - Part of content to scroll to show.
const struct rect * clip
Carret clip rect.
int delay
CONTENT_MSG_REFRESH - Minimum delay.
struct content_msg_data::@107 caret
CONTENT_MSG_CARET - set caret position or, hide caret.
bool selection
false for selection cleared
struct hlcache_handle * content
if NULL, save the content generating the message
struct content_msg_data::@104 dragsave
CONTENT_MSG_DRAGSAVE - Drag save a content.
struct content_msg_data::@108 drag
CONTENT_MSG_DRAG - Drag start or end.
enum content_msg_data::@104::@112 type
struct content_msg_data::@101 redraw
CONTENT_MSG_REDRAW - Area of content which needs redrawing.
struct content_msg_data::@107::@114 pos
With CONTENT_CARET_SET_POS.
For getting at selections in this content or things in this content.
Option reading and saving interface.
#define nsoption_bool(OPTION)
Get the value of a boolean option.