clean up html content handler header use
Improve header use in preperation for making browser window a corewindow
This commit is contained in:
parent
dc9e7c989f
commit
216fb88f58
|
@ -49,6 +49,7 @@
|
|||
#include "css/utils.h"
|
||||
#include "desktop/gui_internal.h"
|
||||
|
||||
#include "html/html.h"
|
||||
#include "html/box.h"
|
||||
#include "html/box_textarea.h"
|
||||
#include "html/form_internal.h"
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include "netsurf/keypress.h"
|
||||
#include "desktop/textarea.h"
|
||||
|
||||
#include "html/html_internal.h"
|
||||
#include "html/box.h"
|
||||
#include "html/box_textarea.h"
|
||||
#include "html/font.h"
|
||||
#include "html/form_internal.h"
|
||||
|
|
|
@ -24,11 +24,9 @@
|
|||
#ifndef NETSURF_HTML_BOX_TEXTAREA_H
|
||||
#define NETSURF_HTML_BOX_TEXTAREA_H
|
||||
|
||||
|
||||
#include "html/box.h"
|
||||
#include "html/html_internal.h"
|
||||
|
||||
struct dom_node;
|
||||
struct html_content;
|
||||
struct box;
|
||||
|
||||
/**
|
||||
* Create textarea widget for a form element
|
||||
|
@ -37,7 +35,7 @@ struct dom_node;
|
|||
* \param box box with gadget to be given textarea widget
|
||||
* \param node DOM node for form element
|
||||
*/
|
||||
bool box_textarea_create_textarea(html_content *html,
|
||||
bool box_textarea_create_textarea(struct html_content *html,
|
||||
struct box *box, struct dom_node *node);
|
||||
|
||||
|
||||
|
@ -49,6 +47,6 @@ bool box_textarea_create_textarea(html_content *html,
|
|||
* \param key keypress
|
||||
* \return true iff keypress handled
|
||||
*/
|
||||
bool box_textarea_keypress(html_content *html, struct box *box, uint32_t key);
|
||||
bool box_textarea_keypress(struct html_content *html, struct box *box, uint32_t key);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -54,9 +54,11 @@
|
|||
#include "javascript/js.h"
|
||||
#include "desktop/gui_internal.h"
|
||||
|
||||
#include "html/html.h"
|
||||
#include "html/html_save.h"
|
||||
#include "html/html_internal.h"
|
||||
#include "html/box.h"
|
||||
#include "html/form_internal.h"
|
||||
#include "html/html_internal.h"
|
||||
#include "html/imagemap.h"
|
||||
#include "html/layout.h"
|
||||
#include "html/search.h"
|
||||
|
|
|
@ -28,9 +28,6 @@
|
|||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <dom/dom.h>
|
||||
#include <dom/bindings/hubbub/parser.h>
|
||||
|
||||
#include "netsurf/types.h"
|
||||
#include "netsurf/content_type.h"
|
||||
#include "netsurf/browser_window.h"
|
||||
|
@ -65,6 +62,7 @@ struct html_stylesheet {
|
|||
bool unused;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Container for scripts used by an HTML document
|
||||
*/
|
||||
|
@ -103,12 +101,10 @@ struct content_html_object {
|
|||
bool background; /**< This object is a background image. */
|
||||
};
|
||||
|
||||
struct html_scrollbar_data {
|
||||
struct content *c;
|
||||
struct box *box;
|
||||
};
|
||||
|
||||
/** Frame tree (frameset or frame tag) */
|
||||
/**
|
||||
* Frame tree (frameset or frame tag)
|
||||
*/
|
||||
struct content_html_frames {
|
||||
int cols; /** number of columns in frameset */
|
||||
int rows; /** number of rows in frameset */
|
||||
|
@ -129,7 +125,9 @@ struct content_html_frames {
|
|||
struct content_html_frames *children; /** [cols * rows] children */
|
||||
};
|
||||
|
||||
/** Inline frame list (iframe tag) */
|
||||
/**
|
||||
* Inline frame list (iframe tag)
|
||||
*/
|
||||
struct content_html_iframe {
|
||||
struct box *box;
|
||||
|
||||
|
@ -153,19 +151,46 @@ struct content_html_iframe {
|
|||
#define STYLESHEET_USER 3 /* user stylesheet */
|
||||
#define STYLESHEET_START 4 /* start of document stylesheets */
|
||||
|
||||
/**
|
||||
* initialise content handler
|
||||
*
|
||||
* \return NSERROR_OK on success otherwise appropriate error code
|
||||
*/
|
||||
nserror html_init(void);
|
||||
|
||||
/**
|
||||
* redraw a specific box
|
||||
*
|
||||
* used by core browser
|
||||
*/
|
||||
void html_redraw_a_box(struct hlcache_handle *h, struct box *box);
|
||||
|
||||
void html_overflow_scroll_drag_end(struct scrollbar *scrollbar,
|
||||
browser_mouse_state mouse, int x, int y);
|
||||
|
||||
dom_document *html_get_document(struct hlcache_handle *h);
|
||||
struct box *html_get_box_tree(struct hlcache_handle *h);
|
||||
/**
|
||||
* obtain html frame content from handle
|
||||
*
|
||||
* used by core browser
|
||||
*/
|
||||
struct content_html_frames *html_get_frameset(struct hlcache_handle *h);
|
||||
|
||||
/**
|
||||
* obtain html iframe content from handle
|
||||
*
|
||||
* used by core browser
|
||||
*/
|
||||
struct content_html_iframe *html_get_iframe(struct hlcache_handle *h);
|
||||
struct nsurl *html_get_base_url(struct hlcache_handle *h);
|
||||
|
||||
/**
|
||||
* obtain html base target from handle
|
||||
*
|
||||
* used by core browser
|
||||
*/
|
||||
const char *html_get_base_target(struct hlcache_handle *h);
|
||||
|
||||
/**
|
||||
* set filename on a file gadget
|
||||
*
|
||||
* used by core browser
|
||||
*/
|
||||
void html_set_file_gadget_filename(struct hlcache_handle *hl,
|
||||
struct form_control *gadget, const char *fn);
|
||||
|
||||
|
@ -179,8 +204,19 @@ void html_set_file_gadget_filename(struct hlcache_handle *hl,
|
|||
struct html_stylesheet *html_get_stylesheets(struct hlcache_handle *h,
|
||||
unsigned int *n);
|
||||
|
||||
/**
|
||||
* Retrieve objects used by HTML document
|
||||
*
|
||||
* \param h Content to retrieve objects from
|
||||
* \param n Pointer to location to receive number of objects
|
||||
* \return Pointer to array of objects
|
||||
*/
|
||||
struct content_html_object *html_get_objects(struct hlcache_handle *h,
|
||||
unsigned int *n);
|
||||
|
||||
/**
|
||||
* get the offset within the docuemnt of a fragment id
|
||||
*/
|
||||
bool html_get_id_offset(struct hlcache_handle *h, lwc_string *frag_id,
|
||||
int *x, int *y);
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "css/css.h"
|
||||
#include "desktop/gui_internal.h"
|
||||
|
||||
#include "html/html.h"
|
||||
#include "html/html_internal.h"
|
||||
|
||||
static nsurl *html_default_stylesheet_url;
|
||||
|
|
|
@ -294,6 +294,45 @@ html__image_coords_dom_user_data_handler(dom_node_operation operation,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* End overflow scroll scrollbar drags
|
||||
*
|
||||
* \param scrollbar scrollbar widget
|
||||
* \param mouse state of mouse buttons and modifier keys
|
||||
* \param x coordinate of mouse
|
||||
* \param y coordinate of mouse
|
||||
*/
|
||||
static void
|
||||
html_overflow_scroll_drag_end(struct scrollbar *scrollbar,
|
||||
browser_mouse_state mouse,
|
||||
int x, int y)
|
||||
{
|
||||
int scroll_mouse_x, scroll_mouse_y, box_x, box_y;
|
||||
struct html_scrollbar_data *data = scrollbar_get_data(scrollbar);
|
||||
struct box *box;
|
||||
|
||||
box = data->box;
|
||||
box_coords(box, &box_x, &box_y);
|
||||
|
||||
if (scrollbar_is_horizontal(scrollbar)) {
|
||||
scroll_mouse_x = x - box_x;
|
||||
scroll_mouse_y = y - (box_y + box->padding[TOP] +
|
||||
box->height + box->padding[BOTTOM] -
|
||||
SCROLLBAR_WIDTH);
|
||||
scrollbar_mouse_drag_end(scrollbar, mouse,
|
||||
scroll_mouse_x, scroll_mouse_y);
|
||||
} else {
|
||||
scroll_mouse_x = x - (box_x + box->padding[LEFT] +
|
||||
box->width + box->padding[RIGHT] -
|
||||
SCROLLBAR_WIDTH);
|
||||
scroll_mouse_y = y - box_y;
|
||||
scrollbar_mouse_drag_end(scrollbar, mouse,
|
||||
scroll_mouse_x, scroll_mouse_y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle mouse clicks and movements in an HTML content window.
|
||||
*
|
||||
|
@ -1227,41 +1266,6 @@ void html_overflow_scroll_callback(void *client_data,
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* End overflow scroll scrollbar drags
|
||||
*
|
||||
* \param scrollbar scrollbar widget
|
||||
* \param mouse state of mouse buttons and modifier keys
|
||||
* \param x coordinate of mouse
|
||||
* \param y coordinate of mouse
|
||||
*/
|
||||
void html_overflow_scroll_drag_end(struct scrollbar *scrollbar,
|
||||
browser_mouse_state mouse, int x, int y)
|
||||
{
|
||||
int scroll_mouse_x, scroll_mouse_y, box_x, box_y;
|
||||
struct html_scrollbar_data *data = scrollbar_get_data(scrollbar);
|
||||
struct box *box;
|
||||
|
||||
box = data->box;
|
||||
box_coords(box, &box_x, &box_y);
|
||||
|
||||
if (scrollbar_is_horizontal(scrollbar)) {
|
||||
scroll_mouse_x = x - box_x;
|
||||
scroll_mouse_y = y - (box_y + box->padding[TOP] +
|
||||
box->height + box->padding[BOTTOM] -
|
||||
SCROLLBAR_WIDTH);
|
||||
scrollbar_mouse_drag_end(scrollbar, mouse,
|
||||
scroll_mouse_x, scroll_mouse_y);
|
||||
} else {
|
||||
scroll_mouse_x = x - (box_x + box->padding[LEFT] +
|
||||
box->width + box->padding[RIGHT] -
|
||||
SCROLLBAR_WIDTH);
|
||||
scroll_mouse_y = y - box_y;
|
||||
scrollbar_mouse_drag_end(scrollbar, mouse,
|
||||
scroll_mouse_x, scroll_mouse_y);
|
||||
}
|
||||
}
|
||||
|
||||
/* Documented in html_internal.h */
|
||||
void html_set_drag_type(html_content *html, html_drag_type drag_type,
|
||||
union html_drag_owner drag_owner, const struct rect *rect)
|
||||
|
|
|
@ -25,14 +25,14 @@
|
|||
#define NETSURF_HTML_HTML_INTERNAL_H
|
||||
|
||||
#include <libcss/libcss.h>
|
||||
#include <dom/bindings/hubbub/parser.h>
|
||||
|
||||
#include "content/handlers/css/utils.h"
|
||||
#include "netsurf/types.h"
|
||||
#include "content/content_protected.h"
|
||||
#include "desktop/selection.h"
|
||||
|
||||
#include "html/html.h"
|
||||
|
||||
struct gui_layout_table;
|
||||
struct scrollbar_msg_data;
|
||||
|
||||
typedef enum {
|
||||
HTML_DRAG_NONE, /** No drag */
|
||||
|
@ -44,12 +44,15 @@ typedef enum {
|
|||
HTML_DRAG_CONTENT_SCROLL /** Not own; drag in child content */
|
||||
} html_drag_type;
|
||||
|
||||
/**
|
||||
* For drags we don't own
|
||||
*/
|
||||
union html_drag_owner {
|
||||
bool no_owner;
|
||||
struct box *content;
|
||||
struct scrollbar *scrollbar;
|
||||
struct box *textarea;
|
||||
}; /**< For drags we don't own */
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
HTML_SELECTION_NONE, /** No selection */
|
||||
|
@ -57,24 +60,39 @@ typedef enum {
|
|||
HTML_SELECTION_SELF, /** Selection in this html content */
|
||||
HTML_SELECTION_CONTENT /** Selection in child content */
|
||||
} html_selection_type;
|
||||
|
||||
/**
|
||||
* For getting at selections in this content or things in this content
|
||||
*/
|
||||
union html_selection_owner {
|
||||
bool none;
|
||||
struct box *textarea;
|
||||
struct box *content;
|
||||
}; /**< For getting at selections in this content or things in this content */
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
HTML_FOCUS_SELF, /** Focus is our own */
|
||||
HTML_FOCUS_CONTENT, /** Focus belongs to child content */
|
||||
HTML_FOCUS_TEXTAREA /** Focus belongs to textarea */
|
||||
HTML_FOCUS_SELF, /**< Focus is our own */
|
||||
HTML_FOCUS_CONTENT, /**< Focus belongs to child content */
|
||||
HTML_FOCUS_TEXTAREA /**< Focus belongs to textarea */
|
||||
} html_focus_type;
|
||||
|
||||
/**
|
||||
* For directing input
|
||||
*/
|
||||
union html_focus_owner {
|
||||
bool self;
|
||||
struct box *textarea;
|
||||
struct box *content;
|
||||
}; /**< For directing input */
|
||||
};
|
||||
|
||||
/** Data specific to CONTENT_HTML. */
|
||||
struct html_scrollbar_data {
|
||||
struct content *c;
|
||||
struct box *box;
|
||||
};
|
||||
|
||||
/**
|
||||
* Data specific to CONTENT_HTML.
|
||||
*/
|
||||
typedef struct html_content {
|
||||
struct content base;
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "desktop/scrollbar.h"
|
||||
#include "desktop/gui_internal.h"
|
||||
|
||||
#include "html/html.h"
|
||||
#include "html/box.h"
|
||||
#include "html/html_internal.h"
|
||||
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright 2018 Vincent Sanders <vince@netsurf-browser.org>
|
||||
*
|
||||
* This file is part of NetSurf, http://www.netsurf-browser.org/
|
||||
*
|
||||
* NetSurf is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* NetSurf is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* Interface to HTML content handler to save documents.
|
||||
*
|
||||
* \todo Investigate altering this API as it is only used for
|
||||
* exporting the html content to disc.
|
||||
*/
|
||||
|
||||
#ifndef NETSURF_HTML_HTML_SAVE_H
|
||||
#define NETSURF_HTML_HTML_SAVE_H
|
||||
|
||||
/**
|
||||
* get the dom document of a html content from a handle
|
||||
*/
|
||||
dom_document *html_get_document(struct hlcache_handle *h);
|
||||
|
||||
|
||||
/**
|
||||
* get the render box tree of a html content from a handle
|
||||
*/
|
||||
struct box *html_get_box_tree(struct hlcache_handle *h);
|
||||
|
||||
/**
|
||||
* get the base url of an html content from a handle
|
||||
*/
|
||||
struct nsurl *html_get_base_url(struct hlcache_handle *h);
|
||||
|
||||
#endif
|
|
@ -39,6 +39,7 @@
|
|||
#include "content/fetch.h"
|
||||
#include "content/hlcache.h"
|
||||
|
||||
#include "html/html.h"
|
||||
#include "html/html_internal.h"
|
||||
|
||||
typedef bool (script_handler_t)(struct jscontext *jscontext, const char *data, size_t size) ;
|
||||
|
|
|
@ -56,10 +56,12 @@
|
|||
#include "desktop/scrollbar.h"
|
||||
#include "desktop/textarea.h"
|
||||
|
||||
#include "html/html.h"
|
||||
#include "html/html_save.h"
|
||||
#include "html/html_internal.h"
|
||||
#include "html/box.h"
|
||||
#include "html/font.h"
|
||||
#include "html/form_internal.h"
|
||||
#include "html/html_internal.h"
|
||||
#include "html/layout.h"
|
||||
#include "html/table.h"
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "content/hlcache.h"
|
||||
#include "css/css.h"
|
||||
#include "html/box.h"
|
||||
#include "html/html_save.h"
|
||||
#include "html/html.h"
|
||||
|
||||
#include "netsurf/misc.h"
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include "utils/utils.h"
|
||||
#include "netsurf/content.h"
|
||||
#include "html/box.h"
|
||||
#include "html/html.h"
|
||||
#include "html/html_save.h"
|
||||
|
||||
#include "netsurf/utf8.h"
|
||||
#include "desktop/gui_internal.h"
|
||||
|
|
Loading…
Reference in New Issue