2008-09-23 06:19:50 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2008 John-Mark Bell <jmb@netsurf-browser.org>
|
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _NETSURF_RENDER_PARSER_BINDING_H_
|
|
|
|
#define _NETSURF_RENDER_PARSER_BINDING_H_
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include <libxml/tree.h>
|
|
|
|
|
2011-09-29 23:15:54 +04:00
|
|
|
struct box;
|
2009-02-20 14:39:25 +03:00
|
|
|
struct form;
|
|
|
|
struct form_control;
|
|
|
|
|
2011-09-29 23:15:54 +04:00
|
|
|
/**
|
|
|
|
* Private data attached to each DOM node
|
|
|
|
*/
|
|
|
|
typedef struct binding_private {
|
|
|
|
struct box *box; /**< Root box if ELEMENT node, or NULL */
|
|
|
|
} binding_private;
|
|
|
|
|
2008-09-23 06:19:50 +04:00
|
|
|
typedef enum binding_error {
|
|
|
|
BINDING_OK,
|
|
|
|
BINDING_NOMEM,
|
2008-11-09 22:04:30 +03:00
|
|
|
BINDING_BADENCODING,
|
2008-09-23 06:19:50 +04:00
|
|
|
BINDING_ENCODINGCHANGE
|
|
|
|
} binding_error;
|
|
|
|
|
|
|
|
typedef enum binding_encoding_source {
|
|
|
|
ENCODING_SOURCE_HEADER,
|
|
|
|
ENCODING_SOURCE_DETECTED,
|
|
|
|
ENCODING_SOURCE_META
|
|
|
|
} binding_encoding_source;
|
|
|
|
|
2009-07-24 03:05:34 +04:00
|
|
|
typedef enum binding_quirks_mode {
|
|
|
|
BINDING_QUIRKS_MODE_NONE,
|
|
|
|
BINDING_QUIRKS_MODE_LIMITED,
|
|
|
|
BINDING_QUIRKS_MODE_FULL
|
|
|
|
} binding_quirks_mode;
|
|
|
|
|
2008-11-09 22:04:30 +03:00
|
|
|
binding_error binding_create_tree(void *arena, const char *charset, void **ctx);
|
|
|
|
binding_error binding_destroy_tree(void *ctx);
|
2008-09-23 06:19:50 +04:00
|
|
|
|
|
|
|
binding_error binding_parse_chunk(void *ctx, const uint8_t *data, size_t len);
|
|
|
|
binding_error binding_parse_completed(void *ctx);
|
|
|
|
|
|
|
|
const char *binding_get_encoding(void *ctx, binding_encoding_source *source);
|
2009-07-24 03:05:34 +04:00
|
|
|
xmlDocPtr binding_get_document(void *ctx, binding_quirks_mode *quirks);
|
2008-09-23 06:19:50 +04:00
|
|
|
|
2009-02-20 14:39:25 +03:00
|
|
|
struct form *binding_get_forms(void *ctx);
|
|
|
|
struct form_control *binding_get_control_for_node(void *ctx, xmlNodePtr node);
|
|
|
|
|
2011-09-29 23:15:54 +04:00
|
|
|
void binding_destroy_document(xmlDocPtr doc);
|
|
|
|
|
2008-09-23 06:19:50 +04:00
|
|
|
#endif
|
|
|
|
|