Subversion Repositories Kolibri OS

Rev

Rev 3584 | Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * Copyright 2004 James Bursa <bursa@users.sourceforge.net>
  3.  *
  4.  * This file is part of NetSurf, http://www.netsurf-browser.org/
  5.  *
  6.  * NetSurf is free software; you can redistribute it and/or modify
  7.  * it under the terms of the GNU General Public License as published by
  8.  * the Free Software Foundation; version 2 of the License.
  9.  *
  10.  * NetSurf is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  * GNU General Public License for more details.
  14.  *
  15.  * You should have received a copy of the GNU General Public License
  16.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  17.  */
  18.  
  19. /** \file
  20.  * Content for text/html (private data).
  21.  */
  22.  
  23. #ifndef NETSURF_RENDER_HTML_INTERNAL_H_
  24. #define NETSURF_RENDER_HTML_INTERNAL_H_
  25.  
  26. #include "content/content_protected.h"
  27. #include "desktop/selection.h"
  28. #include "render/html.h"
  29. #include <dom/functypes.h>
  30.  
  31. /** Data specific to CONTENT_HTML. */
  32. typedef struct html_content {
  33.         struct content base;
  34.  
  35.         dom_hubbub_parser *parser; /**< Parser object handle */
  36.  
  37.         /** Document tree */
  38.         dom_document *document;
  39.         /** Quirkyness of document */
  40.         dom_document_quirks_mode quirks;
  41.  
  42.         /** Encoding of source, NULL if unknown. */
  43.         char *encoding;
  44.         /** Source of encoding information. */
  45.         dom_hubbub_encoding_source encoding_source;
  46.  
  47.         /** Base URL (may be a copy of content->url). */
  48.         nsurl *base_url;
  49.         /** Base target */
  50.         char *base_target;
  51.  
  52.         /** Content has been aborted in the LOADING state */
  53.         bool aborted;
  54.  
  55.         /** A talloc context purely for the render box tree */
  56.         int *bctx;
  57.         /** Box tree, or NULL. */
  58.         struct box *layout;
  59.         /** Document background colour. */
  60.         colour background_colour;
  61.         /** Font callback table */
  62.         const struct font_functions *font_func;
  63.  
  64.         /** Number of entries in scripts */
  65.         unsigned int scripts_count;
  66.         /** Scripts */
  67.         struct html_script *scripts;
  68.         /** javascript context */
  69.         struct jscontext *jscontext;
  70.  
  71.         /** Number of entries in stylesheet_content. */
  72.         unsigned int stylesheet_count;
  73.         /** Stylesheets. Each may be NULL. */
  74.         struct html_stylesheet *stylesheets;
  75.         /**< Style selection context */
  76.         css_select_ctx *select_ctx;
  77.         /**< Universal selector */
  78.         lwc_string *universal;
  79.  
  80.         /** Number of entries in object_list. */
  81.         unsigned int num_objects;
  82.         /** List of objects. */
  83.         struct content_html_object *object_list;
  84.         /** Forms, in reverse order to document. */
  85.         struct form *forms;
  86.         /** Hash table of imagemaps. */
  87.         struct imagemap **imagemaps;
  88.  
  89.         /** Browser window containing this document, or NULL if not open. */
  90.         struct browser_window *bw;
  91.  
  92.         /** Frameset information */
  93.         struct content_html_frames *frameset;
  94.  
  95.         /** Inline frame information */
  96.         struct content_html_iframe *iframe;
  97.  
  98.         /** Content of type CONTENT_HTML containing this, or NULL if not an
  99.          * object within a page. */
  100.         struct html_content *page;
  101.  
  102.         /** Scrollbar capturing all mouse events, updated to any active HTML
  103.          *  scrollbar, or NULL when no scrollbar drags active */
  104.         struct scrollbar *scrollbar;
  105.  
  106.         /** Open core-handled form SELECT menu,
  107.          *  or NULL if none currently open. */
  108.         struct form_control *visible_select_menu;
  109.  
  110.         /** Selection state */
  111.         struct selection sel;
  112.  
  113.         /** Context for free text search, or NULL if none */
  114.         struct search_context *search;
  115.  
  116. } html_content;
  117.  
  118.  
  119. bool html_fetch_object(html_content *c, nsurl *url, struct box *box,
  120.                 content_type permitted_types,
  121.                 int available_width, int available_height,
  122.                 bool background);
  123.  
  124. void html_set_status(html_content *c, const char *extra);
  125.  
  126. void html__redraw_a_box(html_content *html, struct box *box);
  127.  
  128. struct browser_window *html_get_browser_window(struct content *c);
  129. struct search_context *html_get_search(struct content *c);
  130. void html_set_search(struct content *c, struct search_context *s);
  131.  
  132. /**
  133.  * Complete conversion of an HTML document
  134.  *
  135.  * \param htmlc  Content to convert
  136.  */
  137. void html_finish_conversion(html_content *htmlc);
  138.  
  139. /**
  140.  * Begin conversion of an HTML document
  141.  *
  142.  * \param htmlc Content to convert
  143.  */
  144. bool html_begin_conversion(html_content *htmlc);
  145.  
  146. /* in render/html_redraw.c */
  147. bool html_redraw(struct content *c, struct content_redraw_data *data,
  148.                 const struct rect *clip, const struct redraw_context *ctx);
  149.  
  150. /* in render/html_interaction.c */
  151. void html_mouse_track(struct content *c, struct browser_window *bw,
  152.                         browser_mouse_state mouse, int x, int y);
  153. void html_mouse_action(struct content *c, struct browser_window *bw,
  154.                         browser_mouse_state mouse, int x, int y);
  155. void html_overflow_scroll_callback(void *client_data,
  156.                 struct scrollbar_msg_data *scrollbar_data);
  157.  
  158.  
  159. /* in render/html_script.c */
  160. dom_hubbub_error  html_process_script(void *ctx, dom_node *node);
  161. void html_free_scripts(html_content *html);
  162. bool html_scripts_exec(html_content *c);
  163.  
  164. /* in render/html_forms.c */
  165. struct form *html_forms_get_forms(const char *docenc, dom_html_document *doc);
  166. struct form_control *html_forms_get_control_for_node(struct form *forms, dom_node *node);
  167.  
  168. /* Useful dom_string pointers */
  169. struct dom_string;
  170.  
  171. extern struct dom_string *html_dom_string_map;
  172. extern struct dom_string *html_dom_string_id;
  173. extern struct dom_string *html_dom_string_name;
  174. extern struct dom_string *html_dom_string_area;
  175. extern struct dom_string *html_dom_string_a;
  176. extern struct dom_string *html_dom_string_nohref;
  177. extern struct dom_string *html_dom_string_href;
  178. extern struct dom_string *html_dom_string_target;
  179. extern struct dom_string *html_dom_string_shape;
  180. extern struct dom_string *html_dom_string_default;
  181. extern struct dom_string *html_dom_string_rect;
  182. extern struct dom_string *html_dom_string_rectangle;
  183. extern struct dom_string *html_dom_string_coords;
  184. extern struct dom_string *html_dom_string_circle;
  185. extern struct dom_string *html_dom_string_poly;
  186. extern struct dom_string *html_dom_string_polygon;
  187. extern struct dom_string *html_dom_string_text_javascript;
  188. extern struct dom_string *html_dom_string_type;
  189. extern struct dom_string *html_dom_string_src;
  190.  
  191. #endif
  192.  
  193.  
  194.