2003-06-30 16:44:03 +04:00
|
|
|
/*
|
2009-07-24 03:05:34 +04:00
|
|
|
* Copyright 2009 John-Mark Bell <jmb@netsurf-browser.org>
|
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-04-04 19:19:32 +04:00
|
|
|
*/
|
|
|
|
|
2009-07-24 03:05:34 +04:00
|
|
|
#ifndef netsurf_css_css_h_
|
|
|
|
#define netsurf_css_css_h_
|
2004-02-02 03:22:59 +03:00
|
|
|
|
2009-07-27 17:49:10 +04:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2009-07-24 03:05:34 +04:00
|
|
|
#include <libcss/libcss.h>
|
2004-08-01 18:13:47 +04:00
|
|
|
|
2010-03-28 16:56:39 +04:00
|
|
|
#include "utils/errors.h"
|
|
|
|
|
2009-07-24 03:05:34 +04:00
|
|
|
struct content;
|
2010-03-28 16:56:39 +04:00
|
|
|
struct hlcache_handle;
|
|
|
|
struct http_parameter;
|
2009-07-27 17:49:10 +04:00
|
|
|
struct nscss_import;
|
2003-04-05 19:35:55 +04:00
|
|
|
|
2009-07-24 03:05:34 +04:00
|
|
|
/**
|
|
|
|
* CSS content data
|
|
|
|
*/
|
|
|
|
struct content_css_data
|
|
|
|
{
|
|
|
|
css_stylesheet *sheet; /**< Stylesheet object */
|
2010-04-08 19:40:17 +04:00
|
|
|
char *charset; /**< Character set of stylesheet */
|
|
|
|
uint32_t import_count; /**< Number of sheets imported */
|
2009-07-27 17:49:10 +04:00
|
|
|
struct nscss_import *imports; /**< Array of imported sheets */
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Imported stylesheet record
|
|
|
|
*/
|
|
|
|
struct nscss_import {
|
2010-03-28 16:56:39 +04:00
|
|
|
struct hlcache_handle *c; /**< Content containing sheet */
|
2009-07-27 17:49:10 +04:00
|
|
|
uint64_t media; /**< Media types that sheet applies to */
|
2003-04-05 20:24:43 +04:00
|
|
|
};
|
|
|
|
|
2010-04-11 14:52:18 +04:00
|
|
|
/**
|
|
|
|
* Type of callback called when a CSS object has finished importing sheets
|
|
|
|
*
|
|
|
|
* \param css CSS object that has completed
|
|
|
|
* \param pw Client-specific data
|
|
|
|
*/
|
|
|
|
typedef void (*nscss_done_callback)(struct content_css_data *css, void *pw);
|
|
|
|
|
2010-03-28 16:56:39 +04:00
|
|
|
bool nscss_create(struct content *c, const struct http_parameter *params);
|
2003-04-04 19:19:32 +04:00
|
|
|
|
2010-04-03 20:37:36 +04:00
|
|
|
bool nscss_process_data(struct content *c, const char *data, unsigned int size);
|
2003-04-04 19:19:32 +04:00
|
|
|
|
2010-03-30 02:33:21 +04:00
|
|
|
bool nscss_convert(struct content *c);
|
2003-04-04 19:19:32 +04:00
|
|
|
|
2009-07-24 03:05:34 +04:00
|
|
|
void nscss_destroy(struct content *c);
|
2003-04-04 19:19:32 +04:00
|
|
|
|
2010-04-04 16:41:19 +04:00
|
|
|
bool nscss_clone(const struct content *old, struct content *new_content);
|
|
|
|
|
2010-03-28 16:56:39 +04:00
|
|
|
nserror nscss_create_css_data(struct content_css_data *c,
|
|
|
|
const char *url, const char *charset, bool quirks);
|
2010-04-03 20:37:36 +04:00
|
|
|
css_error nscss_process_css_data(struct content_css_data *c, const char *data,
|
2010-03-28 16:56:39 +04:00
|
|
|
unsigned int size);
|
2010-04-11 14:52:18 +04:00
|
|
|
css_error nscss_convert_css_data(struct content_css_data *c,
|
|
|
|
nscss_done_callback callback, void *pw);
|
2010-03-28 16:56:39 +04:00
|
|
|
void nscss_destroy_css_data(struct content_css_data *c);
|
|
|
|
|
|
|
|
struct nscss_import *nscss_get_imports(struct hlcache_handle *h, uint32_t *n);
|
|
|
|
|
2003-04-04 19:19:32 +04:00
|
|
|
#endif
|
|
|
|
|