2011-05-07 00:40:09 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2004 James Bursa <bursa@users.sourceforge.net>
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* Content for text/html (private data).
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef NETSURF_RENDER_HTML_INTERNAL_H_
|
|
|
|
#define NETSURF_RENDER_HTML_INTERNAL_H_
|
|
|
|
|
|
|
|
#include "content/content_protected.h"
|
2011-07-13 17:20:26 +04:00
|
|
|
#include "desktop/selection.h"
|
2011-05-07 00:40:09 +04:00
|
|
|
#include "render/html.h"
|
|
|
|
|
|
|
|
/** Data specific to CONTENT_HTML. */
|
|
|
|
typedef struct html_content {
|
|
|
|
struct content base;
|
|
|
|
|
2012-07-14 03:33:15 +04:00
|
|
|
dom_hubbub_parser *parser; /**< Parser object handle */
|
|
|
|
|
2011-05-07 00:40:09 +04:00
|
|
|
/** Document tree */
|
2012-03-24 03:18:04 +04:00
|
|
|
dom_document *document;
|
2011-05-07 00:40:09 +04:00
|
|
|
/** Quirkyness of document */
|
2012-07-14 19:13:21 +04:00
|
|
|
dom_document_quirks_mode quirks;
|
2011-05-07 00:40:09 +04:00
|
|
|
|
|
|
|
/** Encoding of source, NULL if unknown. */
|
|
|
|
char *encoding;
|
|
|
|
/** Source of encoding information. */
|
2012-07-14 03:33:15 +04:00
|
|
|
dom_hubbub_encoding_source encoding_source;
|
2011-05-07 00:40:09 +04:00
|
|
|
|
|
|
|
/** Base URL (may be a copy of content->url). */
|
2011-10-03 19:56:47 +04:00
|
|
|
nsurl *base_url;
|
2011-05-07 00:40:09 +04:00
|
|
|
/** Base target */
|
|
|
|
char *base_target;
|
|
|
|
|
2011-07-20 00:23:59 +04:00
|
|
|
/** Content has been aborted in the LOADING state */
|
|
|
|
bool aborted;
|
|
|
|
|
2012-10-03 22:24:58 +04:00
|
|
|
/** A talloc context purely for the render box tree */
|
|
|
|
int *bctx;
|
2011-05-07 00:40:09 +04:00
|
|
|
/** Box tree, or NULL. */
|
|
|
|
struct box *layout;
|
|
|
|
/** Document background colour. */
|
|
|
|
colour background_colour;
|
|
|
|
/** Font callback table */
|
|
|
|
const struct font_functions *font_func;
|
|
|
|
|
2012-06-19 13:35:51 +04:00
|
|
|
/** Number of entries in scripts */
|
|
|
|
unsigned int scripts_count;
|
|
|
|
/** Scripts */
|
|
|
|
struct html_script *scripts;
|
|
|
|
/** javascript context */
|
|
|
|
struct jscontext *jscontext;
|
|
|
|
|
2011-05-07 00:40:09 +04:00
|
|
|
/** Number of entries in stylesheet_content. */
|
|
|
|
unsigned int stylesheet_count;
|
|
|
|
/** Stylesheets. Each may be NULL. */
|
|
|
|
struct html_stylesheet *stylesheets;
|
|
|
|
/**< Style selection context */
|
|
|
|
css_select_ctx *select_ctx;
|
2011-10-08 04:21:59 +04:00
|
|
|
/**< Universal selector */
|
|
|
|
lwc_string *universal;
|
2011-05-07 00:40:09 +04:00
|
|
|
|
|
|
|
/** Number of entries in object_list. */
|
|
|
|
unsigned int num_objects;
|
|
|
|
/** List of objects. */
|
|
|
|
struct content_html_object *object_list;
|
|
|
|
/** Forms, in reverse order to document. */
|
|
|
|
struct form *forms;
|
|
|
|
/** Hash table of imagemaps. */
|
|
|
|
struct imagemap **imagemaps;
|
|
|
|
|
|
|
|
/** Browser window containing this document, or NULL if not open. */
|
|
|
|
struct browser_window *bw;
|
|
|
|
|
|
|
|
/** Frameset information */
|
|
|
|
struct content_html_frames *frameset;
|
|
|
|
|
|
|
|
/** Inline frame information */
|
|
|
|
struct content_html_iframe *iframe;
|
|
|
|
|
|
|
|
/** Content of type CONTENT_HTML containing this, or NULL if not an
|
|
|
|
* object within a page. */
|
|
|
|
struct html_content *page;
|
2011-06-28 02:21:15 +04:00
|
|
|
|
|
|
|
/** Scrollbar capturing all mouse events, updated to any active HTML
|
|
|
|
* scrollbar, or NULL when no scrollbar drags active */
|
|
|
|
struct scrollbar *scrollbar;
|
2011-06-28 15:15:39 +04:00
|
|
|
|
|
|
|
/** Open core-handled form SELECT menu,
|
|
|
|
* or NULL if none currently open. */
|
|
|
|
struct form_control *visible_select_menu;
|
2011-07-13 17:20:26 +04:00
|
|
|
|
|
|
|
/** Selection state */
|
|
|
|
struct selection sel;
|
2011-08-24 16:29:30 +04:00
|
|
|
|
|
|
|
/** Context for free text search, or NULL if none */
|
|
|
|
struct search_context *search;
|
2012-06-11 02:17:30 +04:00
|
|
|
|
2011-05-07 00:40:09 +04:00
|
|
|
} html_content;
|
|
|
|
|
|
|
|
|
2011-10-04 14:23:47 +04:00
|
|
|
bool html_fetch_object(html_content *c, nsurl *url, struct box *box,
|
2011-05-07 00:40:09 +04:00
|
|
|
content_type permitted_types,
|
|
|
|
int available_width, int available_height,
|
|
|
|
bool background);
|
|
|
|
|
|
|
|
void html_set_status(html_content *c, const char *extra);
|
|
|
|
|
2012-08-16 16:22:35 +04:00
|
|
|
void html__redraw_a_box(html_content *html, struct box *box);
|
2011-07-07 21:50:04 +04:00
|
|
|
|
2011-07-26 17:53:42 +04:00
|
|
|
struct browser_window *html_get_browser_window(struct content *c);
|
2012-03-25 02:16:03 +04:00
|
|
|
struct search_context *html_get_search(struct content *c);
|
2011-08-24 16:29:30 +04:00
|
|
|
void html_set_search(struct content *c, struct search_context *s);
|
2012-07-30 21:18:11 +04:00
|
|
|
|
2012-07-13 23:19:04 +04:00
|
|
|
/**
|
|
|
|
* Complete conversion of an HTML document
|
|
|
|
*
|
2012-07-30 21:18:11 +04:00
|
|
|
* \param htmlc Content to convert
|
|
|
|
*/
|
|
|
|
void html_finish_conversion(html_content *htmlc);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Begin conversion of an HTML document
|
|
|
|
*
|
|
|
|
* \param htmlc Content to convert
|
2012-07-13 23:19:04 +04:00
|
|
|
*/
|
2012-07-30 21:18:11 +04:00
|
|
|
bool html_begin_conversion(html_content *htmlc);
|
2011-07-26 17:53:42 +04:00
|
|
|
|
2011-05-07 00:40:09 +04:00
|
|
|
/* in render/html_redraw.c */
|
2011-06-29 00:17:39 +04:00
|
|
|
bool html_redraw(struct content *c, struct content_redraw_data *data,
|
2011-06-30 19:48:07 +04:00
|
|
|
const struct rect *clip, const struct redraw_context *ctx);
|
2011-05-07 00:40:09 +04:00
|
|
|
|
|
|
|
/* in render/html_interaction.c */
|
|
|
|
void html_mouse_track(struct content *c, struct browser_window *bw,
|
|
|
|
browser_mouse_state mouse, int x, int y);
|
|
|
|
void html_mouse_action(struct content *c, struct browser_window *bw,
|
|
|
|
browser_mouse_state mouse, int x, int y);
|
|
|
|
void html_overflow_scroll_callback(void *client_data,
|
2011-05-10 02:49:17 +04:00
|
|
|
struct scrollbar_msg_data *scrollbar_data);
|
2011-05-07 00:40:09 +04:00
|
|
|
|
2012-07-15 00:42:02 +04:00
|
|
|
|
2012-07-13 23:19:04 +04:00
|
|
|
/* in render/html_script.c */
|
|
|
|
dom_hubbub_error html_process_script(void *ctx, dom_node *node);
|
2012-07-27 16:53:14 +04:00
|
|
|
void html_free_scripts(html_content *html);
|
2012-08-01 01:33:08 +04:00
|
|
|
bool html_scripts_exec(html_content *c);
|
2012-07-13 23:19:04 +04:00
|
|
|
|
2012-07-14 21:16:37 +04:00
|
|
|
/* in render/html_forms.c */
|
|
|
|
struct form *html_forms_get_forms(const char *docenc, dom_html_document *doc);
|
|
|
|
struct form_control *html_forms_get_control_for_node(struct form *forms, dom_node *node);
|
|
|
|
|
2012-03-25 19:07:08 +04:00
|
|
|
/* Useful dom_string pointers */
|
|
|
|
struct dom_string;
|
|
|
|
|
|
|
|
extern struct dom_string *html_dom_string_map;
|
|
|
|
extern struct dom_string *html_dom_string_id;
|
|
|
|
extern struct dom_string *html_dom_string_name;
|
|
|
|
extern struct dom_string *html_dom_string_area;
|
|
|
|
extern struct dom_string *html_dom_string_a;
|
|
|
|
extern struct dom_string *html_dom_string_nohref;
|
|
|
|
extern struct dom_string *html_dom_string_href;
|
|
|
|
extern struct dom_string *html_dom_string_target;
|
|
|
|
extern struct dom_string *html_dom_string_shape;
|
|
|
|
extern struct dom_string *html_dom_string_default;
|
|
|
|
extern struct dom_string *html_dom_string_rect;
|
|
|
|
extern struct dom_string *html_dom_string_rectangle;
|
|
|
|
extern struct dom_string *html_dom_string_coords;
|
|
|
|
extern struct dom_string *html_dom_string_circle;
|
|
|
|
extern struct dom_string *html_dom_string_poly;
|
|
|
|
extern struct dom_string *html_dom_string_polygon;
|
2012-07-13 23:19:04 +04:00
|
|
|
extern struct dom_string *html_dom_string_text_javascript;
|
|
|
|
extern struct dom_string *html_dom_string_type;
|
|
|
|
extern struct dom_string *html_dom_string_src;
|
2012-03-25 19:07:08 +04:00
|
|
|
|
2011-05-07 00:40:09 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|