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"
|
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;
|
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 {
|
|
|
|
/** Type of sheet */
|
|
|
|
enum { HTML_STYLESHEET_EXTERNAL, HTML_STYLESHEET_INTERNAL } type;
|
|
|
|
union {
|
|
|
|
struct hlcache_handle *external;
|
|
|
|
struct content_css_data *internal;
|
|
|
|
} data; /**< Sheet data */
|
|
|
|
};
|
|
|
|
|
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) */
|
2011-10-04 00:28:29 +04:00
|
|
|
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 */
|
|
|
|
frame_scrolling scrolling; /** scrolling characteristics */
|
|
|
|
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) */
|
2011-10-04 00:28:29 +04:00
|
|
|
nsurl *url; /** frame url */
|
2006-11-27 18:35:18 +03:00
|
|
|
|
2006-09-02 19:52:41 +04:00
|
|
|
frame_scrolling scrolling; /** scrolling characteristics */
|
|
|
|
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
|
|
|
|
2004-10-18 01:10:19 +04:00
|
|
|
/** Render padding and margin box outlines in html_redraw(). */
|
|
|
|
extern bool html_redraw_debug;
|
|
|
|
|
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);
|
|
|
|
const char *html_get_encoding(struct hlcache_handle *h);
|
2012-07-14 03:33:15 +04:00
|
|
|
dom_hubbub_encoding_source html_get_encoding_source(struct hlcache_handle *h);
|
2010-03-28 16:56:39 +04:00
|
|
|
struct content_html_frames *html_get_frameset(struct hlcache_handle *h);
|
|
|
|
struct content_html_iframe *html_get_iframe(struct hlcache_handle *h);
|
2011-10-03 19:56:47 +04:00
|
|
|
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);
|
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);
|
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
|