2003-06-30 16:44:03 +04:00
|
|
|
/*
|
2004-02-15 23:39:53 +03:00
|
|
|
* Copyright 2004 James Bursa <bursa@users.sourceforge.net>
|
2007-08-08 20:16:03 +04:00
|
|
|
*
|
|
|
|
* 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/>.
|
2003-02-09 15:58:15 +03:00
|
|
|
*/
|
|
|
|
|
2018-05-10 13:34:26 +03:00
|
|
|
/**
|
|
|
|
* \file
|
|
|
|
* Interface to text/html content handler.
|
2004-02-20 03:43:17 +03:00
|
|
|
*
|
|
|
|
* These functions should in general be called via the content interface.
|
|
|
|
*/
|
|
|
|
|
2018-05-10 13:34:26 +03:00
|
|
|
#ifndef NETSURF_HTML_HTML_H
|
|
|
|
#define NETSURF_HTML_HTML_H
|
2003-02-09 15:58:15 +03:00
|
|
|
|
2004-06-09 23:55:06 +04:00
|
|
|
#include <stdbool.h>
|
2012-07-14 03:33:15 +04:00
|
|
|
|
2017-01-13 13:01:25 +03:00
|
|
|
#include "netsurf/types.h"
|
2016-06-06 10:59:23 +03:00
|
|
|
#include "netsurf/content_type.h"
|
2016-05-30 19:32:57 +03:00
|
|
|
#include "netsurf/browser_window.h"
|
2016-05-30 14:07:16 +03:00
|
|
|
#include "netsurf/mouse.h"
|
2012-03-24 21:09:21 +04:00
|
|
|
#include "desktop/frame_types.h"
|
2003-09-08 01:08:13 +04:00
|
|
|
|
2010-03-28 16:56:39 +04:00
|
|
|
struct fetch_multipart_data;
|
2003-09-08 01:08:13 +04:00
|
|
|
struct box;
|
2006-02-16 02:09:55 +03:00
|
|
|
struct rect;
|
2003-09-08 01:08:13 +04:00
|
|
|
struct browser_window;
|
|
|
|
struct content;
|
2010-03-28 16:56:39 +04:00
|
|
|
struct hlcache_handle;
|
|
|
|
struct http_parameter;
|
2004-03-27 01:16:31 +03:00
|
|
|
struct imagemap;
|
2004-10-18 01:10:19 +04:00
|
|
|
struct object_params;
|
|
|
|
struct plotters;
|
2013-02-07 02:39:45 +04:00
|
|
|
struct textarea;
|
2011-05-10 02:49:17 +04:00
|
|
|
struct scrollbar;
|
|
|
|
struct scrollbar_msg_data;
|
2012-08-14 16:41:30 +04:00
|
|
|
struct search_context;
|
2013-02-22 16:19:35 +04:00
|
|
|
struct selection;
|
2014-07-06 21:34:34 +04:00
|
|
|
struct nsurl;
|
2017-01-13 13:01:25 +03:00
|
|
|
struct plot_font_style;
|
2003-09-08 01:08:13 +04:00
|
|
|
|
2010-03-28 16:56:39 +04:00
|
|
|
/**
|
|
|
|
* Container for stylesheets used by an HTML document
|
|
|
|
*/
|
|
|
|
struct html_stylesheet {
|
2013-02-20 21:13:23 +04:00
|
|
|
struct dom_node *node; /**< dom node associated with sheet */
|
2013-02-27 07:11:10 +04:00
|
|
|
struct hlcache_handle *sheet;
|
2013-03-16 14:50:17 +04:00
|
|
|
bool modified;
|
2016-09-24 14:44:28 +03:00
|
|
|
bool unused;
|
2010-03-28 16:56:39 +04:00
|
|
|
};
|
|
|
|
|
2018-05-11 15:15:17 +03:00
|
|
|
|
2012-06-19 13:35:51 +04:00
|
|
|
/**
|
|
|
|
* Container for scripts used by an HTML document
|
|
|
|
*/
|
|
|
|
struct html_script {
|
|
|
|
/** Type of script */
|
2012-07-27 16:53:14 +04:00
|
|
|
enum html_script_type { HTML_SCRIPT_INLINE,
|
|
|
|
HTML_SCRIPT_SYNC,
|
|
|
|
HTML_SCRIPT_DEFER,
|
|
|
|
HTML_SCRIPT_ASYNC } type;
|
2012-06-19 13:35:51 +04:00
|
|
|
union {
|
2012-07-27 16:53:14 +04:00
|
|
|
struct hlcache_handle *handle;
|
|
|
|
struct dom_string *string;
|
2012-06-19 13:35:51 +04:00
|
|
|
} data; /**< Script data */
|
2012-06-28 18:38:28 +04:00
|
|
|
struct dom_string *mimetype;
|
2012-06-19 13:35:51 +04:00
|
|
|
struct dom_string *encoding;
|
|
|
|
bool already_started;
|
|
|
|
bool parser_inserted;
|
|
|
|
bool force_async;
|
|
|
|
bool ready_exec;
|
|
|
|
bool async;
|
|
|
|
bool defer;
|
|
|
|
};
|
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
|
2018-05-10 13:34:26 +03:00
|
|
|
/**
|
|
|
|
* An object (img, object, etc. tag) in a CONTENT_HTML document.
|
|
|
|
*/
|
2005-01-02 01:05:21 +03:00
|
|
|
struct content_html_object {
|
2011-03-11 02:08:34 +03:00
|
|
|
struct content *parent; /**< Parent document */
|
|
|
|
struct content_html_object *next; /**< Next in chain */
|
|
|
|
|
2010-03-28 16:56:39 +04:00
|
|
|
struct hlcache_handle *content; /**< Content, or 0. */
|
2005-01-02 01:05:21 +03:00
|
|
|
struct box *box; /**< Node in box tree containing it. */
|
2011-05-07 00:40:09 +04:00
|
|
|
/** Bitmap of acceptable content types */
|
|
|
|
content_type permitted_types;
|
2005-08-21 02:52:20 +04:00
|
|
|
bool background; /**< This object is a background image. */
|
2006-09-02 19:52:41 +04:00
|
|
|
};
|
|
|
|
|
2011-06-28 02:21:15 +04:00
|
|
|
|
2018-05-11 15:15:17 +03:00
|
|
|
/**
|
|
|
|
* Frame tree (frameset or frame tag)
|
|
|
|
*/
|
2006-09-02 19:52:41 +04:00
|
|
|
struct content_html_frames {
|
|
|
|
int cols; /** number of columns in frameset */
|
|
|
|
int rows; /** number of rows in frameset */
|
2006-11-27 18:35:18 +03:00
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
struct frame_dimension width; /** frame width */
|
|
|
|
struct frame_dimension height; /** frame width */
|
|
|
|
int margin_width; /** frame margin width */
|
|
|
|
int margin_height; /** frame margin height */
|
2006-11-27 18:35:18 +03:00
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
char *name; /** frame name (for targetting) */
|
2014-07-06 21:34:34 +04:00
|
|
|
struct nsurl *url; /** frame url */
|
2006-11-27 18:35:18 +03:00
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
bool no_resize; /** frame is not resizable */
|
2014-10-25 15:04:11 +04:00
|
|
|
browser_scrolling scrolling; /** scrolling characteristics */
|
2006-09-02 19:52:41 +04:00
|
|
|
bool border; /** frame has a border */
|
|
|
|
colour border_colour; /** frame border colour */
|
2006-11-27 18:35:18 +03:00
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
struct content_html_frames *children; /** [cols * rows] children */
|
|
|
|
};
|
|
|
|
|
2018-05-11 15:15:17 +03:00
|
|
|
/**
|
|
|
|
* Inline frame list (iframe tag)
|
|
|
|
*/
|
2006-09-02 19:52:41 +04:00
|
|
|
struct content_html_iframe {
|
2018-05-10 13:34:26 +03:00
|
|
|
struct box *box;
|
2006-09-02 19:52:41 +04:00
|
|
|
|
|
|
|
int margin_width; /** frame margin width */
|
|
|
|
int margin_height; /** frame margin height */
|
2006-11-27 18:35:18 +03:00
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
char *name; /** frame name (for targetting) */
|
2014-07-06 21:34:34 +04:00
|
|
|
struct nsurl *url; /** frame url */
|
2006-11-27 18:35:18 +03:00
|
|
|
|
2014-10-25 15:04:11 +04:00
|
|
|
browser_scrolling scrolling; /** scrolling characteristics */
|
2006-09-02 19:52:41 +04:00
|
|
|
bool border; /** frame has a border */
|
|
|
|
colour border_colour; /** frame border colour */
|
|
|
|
|
2018-05-10 13:34:26 +03:00
|
|
|
struct content_html_iframe *next;
|
2005-01-02 01:05:21 +03:00
|
|
|
};
|
|
|
|
|
2011-05-07 00:40:09 +04:00
|
|
|
/* entries in stylesheet_content */
|
|
|
|
#define STYLESHEET_BASE 0 /* base style sheet */
|
|
|
|
#define STYLESHEET_QUIRKS 1 /* quirks mode stylesheet */
|
|
|
|
#define STYLESHEET_ADBLOCK 2 /* adblocking stylesheet */
|
2012-03-06 21:44:24 +04:00
|
|
|
#define STYLESHEET_USER 3 /* user stylesheet */
|
|
|
|
#define STYLESHEET_START 4 /* start of document stylesheets */
|
2011-05-07 00:40:09 +04:00
|
|
|
|
2018-05-11 15:15:17 +03:00
|
|
|
/**
|
|
|
|
* initialise content handler
|
|
|
|
*
|
|
|
|
* \return NSERROR_OK on success otherwise appropriate error code
|
|
|
|
*/
|
2011-05-07 00:40:09 +04:00
|
|
|
nserror html_init(void);
|
2003-11-13 01:22:45 +03:00
|
|
|
|
2018-05-11 15:15:17 +03:00
|
|
|
/**
|
|
|
|
* redraw a specific box
|
|
|
|
*
|
|
|
|
* used by core browser
|
|
|
|
*/
|
2010-06-04 13:35:08 +04:00
|
|
|
void html_redraw_a_box(struct hlcache_handle *h, struct box *box);
|
|
|
|
|
2018-05-11 15:15:17 +03:00
|
|
|
/**
|
|
|
|
* obtain html frame content from handle
|
|
|
|
*
|
|
|
|
* used by core browser
|
|
|
|
*/
|
2010-03-28 16:56:39 +04:00
|
|
|
struct content_html_frames *html_get_frameset(struct hlcache_handle *h);
|
2018-05-11 15:15:17 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* obtain html iframe content from handle
|
|
|
|
*
|
|
|
|
* used by core browser
|
|
|
|
*/
|
2010-03-28 16:56:39 +04:00
|
|
|
struct content_html_iframe *html_get_iframe(struct hlcache_handle *h);
|
2018-05-11 15:15:17 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* obtain html base target from handle
|
|
|
|
*
|
|
|
|
* used by core browser
|
|
|
|
*/
|
2010-03-28 16:56:39 +04:00
|
|
|
const char *html_get_base_target(struct hlcache_handle *h);
|
2018-05-11 15:15:17 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* set filename on a file gadget
|
|
|
|
*
|
|
|
|
* used by core browser
|
|
|
|
*/
|
2014-01-05 20:04:35 +04:00
|
|
|
void html_set_file_gadget_filename(struct hlcache_handle *hl,
|
|
|
|
struct form_control *gadget, const char *fn);
|
2013-02-24 17:15:05 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve stylesheets used by HTML document
|
|
|
|
*
|
|
|
|
* \param h Content to retrieve stylesheets from
|
|
|
|
* \param n Pointer to location to receive number of sheets
|
|
|
|
* \return Pointer to array of stylesheets
|
|
|
|
*/
|
2012-07-27 16:53:14 +04:00
|
|
|
struct html_stylesheet *html_get_stylesheets(struct hlcache_handle *h,
|
2010-03-28 16:56:39 +04:00
|
|
|
unsigned int *n);
|
2013-02-24 17:15:05 +04:00
|
|
|
|
2018-05-11 15:15:17 +03:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2012-07-27 16:53:14 +04:00
|
|
|
struct content_html_object *html_get_objects(struct hlcache_handle *h,
|
2010-06-04 13:35:08 +04:00
|
|
|
unsigned int *n);
|
2018-05-11 15:15:17 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* get the offset within the docuemnt of a fragment id
|
|
|
|
*/
|
2011-10-29 15:37:05 +04:00
|
|
|
bool html_get_id_offset(struct hlcache_handle *h, lwc_string *frag_id,
|
2010-06-04 13:35:08 +04:00
|
|
|
int *x, int *y);
|
2010-03-28 16:56:39 +04:00
|
|
|
|
2003-02-09 15:58:15 +03:00
|
|
|
#endif
|