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
|
|
|
*/
|
|
|
|
|
2004-02-20 03:43:17 +03:00
|
|
|
/** \file
|
|
|
|
* Content for text/html (interface).
|
|
|
|
*
|
|
|
|
* These functions should in general be called via the content interface.
|
|
|
|
*/
|
|
|
|
|
2003-02-09 15:58:15 +03:00
|
|
|
#ifndef _NETSURF_RENDER_HTML_H_
|
|
|
|
#define _NETSURF_RENDER_HTML_H_
|
|
|
|
|
2004-06-09 23:55:06 +04:00
|
|
|
#include <stdbool.h>
|
2012-07-14 03:33:15 +04:00
|
|
|
|
|
|
|
#include <dom/dom.h>
|
|
|
|
#include <dom/bindings/hubbub/parser.h>
|
|
|
|
|
2007-05-31 02:39:54 +04:00
|
|
|
#include "content/content_type.h"
|
|
|
|
#include "css/css.h"
|
2014-10-25 15:04:11 +04:00
|
|
|
#include "desktop/browser.h"
|
2010-06-04 13:35:08 +04:00
|
|
|
#include "desktop/mouse.h"
|
2009-07-21 14:59:53 +04:00
|
|
|
#include "desktop/plot_style.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;
|
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;
|
2010-03-28 16:56:39 +04: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
|
|
|
|
2005-01-02 01:05:21 +03:00
|
|
|
/** An object (<img>, <object>, etc.) in a CONTENT_HTML document. */
|
|
|
|
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
|
|
|
struct html_scrollbar_data {
|
|
|
|
struct content *c;
|
|
|
|
struct box *box;
|
|
|
|
};
|
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
/** Frame tree (<frameset>, <frame>) */
|
|
|
|
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 */
|
|
|
|
};
|
|
|
|
|
|
|
|
/** Inline frame list (<iframe>) */
|
|
|
|
struct content_html_iframe {
|
|
|
|
struct box *box;
|
|
|
|
|
|
|
|
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 */
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
nserror html_init(void);
|
2003-11-13 01:22:45 +03:00
|
|
|
|
2010-06-04 13:35:08 +04:00
|
|
|
void html_redraw_a_box(struct hlcache_handle *h, struct box *box);
|
|
|
|
|
2011-05-10 02:49:17 +04:00
|
|
|
void html_overflow_scroll_drag_end(struct scrollbar *scrollbar,
|
2010-06-04 13:35:08 +04:00
|
|
|
browser_mouse_state mouse, int x, int y);
|
2006-02-16 02:09:55 +03:00
|
|
|
|
|
|
|
bool text_redraw(const char *utf8_text, size_t utf8_len,
|
2011-03-01 23:00:41 +03:00
|
|
|
size_t offset, int space,
|
2009-07-21 14:59:53 +04:00
|
|
|
const plot_font_style_t *fstyle,
|
2006-02-16 02:09:55 +03:00
|
|
|
int x, int y,
|
2011-02-14 22:17:08 +03:00
|
|
|
const struct rect *clip,
|
2006-02-16 02:09:55 +03:00
|
|
|
int height,
|
2009-07-21 14:59:53 +04:00
|
|
|
float scale,
|
2011-06-30 19:48:07 +04:00
|
|
|
bool excluded,
|
2011-08-24 16:29:30 +04:00
|
|
|
struct content *c,
|
2011-07-13 17:20:26 +04:00
|
|
|
const struct selection *sel,
|
2011-08-24 16:29:30 +04:00
|
|
|
struct search_context *search,
|
2011-06-30 19:48:07 +04:00
|
|
|
const struct redraw_context *ctx);
|
2006-02-16 02:09:55 +03:00
|
|
|
|
2012-03-24 03:18:04 +04:00
|
|
|
dom_document *html_get_document(struct hlcache_handle *h);
|
2010-03-28 16:56:39 +04:00
|
|
|
struct box *html_get_box_tree(struct hlcache_handle *h);
|
|
|
|
struct content_html_frames *html_get_frameset(struct hlcache_handle *h);
|
|
|
|
struct content_html_iframe *html_get_iframe(struct hlcache_handle *h);
|
2014-07-06 21:34:34 +04:00
|
|
|
struct nsurl *html_get_base_url(struct hlcache_handle *h);
|
2010-03-28 16:56:39 +04:00
|
|
|
const char *html_get_base_target(struct hlcache_handle *h);
|
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
|
|
|
|
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);
|
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
|