Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * Copyright 2009 John-Mark Bell <jmb@netsurf-browser.org>
  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. #ifndef netsurf_css_css_h_
  20. #define netsurf_css_css_h_
  21.  
  22. #include <stdint.h>
  23.  
  24. #include <libcss/libcss.h>
  25.  
  26. #include "utils/errors.h"
  27.  
  28. struct content;
  29. struct content_css_data;
  30. struct hlcache_handle;
  31. struct http_parameter;
  32. struct nscss_import;
  33.  
  34. /**
  35.  * Type of callback called when a CSS object has finished
  36.  *
  37.  * \param css  CSS object that has completed
  38.  * \param pw   Client-specific data
  39.  */
  40. typedef void (*nscss_done_callback)(struct content_css_data *css, void *pw);
  41.  
  42. /**
  43.  * CSS content data
  44.  */
  45. struct content_css_data
  46. {
  47.         css_stylesheet *sheet;          /**< Stylesheet object */
  48.         char *charset;                  /**< Character set of stylesheet */
  49.         struct nscss_import *imports;   /**< Array of imported sheets */
  50.         uint32_t import_count;          /**< Number of sheets imported */
  51.         uint32_t next_to_register;      /**< Index of next import to register */
  52.         nscss_done_callback done;       /**< Completion callback */
  53.         void *pw;                       /**< Client data */
  54. };
  55.  
  56. /**
  57.  * Imported stylesheet record
  58.  */
  59. struct nscss_import {
  60.         struct hlcache_handle *c;       /**< Content containing sheet */
  61.         uint64_t media;         /**< Media types that sheet applies to */
  62. };
  63.  
  64. nserror nscss_init(void);
  65.  
  66. nserror nscss_create_css_data(struct content_css_data *c,
  67.                 const char *url, const char *charset, bool quirks,
  68.                 nscss_done_callback done, void *pw);
  69. css_error nscss_process_css_data(struct content_css_data *c, const char *data,
  70.                 unsigned int size);
  71. css_error nscss_convert_css_data(struct content_css_data *c);
  72. void nscss_destroy_css_data(struct content_css_data *c);
  73.  
  74. css_stylesheet *nscss_get_stylesheet(struct hlcache_handle *h);
  75. struct nscss_import *nscss_get_imports(struct hlcache_handle *h, uint32_t *n);
  76.  
  77. #endif
  78.  
  79.