forked from KolibriOS/kolibrios
Netsurf initial port (still needs native ui and cURL)
git-svn-id: svn://kolibrios.org@3584 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
c4b7d3ff45
commit
370da47fa0
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef dom_hubbub_errors_h_
|
||||
#define dom_hubbub_errors_h_
|
||||
|
||||
typedef enum {
|
||||
DOM_HUBBUB_OK = 0,
|
||||
|
||||
DOM_HUBBUB_NOMEM = 1,
|
||||
|
||||
DOM_HUBBUB_BADPARM = 2, /**< Bad input parameter */
|
||||
|
||||
DOM_HUBBUB_DOM = 3, /**< DOM operation failed */
|
||||
|
||||
DOM_HUBBUB_HUBBUB_ERR = (1<<16),
|
||||
|
||||
DOM_HUBBUB_HUBBUB_ERR_PAUSED = (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_PAUSED),
|
||||
|
||||
DOM_HUBBUB_HUBBUB_ERR_ENCODINGCHANGE = (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_ENCODINGCHANGE),
|
||||
|
||||
DOM_HUBBUB_HUBBUB_ERR_NOMEM = (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_NOMEM),
|
||||
|
||||
DOM_HUBBUB_HUBBUB_ERR_BADPARM = (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_BADPARM),
|
||||
|
||||
DOM_HUBBUB_HUBBUB_ERR_INVALID = (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_INVALID),
|
||||
|
||||
DOM_HUBBUB_HUBBUB_ERR_FILENOTFOUND = (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_FILENOTFOUND),
|
||||
|
||||
DOM_HUBBUB_HUBBUB_ERR_NEEDDATA = (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_NEEDDATA),
|
||||
|
||||
DOM_HUBBUB_HUBBUB_ERR_BADENCODING = (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_BADENCODING),
|
||||
|
||||
DOM_HUBBUB_HUBBUB_ERR_UNKNOWN = (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_UNKNOWN),
|
||||
|
||||
} dom_hubbub_error;
|
||||
|
||||
#endif
|
101
programs/network/netsurf/include/dom/bindings/hubbub/parser.h
Normal file
101
programs/network/netsurf/include/dom/bindings/hubbub/parser.h
Normal file
@ -0,0 +1,101 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef dom_hubbub_parser_h_
|
||||
#define dom_hubbub_parser_h_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <hubbub/errors.h>
|
||||
|
||||
#include <dom/dom.h>
|
||||
|
||||
#include "errors.h"
|
||||
|
||||
/**
|
||||
* Type of script completion function
|
||||
*/
|
||||
typedef dom_hubbub_error (*dom_script)(void *ctx, struct dom_node *node);
|
||||
|
||||
typedef struct dom_hubbub_parser dom_hubbub_parser;
|
||||
|
||||
/* The encoding source of the document */
|
||||
typedef enum dom_hubbub_encoding_source {
|
||||
DOM_HUBBUB_ENCODING_SOURCE_HEADER,
|
||||
DOM_HUBBUB_ENCODING_SOURCE_DETECTED,
|
||||
DOM_HUBBUB_ENCODING_SOURCE_META
|
||||
} dom_hubbub_encoding_source;
|
||||
|
||||
/* The recommended way to use the parser is:
|
||||
*
|
||||
* dom_hubbub_parser_create(...);
|
||||
* dom_hubbub_parser_parse_chunk(...);
|
||||
* call _parse_chunk for all chunks of data
|
||||
*
|
||||
* After you have parsed the data,
|
||||
*
|
||||
* dom_hubbub_parser_completed(...);
|
||||
* dom_hubbub_parser_destroy(...);
|
||||
*
|
||||
* Clients must ensure that these function calls above are called in
|
||||
* the order shown. dom_hubbub_parser_create() will pass the ownership
|
||||
* of the document to the client. After that, the parser should be destroyed.
|
||||
* The client must not call any method of this parser after destruction.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Parameter block for dom_hubbub_parser_create
|
||||
*/
|
||||
typedef struct dom_hubbub_parser_params {
|
||||
const char *enc; /**< Source charset, or NULL */
|
||||
bool fix_enc; /**< Whether fix the encoding */
|
||||
|
||||
bool enable_script; /**< Whether scripting should be enabled. */
|
||||
dom_script script; /**< Script callback function */
|
||||
|
||||
dom_msg msg; /**< Informational message function */
|
||||
void *ctx; /**< Pointer to client-specific private data */
|
||||
|
||||
/** default action fetcher function */
|
||||
dom_events_default_action_fetcher daf;
|
||||
} dom_hubbub_parser_params;
|
||||
|
||||
/* Create a Hubbub parser instance */
|
||||
dom_hubbub_error dom_hubbub_parser_create(dom_hubbub_parser_params *params,
|
||||
dom_hubbub_parser **parser,
|
||||
dom_document **document);
|
||||
|
||||
/* Destroy a Hubbub parser instance */
|
||||
void dom_hubbub_parser_destroy(dom_hubbub_parser *parser);
|
||||
|
||||
/* Parse a chunk of data */
|
||||
dom_hubbub_error dom_hubbub_parser_parse_chunk(dom_hubbub_parser *parser,
|
||||
const uint8_t *data, size_t len);
|
||||
|
||||
/* insert data into the parse stream but do not parse it */
|
||||
dom_hubbub_error dom_hubbub_parser_insert_chunk(dom_hubbub_parser *parser,
|
||||
const uint8_t *data, size_t length);
|
||||
|
||||
/* Notify parser that datastream is empty */
|
||||
dom_hubbub_error dom_hubbub_parser_completed(dom_hubbub_parser *parser);
|
||||
|
||||
/* Retrieve the document's encoding */
|
||||
const char *dom_hubbub_parser_get_encoding(dom_hubbub_parser *parser,
|
||||
dom_hubbub_encoding_source *source);
|
||||
|
||||
/**
|
||||
* Set the Parse pause state.
|
||||
*
|
||||
* \param parser The parser object
|
||||
* \param pause The pause state to set.
|
||||
* \return DOM_HUBBUB_OK on success,
|
||||
* DOM_HUBBUB_HUBBUB_ERR | <hubbub_error> on failure
|
||||
*/
|
||||
dom_hubbub_error dom_hubbub_parser_pause(dom_hubbub_parser *parser, bool pause);
|
||||
|
||||
#endif
|
19
programs/network/netsurf/include/dom/bindings/xml/xmlerror.h
Normal file
19
programs/network/netsurf/include/dom/bindings/xml/xmlerror.h
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef xml_xmlerror_h_
|
||||
#define xml_xmlerror_h_
|
||||
|
||||
typedef enum {
|
||||
DOM_XML_OK = 0,
|
||||
|
||||
DOM_XML_NOMEM = 1,
|
||||
|
||||
DOM_XML_EXTERNAL_ERR = (1<<16),
|
||||
} dom_xml_error;
|
||||
|
||||
#endif
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef xml_xmlparser_h_
|
||||
#define xml_xmlparser_h_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <dom/dom.h>
|
||||
|
||||
#include "xmlerror.h"
|
||||
|
||||
typedef struct dom_xml_parser dom_xml_parser;
|
||||
|
||||
/* Create an XML parser instance */
|
||||
dom_xml_parser *dom_xml_parser_create(const char *enc, const char *int_enc,
|
||||
dom_msg msg, void *mctx, dom_document **document);
|
||||
|
||||
/* Destroy an XML parser instance */
|
||||
void dom_xml_parser_destroy(dom_xml_parser *parser);
|
||||
|
||||
/* Parse a chunk of data */
|
||||
dom_xml_error dom_xml_parser_parse_chunk(dom_xml_parser *parser,
|
||||
uint8_t *data, size_t len);
|
||||
|
||||
/* Notify parser that datastream is empty */
|
||||
dom_xml_error dom_xml_parser_completed(dom_xml_parser *parser);
|
||||
|
||||
#endif
|
147
programs/network/netsurf/include/dom/core/attr.h
Normal file
147
programs/network/netsurf/include/dom/core/attr.h
Normal file
@ -0,0 +1,147 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef dom_core_attr_h_
|
||||
#define dom_core_attr_h_
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/node.h>
|
||||
|
||||
struct dom_element;
|
||||
struct dom_type_info;
|
||||
struct dom_node;
|
||||
struct dom_attr;
|
||||
|
||||
typedef struct dom_attr dom_attr;
|
||||
|
||||
/**
|
||||
* The attribute type
|
||||
*/
|
||||
typedef enum {
|
||||
DOM_ATTR_UNSET = 0,
|
||||
DOM_ATTR_STRING,
|
||||
DOM_ATTR_BOOL,
|
||||
DOM_ATTR_SHORT,
|
||||
DOM_ATTR_INTEGER
|
||||
} dom_attr_type;
|
||||
|
||||
/* DOM Attr vtable */
|
||||
typedef struct dom_attr_vtable {
|
||||
struct dom_node_vtable base;
|
||||
|
||||
dom_exception (*dom_attr_get_name)(struct dom_attr *attr,
|
||||
dom_string **result);
|
||||
dom_exception (*dom_attr_get_specified)(struct dom_attr *attr,
|
||||
bool *result);
|
||||
dom_exception (*dom_attr_get_value)(struct dom_attr *attr,
|
||||
dom_string **result);
|
||||
dom_exception (*dom_attr_set_value)(struct dom_attr *attr,
|
||||
dom_string *value);
|
||||
dom_exception (*dom_attr_get_owner_element)(struct dom_attr *attr,
|
||||
struct dom_element **result);
|
||||
dom_exception (*dom_attr_get_schema_type_info)(struct dom_attr *attr,
|
||||
struct dom_type_info **result);
|
||||
dom_exception (*dom_attr_is_id)(struct dom_attr *attr, bool *result);
|
||||
} dom_attr_vtable;
|
||||
|
||||
static inline dom_exception dom_attr_get_name(struct dom_attr *attr,
|
||||
dom_string **result)
|
||||
{
|
||||
return ((dom_attr_vtable *) ((dom_node *) attr)->vtable)->
|
||||
dom_attr_get_name(attr, result);
|
||||
}
|
||||
#define dom_attr_get_name(a, r) dom_attr_get_name((struct dom_attr *) (a), (r))
|
||||
|
||||
static inline dom_exception dom_attr_get_specified(struct dom_attr *attr,
|
||||
bool *result)
|
||||
{
|
||||
return ((dom_attr_vtable *) ((dom_node *) attr)->vtable)->
|
||||
dom_attr_get_specified(attr, result);
|
||||
}
|
||||
#define dom_attr_get_specified(a, r) dom_attr_get_specified( \
|
||||
(struct dom_attr *) (a), (bool *) (r))
|
||||
|
||||
static inline dom_exception dom_attr_get_value(struct dom_attr *attr,
|
||||
dom_string **result)
|
||||
{
|
||||
return ((dom_attr_vtable *) ((dom_node *) attr)->vtable)->
|
||||
dom_attr_get_value(attr, result);
|
||||
}
|
||||
#define dom_attr_get_value(a, r) dom_attr_get_value((struct dom_attr *) (a), (r))
|
||||
|
||||
static inline dom_exception dom_attr_set_value(struct dom_attr *attr,
|
||||
dom_string *value)
|
||||
{
|
||||
return ((dom_attr_vtable *) ((dom_node *) attr)->vtable)->
|
||||
dom_attr_set_value(attr, value);
|
||||
}
|
||||
#define dom_attr_set_value(a, v) dom_attr_set_value((struct dom_attr *) (a), (v))
|
||||
|
||||
static inline dom_exception dom_attr_get_owner_element(struct dom_attr *attr,
|
||||
struct dom_element **result)
|
||||
{
|
||||
return ((dom_attr_vtable *) ((dom_node *) attr)->vtable)->
|
||||
dom_attr_get_owner_element(attr, result);
|
||||
}
|
||||
#define dom_attr_get_owner_element(a, r) dom_attr_get_owner_element(\
|
||||
(struct dom_attr *) (a), (struct dom_element **) (r))
|
||||
|
||||
static inline dom_exception dom_attr_get_schema_type_info(
|
||||
struct dom_attr *attr, struct dom_type_info **result)
|
||||
{
|
||||
return ((dom_attr_vtable *) ((dom_node *) attr)->vtable)->
|
||||
dom_attr_get_schema_type_info(attr, result);
|
||||
}
|
||||
#define dom_attr_get_schema_type_info(a, r) dom_attr_get_schema_type_info( \
|
||||
(struct dom_attr *) (a), (struct dom_type_info **) (r))
|
||||
|
||||
static inline dom_exception dom_attr_is_id(struct dom_attr *attr, bool *result)
|
||||
{
|
||||
return ((dom_attr_vtable *) ((dom_node *) attr)->vtable)->
|
||||
dom_attr_is_id(attr, result);
|
||||
}
|
||||
#define dom_attr_is_id(a, r) dom_attr_is_id((struct dom_attr *) (a), \
|
||||
(bool *) (r))
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/**
|
||||
* Following are our implementation specific APIs.
|
||||
*
|
||||
* These APIs are defined for the purpose that there are some attributes in
|
||||
* HTML and other DOM module whose type is not DOMString, but uint32_t or
|
||||
* boolean, for those types of attributes, clients should call one of the
|
||||
* following APIs to set it.
|
||||
*
|
||||
* When an Attr node is created, its type is unset and it can be turned into
|
||||
* any of the four types. Once the type is fixed by calling any of the four
|
||||
* APIs:
|
||||
* dom_attr_set_value
|
||||
* dom_attr_set_integer
|
||||
* dom_attr_set_short
|
||||
* dom_attr_set_bool
|
||||
* it can't be modified in future.
|
||||
*
|
||||
* For integer/short/bool type of attributes, we provide no string
|
||||
* repensentation of them, so when you call dom_attr_get_value on these
|
||||
* three type of attribute nodes, you will always get a empty dom_string.
|
||||
* If you want to do something with Attr node, you must know its type
|
||||
* firstly by calling dom_attr_get_type before you decide to call other
|
||||
* dom_attr_get_* functions.
|
||||
*/
|
||||
dom_attr_type dom_attr_get_type(dom_attr *a);
|
||||
dom_exception dom_attr_get_integer(dom_attr *a, uint32_t *value);
|
||||
dom_exception dom_attr_set_integer(dom_attr *a, uint32_t value);
|
||||
dom_exception dom_attr_get_short(dom_attr *a, unsigned short *value);
|
||||
dom_exception dom_attr_set_short(dom_attr *a, unsigned short value);
|
||||
dom_exception dom_attr_get_bool(dom_attr *a, bool *value);
|
||||
dom_exception dom_attr_set_bool(dom_attr *a, bool value);
|
||||
/* Make a attribute node readonly */
|
||||
void dom_attr_mark_readonly(dom_attr *a);
|
||||
|
||||
#endif
|
12
programs/network/netsurf/include/dom/core/cdatasection.h
Normal file
12
programs/network/netsurf/include/dom/core/cdatasection.h
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
|
||||
#ifndef dom_core_cdatasection_h_
|
||||
#define dom_core_cdatasection_h_
|
||||
|
||||
typedef struct dom_cdata_section dom_cdata_section;
|
||||
|
||||
#endif
|
130
programs/network/netsurf/include/dom/core/characterdata.h
Normal file
130
programs/network/netsurf/include/dom/core/characterdata.h
Normal file
@ -0,0 +1,130 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef dom_core_characterdata_h_
|
||||
#define dom_core_characterdata_h_
|
||||
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/node.h>
|
||||
|
||||
typedef struct dom_characterdata dom_characterdata;
|
||||
|
||||
/* The vtable for characterdata */
|
||||
typedef struct dom_characterdata_vtable {
|
||||
struct dom_node_vtable base;
|
||||
|
||||
dom_exception (*dom_characterdata_get_data)(
|
||||
struct dom_characterdata *cdata,
|
||||
dom_string **data);
|
||||
dom_exception (*dom_characterdata_set_data)(
|
||||
struct dom_characterdata *cdata,
|
||||
dom_string *data);
|
||||
dom_exception (*dom_characterdata_get_length)(
|
||||
struct dom_characterdata *cdata,
|
||||
uint32_t *length);
|
||||
dom_exception (*dom_characterdata_substring_data)(
|
||||
struct dom_characterdata *cdata, uint32_t offset,
|
||||
uint32_t count, dom_string **data);
|
||||
dom_exception (*dom_characterdata_append_data)(
|
||||
struct dom_characterdata *cdata,
|
||||
dom_string *data);
|
||||
dom_exception (*dom_characterdata_insert_data)(
|
||||
struct dom_characterdata *cdata,
|
||||
uint32_t offset, dom_string *data);
|
||||
dom_exception (*dom_characterdata_delete_data)(
|
||||
struct dom_characterdata *cdata,
|
||||
uint32_t offset, uint32_t count);
|
||||
dom_exception (*dom_characterdata_replace_data)(
|
||||
struct dom_characterdata *cdata, uint32_t offset,
|
||||
uint32_t count, dom_string *data);
|
||||
} dom_characterdata_vtable;
|
||||
|
||||
|
||||
static inline dom_exception dom_characterdata_get_data(
|
||||
struct dom_characterdata *cdata, dom_string **data)
|
||||
{
|
||||
return ((dom_characterdata_vtable *) ((dom_node *) cdata)->vtable)->
|
||||
dom_characterdata_get_data(cdata, data);
|
||||
}
|
||||
#define dom_characterdata_get_data(c, d) dom_characterdata_get_data( \
|
||||
(struct dom_characterdata *) (c), (d))
|
||||
|
||||
static inline dom_exception dom_characterdata_set_data(
|
||||
struct dom_characterdata *cdata, dom_string *data)
|
||||
{
|
||||
return ((dom_characterdata_vtable *) ((dom_node *) cdata)->vtable)->
|
||||
dom_characterdata_set_data(cdata, data);
|
||||
}
|
||||
#define dom_characterdata_set_data(c, d) dom_characterdata_set_data( \
|
||||
(struct dom_characterdata *) (c), (d))
|
||||
|
||||
static inline dom_exception dom_characterdata_get_length(
|
||||
struct dom_characterdata *cdata, uint32_t *length)
|
||||
{
|
||||
return ((dom_characterdata_vtable *) ((dom_node *) cdata)->vtable)->
|
||||
dom_characterdata_get_length(cdata, length);
|
||||
}
|
||||
#define dom_characterdata_get_length(c, l) dom_characterdata_get_length( \
|
||||
(struct dom_characterdata *) (c), (uint32_t *) (l))
|
||||
|
||||
static inline dom_exception dom_characterdata_substring_data(
|
||||
struct dom_characterdata *cdata, uint32_t offset,
|
||||
uint32_t count, dom_string **data)
|
||||
{
|
||||
return ((dom_characterdata_vtable *) ((dom_node *) cdata)->vtable)->
|
||||
dom_characterdata_substring_data(cdata, offset, count,
|
||||
data);
|
||||
}
|
||||
#define dom_characterdata_substring_data(c, o, ct, d) \
|
||||
dom_characterdata_substring_data( \
|
||||
(struct dom_characterdata *) (c), (uint32_t) (o), \
|
||||
(uint32_t) (ct), (d))
|
||||
|
||||
static inline dom_exception dom_characterdata_append_data(
|
||||
struct dom_characterdata *cdata, dom_string *data)
|
||||
{
|
||||
return ((dom_characterdata_vtable *) ((dom_node *) cdata)->vtable)->
|
||||
dom_characterdata_append_data(cdata, data);
|
||||
}
|
||||
#define dom_characterdata_append_data(c, d) dom_characterdata_append_data( \
|
||||
(struct dom_characterdata *) (c), (d))
|
||||
|
||||
static inline dom_exception dom_characterdata_insert_data(
|
||||
struct dom_characterdata *cdata, uint32_t offset,
|
||||
dom_string *data)
|
||||
{
|
||||
return ((dom_characterdata_vtable *) ((dom_node *) cdata)->vtable)->
|
||||
dom_characterdata_insert_data(cdata, offset, data);
|
||||
}
|
||||
#define dom_characterdata_insert_data(c, o, d) dom_characterdata_insert_data( \
|
||||
(struct dom_characterdata *) (c), (uint32_t) (o), (d))
|
||||
|
||||
static inline dom_exception dom_characterdata_delete_data(
|
||||
struct dom_characterdata *cdata, uint32_t offset,
|
||||
uint32_t count)
|
||||
{
|
||||
return ((dom_characterdata_vtable *) ((dom_node *) cdata)->vtable)->
|
||||
dom_characterdata_delete_data(cdata, offset, count);
|
||||
}
|
||||
#define dom_characterdata_delete_data(c, o, ct) dom_characterdata_delete_data(\
|
||||
(struct dom_characterdata *) (c), (uint32_t) (o), \
|
||||
(uint32_t) (ct))
|
||||
|
||||
static inline dom_exception dom_characterdata_replace_data(
|
||||
struct dom_characterdata *cdata, uint32_t offset,
|
||||
uint32_t count, dom_string *data)
|
||||
{
|
||||
return ((dom_characterdata_vtable *) ((dom_node *) cdata)->vtable)->
|
||||
dom_characterdata_replace_data(cdata, offset, count,
|
||||
data);
|
||||
}
|
||||
#define dom_characterdata_replace_data(c, o, ct, d) \
|
||||
dom_characterdata_replace_data(\
|
||||
(struct dom_characterdata *) (c), (uint32_t) (o),\
|
||||
(uint32_t) (ct), (d))
|
||||
|
||||
#endif
|
18
programs/network/netsurf/include/dom/core/comment.h
Normal file
18
programs/network/netsurf/include/dom/core/comment.h
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef dom_core_comment_h_
|
||||
#define dom_core_comment_h_
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/characterdata.h>
|
||||
|
||||
typedef struct dom_comment dom_comment;
|
||||
|
||||
#endif
|
12
programs/network/netsurf/include/dom/core/doc_fragment.h
Normal file
12
programs/network/netsurf/include/dom/core/doc_fragment.h
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
|
||||
#ifndef dom_core_documentfragment_h_
|
||||
#define dom_core_documentfragment_h_
|
||||
|
||||
typedef struct dom_document_fragment dom_document_fragment;
|
||||
|
||||
#endif
|
471
programs/network/netsurf/include/dom/core/document.h
Normal file
471
programs/network/netsurf/include/dom/core/document.h
Normal file
@ -0,0 +1,471 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef dom_core_document_h_
|
||||
#define dom_core_document_h_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <inttypes.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/implementation.h>
|
||||
#include <dom/core/node.h>
|
||||
|
||||
struct dom_attr;
|
||||
struct dom_cdata_section;
|
||||
struct dom_characterdata;
|
||||
struct dom_comment;
|
||||
struct dom_configuration;
|
||||
struct dom_document_fragment;
|
||||
struct dom_document_type;
|
||||
struct dom_element;
|
||||
struct dom_entity_reference;
|
||||
struct dom_node;
|
||||
struct dom_nodelist;
|
||||
struct dom_processing_instruction;
|
||||
struct dom_text;
|
||||
struct lwc_string_s;
|
||||
|
||||
typedef struct dom_document dom_document;
|
||||
|
||||
/**
|
||||
* Quirks mode flag
|
||||
*/
|
||||
typedef enum dom_document_quirks_mode {
|
||||
DOM_DOCUMENT_QUIRKS_MODE_NONE,
|
||||
DOM_DOCUMENT_QUIRKS_MODE_LIMITED,
|
||||
DOM_DOCUMENT_QUIRKS_MODE_FULL
|
||||
} dom_document_quirks_mode;
|
||||
|
||||
|
||||
/* DOM Document vtable */
|
||||
typedef struct dom_document_vtable {
|
||||
struct dom_node_vtable base;
|
||||
|
||||
dom_exception (*dom_document_get_doctype)(struct dom_document *doc,
|
||||
struct dom_document_type **result);
|
||||
dom_exception (*dom_document_get_implementation)(
|
||||
struct dom_document *doc,
|
||||
dom_implementation **result);
|
||||
dom_exception (*dom_document_get_document_element)(
|
||||
struct dom_document *doc, struct dom_element **result);
|
||||
dom_exception (*dom_document_create_element)(struct dom_document *doc,
|
||||
dom_string *tag_name,
|
||||
struct dom_element **result);
|
||||
dom_exception (*dom_document_create_document_fragment)(
|
||||
struct dom_document *doc,
|
||||
struct dom_document_fragment **result);
|
||||
dom_exception (*dom_document_create_text_node)(struct dom_document *doc,
|
||||
dom_string *data, struct dom_text **result);
|
||||
dom_exception (*dom_document_create_comment)(struct dom_document *doc,
|
||||
dom_string *data, struct dom_comment **result);
|
||||
dom_exception (*dom_document_create_cdata_section)(
|
||||
struct dom_document *doc, dom_string *data,
|
||||
struct dom_cdata_section **result);
|
||||
dom_exception (*dom_document_create_processing_instruction)(
|
||||
struct dom_document *doc, dom_string *target,
|
||||
dom_string *data,
|
||||
struct dom_processing_instruction **result);
|
||||
dom_exception (*dom_document_create_attribute)(struct dom_document *doc,
|
||||
dom_string *name, struct dom_attr **result);
|
||||
dom_exception (*dom_document_create_entity_reference)(
|
||||
struct dom_document *doc, dom_string *name,
|
||||
struct dom_entity_reference **result);
|
||||
dom_exception (*dom_document_get_elements_by_tag_name)(
|
||||
struct dom_document *doc, dom_string *tagname,
|
||||
struct dom_nodelist **result);
|
||||
dom_exception (*dom_document_import_node)(struct dom_document *doc,
|
||||
struct dom_node *node, bool deep,
|
||||
struct dom_node **result);
|
||||
dom_exception (*dom_document_create_element_ns)(
|
||||
struct dom_document *doc, dom_string *namespace,
|
||||
dom_string *qname, struct dom_element **result);
|
||||
dom_exception (*dom_document_create_attribute_ns)(
|
||||
struct dom_document *doc, dom_string *namespace,
|
||||
dom_string *qname, struct dom_attr **result);
|
||||
dom_exception (*dom_document_get_elements_by_tag_name_ns)(
|
||||
struct dom_document *doc, dom_string *namespace,
|
||||
dom_string *localname,
|
||||
struct dom_nodelist **result);
|
||||
dom_exception (*dom_document_get_element_by_id)(
|
||||
struct dom_document *doc, dom_string *id,
|
||||
struct dom_element **result);
|
||||
dom_exception (*dom_document_get_input_encoding)(
|
||||
struct dom_document *doc, dom_string **result);
|
||||
dom_exception (*dom_document_get_xml_encoding)(struct dom_document *doc,
|
||||
dom_string **result);
|
||||
dom_exception (*dom_document_get_xml_standalone)(
|
||||
struct dom_document *doc, bool *result);
|
||||
dom_exception (*dom_document_set_xml_standalone)(
|
||||
struct dom_document *doc, bool standalone);
|
||||
dom_exception (*dom_document_get_xml_version)(struct dom_document *doc,
|
||||
dom_string **result);
|
||||
dom_exception (*dom_document_set_xml_version)(struct dom_document *doc,
|
||||
dom_string *version);
|
||||
dom_exception (*dom_document_get_strict_error_checking)(
|
||||
struct dom_document *doc, bool *result);
|
||||
dom_exception (*dom_document_set_strict_error_checking)(
|
||||
struct dom_document *doc, bool strict);
|
||||
dom_exception (*dom_document_get_uri)(struct dom_document *doc,
|
||||
dom_string **result);
|
||||
dom_exception (*dom_document_set_uri)(struct dom_document *doc,
|
||||
dom_string *uri);
|
||||
dom_exception (*dom_document_adopt_node)(struct dom_document *doc,
|
||||
struct dom_node *node, struct dom_node **result);
|
||||
dom_exception (*dom_document_get_dom_config)(struct dom_document *doc,
|
||||
struct dom_configuration **result);
|
||||
dom_exception (*dom_document_normalize)(struct dom_document *doc);
|
||||
dom_exception (*dom_document_rename_node)(struct dom_document *doc,
|
||||
struct dom_node *node, dom_string *namespace,
|
||||
dom_string *qname, struct dom_node **result);
|
||||
dom_exception (*get_quirks_mode)(dom_document *doc,
|
||||
dom_document_quirks_mode *result);
|
||||
dom_exception (*set_quirks_mode)(dom_document *doc,
|
||||
dom_document_quirks_mode quirks);
|
||||
} dom_document_vtable;
|
||||
|
||||
static inline dom_exception dom_document_get_doctype(struct dom_document *doc,
|
||||
struct dom_document_type **result)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_get_doctype(doc, result);
|
||||
}
|
||||
#define dom_document_get_doctype(d, r) dom_document_get_doctype( \
|
||||
(dom_document *) (d), (struct dom_document_type **) (r))
|
||||
|
||||
static inline dom_exception dom_document_get_implementation(
|
||||
struct dom_document *doc, dom_implementation **result)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_get_implementation(doc, result);
|
||||
}
|
||||
#define dom_document_get_implementation(d, r) dom_document_get_implementation(\
|
||||
(dom_document *) (d), (dom_implementation **) (r))
|
||||
|
||||
static inline dom_exception dom_document_get_document_element(
|
||||
struct dom_document *doc, struct dom_element **result)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_get_document_element(doc, result);
|
||||
}
|
||||
#define dom_document_get_document_element(d, r) \
|
||||
dom_document_get_document_element((dom_document *) (d), \
|
||||
(struct dom_element **) (r))
|
||||
|
||||
static inline dom_exception dom_document_create_element(
|
||||
struct dom_document *doc, dom_string *tag_name,
|
||||
struct dom_element **result)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_create_element(doc, tag_name, result);
|
||||
}
|
||||
#define dom_document_create_element(d, t, r) dom_document_create_element( \
|
||||
(dom_document *) (d), (t), \
|
||||
(struct dom_element **) (r))
|
||||
|
||||
static inline dom_exception dom_document_create_document_fragment(
|
||||
struct dom_document *doc,
|
||||
struct dom_document_fragment **result)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_create_document_fragment(doc, result);
|
||||
}
|
||||
#define dom_document_create_document_fragment(d, r) \
|
||||
dom_document_create_document_fragment((dom_document *) (d), \
|
||||
(struct dom_document_fragment **) (r))
|
||||
|
||||
static inline dom_exception dom_document_create_text_node(
|
||||
struct dom_document *doc, dom_string *data,
|
||||
struct dom_text **result)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_create_text_node(doc, data, result);
|
||||
}
|
||||
#define dom_document_create_text_node(d, data, r) \
|
||||
dom_document_create_text_node((dom_document *) (d), \
|
||||
(data), (struct dom_text **) (r))
|
||||
|
||||
static inline dom_exception dom_document_create_comment(
|
||||
struct dom_document *doc, dom_string *data,
|
||||
struct dom_comment **result)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_create_comment(doc, data, result);
|
||||
}
|
||||
#define dom_document_create_comment(d, data, r) dom_document_create_comment( \
|
||||
(dom_document *) (d), (data), \
|
||||
(struct dom_comment **) (r))
|
||||
|
||||
static inline dom_exception dom_document_create_cdata_section(
|
||||
struct dom_document *doc, dom_string *data,
|
||||
struct dom_cdata_section **result)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_create_cdata_section(doc, data, result);
|
||||
}
|
||||
#define dom_document_create_cdata_section(d, data, r) \
|
||||
dom_document_create_cdata_section((dom_document *) (d), \
|
||||
(data), (struct dom_cdata_section **) (r))
|
||||
|
||||
static inline dom_exception dom_document_create_processing_instruction(
|
||||
struct dom_document *doc, dom_string *target,
|
||||
dom_string *data,
|
||||
struct dom_processing_instruction **result)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_create_processing_instruction(doc, target,
|
||||
data, result);
|
||||
}
|
||||
#define dom_document_create_processing_instruction(d, t, data, r) \
|
||||
dom_document_create_processing_instruction( \
|
||||
(dom_document *) (d), (t), (data), \
|
||||
(struct dom_processing_instruction **) (r))
|
||||
|
||||
static inline dom_exception dom_document_create_attribute(
|
||||
struct dom_document *doc, dom_string *name,
|
||||
struct dom_attr **result)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_create_attribute(doc, name, result);
|
||||
}
|
||||
#define dom_document_create_attribute(d, n, r) dom_document_create_attribute( \
|
||||
(dom_document *) (d), (n), \
|
||||
(struct dom_attr **) (r))
|
||||
|
||||
static inline dom_exception dom_document_create_entity_reference(
|
||||
struct dom_document *doc, dom_string *name,
|
||||
struct dom_entity_reference **result)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_create_entity_reference(doc, name,
|
||||
result);
|
||||
}
|
||||
#define dom_document_create_entity_reference(d, n, r) \
|
||||
dom_document_create_entity_reference((dom_document *) (d), \
|
||||
(n), (struct dom_entity_reference **) (r))
|
||||
|
||||
static inline dom_exception dom_document_get_elements_by_tag_name(
|
||||
struct dom_document *doc, dom_string *tagname,
|
||||
struct dom_nodelist **result)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_get_elements_by_tag_name(doc, tagname,
|
||||
result);
|
||||
}
|
||||
#define dom_document_get_elements_by_tag_name(d, t, r) \
|
||||
dom_document_get_elements_by_tag_name((dom_document *) (d), \
|
||||
(t), (struct dom_nodelist **) (r))
|
||||
|
||||
static inline dom_exception dom_document_import_node(struct dom_document *doc,
|
||||
struct dom_node *node, bool deep, struct dom_node **result)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_import_node(doc, node, deep, result);
|
||||
}
|
||||
#define dom_document_import_node(d, n, deep, r) dom_document_import_node( \
|
||||
(dom_document *) (d), (dom_node *) (n), (bool) deep, \
|
||||
(dom_node **) (r))
|
||||
|
||||
static inline dom_exception dom_document_create_element_ns(
|
||||
struct dom_document *doc, dom_string *namespace,
|
||||
dom_string *qname, struct dom_element **result)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_create_element_ns(doc, namespace,
|
||||
qname, result);
|
||||
}
|
||||
#define dom_document_create_element_ns(d, n, q, r) \
|
||||
dom_document_create_element_ns((dom_document *) (d), \
|
||||
(n), (q), \
|
||||
(struct dom_element **) (r))
|
||||
|
||||
static inline dom_exception dom_document_create_attribute_ns
|
||||
(struct dom_document *doc, dom_string *namespace,
|
||||
dom_string *qname, struct dom_attr **result)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_create_attribute_ns(doc, namespace,
|
||||
qname, result);
|
||||
}
|
||||
#define dom_document_create_attribute_ns(d, n, q, r) \
|
||||
dom_document_create_attribute_ns((dom_document *) (d), \
|
||||
(n), (q), (struct dom_attr **) (r))
|
||||
|
||||
static inline dom_exception dom_document_get_elements_by_tag_name_ns(
|
||||
struct dom_document *doc, dom_string *namespace,
|
||||
dom_string *localname, struct dom_nodelist **result)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_get_elements_by_tag_name_ns(doc,
|
||||
namespace, localname, result);
|
||||
}
|
||||
#define dom_document_get_elements_by_tag_name_ns(d, n, l, r) \
|
||||
dom_document_get_elements_by_tag_name_ns((dom_document *) (d),\
|
||||
(n), (l), (struct dom_nodelist **) (r))
|
||||
|
||||
static inline dom_exception dom_document_get_element_by_id(
|
||||
struct dom_document *doc, dom_string *id,
|
||||
struct dom_element **result)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_get_element_by_id(doc, id, result);
|
||||
}
|
||||
#define dom_document_get_element_by_id(d, i, r) \
|
||||
dom_document_get_element_by_id((dom_document *) (d), \
|
||||
(i), (struct dom_element **) (r))
|
||||
|
||||
static inline dom_exception dom_document_get_input_encoding(
|
||||
struct dom_document *doc, dom_string **result)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_get_input_encoding(doc, result);
|
||||
}
|
||||
#define dom_document_get_input_encoding(d, r) dom_document_get_input_encoding(\
|
||||
(dom_document *) (d), (r))
|
||||
|
||||
static inline dom_exception dom_document_get_xml_encoding(
|
||||
struct dom_document *doc, dom_string **result)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_get_xml_encoding(doc, result);
|
||||
}
|
||||
#define dom_document_get_xml_encoding(d, r) dom_document_get_xml_encoding( \
|
||||
(dom_document *) (d), (r))
|
||||
|
||||
static inline dom_exception dom_document_get_xml_standalone(
|
||||
struct dom_document *doc, bool *result)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_get_xml_standalone(doc, result);
|
||||
}
|
||||
#define dom_document_get_xml_standalone(d, r) dom_document_get_xml_standalone(\
|
||||
(dom_document *) (d), (bool *) (r))
|
||||
|
||||
static inline dom_exception dom_document_set_xml_standalone(
|
||||
struct dom_document *doc, bool standalone)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_set_xml_standalone(doc, standalone);
|
||||
}
|
||||
#define dom_document_set_xml_standalone(d, s) dom_document_set_xml_standalone(\
|
||||
(dom_document *) (d), (bool) (s))
|
||||
|
||||
static inline dom_exception dom_document_get_xml_version(
|
||||
struct dom_document *doc, dom_string **result)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_get_xml_version(doc, result);
|
||||
}
|
||||
#define dom_document_get_xml_version(d, r) dom_document_get_xml_version( \
|
||||
(dom_document *) (d), (r))
|
||||
|
||||
static inline dom_exception dom_document_set_xml_version(
|
||||
struct dom_document *doc, dom_string *version)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_set_xml_version(doc, version);
|
||||
}
|
||||
#define dom_document_set_xml_version(d, v) dom_document_set_xml_version( \
|
||||
(dom_document *) (d), (v))
|
||||
|
||||
static inline dom_exception dom_document_get_strict_error_checking(
|
||||
struct dom_document *doc, bool *result)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_get_strict_error_checking(doc, result);
|
||||
}
|
||||
#define dom_document_get_strict_error_checking(d, r) \
|
||||
dom_document_get_strict_error_checking((dom_document *) (d), \
|
||||
(bool *) (r))
|
||||
|
||||
static inline dom_exception dom_document_set_strict_error_checking(
|
||||
struct dom_document *doc, bool strict)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_set_strict_error_checking(doc, strict);
|
||||
}
|
||||
#define dom_document_set_strict_error_checking(d, s) \
|
||||
dom_document_set_strict_error_checking((dom_document *) (d), \
|
||||
(bool) (s))
|
||||
|
||||
static inline dom_exception dom_document_get_uri(struct dom_document *doc,
|
||||
dom_string **result)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_get_uri(doc, result);
|
||||
}
|
||||
#define dom_document_get_uri(d, r) dom_document_get_uri((dom_document *) (d), \
|
||||
(r))
|
||||
|
||||
static inline dom_exception dom_document_set_uri(struct dom_document *doc,
|
||||
dom_string *uri)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_set_uri(doc, uri);
|
||||
}
|
||||
#define dom_document_set_uri(d, u) dom_document_set_uri((dom_document *) (d), \
|
||||
(u))
|
||||
|
||||
static inline dom_exception dom_document_adopt_node(struct dom_document *doc,
|
||||
struct dom_node *node, struct dom_node **result)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_adopt_node(doc, node, result);
|
||||
}
|
||||
#define dom_document_adopt_node(d, n, r) dom_document_adopt_node( \
|
||||
(dom_document *) (d), (dom_node *) (n), (dom_node **) (r))
|
||||
|
||||
static inline dom_exception dom_document_get_dom_config(
|
||||
struct dom_document *doc, struct dom_configuration **result)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_get_dom_config(doc, result);
|
||||
}
|
||||
#define dom_document_get_dom_config(d, r) dom_document_get_dom_config( \
|
||||
(dom_document *) (d), (struct dom_configuration **) (r))
|
||||
|
||||
static inline dom_exception dom_document_normalize(struct dom_document *doc)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_normalize(doc);
|
||||
}
|
||||
#define dom_document_normalize(d) dom_document_normalize((dom_document *) (d))
|
||||
|
||||
static inline dom_exception dom_document_rename_node(struct dom_document *doc,
|
||||
struct dom_node *node,
|
||||
dom_string *namespace, dom_string *qname,
|
||||
struct dom_node **result)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
dom_document_rename_node(doc, node, namespace, qname,
|
||||
result);
|
||||
}
|
||||
#define dom_document_rename_node(d, n, ns, q, r) dom_document_rename_node( \
|
||||
(dom_document *) (d), (ns), \
|
||||
(q), (dom_node **) (r))
|
||||
|
||||
static inline dom_exception dom_document_get_quirks_mode(
|
||||
dom_document *doc, dom_document_quirks_mode *result)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
get_quirks_mode(doc, result);
|
||||
}
|
||||
#define dom_document_get_quirks_mode(d, r) \
|
||||
dom_document_get_quirks_mode((dom_document *) (d), (r))
|
||||
|
||||
static inline dom_exception dom_document_set_quirks_mode(
|
||||
dom_document *doc, dom_document_quirks_mode quirks)
|
||||
{
|
||||
return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
set_quirks_mode(doc, quirks);
|
||||
}
|
||||
#define dom_document_set_quirks_mode(d, q) \
|
||||
dom_document_set_quirks_mode((dom_document *) (d), (q))
|
||||
|
||||
#endif
|
106
programs/network/netsurf/include/dom/core/document_type.h
Normal file
106
programs/network/netsurf/include/dom/core/document_type.h
Normal file
@ -0,0 +1,106 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
* Copyright 2007 James Shaw <jshaw@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef dom_core_document_type_h_
|
||||
#define dom_core_document_type_h_
|
||||
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/node.h>
|
||||
|
||||
struct dom_namednodemap;
|
||||
|
||||
typedef struct dom_document_type dom_document_type;
|
||||
/* The Dom DocumentType vtable */
|
||||
typedef struct dom_document_type_vtable {
|
||||
struct dom_node_vtable base;
|
||||
|
||||
dom_exception (*dom_document_type_get_name)(
|
||||
struct dom_document_type *doc_type,
|
||||
dom_string **result);
|
||||
dom_exception (*dom_document_type_get_entities)(
|
||||
struct dom_document_type *doc_type,
|
||||
struct dom_namednodemap **result);
|
||||
dom_exception (*dom_document_type_get_notations)(
|
||||
struct dom_document_type *doc_type,
|
||||
struct dom_namednodemap **result);
|
||||
dom_exception (*dom_document_type_get_public_id)(
|
||||
struct dom_document_type *doc_type,
|
||||
dom_string **result);
|
||||
dom_exception (*dom_document_type_get_system_id)(
|
||||
struct dom_document_type *doc_type,
|
||||
dom_string **result);
|
||||
dom_exception (*dom_document_type_get_internal_subset)(
|
||||
struct dom_document_type *doc_type,
|
||||
dom_string **result);
|
||||
} dom_document_type_vtable;
|
||||
|
||||
static inline dom_exception dom_document_type_get_name(
|
||||
struct dom_document_type *doc_type, dom_string **result)
|
||||
{
|
||||
return ((dom_document_type_vtable *) ((dom_node *) (doc_type))->vtable)
|
||||
->dom_document_type_get_name(doc_type, result);
|
||||
}
|
||||
#define dom_document_type_get_name(dt, r) dom_document_type_get_name( \
|
||||
(dom_document_type *) (dt), (r))
|
||||
|
||||
static inline dom_exception dom_document_type_get_entities(
|
||||
struct dom_document_type *doc_type,
|
||||
struct dom_namednodemap **result)
|
||||
{
|
||||
return ((dom_document_type_vtable *) ((dom_node *) (doc_type))->vtable)
|
||||
->dom_document_type_get_entities(doc_type, result);
|
||||
}
|
||||
#define dom_document_type_get_entities(dt, r) dom_document_type_get_entities( \
|
||||
(dom_document_type *) (dt), (struct dom_namednodemap **) (r))
|
||||
|
||||
static inline dom_exception dom_document_type_get_notations(
|
||||
struct dom_document_type *doc_type,
|
||||
struct dom_namednodemap **result)
|
||||
{
|
||||
return ((dom_document_type_vtable *) ((dom_node *) (doc_type))->vtable)
|
||||
->dom_document_type_get_notations(doc_type, result);
|
||||
}
|
||||
#define dom_document_type_get_notations(dt, r) dom_document_type_get_notations(\
|
||||
(dom_document_type *) (dt), (struct dom_namednodemap **) (r))
|
||||
|
||||
static inline dom_exception dom_document_type_get_public_id(
|
||||
struct dom_document_type *doc_type,
|
||||
dom_string **result)
|
||||
{
|
||||
return ((dom_document_type_vtable *) ((dom_node *) (doc_type))->vtable)
|
||||
->dom_document_type_get_public_id(doc_type, result);
|
||||
}
|
||||
#define dom_document_type_get_public_id(dt, r) \
|
||||
dom_document_type_get_public_id((dom_document_type *) (dt), \
|
||||
(r))
|
||||
|
||||
static inline dom_exception dom_document_type_get_system_id(
|
||||
struct dom_document_type *doc_type,
|
||||
dom_string **result)
|
||||
{
|
||||
return ((dom_document_type_vtable *) ((dom_node *) (doc_type))->vtable)
|
||||
->dom_document_type_get_system_id(doc_type, result);
|
||||
}
|
||||
#define dom_document_type_get_system_id(dt, r) \
|
||||
dom_document_type_get_system_id((dom_document_type *) (dt), \
|
||||
(r))
|
||||
|
||||
static inline dom_exception dom_document_type_get_internal_subset(
|
||||
struct dom_document_type *doc_type,
|
||||
dom_string **result)
|
||||
{
|
||||
return ((dom_document_type_vtable *) ((dom_node *) (doc_type))->vtable)
|
||||
->dom_document_type_get_internal_subset(doc_type,
|
||||
result);
|
||||
}
|
||||
#define dom_document_type_get_internal_subset(dt, r) \
|
||||
dom_document_type_get_internal_subset( \
|
||||
(dom_document_type *) (dt), (r))
|
||||
|
||||
|
||||
#endif
|
359
programs/network/netsurf/include/dom/core/element.h
Normal file
359
programs/network/netsurf/include/dom/core/element.h
Normal file
@ -0,0 +1,359 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef dom_core_element_h_
|
||||
#define dom_core_element_h_
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/node.h>
|
||||
|
||||
struct dom_attr;
|
||||
struct dom_nodelist;
|
||||
struct dom_type_info;
|
||||
|
||||
typedef struct dom_element dom_element;
|
||||
|
||||
/* The DOMElement vtable */
|
||||
typedef struct dom_element_vtable {
|
||||
struct dom_node_vtable base;
|
||||
|
||||
dom_exception (*dom_element_get_tag_name)(struct dom_element *element,
|
||||
dom_string **name);
|
||||
dom_exception (*dom_element_get_attribute)(struct dom_element *element,
|
||||
dom_string *name, dom_string **value);
|
||||
dom_exception (*dom_element_set_attribute)(struct dom_element *element,
|
||||
dom_string *name, dom_string *value);
|
||||
dom_exception (*dom_element_remove_attribute)(
|
||||
struct dom_element *element, dom_string *name);
|
||||
dom_exception (*dom_element_get_attribute_node)(
|
||||
struct dom_element *element, dom_string *name,
|
||||
struct dom_attr **result);
|
||||
dom_exception (*dom_element_set_attribute_node)(
|
||||
struct dom_element *element, struct dom_attr *attr,
|
||||
struct dom_attr **result);
|
||||
dom_exception (*dom_element_remove_attribute_node)(
|
||||
struct dom_element *element, struct dom_attr *attr,
|
||||
struct dom_attr **result);
|
||||
dom_exception (*dom_element_get_elements_by_tag_name)(
|
||||
struct dom_element *element, dom_string *name,
|
||||
struct dom_nodelist **result);
|
||||
dom_exception (*dom_element_get_attribute_ns)(
|
||||
struct dom_element *element,
|
||||
dom_string *namespace,
|
||||
dom_string *localname,
|
||||
dom_string **value);
|
||||
dom_exception (*dom_element_set_attribute_ns)(
|
||||
struct dom_element *element,
|
||||
dom_string *namespace, dom_string *qname,
|
||||
dom_string *value);
|
||||
dom_exception (*dom_element_remove_attribute_ns)(
|
||||
struct dom_element *element,
|
||||
dom_string *namespace,
|
||||
dom_string *localname);
|
||||
dom_exception (*dom_element_get_attribute_node_ns)(
|
||||
struct dom_element *element,
|
||||
dom_string *namespace,
|
||||
dom_string *localname, struct dom_attr **result);
|
||||
dom_exception (*dom_element_set_attribute_node_ns)(
|
||||
struct dom_element *element, struct dom_attr *attr,
|
||||
struct dom_attr **result);
|
||||
dom_exception (*dom_element_get_elements_by_tag_name_ns)(
|
||||
struct dom_element *element,
|
||||
dom_string *namespace,
|
||||
dom_string *localname,
|
||||
struct dom_nodelist **result);
|
||||
dom_exception (*dom_element_has_attribute)(struct dom_element *element,
|
||||
dom_string *name, bool *result);
|
||||
dom_exception (*dom_element_has_attribute_ns)(
|
||||
struct dom_element *element,
|
||||
dom_string *namespace,
|
||||
dom_string *localname, bool *result);
|
||||
dom_exception (*dom_element_get_schema_type_info)(
|
||||
struct dom_element *element,
|
||||
struct dom_type_info **result);
|
||||
dom_exception (*dom_element_set_id_attribute)(
|
||||
struct dom_element *element, dom_string *name,
|
||||
bool is_id);
|
||||
dom_exception (*dom_element_set_id_attribute_ns)(
|
||||
struct dom_element *element,
|
||||
dom_string *namespace,
|
||||
dom_string *localname, bool is_id);
|
||||
dom_exception (*dom_element_set_id_attribute_node)(
|
||||
struct dom_element *element,
|
||||
struct dom_attr *id_attr, bool is_id);
|
||||
|
||||
/* These two are for the benefit of bindings to libcss */
|
||||
dom_exception (*dom_element_get_classes)(
|
||||
struct dom_element *element,
|
||||
lwc_string ***classes, uint32_t *n_classes);
|
||||
dom_exception (*dom_element_has_class)(
|
||||
struct dom_element *element,
|
||||
lwc_string *name, bool *match);
|
||||
} dom_element_vtable;
|
||||
|
||||
static inline dom_exception dom_element_get_tag_name(
|
||||
struct dom_element *element, dom_string **name)
|
||||
{
|
||||
return ((dom_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_element_get_tag_name(element, name);
|
||||
}
|
||||
#define dom_element_get_tag_name(e, n) dom_element_get_tag_name( \
|
||||
(dom_element *) (e), (n))
|
||||
|
||||
static inline dom_exception dom_element_get_attribute(
|
||||
struct dom_element *element, dom_string *name,
|
||||
dom_string **value)
|
||||
{
|
||||
return ((dom_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_element_get_attribute(element, name, value);
|
||||
}
|
||||
#define dom_element_get_attribute(e, n, v) dom_element_get_attribute( \
|
||||
(dom_element *) (e), (n), (v))
|
||||
|
||||
static inline dom_exception dom_element_set_attribute(
|
||||
struct dom_element *element, dom_string *name,
|
||||
dom_string *value)
|
||||
{
|
||||
return ((dom_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_element_set_attribute(element, name, value);
|
||||
}
|
||||
#define dom_element_set_attribute(e, n, v) dom_element_set_attribute( \
|
||||
(dom_element *) (e), (n), (v))
|
||||
|
||||
static inline dom_exception dom_element_remove_attribute(
|
||||
struct dom_element *element, dom_string *name)
|
||||
{
|
||||
return ((dom_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_element_remove_attribute(element, name);
|
||||
}
|
||||
#define dom_element_remove_attribute(e, n) dom_element_remove_attribute( \
|
||||
(dom_element *) (e), (n))
|
||||
|
||||
static inline dom_exception dom_element_get_attribute_node(
|
||||
struct dom_element *element, dom_string *name,
|
||||
struct dom_attr **result)
|
||||
{
|
||||
return ((dom_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_element_get_attribute_node(element, name, result);
|
||||
}
|
||||
#define dom_element_get_attribute_node(e, n, r) \
|
||||
dom_element_get_attribute_node((dom_element *) (e), \
|
||||
(n), (struct dom_attr **) (r))
|
||||
|
||||
static inline dom_exception dom_element_set_attribute_node(
|
||||
struct dom_element *element, struct dom_attr *attr,
|
||||
struct dom_attr **result)
|
||||
{
|
||||
return ((dom_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_element_set_attribute_node(element, attr, result);
|
||||
}
|
||||
#define dom_element_set_attribute_node(e, a, r) \
|
||||
dom_element_set_attribute_node((dom_element *) (e), \
|
||||
(struct dom_attr *) (a), (struct dom_attr **) (r))
|
||||
|
||||
static inline dom_exception dom_element_remove_attribute_node(
|
||||
struct dom_element *element, struct dom_attr *attr,
|
||||
struct dom_attr **result)
|
||||
{
|
||||
return ((dom_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_element_remove_attribute_node(element, attr,
|
||||
result);
|
||||
}
|
||||
#define dom_element_remove_attribute_node(e, a, r) \
|
||||
dom_element_remove_attribute_node((dom_element *) (e), \
|
||||
(struct dom_attr *) (a), (struct dom_attr **) (r))
|
||||
|
||||
|
||||
static inline dom_exception dom_element_get_elements_by_tag_name(
|
||||
struct dom_element *element, dom_string *name,
|
||||
struct dom_nodelist **result)
|
||||
{
|
||||
return ((dom_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_element_get_elements_by_tag_name(element, name,
|
||||
result);
|
||||
}
|
||||
#define dom_element_get_elements_by_tag_name(e, n, r) \
|
||||
dom_element_get_elements_by_tag_name((dom_element *) (e), \
|
||||
(n), (struct dom_nodelist **) (r))
|
||||
|
||||
static inline dom_exception dom_element_get_attribute_ns(
|
||||
struct dom_element *element, dom_string *namespace,
|
||||
dom_string *localname, dom_string **value)
|
||||
{
|
||||
return ((dom_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_element_get_attribute_ns(element, namespace,
|
||||
localname, value);
|
||||
}
|
||||
#define dom_element_get_attribute_ns(e, n, l, v) \
|
||||
dom_element_get_attribute_ns((dom_element *) (e), \
|
||||
(n), (l), (v))
|
||||
|
||||
static inline dom_exception dom_element_set_attribute_ns(
|
||||
struct dom_element *element, dom_string *namespace,
|
||||
dom_string *qname, dom_string *value)
|
||||
{
|
||||
return ((dom_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_element_set_attribute_ns(element, namespace,
|
||||
qname, value);
|
||||
}
|
||||
#define dom_element_set_attribute_ns(e, n, l, v) \
|
||||
dom_element_set_attribute_ns((dom_element *) (e), \
|
||||
(n), (l), (v))
|
||||
|
||||
|
||||
static inline dom_exception dom_element_remove_attribute_ns(
|
||||
struct dom_element *element, dom_string *namespace,
|
||||
dom_string *localname)
|
||||
{
|
||||
return ((dom_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_element_remove_attribute_ns(element, namespace,
|
||||
localname);
|
||||
}
|
||||
#define dom_element_remove_attribute_ns(e, n, l) \
|
||||
dom_element_remove_attribute_ns((dom_element *) (e), \
|
||||
(n), (l))
|
||||
|
||||
|
||||
static inline dom_exception dom_element_get_attribute_node_ns(
|
||||
struct dom_element *element, dom_string *namespace,
|
||||
dom_string *localname, struct dom_attr **result)
|
||||
{
|
||||
return ((dom_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_element_get_attribute_node_ns(element, namespace,
|
||||
localname, result);
|
||||
}
|
||||
#define dom_element_get_attribute_node_ns(e, n, l, r) \
|
||||
dom_element_get_attribute_node_ns((dom_element *) (e), \
|
||||
(n), (l), \
|
||||
(struct dom_attr **) (r))
|
||||
|
||||
static inline dom_exception dom_element_set_attribute_node_ns(
|
||||
struct dom_element *element, struct dom_attr *attr,
|
||||
struct dom_attr **result)
|
||||
{
|
||||
return ((dom_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_element_set_attribute_node_ns(element, attr,
|
||||
result);
|
||||
}
|
||||
#define dom_element_set_attribute_node_ns(e, a, r) \
|
||||
dom_element_set_attribute_node_ns((dom_element *) (e), \
|
||||
(struct dom_attr *) (a), (struct dom_attr **) (r))
|
||||
|
||||
static inline dom_exception dom_element_get_elements_by_tag_name_ns(
|
||||
struct dom_element *element, dom_string *namespace,
|
||||
dom_string *localname, struct dom_nodelist **result)
|
||||
{
|
||||
return ((dom_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_element_get_elements_by_tag_name_ns(element,
|
||||
namespace, localname, result);
|
||||
}
|
||||
#define dom_element_get_elements_by_tag_name_ns(e, n, l, r) \
|
||||
dom_element_get_elements_by_tag_name_ns((dom_element *) (e), \
|
||||
(n), (l), (struct dom_nodelist **) (r))
|
||||
|
||||
static inline dom_exception dom_element_has_attribute(
|
||||
struct dom_element *element, dom_string *name,
|
||||
bool *result)
|
||||
{
|
||||
return ((dom_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_element_has_attribute(element, name, result);
|
||||
}
|
||||
#define dom_element_has_attribute(e, n, r) dom_element_has_attribute( \
|
||||
(dom_element *) (e), (n), (bool *) (r))
|
||||
|
||||
static inline dom_exception dom_element_has_attribute_ns(
|
||||
struct dom_element *element, dom_string *namespace,
|
||||
dom_string *localname, bool *result)
|
||||
{
|
||||
return ((dom_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_element_has_attribute_ns(element, namespace,
|
||||
localname, result);
|
||||
}
|
||||
#define dom_element_has_attribute_ns(e, n, l, r) dom_element_has_attribute_ns(\
|
||||
(dom_element *) (e), (n), (l), (bool *) (r))
|
||||
|
||||
static inline dom_exception dom_element_get_schema_type_info(
|
||||
struct dom_element *element, struct dom_type_info **result)
|
||||
{
|
||||
return ((dom_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_element_get_schema_type_info(element, result);
|
||||
}
|
||||
#define dom_element_get_schema_type_info(e, r) \
|
||||
dom_element_get_schema_type_info((dom_element *) (e), \
|
||||
(struct dom_type_info **) (r))
|
||||
|
||||
static inline dom_exception dom_element_set_id_attribute(
|
||||
struct dom_element *element, dom_string *name,
|
||||
bool is_id)
|
||||
{
|
||||
return ((dom_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_element_set_id_attribute(element, name, is_id);
|
||||
}
|
||||
#define dom_element_set_id_attribute(e, n, i) \
|
||||
dom_element_set_id_attribute((dom_element *) (e), \
|
||||
(n), (bool) (i))
|
||||
|
||||
static inline dom_exception dom_element_set_id_attribute_ns(
|
||||
struct dom_element *element, dom_string *namespace,
|
||||
dom_string *localname, bool is_id)
|
||||
{
|
||||
return ((dom_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_element_set_id_attribute_ns(element, namespace,
|
||||
localname, is_id);
|
||||
}
|
||||
#define dom_element_set_id_attribute_ns(e, n, l, i) \
|
||||
dom_element_set_id_attribute_ns((dom_element *) (e), \
|
||||
(n), (l), (bool) (i))
|
||||
|
||||
static inline dom_exception dom_element_set_id_attribute_node(
|
||||
struct dom_element *element, struct dom_attr *id_attr,
|
||||
bool is_id)
|
||||
{
|
||||
return ((dom_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_element_set_id_attribute_node(element, id_attr,
|
||||
is_id);
|
||||
}
|
||||
#define dom_element_set_id_attribute_node(e, a, i) \
|
||||
dom_element_set_id_attribute_node((dom_element *) (e), \
|
||||
(struct dom_attr *) (a), (bool) (i))
|
||||
|
||||
static inline dom_exception dom_element_get_classes(
|
||||
struct dom_element *element,
|
||||
lwc_string ***classes, uint32_t *n_classes)
|
||||
{
|
||||
return ((dom_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_element_get_classes(element, classes, n_classes);
|
||||
}
|
||||
#define dom_element_get_classes(e, c, n) \
|
||||
dom_element_get_classes((dom_element *) (e), \
|
||||
(lwc_string ***) (c), (uint32_t *) (n))
|
||||
|
||||
static inline dom_exception dom_element_has_class(
|
||||
struct dom_element *element, lwc_string *name, bool *match)
|
||||
{
|
||||
return ((dom_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_element_has_class(element, name, match);
|
||||
}
|
||||
#define dom_element_has_class(e, n, m) \
|
||||
dom_element_has_class((dom_element *) (e), \
|
||||
(lwc_string *) (n), (bool *) (m))
|
||||
|
||||
|
||||
/* Functions for implementing some libcss selection callbacks.
|
||||
* Note that they don't take a reference to the returned element, as such they
|
||||
* are UNSAFE if you require the returned element to live beyond the next time
|
||||
* the DOM gets a chance to change. */
|
||||
dom_exception dom_element_named_ancestor_node(dom_element *element,
|
||||
lwc_string *name, dom_element **ancestor);
|
||||
dom_exception dom_element_named_parent_node(dom_element *element,
|
||||
lwc_string *name, dom_element **parent);
|
||||
dom_exception dom_element_parent_node(dom_element *element,
|
||||
dom_element **parent);
|
||||
|
||||
#endif
|
13
programs/network/netsurf/include/dom/core/entity_ref.h
Normal file
13
programs/network/netsurf/include/dom/core/entity_ref.h
Normal file
@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef dom_core_entityreference_h_
|
||||
#define dom_core_entityreference_h_
|
||||
|
||||
typedef struct dom_entity_reference dom_entity_reference;
|
||||
|
||||
#endif
|
52
programs/network/netsurf/include/dom/core/exceptions.h
Normal file
52
programs/network/netsurf/include/dom/core/exceptions.h
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef dom_core_exceptions_h_
|
||||
#define dom_core_exceptions_h_
|
||||
|
||||
/**
|
||||
* Class of a DOM exception.
|
||||
*
|
||||
* The top 16 bits of a dom_exception are a bitfield
|
||||
* indicating which class the exception belongs to.
|
||||
*/
|
||||
typedef enum {
|
||||
DOM_EXCEPTION_CLASS_NORMAL = 0,
|
||||
DOM_EXCEPTION_CLASS_EVENT = (1<<30),
|
||||
DOM_EXCEPTION_CLASS_INTERNAL = (1<<31)
|
||||
} dom_exception_class;
|
||||
|
||||
/* The DOM spec says that this is actually an unsigned short */
|
||||
typedef enum {
|
||||
DOM_NO_ERR = 0,
|
||||
DOM_INDEX_SIZE_ERR = 1,
|
||||
DOM_DOMSTRING_SIZE_ERR = 2,
|
||||
DOM_HIERARCHY_REQUEST_ERR = 3,
|
||||
DOM_WRONG_DOCUMENT_ERR = 4,
|
||||
DOM_INVALID_CHARACTER_ERR = 5,
|
||||
DOM_NO_DATA_ALLOWED_ERR = 6,
|
||||
DOM_NO_MODIFICATION_ALLOWED_ERR = 7,
|
||||
DOM_NOT_FOUND_ERR = 8,
|
||||
DOM_NOT_SUPPORTED_ERR = 9,
|
||||
DOM_INUSE_ATTRIBUTE_ERR = 10,
|
||||
DOM_INVALID_STATE_ERR = 11,
|
||||
DOM_SYNTAX_ERR = 12,
|
||||
DOM_INVALID_MODIFICATION_ERR = 13,
|
||||
DOM_NAMESPACE_ERR = 14,
|
||||
DOM_INVALID_ACCESS_ERR = 15,
|
||||
DOM_VALIDATION_ERR = 16,
|
||||
DOM_TYPE_MISMATCH_ERR = 17,
|
||||
|
||||
DOM_UNSPECIFIED_EVENT_TYPE_ERR = DOM_EXCEPTION_CLASS_EVENT + 0,
|
||||
DOM_DISPATCH_REQUEST_ERR = DOM_EXCEPTION_CLASS_EVENT + 1,
|
||||
|
||||
DOM_NO_MEM_ERR = DOM_EXCEPTION_CLASS_INTERNAL + 0,
|
||||
DOM_ATTR_WRONG_TYPE_ERR = DOM_EXCEPTION_CLASS_INTERNAL + 1
|
||||
/* our own internal error */
|
||||
} dom_exception;
|
||||
|
||||
#endif
|
53
programs/network/netsurf/include/dom/core/implementation.h
Normal file
53
programs/network/netsurf/include/dom/core/implementation.h
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef dom_core_implementation_h_
|
||||
#define dom_core_implementation_h_
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/events/document_event.h>
|
||||
#include <dom/functypes.h>
|
||||
|
||||
struct dom_document;
|
||||
struct dom_document_type;
|
||||
|
||||
typedef const char dom_implementation;
|
||||
|
||||
typedef enum dom_implementation_type {
|
||||
DOM_IMPLEMENTATION_CORE = 0,
|
||||
DOM_IMPLEMENTATION_XML = (1 << 0), /* not implemented */
|
||||
DOM_IMPLEMENTATION_HTML = (1 << 1),
|
||||
|
||||
DOM_IMPLEMENTATION_ALL = DOM_IMPLEMENTATION_CORE |
|
||||
DOM_IMPLEMENTATION_XML |
|
||||
DOM_IMPLEMENTATION_HTML
|
||||
} dom_implementation_type;
|
||||
|
||||
dom_exception dom_implementation_has_feature(
|
||||
const char *feature, const char *version,
|
||||
bool *result);
|
||||
|
||||
dom_exception dom_implementation_create_document_type(
|
||||
const char *qname,
|
||||
const char *public_id, const char *system_id,
|
||||
struct dom_document_type **doctype);
|
||||
|
||||
dom_exception dom_implementation_create_document(
|
||||
uint32_t impl_type,
|
||||
const char *namespace, const char *qname,
|
||||
struct dom_document_type *doctype,
|
||||
dom_events_default_action_fetcher daf,
|
||||
void *daf_ctx,
|
||||
struct dom_document **doc);
|
||||
|
||||
dom_exception dom_implementation_get_feature(
|
||||
const char *feature, const char *version,
|
||||
void **object);
|
||||
|
||||
#endif
|
83
programs/network/netsurf/include/dom/core/namednodemap.h
Normal file
83
programs/network/netsurf/include/dom/core/namednodemap.h
Normal file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef dom_core_namednodemap_h_
|
||||
#define dom_core_namednodemap_h_
|
||||
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/string.h>
|
||||
|
||||
struct dom_node;
|
||||
|
||||
typedef struct dom_namednodemap dom_namednodemap;
|
||||
|
||||
void dom_namednodemap_ref(struct dom_namednodemap *map);
|
||||
void dom_namednodemap_unref(struct dom_namednodemap *map);
|
||||
|
||||
dom_exception dom_namednodemap_get_length(struct dom_namednodemap *map,
|
||||
uint32_t *length);
|
||||
|
||||
dom_exception _dom_namednodemap_get_named_item(struct dom_namednodemap *map,
|
||||
dom_string *name, struct dom_node **node);
|
||||
|
||||
#define dom_namednodemap_get_named_item(m, n, r) \
|
||||
_dom_namednodemap_get_named_item((dom_namednodemap *) (m), \
|
||||
(n), (dom_node **) (r))
|
||||
|
||||
|
||||
dom_exception _dom_namednodemap_set_named_item(struct dom_namednodemap *map,
|
||||
struct dom_node *arg, struct dom_node **node);
|
||||
|
||||
#define dom_namednodemap_set_named_item(m, a, n) \
|
||||
_dom_namednodemap_set_named_item((dom_namednodemap *) (m), \
|
||||
(dom_node *) (a), (dom_node **) (n))
|
||||
|
||||
|
||||
dom_exception _dom_namednodemap_remove_named_item(
|
||||
struct dom_namednodemap *map, dom_string *name,
|
||||
struct dom_node **node);
|
||||
|
||||
#define dom_namednodemap_remove_named_item(m, n, r) \
|
||||
_dom_namednodemap_remove_named_item((dom_namednodemap *) (m), \
|
||||
(n), (dom_node **) (r))
|
||||
|
||||
|
||||
dom_exception _dom_namednodemap_item(struct dom_namednodemap *map,
|
||||
uint32_t index, struct dom_node **node);
|
||||
|
||||
#define dom_namednodemap_item(m, i, n) _dom_namednodemap_item( \
|
||||
(dom_namednodemap *) (m), (uint32_t) (i), \
|
||||
(dom_node **) (n))
|
||||
|
||||
|
||||
dom_exception _dom_namednodemap_get_named_item_ns(
|
||||
struct dom_namednodemap *map, dom_string *namespace,
|
||||
dom_string *localname, struct dom_node **node);
|
||||
|
||||
#define dom_namednodemap_get_named_item_ns(m, n, l, r) \
|
||||
_dom_namednodemap_get_named_item_ns((dom_namednodemap *) (m), \
|
||||
(n), (l), (dom_node **) (r))
|
||||
|
||||
|
||||
dom_exception _dom_namednodemap_set_named_item_ns(
|
||||
struct dom_namednodemap *map, struct dom_node *arg,
|
||||
struct dom_node **node);
|
||||
|
||||
#define dom_namednodemap_set_named_item_ns(m, a, n) \
|
||||
_dom_namednodemap_set_named_item_ns((dom_namednodemap *) (m), \
|
||||
(dom_node *) (a), (dom_node **) (n))
|
||||
|
||||
|
||||
dom_exception _dom_namednodemap_remove_named_item_ns(
|
||||
struct dom_namednodemap *map, dom_string *namespace,
|
||||
dom_string *localname, struct dom_node **node);
|
||||
|
||||
#define dom_namednodemap_remove_named_item_ns(m, n, l, r) \
|
||||
_dom_namednodemap_remove_named_item_ns(\
|
||||
(dom_namednodemap *) (m), (n),(l), (dom_node **) (r))
|
||||
|
||||
#endif
|
569
programs/network/netsurf/include/dom/core/node.h
Normal file
569
programs/network/netsurf/include/dom/core/node.h
Normal file
@ -0,0 +1,569 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef dom_core_node_h_
|
||||
#define dom_core_node_h_
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/string.h>
|
||||
#include <dom/events/event_target.h>
|
||||
|
||||
struct dom_document;
|
||||
struct dom_nodelist;
|
||||
struct dom_namednodemap;
|
||||
struct dom_node;
|
||||
|
||||
/**
|
||||
* Bits defining position of a node in a document relative to some other node
|
||||
*/
|
||||
typedef enum {
|
||||
DOM_DOCUMENT_POSITION_DISCONNECTED = 0x01,
|
||||
DOM_DOCUMENT_POSITION_PRECEDING = 0x02,
|
||||
DOM_DOCUMENT_POSITION_FOLLOWING = 0x04,
|
||||
DOM_DOCUMENT_POSITION_CONTAINS = 0x08,
|
||||
DOM_DOCUMENT_POSITION_CONTAINED_BY = 0x10,
|
||||
DOM_DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20
|
||||
} dom_document_position;
|
||||
|
||||
/**
|
||||
* Type of node operation being notified to user_data_handler
|
||||
*/
|
||||
typedef enum {
|
||||
DOM_NODE_CLONED = 1,
|
||||
DOM_NODE_IMPORTED = 2,
|
||||
DOM_NODE_DELETED = 3,
|
||||
DOM_NODE_RENAMED = 4,
|
||||
DOM_NODE_ADOPTED = 5
|
||||
} dom_node_operation;
|
||||
|
||||
/**
|
||||
* Type of handler function for user data registered on a DOM node
|
||||
*/
|
||||
typedef void (*dom_user_data_handler)(dom_node_operation operation,
|
||||
dom_string *key, void *data, struct dom_node *src,
|
||||
struct dom_node *dst);
|
||||
|
||||
/**
|
||||
* Type of a DOM node
|
||||
*/
|
||||
typedef enum {
|
||||
DOM_ELEMENT_NODE = 1,
|
||||
DOM_ATTRIBUTE_NODE = 2,
|
||||
DOM_TEXT_NODE = 3,
|
||||
DOM_CDATA_SECTION_NODE = 4,
|
||||
DOM_ENTITY_REFERENCE_NODE = 5,
|
||||
DOM_ENTITY_NODE = 6,
|
||||
DOM_PROCESSING_INSTRUCTION_NODE = 7,
|
||||
DOM_COMMENT_NODE = 8,
|
||||
DOM_DOCUMENT_NODE = 9,
|
||||
DOM_DOCUMENT_TYPE_NODE = 10,
|
||||
DOM_DOCUMENT_FRAGMENT_NODE = 11,
|
||||
DOM_NOTATION_NODE = 12,
|
||||
|
||||
/* And a count of the number of node types */
|
||||
DOM_NODE_TYPE_COUNT = DOM_NOTATION_NODE
|
||||
} dom_node_type;
|
||||
|
||||
typedef struct dom_node_internal dom_node_internal;
|
||||
|
||||
/**
|
||||
* DOM node type
|
||||
*/
|
||||
typedef struct dom_node {
|
||||
void *vtable;
|
||||
uint32_t refcnt;
|
||||
} dom_node;
|
||||
|
||||
/* DOM node vtable */
|
||||
typedef struct dom_node_vtable {
|
||||
dom_event_target_vtable base;
|
||||
/* pre-destruction hook */
|
||||
dom_exception (*dom_node_try_destroy)(dom_node_internal *node);
|
||||
/* The DOM level 3 node's oprations */
|
||||
dom_exception (*dom_node_get_node_name)(dom_node_internal *node,
|
||||
dom_string **result);
|
||||
dom_exception (*dom_node_get_node_value)(dom_node_internal *node,
|
||||
dom_string **result);
|
||||
dom_exception (*dom_node_set_node_value)(dom_node_internal *node,
|
||||
dom_string *value);
|
||||
dom_exception (*dom_node_get_node_type)(dom_node_internal *node,
|
||||
dom_node_type *result);
|
||||
dom_exception (*dom_node_get_parent_node)(dom_node_internal *node,
|
||||
dom_node_internal **result);
|
||||
dom_exception (*dom_node_get_child_nodes)(dom_node_internal *node,
|
||||
struct dom_nodelist **result);
|
||||
dom_exception (*dom_node_get_first_child)(dom_node_internal *node,
|
||||
dom_node_internal **result);
|
||||
dom_exception (*dom_node_get_last_child)(dom_node_internal *node,
|
||||
dom_node_internal **result);
|
||||
dom_exception (*dom_node_get_previous_sibling)(dom_node_internal *node,
|
||||
dom_node_internal **result);
|
||||
dom_exception (*dom_node_get_next_sibling)(dom_node_internal *node,
|
||||
dom_node_internal **result);
|
||||
dom_exception (*dom_node_get_attributes)(dom_node_internal *node,
|
||||
struct dom_namednodemap **result);
|
||||
dom_exception (*dom_node_get_owner_document)(dom_node_internal *node,
|
||||
struct dom_document **result);
|
||||
dom_exception (*dom_node_insert_before)(dom_node_internal *node,
|
||||
dom_node_internal *new_child,
|
||||
dom_node_internal *ref_child,
|
||||
dom_node_internal **result);
|
||||
dom_exception (*dom_node_replace_child)(dom_node_internal *node,
|
||||
dom_node_internal *new_child,
|
||||
dom_node_internal *old_child,
|
||||
dom_node_internal **result);
|
||||
dom_exception (*dom_node_remove_child)(dom_node_internal *node,
|
||||
dom_node_internal *old_child,
|
||||
dom_node_internal **result);
|
||||
dom_exception (*dom_node_append_child)(dom_node_internal *node,
|
||||
dom_node_internal *new_child,
|
||||
dom_node_internal **result);
|
||||
dom_exception (*dom_node_has_child_nodes)(dom_node_internal *node,
|
||||
bool *result);
|
||||
dom_exception (*dom_node_clone_node)(dom_node_internal *node, bool deep,
|
||||
dom_node_internal **result);
|
||||
dom_exception (*dom_node_normalize)(dom_node_internal *node);
|
||||
dom_exception (*dom_node_is_supported)(dom_node_internal *node,
|
||||
dom_string *feature, dom_string *version,
|
||||
bool *result);
|
||||
dom_exception (*dom_node_get_namespace)(dom_node_internal *node,
|
||||
dom_string **result);
|
||||
dom_exception (*dom_node_get_prefix)(dom_node_internal *node,
|
||||
dom_string **result);
|
||||
dom_exception (*dom_node_set_prefix)(dom_node_internal *node,
|
||||
dom_string *prefix);
|
||||
dom_exception (*dom_node_get_local_name)(dom_node_internal *node,
|
||||
dom_string **result);
|
||||
dom_exception (*dom_node_has_attributes)(dom_node_internal *node,
|
||||
bool *result);
|
||||
dom_exception (*dom_node_get_base)(dom_node_internal *node,
|
||||
dom_string **result);
|
||||
dom_exception (*dom_node_compare_document_position)(
|
||||
dom_node_internal *node, dom_node_internal *other,
|
||||
uint16_t *result);
|
||||
dom_exception (*dom_node_get_text_content)(dom_node_internal *node,
|
||||
dom_string **result);
|
||||
dom_exception (*dom_node_set_text_content)(dom_node_internal *node,
|
||||
dom_string *content);
|
||||
dom_exception (*dom_node_is_same)(dom_node_internal *node,
|
||||
dom_node_internal *other, bool *result);
|
||||
dom_exception (*dom_node_lookup_prefix)(dom_node_internal *node,
|
||||
dom_string *namespace,
|
||||
dom_string **result);
|
||||
dom_exception (*dom_node_is_default_namespace)(dom_node_internal *node,
|
||||
dom_string *namespace, bool *result);
|
||||
dom_exception (*dom_node_lookup_namespace)(dom_node_internal *node,
|
||||
dom_string *prefix, dom_string **result);
|
||||
dom_exception (*dom_node_is_equal)(dom_node_internal *node,
|
||||
dom_node_internal *other, bool *result);
|
||||
dom_exception (*dom_node_get_feature)(dom_node_internal *node,
|
||||
dom_string *feature, dom_string *version,
|
||||
void **result);
|
||||
dom_exception (*dom_node_set_user_data)(dom_node_internal *node,
|
||||
dom_string *key, void *data,
|
||||
dom_user_data_handler handler, void **result);
|
||||
dom_exception (*dom_node_get_user_data)(dom_node_internal *node,
|
||||
dom_string *key, void **result);
|
||||
} dom_node_vtable;
|
||||
|
||||
/* The ref/unref methods define */
|
||||
|
||||
static inline dom_node *dom_node_ref(dom_node *node)
|
||||
{
|
||||
if (node != NULL)
|
||||
node->refcnt++;
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
#define dom_node_ref(n) dom_node_ref((dom_node *) (n))
|
||||
|
||||
static inline dom_exception dom_node_try_destroy(dom_node *node)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_try_destroy(
|
||||
(dom_node_internal *) node);
|
||||
}
|
||||
#define dom_node_try_destroy(n) dom_node_try_destroy((dom_node *) (n))
|
||||
|
||||
static inline void dom_node_unref(dom_node *node)
|
||||
{
|
||||
if (node != NULL) {
|
||||
if (--node->refcnt == 0)
|
||||
dom_node_try_destroy(node);
|
||||
}
|
||||
|
||||
}
|
||||
#define dom_node_unref(n) dom_node_unref((dom_node *) (n))
|
||||
|
||||
static inline dom_exception dom_node_get_node_name(struct dom_node *node,
|
||||
dom_string **result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_get_node_name(
|
||||
(dom_node_internal *) node, result);
|
||||
}
|
||||
#define dom_node_get_node_name(n, r) dom_node_get_node_name((dom_node *) (n), (r))
|
||||
|
||||
static inline dom_exception dom_node_get_node_value(struct dom_node *node,
|
||||
dom_string **result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_get_node_value(
|
||||
(dom_node_internal *) node, result);
|
||||
}
|
||||
#define dom_node_get_node_value(n, r) dom_node_get_node_value( \
|
||||
(dom_node *) (n), (r))
|
||||
|
||||
static inline dom_exception dom_node_set_node_value(struct dom_node *node,
|
||||
dom_string *value)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_set_node_value(
|
||||
(dom_node_internal *) node, value);
|
||||
}
|
||||
#define dom_node_set_node_value(n, v) dom_node_set_node_value( \
|
||||
(dom_node *) (n), (v))
|
||||
|
||||
static inline dom_exception dom_node_get_node_type(struct dom_node *node,
|
||||
dom_node_type *result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_get_node_type(
|
||||
(dom_node_internal *) node, result);
|
||||
}
|
||||
#define dom_node_get_node_type(n, r) dom_node_get_node_type( \
|
||||
(dom_node *) (n), (dom_node_type *) (r))
|
||||
|
||||
static inline dom_exception dom_node_get_parent_node(struct dom_node *node,
|
||||
dom_node **result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_get_parent_node(
|
||||
(dom_node_internal *) node,
|
||||
(dom_node_internal **) result);
|
||||
}
|
||||
#define dom_node_get_parent_node(n, r) dom_node_get_parent_node( \
|
||||
(dom_node *) (n), (dom_node **) (r))
|
||||
|
||||
static inline dom_exception dom_node_get_child_nodes(struct dom_node *node,
|
||||
struct dom_nodelist **result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_get_child_nodes(
|
||||
(dom_node_internal *) node, result);
|
||||
}
|
||||
#define dom_node_get_child_nodes(n, r) dom_node_get_child_nodes( \
|
||||
(dom_node *) (n), (struct dom_nodelist **) (r))
|
||||
|
||||
static inline dom_exception dom_node_get_first_child(struct dom_node *node,
|
||||
dom_node **result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_get_first_child(
|
||||
(dom_node_internal *) node,
|
||||
(dom_node_internal **) result);
|
||||
}
|
||||
#define dom_node_get_first_child(n, r) dom_node_get_first_child( \
|
||||
(dom_node *) (n), (dom_node **) (r))
|
||||
|
||||
static inline dom_exception dom_node_get_last_child(struct dom_node *node,
|
||||
dom_node **result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_get_last_child(
|
||||
(dom_node_internal *) node,
|
||||
(dom_node_internal **) result);
|
||||
}
|
||||
#define dom_node_get_last_child(n, r) dom_node_get_last_child( \
|
||||
(dom_node *) (n), (dom_node **) (r))
|
||||
|
||||
static inline dom_exception dom_node_get_previous_sibling(
|
||||
struct dom_node *node, dom_node **result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->
|
||||
dom_node_get_previous_sibling(
|
||||
(dom_node_internal *) node,
|
||||
(dom_node_internal **) result);
|
||||
}
|
||||
#define dom_node_get_previous_sibling(n, r) dom_node_get_previous_sibling( \
|
||||
(dom_node *) (n), (dom_node **) (r))
|
||||
|
||||
static inline dom_exception dom_node_get_next_sibling(struct dom_node *node,
|
||||
dom_node **result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_get_next_sibling(
|
||||
(dom_node_internal *) node,
|
||||
(dom_node_internal **) result);
|
||||
}
|
||||
#define dom_node_get_next_sibling(n, r) dom_node_get_next_sibling( \
|
||||
(dom_node *) (n), (dom_node **) (r))
|
||||
|
||||
static inline dom_exception dom_node_get_attributes(struct dom_node *node,
|
||||
struct dom_namednodemap **result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_get_attributes(
|
||||
(dom_node_internal *) node, result);
|
||||
}
|
||||
#define dom_node_get_attributes(n, r) dom_node_get_attributes( \
|
||||
(dom_node *) (n), (struct dom_namednodemap **) (r))
|
||||
|
||||
static inline dom_exception dom_node_get_owner_document(struct dom_node *node,
|
||||
struct dom_document **result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_get_owner_document(
|
||||
(dom_node_internal *) node, result);
|
||||
}
|
||||
#define dom_node_get_owner_document(n, r) dom_node_get_owner_document( \
|
||||
(dom_node *) (n), (struct dom_document **) (r))
|
||||
|
||||
static inline dom_exception dom_node_insert_before(struct dom_node *node,
|
||||
struct dom_node *new_child, struct dom_node *ref_child,
|
||||
struct dom_node **result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_insert_before(
|
||||
(dom_node_internal *) node,
|
||||
(dom_node_internal *) new_child,
|
||||
(dom_node_internal *) ref_child,
|
||||
(dom_node_internal **) result);
|
||||
}
|
||||
#define dom_node_insert_before(n, nn, ref, ret) dom_node_insert_before( \
|
||||
(dom_node *) (n), (dom_node *) (nn), (dom_node *) (ref),\
|
||||
(dom_node **) (ret))
|
||||
|
||||
static inline dom_exception dom_node_replace_child(struct dom_node *node,
|
||||
struct dom_node *new_child, struct dom_node *old_child,
|
||||
struct dom_node **result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_replace_child(
|
||||
(dom_node_internal *) node,
|
||||
(dom_node_internal *) new_child,
|
||||
(dom_node_internal *) old_child,
|
||||
(dom_node_internal **) result);
|
||||
}
|
||||
#define dom_node_replace_child(n, nn, old, ret) dom_node_replace_child( \
|
||||
(dom_node *) (n), (dom_node *) (nn), (dom_node *) (old),\
|
||||
(dom_node **) (ret))
|
||||
|
||||
static inline dom_exception dom_node_remove_child(struct dom_node *node,
|
||||
struct dom_node *old_child,
|
||||
struct dom_node **result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_remove_child(
|
||||
(dom_node_internal *) node,
|
||||
(dom_node_internal *) old_child,
|
||||
(dom_node_internal **) result);
|
||||
}
|
||||
#define dom_node_remove_child(n, old, ret) dom_node_remove_child( \
|
||||
(dom_node *) (n), (dom_node *) (old), (dom_node **) (ret))
|
||||
|
||||
static inline dom_exception dom_node_append_child(struct dom_node *node,
|
||||
struct dom_node *new_child,
|
||||
struct dom_node **result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_append_child(
|
||||
(dom_node_internal *) node,
|
||||
(dom_node_internal *) new_child,
|
||||
(dom_node_internal **) result);
|
||||
}
|
||||
#define dom_node_append_child(n, nn, ret) dom_node_append_child( \
|
||||
(dom_node *) (n), (dom_node *) (nn), (dom_node **) (ret))
|
||||
|
||||
static inline dom_exception dom_node_has_child_nodes(struct dom_node *node,
|
||||
bool *result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_has_child_nodes(
|
||||
(dom_node_internal *) node, result);
|
||||
}
|
||||
#define dom_node_has_child_nodes(n, r) dom_node_has_child_nodes( \
|
||||
(dom_node *) (n), (bool *) (r))
|
||||
|
||||
static inline dom_exception dom_node_clone_node(struct dom_node *node,
|
||||
bool deep, struct dom_node **result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_clone_node(
|
||||
(dom_node_internal *) node, deep,
|
||||
(dom_node_internal **) result);
|
||||
}
|
||||
#define dom_node_clone_node(n, d, r) dom_node_clone_node((dom_node *) (n), \
|
||||
(bool) (d), (dom_node **) (r))
|
||||
|
||||
static inline dom_exception dom_node_normalize(struct dom_node *node)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_normalize(
|
||||
(dom_node_internal *) node);
|
||||
}
|
||||
#define dom_node_normalize(n) dom_node_normalize((dom_node *) (n))
|
||||
|
||||
static inline dom_exception dom_node_is_supported(struct dom_node *node,
|
||||
dom_string *feature, dom_string *version,
|
||||
bool *result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_is_supported(
|
||||
(dom_node_internal *) node, feature,
|
||||
version, result);
|
||||
}
|
||||
#define dom_node_is_supported(n, f, v, r) dom_node_is_supported( \
|
||||
(dom_node *) (n), (f), (v), (bool *) (r))
|
||||
|
||||
static inline dom_exception dom_node_get_namespace(struct dom_node *node,
|
||||
dom_string **result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_get_namespace(
|
||||
(dom_node_internal *) node, result);
|
||||
}
|
||||
#define dom_node_get_namespace(n, r) dom_node_get_namespace((dom_node *) (n), (r))
|
||||
|
||||
static inline dom_exception dom_node_get_prefix(struct dom_node *node,
|
||||
dom_string **result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_get_prefix(
|
||||
(dom_node_internal *) node, result);
|
||||
}
|
||||
#define dom_node_get_prefix(n, r) dom_node_get_prefix((dom_node *) (n), (r))
|
||||
|
||||
static inline dom_exception dom_node_set_prefix(struct dom_node *node,
|
||||
dom_string *prefix)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_set_prefix(
|
||||
(dom_node_internal *) node, prefix);
|
||||
}
|
||||
#define dom_node_set_prefix(n, p) dom_node_set_prefix((dom_node *) (n), (p))
|
||||
|
||||
static inline dom_exception dom_node_get_local_name(struct dom_node *node,
|
||||
dom_string **result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_get_local_name(
|
||||
(dom_node_internal *) node, result);
|
||||
}
|
||||
#define dom_node_get_local_name(n, r) dom_node_get_local_name((dom_node *) (n), (r))
|
||||
|
||||
static inline dom_exception dom_node_has_attributes(struct dom_node *node,
|
||||
bool *result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_has_attributes(
|
||||
(dom_node_internal *) node, result);
|
||||
}
|
||||
#define dom_node_has_attributes(n, r) dom_node_has_attributes( \
|
||||
(dom_node *) (n), (bool *) (r))
|
||||
|
||||
static inline dom_exception dom_node_get_base(struct dom_node *node,
|
||||
dom_string **result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_get_base(
|
||||
(dom_node_internal *) node, result);
|
||||
}
|
||||
#define dom_node_get_base(n, r) dom_node_get_base((dom_node *) (n), (r))
|
||||
|
||||
static inline dom_exception dom_node_compare_document_position(
|
||||
struct dom_node *node, struct dom_node *other,
|
||||
uint16_t *result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->
|
||||
dom_node_compare_document_position(
|
||||
(dom_node_internal *) node,
|
||||
(dom_node_internal *) other, result);
|
||||
}
|
||||
#define dom_node_compare_document_position(n, o, r) \
|
||||
dom_node_compare_document_position((dom_node *) (n), \
|
||||
(dom_node *) (o), (uint16_t *) (r))
|
||||
|
||||
static inline dom_exception dom_node_get_text_content(struct dom_node *node,
|
||||
dom_string **result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_get_text_content(
|
||||
(dom_node_internal *) node, result);
|
||||
}
|
||||
#define dom_node_get_text_content(n, r) dom_node_get_text_content( \
|
||||
(dom_node *) (n), (r))
|
||||
|
||||
static inline dom_exception dom_node_set_text_content(struct dom_node *node,
|
||||
dom_string *content)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_set_text_content(
|
||||
(dom_node_internal *) node, content);
|
||||
}
|
||||
#define dom_node_set_text_content(n, c) dom_node_set_text_content( \
|
||||
(dom_node *) (n), (c))
|
||||
|
||||
static inline dom_exception dom_node_is_same(struct dom_node *node,
|
||||
struct dom_node *other, bool *result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_is_same(
|
||||
(dom_node_internal *) node,
|
||||
(dom_node_internal *) other,
|
||||
result);
|
||||
}
|
||||
#define dom_node_is_same(n, o, r) dom_node_is_same((dom_node *) (n), \
|
||||
(dom_node *) (o), (bool *) (r))
|
||||
|
||||
static inline dom_exception dom_node_lookup_prefix(struct dom_node *node,
|
||||
dom_string *namespace, dom_string **result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_lookup_prefix(
|
||||
(dom_node_internal *) node, namespace, result);
|
||||
}
|
||||
#define dom_node_lookup_prefix(n, ns, r) dom_node_lookup_prefix( \
|
||||
(dom_node *) (n), (ns), (r))
|
||||
|
||||
static inline dom_exception dom_node_is_default_namespace(
|
||||
struct dom_node *node, dom_string *namespace,
|
||||
bool *result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->
|
||||
dom_node_is_default_namespace(
|
||||
(dom_node_internal *) node, namespace, result);
|
||||
}
|
||||
#define dom_node_is_default_namespace(n, ns, r) dom_node_is_default_namespace(\
|
||||
(dom_node *) (n), (ns), (bool *) (r))
|
||||
|
||||
static inline dom_exception dom_node_lookup_namespace(struct dom_node *node,
|
||||
dom_string *prefix, dom_string **result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_lookup_namespace(
|
||||
(dom_node_internal *) node, prefix, result);
|
||||
}
|
||||
#define dom_node_lookup_namespace(n, p, r) dom_node_lookup_namespace( \
|
||||
(dom_node *) (n), (p), (r))
|
||||
|
||||
static inline dom_exception dom_node_is_equal(struct dom_node *node,
|
||||
struct dom_node *other, bool *result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_is_equal(
|
||||
(dom_node_internal *) node,
|
||||
(dom_node_internal *) other,
|
||||
result);
|
||||
}
|
||||
#define dom_node_is_equal(n, o, r) dom_node_is_equal((dom_node *) (n), \
|
||||
(dom_node *) (o), (bool *) (r))
|
||||
|
||||
static inline dom_exception dom_node_get_feature(struct dom_node *node,
|
||||
dom_string *feature, dom_string *version,
|
||||
void **result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_get_feature(
|
||||
(dom_node_internal *) node, feature, version, result);
|
||||
}
|
||||
#define dom_node_get_feature(n, f, v, r) dom_node_get_feature( \
|
||||
(dom_node *) (n), (f), (v), (void **) (r))
|
||||
|
||||
static inline dom_exception dom_node_set_user_data(struct dom_node *node,
|
||||
dom_string *key, void *data,
|
||||
dom_user_data_handler handler, void **result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_set_user_data(
|
||||
(dom_node_internal *) node, key, data, handler,
|
||||
result);
|
||||
}
|
||||
#define dom_node_set_user_data(n, k, d, h, r) dom_node_set_user_data( \
|
||||
(dom_node *) (n), (k), (void *) (d), \
|
||||
(dom_user_data_handler) h, (void **) (r))
|
||||
|
||||
static inline dom_exception dom_node_get_user_data(struct dom_node *node,
|
||||
dom_string *key, void **result)
|
||||
{
|
||||
return ((dom_node_vtable *) node->vtable)->dom_node_get_user_data(
|
||||
(dom_node_internal *) node, key, result);
|
||||
}
|
||||
#define dom_node_get_user_data(n, k, r) dom_node_get_user_data( \
|
||||
(dom_node *) (n), (k), (void **) (r))
|
||||
|
||||
#endif
|
28
programs/network/netsurf/include/dom/core/nodelist.h
Normal file
28
programs/network/netsurf/include/dom/core/nodelist.h
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef dom_core_nodelist_h_
|
||||
#define dom_core_nodelist_h_
|
||||
|
||||
#include <dom/core/exceptions.h>
|
||||
|
||||
struct dom_node;
|
||||
|
||||
typedef struct dom_nodelist dom_nodelist;
|
||||
|
||||
void dom_nodelist_ref(struct dom_nodelist *list);
|
||||
void dom_nodelist_unref(struct dom_nodelist *list);
|
||||
|
||||
dom_exception dom_nodelist_get_length(struct dom_nodelist *list,
|
||||
uint32_t *length);
|
||||
dom_exception _dom_nodelist_item(struct dom_nodelist *list,
|
||||
uint32_t index, struct dom_node **node);
|
||||
|
||||
#define dom_nodelist_item(l, i, n) _dom_nodelist_item((dom_nodelist *) (l), \
|
||||
(uint32_t) (i), (dom_node **) (n))
|
||||
|
||||
#endif
|
13
programs/network/netsurf/include/dom/core/pi.h
Normal file
13
programs/network/netsurf/include/dom/core/pi.h
Normal file
@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef dom_core_processinginstruction_h_
|
||||
#define dom_core_processinginstruction_h_
|
||||
|
||||
typedef struct dom_processing_instruction dom_processing_instruction;
|
||||
|
||||
#endif
|
116
programs/network/netsurf/include/dom/core/string.h
Normal file
116
programs/network/netsurf/include/dom/core/string.h
Normal file
@ -0,0 +1,116 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef dom_string_h_
|
||||
#define dom_string_h_
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stddef.h>
|
||||
#include <libwapcaplet/libwapcaplet.h>
|
||||
|
||||
#include <dom/functypes.h>
|
||||
#include <dom/core/exceptions.h>
|
||||
|
||||
typedef struct dom_string dom_string;
|
||||
struct dom_string {
|
||||
uint32_t refcnt;
|
||||
} _ALIGNED;
|
||||
|
||||
|
||||
/* Claim a reference on a DOM string */
|
||||
static inline dom_string *dom_string_ref(dom_string *str)
|
||||
{
|
||||
if (str != NULL)
|
||||
str->refcnt++;
|
||||
return str;
|
||||
}
|
||||
|
||||
/* Destroy a DOM string */
|
||||
void dom_string_destroy(dom_string *str);
|
||||
|
||||
/* Release a reference on a DOM string */
|
||||
static inline void dom_string_unref(dom_string *str)
|
||||
{
|
||||
if ((str != NULL) && (--(str->refcnt) == 0)) {
|
||||
dom_string_destroy(str);
|
||||
}
|
||||
}
|
||||
|
||||
/* Create a DOM string from a string of characters */
|
||||
dom_exception dom_string_create(const uint8_t *ptr, size_t len,
|
||||
dom_string **str);
|
||||
dom_exception dom_string_create_interned(const uint8_t *ptr, size_t len,
|
||||
dom_string **str);
|
||||
|
||||
/* Obtain an interned representation of a dom string */
|
||||
dom_exception dom_string_intern(dom_string *str,
|
||||
struct lwc_string_s **lwcstr);
|
||||
|
||||
/* Case sensitively compare two DOM strings */
|
||||
bool dom_string_isequal(const dom_string *s1, const dom_string *s2);
|
||||
/* Case insensitively compare two DOM strings */
|
||||
bool dom_string_caseless_isequal(const dom_string *s1, const dom_string *s2);
|
||||
|
||||
/* Case sensitively compare DOM string and lwc_string */
|
||||
bool dom_string_lwc_isequal(const dom_string *s1, lwc_string *s2);
|
||||
/* Case insensitively compare DOM string and lwc_string */
|
||||
bool dom_string_caseless_lwc_isequal(const dom_string *s1, lwc_string *s2);
|
||||
|
||||
/* Get the index of the first occurrence of a character in a dom string */
|
||||
uint32_t dom_string_index(dom_string *str, uint32_t chr);
|
||||
/* Get the index of the last occurrence of a character in a dom string */
|
||||
uint32_t dom_string_rindex(dom_string *str, uint32_t chr);
|
||||
|
||||
/* Get the length, in characters, of a dom string */
|
||||
uint32_t dom_string_length(dom_string *str);
|
||||
|
||||
/**
|
||||
* Get the raw character data of the dom_string.
|
||||
* @note: This function is just provided for the convenience of accessing the
|
||||
* raw C string character, no change on the result string is allowed.
|
||||
*/
|
||||
const char *dom_string_data(const dom_string *str);
|
||||
|
||||
/* Get the byte length of this dom_string */
|
||||
size_t dom_string_byte_length(const dom_string *str);
|
||||
|
||||
/* Get the UCS-4 character at position index, the index should be in
|
||||
* [0, length), and length can be get by calling dom_string_length
|
||||
*/
|
||||
dom_exception dom_string_at(dom_string *str, uint32_t index,
|
||||
uint32_t *ch);
|
||||
|
||||
/* Concatenate two dom strings */
|
||||
dom_exception dom_string_concat(dom_string *s1, dom_string *s2,
|
||||
dom_string **result);
|
||||
|
||||
/* Extract a substring from a dom string */
|
||||
dom_exception dom_string_substr(dom_string *str,
|
||||
uint32_t i1, uint32_t i2, dom_string **result);
|
||||
|
||||
/* Insert data into a dom string at the given location */
|
||||
dom_exception dom_string_insert(dom_string *target,
|
||||
dom_string *source, uint32_t offset,
|
||||
dom_string **result);
|
||||
|
||||
/* Replace a section of a dom string */
|
||||
dom_exception dom_string_replace(dom_string *target,
|
||||
dom_string *source, uint32_t i1, uint32_t i2,
|
||||
dom_string **result);
|
||||
|
||||
/* Generate an uppercase version of the given string */
|
||||
dom_exception dom_string_toupper(dom_string *source, bool ascii_only,
|
||||
dom_string **upper);
|
||||
|
||||
/* Generate an lowercase version of the given string */
|
||||
dom_exception dom_string_tolower(dom_string *source, bool ascii_only,
|
||||
dom_string **lower);
|
||||
|
||||
/* Calculate a hash value from a dom string */
|
||||
uint32_t dom_string_hash(dom_string *str);
|
||||
|
||||
#endif
|
70
programs/network/netsurf/include/dom/core/text.h
Normal file
70
programs/network/netsurf/include/dom/core/text.h
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef dom_core_text_h_
|
||||
#define dom_core_text_h_
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/characterdata.h>
|
||||
|
||||
struct dom_characterdata;
|
||||
|
||||
typedef struct dom_text dom_text;
|
||||
|
||||
typedef struct dom_text_vtable {
|
||||
struct dom_characterdata_vtable base;
|
||||
|
||||
dom_exception (*dom_text_split_text)(struct dom_text *text,
|
||||
uint32_t offset, struct dom_text **result);
|
||||
dom_exception (*dom_text_get_is_element_content_whitespace)(
|
||||
struct dom_text *text, bool *result);
|
||||
dom_exception (*dom_text_get_whole_text)(struct dom_text *text,
|
||||
dom_string **result);
|
||||
dom_exception (*dom_text_replace_whole_text)(struct dom_text *text,
|
||||
dom_string *content, struct dom_text **result);
|
||||
} dom_text_vtable;
|
||||
|
||||
static inline dom_exception dom_text_split_text(struct dom_text *text,
|
||||
uint32_t offset, struct dom_text **result)
|
||||
{
|
||||
return ((dom_text_vtable *) ((dom_node *) text)->vtable)->
|
||||
dom_text_split_text(text, offset, result);
|
||||
}
|
||||
#define dom_text_split_text(t, o, r) dom_text_split_text((dom_text *) (t), \
|
||||
(uint32_t) (o), (dom_text **) (r))
|
||||
|
||||
static inline dom_exception dom_text_get_is_element_content_whitespace(
|
||||
struct dom_text *text, bool *result)
|
||||
{
|
||||
return ((dom_text_vtable *) ((dom_node *) text)->vtable)->
|
||||
dom_text_get_is_element_content_whitespace(text,
|
||||
result);
|
||||
}
|
||||
#define dom_text_get_is_element_content_whitespace(t, r) \
|
||||
dom_text_get_is_element_content_whitespace((dom_text *) (t), \
|
||||
(bool *) (r))
|
||||
|
||||
static inline dom_exception dom_text_get_whole_text(struct dom_text *text,
|
||||
dom_string **result)
|
||||
{
|
||||
return ((dom_text_vtable *) ((dom_node *) text)->vtable)->
|
||||
dom_text_get_whole_text(text, result);
|
||||
}
|
||||
#define dom_text_get_whole_text(t, r) dom_text_get_whole_text((dom_text *) (t), (r))
|
||||
|
||||
static inline dom_exception dom_text_replace_whole_text(struct dom_text *text,
|
||||
dom_string *content, struct dom_text **result)
|
||||
{
|
||||
return ((dom_text_vtable *) ((dom_node *) text)->vtable)->
|
||||
dom_text_replace_whole_text(text, content, result);
|
||||
}
|
||||
#define dom_text_replace_whole_text(t, c, r) dom_text_replace_whole_text( \
|
||||
(dom_text *) (t), (c), (dom_text **) (r))
|
||||
|
||||
#endif
|
45
programs/network/netsurf/include/dom/core/typeinfo.h
Normal file
45
programs/network/netsurf/include/dom/core/typeinfo.h
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef dom_core_typeinfo_h_
|
||||
#define dom_core_typeinfo_h_
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/string.h>
|
||||
|
||||
typedef struct dom_type_info dom_type_info;
|
||||
|
||||
typedef enum {
|
||||
DOM_TYPE_INFO_DERIVATION_RESTRICTION = 0x00000001,
|
||||
DOM_TYPE_INFO_DERIVATION_EXTENSION = 0x00000002,
|
||||
DOM_TYPE_INFO_DERIVATION_UNION = 0x00000004,
|
||||
DOM_TYPE_INFO_DERIVATION_LIST = 0x00000008
|
||||
} dom_type_info_derivation_method;
|
||||
|
||||
dom_exception _dom_type_info_get_type_name(dom_type_info *ti,
|
||||
dom_string **ret);
|
||||
#define dom_type_info_get_type_name(t, r) _dom_type_info_get_type_name( \
|
||||
(dom_type_info *) (t), (r))
|
||||
|
||||
|
||||
dom_exception _dom_type_info_get_type_namespace(dom_type_info *ti,
|
||||
dom_string **ret);
|
||||
#define dom_type_info_get_type_namespace(t, r) \
|
||||
_dom_type_info_get_type_namespace((dom_type_info *) (t), (r))
|
||||
|
||||
|
||||
dom_exception _dom_type_info_is_derived(dom_type_info *ti,
|
||||
dom_string *namespace, dom_string *name,
|
||||
dom_type_info_derivation_method method, bool *ret);
|
||||
#define dom_type_info_is_derived(t, s, n, m, r) _dom_type_info_is_derived(\
|
||||
(dom_type_info *) (t), (s), (n), \
|
||||
(dom_type_info_derivation_method) (m), (bool *) (r))
|
||||
|
||||
|
||||
#endif
|
75
programs/network/netsurf/include/dom/dom.h
Normal file
75
programs/network/netsurf/include/dom/dom.h
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* This is the top-level header file for libdom. The intention of this is
|
||||
* to allow client applications to simply include this file and get access
|
||||
* to all the libdom API.
|
||||
*/
|
||||
|
||||
#ifndef dom_dom_h_
|
||||
#define dom_dom_h_
|
||||
|
||||
/* Base library headers */
|
||||
#include <dom/functypes.h>
|
||||
|
||||
/* DOM core headers */
|
||||
#include <dom/core/attr.h>
|
||||
#include <dom/core/characterdata.h>
|
||||
#include <dom/core/document.h>
|
||||
#include <dom/core/document_type.h>
|
||||
#include <dom/core/element.h>
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/implementation.h>
|
||||
#include <dom/core/namednodemap.h>
|
||||
#include <dom/core/node.h>
|
||||
#include <dom/core/cdatasection.h>
|
||||
#include <dom/core/doc_fragment.h>
|
||||
#include <dom/core/entity_ref.h>
|
||||
#include <dom/core/nodelist.h>
|
||||
#include <dom/core/string.h>
|
||||
#include <dom/core/text.h>
|
||||
#include <dom/core/pi.h>
|
||||
#include <dom/core/typeinfo.h>
|
||||
#include <dom/core/comment.h>
|
||||
|
||||
/* DOM HTML headers */
|
||||
#include <dom/html/html_collection.h>
|
||||
#include <dom/html/html_document.h>
|
||||
#include <dom/html/html_element.h>
|
||||
#include <dom/html/html_html_element.h>
|
||||
#include <dom/html/html_head_element.h>
|
||||
#include <dom/html/html_link_element.h>
|
||||
#include <dom/html/html_title_element.h>
|
||||
#include <dom/html/html_body_element.h>
|
||||
#include <dom/html/html_meta_element.h>
|
||||
#include <dom/html/html_form_element.h>
|
||||
#include <dom/html/html_input_element.h>
|
||||
#include <dom/html/html_button_element.h>
|
||||
#include <dom/html/html_text_area_element.h>
|
||||
#include <dom/html/html_opt_group_element.h>
|
||||
#include <dom/html/html_option_element.h>
|
||||
#include <dom/html/html_select_element.h>
|
||||
|
||||
/* DOM Events header */
|
||||
#include <dom/events/events.h>
|
||||
|
||||
typedef enum dom_namespace {
|
||||
DOM_NAMESPACE_NULL = 0,
|
||||
DOM_NAMESPACE_HTML = 1,
|
||||
DOM_NAMESPACE_MATHML = 2,
|
||||
DOM_NAMESPACE_SVG = 3,
|
||||
DOM_NAMESPACE_XLINK = 4,
|
||||
DOM_NAMESPACE_XML = 5,
|
||||
DOM_NAMESPACE_XMLNS = 6,
|
||||
|
||||
DOM_NAMESPACE_COUNT = 7
|
||||
} dom_namespace;
|
||||
|
||||
extern dom_string *dom_namespaces[DOM_NAMESPACE_COUNT];
|
||||
|
||||
#endif
|
31
programs/network/netsurf/include/dom/events/custom_event.h
Normal file
31
programs/network/netsurf/include/dom/events/custom_event.h
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef dom_events_custom_event_h_
|
||||
#define dom_events_custom_event_h_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/string.h>
|
||||
|
||||
typedef struct dom_custom_event dom_custom_event;
|
||||
|
||||
dom_exception _dom_custom_event_get_detail(dom_custom_event *evt,
|
||||
void **detail);
|
||||
#define dom_custom_event_get_detail(e, d) \
|
||||
_dom_custom_event_get_detail((dom_custom_event *) (e),\
|
||||
(void **) (d))
|
||||
|
||||
dom_exception _dom_custom_event_init_ns(dom_custom_event *evt,
|
||||
dom_string *namespace, dom_string *type,
|
||||
bool bubble, bool cancelable, void *detail);
|
||||
#define dom_custom_event_init_ns(e, n, t, b, c, d) \
|
||||
_dom_custom_event_init_ns((dom_custom_event *) (e), \
|
||||
(dom_string *) (n), (dom_string *) (t), \
|
||||
(bool) (b), (bool) (c), (void *) (d))
|
||||
|
||||
#endif
|
100
programs/network/netsurf/include/dom/events/document_event.h
Normal file
100
programs/network/netsurf/include/dom/events/document_event.h
Normal file
@ -0,0 +1,100 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef dom_events_document_event_h_
|
||||
#define dom_events_document_event_h_
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/string.h>
|
||||
|
||||
struct dom_event;
|
||||
struct dom_document;
|
||||
|
||||
typedef struct dom_document dom_document_event;
|
||||
|
||||
/**
|
||||
* The callback function which is used to process the default action of any
|
||||
* event.
|
||||
*
|
||||
* As ::dom_default_action_phase defines, we have three points in our
|
||||
* implementation where these kinds of callbacks get invoked.
|
||||
*
|
||||
* When the implementation start to dispatch certain event, it firstly invoke
|
||||
* the following callback, which should process the event before the normal
|
||||
* event flow.
|
||||
*
|
||||
* Take a MousePressed event on a check box object as example:
|
||||
* 1. The 'pressed' event is generated by OS and catched by our UI code;
|
||||
* 2. The UI code dispatch the event to DOM;
|
||||
* 3. DOM trys to dispatch the event as what the spec said;
|
||||
* 4. Before the real event flow happens, DOM get the
|
||||
* dom_default_action_callback function from the
|
||||
* dom_events_default_action_fetcher with param
|
||||
* DOM_DEFAULT_ACTION_STARTED, and then call it;
|
||||
* 5. The callback function invoke some System-denpendent API to make the
|
||||
* checkbox checked and then return;
|
||||
* 6. Normal event flow goes on.
|
||||
* 7. When the implementation reach the end of the event flow, it check whether
|
||||
* the event's default action is prevented, if it is, then go to step 8,
|
||||
* else go to step 9.
|
||||
* 8. The event's default action get prevented, DOM get the
|
||||
* dom_default_action_callback function from the
|
||||
* dom_events_default_action_fetcher with param
|
||||
* DOM_DEFAULT_ACTION_PREVENTED, and then call it.
|
||||
* 8. The event's default action does not get prevented, DOM get the
|
||||
* dom_default_action_callback function from the
|
||||
* dom_events_default_action_fetcher with param
|
||||
* DOM_DEFAULT_ACTION_END, and then call it.
|
||||
*
|
||||
* @note: the point here is that we want the UI related stuff to be done
|
||||
* within the default action code. The DOM only take care of the content tree
|
||||
* and the event flow itself.
|
||||
*/
|
||||
typedef void (*dom_default_action_callback)(struct dom_event *evt, void *pw);
|
||||
|
||||
/**
|
||||
* The default action phase
|
||||
*
|
||||
* @note: we define the following three values to fetch three different types
|
||||
* of dom_default_action_callback function and their private data.
|
||||
*/
|
||||
typedef enum {
|
||||
DOM_DEFAULT_ACTION_STARTED = 0,
|
||||
DOM_DEFAULT_ACTION_PREVENTED,
|
||||
DOM_DEFAULT_ACTION_END
|
||||
} dom_default_action_phase;
|
||||
|
||||
/**
|
||||
* The default action fetcher
|
||||
*
|
||||
* \param type The type of the event
|
||||
* \param phase The phase of the default action callback
|
||||
* \param pw The return private data of the callback function
|
||||
* \return a callback function, NULL if there is none.
|
||||
*/
|
||||
typedef dom_default_action_callback (*dom_events_default_action_fetcher)
|
||||
(dom_string *type, dom_default_action_phase phase,
|
||||
void **pw);
|
||||
|
||||
dom_exception _dom_document_event_create_event(dom_document_event *de,
|
||||
dom_string *type, struct dom_event **evt);
|
||||
#define dom_document_event_create_event(d, t, e) \
|
||||
_dom_document_event_create_event((dom_document_event *) (d), \
|
||||
(dom_string *) (t), (struct dom_event **) (e))
|
||||
|
||||
dom_exception _dom_document_event_can_dispatch(dom_document_event *de,
|
||||
dom_string *namespace, dom_string *type,
|
||||
bool* can);
|
||||
#define dom_document_event_can_dispatch(d, n, t, c) \
|
||||
_dom_document_event_can_dispatch((dom_document_event *) (d), \
|
||||
(dom_string *) (n), (dom_string *) (t),\
|
||||
(bool *) (c))
|
||||
|
||||
#endif
|
||||
|
92
programs/network/netsurf/include/dom/events/event.h
Normal file
92
programs/network/netsurf/include/dom/events/event.h
Normal file
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef dom_events_event_h_
|
||||
#define dom_events_event_h_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/string.h>
|
||||
#include <dom/events/event_target.h>
|
||||
|
||||
typedef enum {
|
||||
DOM_CAPTURING_PHASE = 1,
|
||||
DOM_AT_TARGET = 2,
|
||||
DOM_BUBBLING_PHASE = 3
|
||||
} dom_event_flow_phase;
|
||||
|
||||
typedef struct dom_event dom_event;
|
||||
|
||||
/* The ref/unref methods define */
|
||||
void _dom_event_ref(dom_event *evt);
|
||||
#define dom_event_ref(n) _dom_event_ref((dom_event *) (n))
|
||||
void _dom_event_unref(dom_event *evt);
|
||||
#define dom_event_unref(n) _dom_event_unref((dom_event *) (n))
|
||||
|
||||
dom_exception _dom_event_get_type(dom_event *evt, dom_string **type);
|
||||
#define dom_event_get_type(e, t) _dom_event_get_type((dom_event *) (e), \
|
||||
(dom_string **) (t))
|
||||
|
||||
dom_exception _dom_event_get_target(dom_event *evt, dom_event_target **target);
|
||||
#define dom_event_get_target(e, t) _dom_event_get_target((dom_event *) (e), \
|
||||
(dom_event_target **) (t))
|
||||
|
||||
dom_exception _dom_event_get_current_target(dom_event *evt,
|
||||
dom_event_target **current);
|
||||
#define dom_event_get_current_target(e, c) _dom_event_get_current_target(\
|
||||
(dom_event *) (e), (dom_event_target **) (c))
|
||||
|
||||
dom_exception _dom_event_get_bubbles(dom_event *evt, bool *bubbles);
|
||||
#define dom_event_get_bubbles(e, b) _dom_event_get_bubbles((dom_event *) (e), \
|
||||
(bool *) (b))
|
||||
|
||||
dom_exception _dom_event_get_cancelable(dom_event *evt, bool *cancelable);
|
||||
#define dom_event_get_cancelable(e, c) _dom_event_get_cancelable(\
|
||||
(dom_event *) (e), (bool *) (c))
|
||||
|
||||
dom_exception _dom_event_get_timestamp(dom_event *evt,
|
||||
unsigned int *timestamp);
|
||||
#define dom_event_get_timestamp(e, t) _dom_event_get_timestamp(\
|
||||
(dom_event *) (e), (unsigned int *) (t))
|
||||
|
||||
dom_exception _dom_event_stop_propagation(dom_event *evt);
|
||||
#define dom_event_stop_propagation(e) _dom_event_stop_propagation(\
|
||||
(dom_event *) (e))
|
||||
|
||||
dom_exception _dom_event_prevent_default(dom_event *evt);
|
||||
#define dom_event_prevent_default(e) _dom_event_prevent_default(\
|
||||
(dom_event *) (e))
|
||||
|
||||
dom_exception _dom_event_init(dom_event *evt, dom_string *type,
|
||||
bool bubble, bool cancelable);
|
||||
#define dom_event_init(e, t, b, c) _dom_event_init((dom_event *) (e), \
|
||||
(dom_string *) (t), (bool) (b), (bool) (c))
|
||||
|
||||
dom_exception _dom_event_get_namespace(dom_event *evt,
|
||||
dom_string **namespace);
|
||||
#define dom_event_get_namespace(e, n) _dom_event_get_namespace(\
|
||||
(dom_event *) (e), (dom_string **) (n))
|
||||
|
||||
dom_exception _dom_event_is_custom(dom_event *evt, bool *custom);
|
||||
#define dom_event_is_custom(e, c) _dom_event_is_custom((dom_event *) (e), \
|
||||
(bool *) (c))
|
||||
|
||||
dom_exception _dom_event_stop_immediate_propagation(dom_event *evt);
|
||||
#define dom_event_stop_immediate_propagation(e) \
|
||||
_dom_event_stop_immediate_propagation((dom_event *) (e))
|
||||
|
||||
dom_exception _dom_event_is_default_prevented(dom_event *evt, bool *prevented);
|
||||
#define dom_event_is_default_prevented(e, p) \
|
||||
_dom_event_is_default_prevented((dom_event *) (e), (bool *) (p))
|
||||
|
||||
dom_exception _dom_event_init_ns(dom_event *evt, dom_string *namespace,
|
||||
dom_string *type, bool bubble, bool cancelable);
|
||||
#define dom_event_init_ns(e, n, t, b, c) _dom_event_init_ns( \
|
||||
(dom_event *) (e), (dom_string *) (n), \
|
||||
(dom_string *) (t), (bool) (b), (bool) (c))
|
||||
|
||||
#endif
|
27
programs/network/netsurf/include/dom/events/event_listener.h
Normal file
27
programs/network/netsurf/include/dom/events/event_listener.h
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef dom_events_event_listener_h_
|
||||
#define dom_events_event_listener_h_
|
||||
|
||||
#include <dom/core/exceptions.h>
|
||||
|
||||
struct dom_document;
|
||||
struct dom_event;
|
||||
|
||||
typedef void (*handle_event)(struct dom_event *evt, void *pw);
|
||||
|
||||
typedef struct dom_event_listener dom_event_listener;
|
||||
|
||||
dom_exception dom_event_listener_create(struct dom_document *doc,
|
||||
handle_event handler, void *pw, dom_event_listener **listener);
|
||||
|
||||
void dom_event_listener_ref(dom_event_listener *listener);
|
||||
void dom_event_listener_unref(dom_event_listener *listener);
|
||||
|
||||
#endif
|
||||
|
111
programs/network/netsurf/include/dom/events/event_target.h
Normal file
111
programs/network/netsurf/include/dom/events/event_target.h
Normal file
@ -0,0 +1,111 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef dom_events_event_target_h_
|
||||
#define dom_events_event_target_h_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/string.h>
|
||||
|
||||
struct dom_event_listener;
|
||||
struct dom_event;
|
||||
|
||||
/* Event target is a mixin interface, thus has no concrete implementation.
|
||||
* Subclasses must provide implementations of the event target methods. */
|
||||
typedef struct dom_event_target {
|
||||
void *vtable;
|
||||
} dom_event_target;
|
||||
|
||||
typedef struct dom_event_target_vtable {
|
||||
dom_exception (*add_event_listener)(
|
||||
dom_event_target *et, dom_string *type,
|
||||
struct dom_event_listener *listener,
|
||||
bool capture);
|
||||
dom_exception (*remove_event_listener)(
|
||||
dom_event_target *et, dom_string *type,
|
||||
struct dom_event_listener *listener,
|
||||
bool capture);
|
||||
dom_exception (*dispatch_event)(
|
||||
dom_event_target *et,
|
||||
struct dom_event *evt, bool *success);
|
||||
dom_exception (*add_event_listener_ns)(
|
||||
dom_event_target *et,
|
||||
dom_string *namespace, dom_string *type,
|
||||
struct dom_event_listener *listener,
|
||||
bool capture);
|
||||
dom_exception (*remove_event_listener_ns)(
|
||||
dom_event_target *et,
|
||||
dom_string *namespace, dom_string *type,
|
||||
struct dom_event_listener *listener,
|
||||
bool capture);
|
||||
} dom_event_target_vtable;
|
||||
|
||||
static inline dom_exception dom_event_target_add_event_listener(
|
||||
dom_event_target *et, dom_string *type,
|
||||
struct dom_event_listener *listener, bool capture)
|
||||
{
|
||||
return ((dom_event_target_vtable *) et->vtable)->add_event_listener(
|
||||
et, type, listener, capture);
|
||||
}
|
||||
#define dom_event_target_add_event_listener(et, t, l, c) \
|
||||
dom_event_target_add_event_listener((dom_event_target *) (et),\
|
||||
(dom_string *) (t), (struct dom_event_listener *) (l), \
|
||||
(bool) (c))
|
||||
|
||||
static inline dom_exception dom_event_target_remove_event_listener(
|
||||
dom_event_target *et, dom_string *type,
|
||||
struct dom_event_listener *listener, bool capture)
|
||||
{
|
||||
return ((dom_event_target_vtable *) et->vtable)->remove_event_listener(
|
||||
et, type, listener, capture);
|
||||
}
|
||||
#define dom_event_target_remove_event_listener(et, t, l, c) \
|
||||
dom_event_target_remove_event_listener(\
|
||||
(dom_event_target *) (et), (dom_string *) (t),\
|
||||
(struct dom_event_listener *) (l), (bool) (c))
|
||||
|
||||
static inline dom_exception dom_event_target_dispatch_event(
|
||||
dom_event_target *et, struct dom_event *evt, bool *success)
|
||||
{
|
||||
return ((dom_event_target_vtable *) et->vtable)->dispatch_event(
|
||||
et, evt, success);
|
||||
}
|
||||
#define dom_event_target_dispatch_event(et, e, s) \
|
||||
dom_event_target_dispatch_event((dom_event_target *) (et),\
|
||||
(struct dom_event *) (e), (bool *) (s))
|
||||
|
||||
static inline dom_exception dom_event_target_add_event_listener_ns(
|
||||
dom_event_target *et,
|
||||
dom_string *namespace, dom_string *type,
|
||||
struct dom_event_listener *listener, bool capture)
|
||||
{
|
||||
return ((dom_event_target_vtable *) et->vtable)->add_event_listener_ns(
|
||||
et, namespace, type, listener, capture);
|
||||
}
|
||||
#define dom_event_target_add_event_listener_ns(et, n, t, l, c) \
|
||||
dom_event_target_add_event_listener_ns(\
|
||||
(dom_event_target *) (et), (dom_string *) (n),\
|
||||
(dom_string *) (t), (struct dom_event_listener *) (l),\
|
||||
(bool) (c))
|
||||
|
||||
static inline dom_exception dom_event_target_remove_event_listener_ns(
|
||||
dom_event_target *et,
|
||||
dom_string *namespace, dom_string *type,
|
||||
struct dom_event_listener *listener, bool capture)
|
||||
{
|
||||
return ((dom_event_target_vtable *) et->vtable)->remove_event_listener_ns(
|
||||
et, namespace, type, listener, capture);
|
||||
}
|
||||
#define dom_event_target_remove_event_listener_ns(et, n, t, l, c) \
|
||||
dom_event_target_remove_event_listener_ns(\
|
||||
(dom_event_target *) (et), (dom_string *) (n),\
|
||||
(dom_string *) (t), (struct dom_event_listener *) (l),\
|
||||
(bool) (c))
|
||||
|
||||
#endif
|
||||
|
25
programs/network/netsurf/include/dom/events/events.h
Normal file
25
programs/network/netsurf/include/dom/events/events.h
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef dom_events_h_
|
||||
#define dom_events_h_
|
||||
|
||||
#include <dom/events/event.h>
|
||||
#include <dom/events/ui_event.h>
|
||||
#include <dom/events/custom_event.h>
|
||||
#include <dom/events/mouse_event.h>
|
||||
#include <dom/events/keyboard_event.h>
|
||||
#include <dom/events/mouse_wheel_event.h>
|
||||
#include <dom/events/mouse_multi_wheel_event.h>
|
||||
#include <dom/events/mutation_event.h>
|
||||
#include <dom/events/mutation_name_event.h>
|
||||
#include <dom/events/text_event.h>
|
||||
#include <dom/events/event_listener.h>
|
||||
#include <dom/events/document_event.h>
|
||||
#include <dom/events/event_target.h>
|
||||
|
||||
#endif
|
89
programs/network/netsurf/include/dom/events/keyboard_event.h
Normal file
89
programs/network/netsurf/include/dom/events/keyboard_event.h
Normal file
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef dom_events_keyboard_event_h_
|
||||
#define dom_events_keyboard_event_h_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/string.h>
|
||||
|
||||
struct dom_abstract_view;
|
||||
|
||||
typedef struct dom_keyboard_event dom_keyboard_event;
|
||||
|
||||
typedef enum {
|
||||
DOM_KEY_LOCATION_STANDARD = 0,
|
||||
DOM_KEY_LOCATION_LEFT = 1,
|
||||
DOM_KEY_LOCATION_RIGHT = 2,
|
||||
DOM_KEY_LOCATION_NUMPAD = 3
|
||||
} dom_key_location;
|
||||
|
||||
dom_exception _dom_keyboard_event_get_key_identifier(dom_keyboard_event *evt,
|
||||
dom_string **ident);
|
||||
#define dom_keyboard_event_get_key_identifier(e, i) \
|
||||
_dom_keyboard_event_get_key_identifier( \
|
||||
(dom_keyboard_event *) (e), (dom_string **) (i))
|
||||
|
||||
dom_exception _dom_keyboard_event_get_key_location(dom_keyboard_event *evt,
|
||||
dom_key_location *loc);
|
||||
#define dom_keyboard_event_get_key_location(e, l) \
|
||||
_dom_keyboard_event_get_key_location( \
|
||||
(dom_keyboard_event *) (e), (dom_key_location *) (l))
|
||||
|
||||
dom_exception _dom_keyboard_event_get_ctrl_key(dom_keyboard_event *evt,
|
||||
bool *key);
|
||||
#define dom_keyboard_event_get_ctrl_key(e, k) _dom_keyboard_event_get_ctrl_key(\
|
||||
(dom_keyboard_event *) (e), (bool *) (k))
|
||||
|
||||
dom_exception _dom_keyboard_event_get_shift_key(dom_keyboard_event *evt,
|
||||
bool *key);
|
||||
#define dom_keyboard_event_get_shift_key(e, k) \
|
||||
_dom_keyboard_event_get_shift_key((dom_keyboard_event *) (e), \
|
||||
(bool *) (k))
|
||||
|
||||
dom_exception _dom_keyboard_event_get_alt_key(dom_keyboard_event *evt,
|
||||
bool *key);
|
||||
#define dom_keyboard_event_get_alt_key(e, k) _dom_keyboard_event_get_alt_key(\
|
||||
(dom_keyboard_event *) (e), (bool *) (k))
|
||||
|
||||
dom_exception _dom_keyboard_event_get_meta_key(dom_keyboard_event *evt,
|
||||
bool *key);
|
||||
#define dom_keyboard_event_get_meta_key(e, k) _dom_keyboard_event_get_meta_key(\
|
||||
(dom_keyboard_event *) (e), (bool *) (k))
|
||||
|
||||
dom_exception _dom_keyboard_event_get_modifier_state(dom_keyboard_event *evt,
|
||||
dom_string *m, bool *state);
|
||||
#define dom_keyboard_event_get_modifier_state(e, m, s) \
|
||||
_dom_keyboard_event_get_modifier_state( \
|
||||
(dom_keyboard_event *) (e), (dom_string *) (m),\
|
||||
(bool *) (s))
|
||||
|
||||
dom_exception _dom_keyboard_event_init(dom_keyboard_event *evt,
|
||||
dom_string *type, bool bubble, bool cancelable,
|
||||
struct dom_abstract_view *view, dom_string *key_ident,
|
||||
dom_key_location key_loc, dom_string *modifier_list);
|
||||
#define dom_keyboard_event_init(e, t, b, c, v, ki, kl, m) \
|
||||
_dom_keyboard_event_init((dom_keyboard_event *) (e), \
|
||||
(dom_string *) (t), (bool) (b), (bool) (c), \
|
||||
(struct dom_abstract_view *) (v), (dom_string *) (ki), \
|
||||
(dom_key_location) (kl), (dom_string *) (m))
|
||||
|
||||
dom_exception _dom_keyboard_event_init_ns(dom_keyboard_event *evt,
|
||||
dom_string *namespace, dom_string *type,
|
||||
bool bubble, bool cancelable, struct dom_abstract_view *view,
|
||||
dom_string *key_ident, dom_key_location key_loc,
|
||||
dom_string *modifier_list);
|
||||
#define dom_keyboard_event_init_ns(e, n, t, b, c, v, ki, kl, m) \
|
||||
_dom_keyboard_event_init_ns((dom_keyboard_event *) (e), \
|
||||
(dom_string *) (n), (dom_string *) (t), \
|
||||
(bool) (b), (bool) (c), (struct dom_abstract_view *) (v), \
|
||||
(dom_string *) (ki), (dom_key_location) (kl), \
|
||||
(dom_string *) (m))
|
||||
|
||||
#endif
|
||||
|
108
programs/network/netsurf/include/dom/events/mouse_event.h
Normal file
108
programs/network/netsurf/include/dom/events/mouse_event.h
Normal file
@ -0,0 +1,108 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef dom_events_mouse_event_h_
|
||||
#define dom_events_mouse_event_h_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/string.h>
|
||||
#include <dom/events/event_target.h>
|
||||
|
||||
struct dom_abstract_view;
|
||||
|
||||
typedef struct dom_mouse_event dom_mouse_event;
|
||||
|
||||
dom_exception _dom_mouse_event_get_screen_x(dom_mouse_event *evt,
|
||||
int32_t *x);
|
||||
#define dom_mouse_event_get_screen_x(e, x) _dom_mouse_event_get_screen_x(\
|
||||
(dom_mouse_event *) (e), (int32_t *) (x))
|
||||
|
||||
dom_exception _dom_mouse_event_get_screen_y(dom_mouse_event *evt,
|
||||
int32_t *y);
|
||||
#define dom_mouse_event_get_screen_y(e, y) _dom_mouse_event_get_screen_y(\
|
||||
(dom_mouse_event *) (e), (int32_t *) (y))
|
||||
|
||||
dom_exception _dom_mouse_event_get_client_x(dom_mouse_event *evt,
|
||||
int32_t *x);
|
||||
#define dom_mouse_event_get_client_x(e, x) _dom_mouse_event_get_client_x(\
|
||||
(dom_mouse_event *) (e), (int32_t *) (x))
|
||||
|
||||
dom_exception _dom_mouse_event_get_client_y(dom_mouse_event *evt,
|
||||
int32_t *y);
|
||||
#define dom_mouse_event_get_client_y(e, y) _dom_mouse_event_get_client_y(\
|
||||
(dom_mouse_event *) (e), (int32_t *) (y))
|
||||
|
||||
dom_exception _dom_mouse_event_get_ctrl_key(dom_mouse_event *evt,
|
||||
bool *key);
|
||||
#define dom_mouse_event_get_ctrl_key(e, k) _dom_mouse_event_get_ctrl_key( \
|
||||
(dom_mouse_event *) (e), (bool *) (k))
|
||||
|
||||
dom_exception _dom_mouse_event_get_shift_key(dom_mouse_event *evt,
|
||||
bool *key);
|
||||
#define dom_mouse_event_get_shift_key(e, k) _dom_mouse_event_get_shift_key( \
|
||||
(dom_mouse_event *) (e), (bool *) (k))
|
||||
|
||||
dom_exception _dom_mouse_event_get_alt_key(dom_mouse_event *evt,
|
||||
bool *key);
|
||||
#define dom_mouse_event_get_alt_key(e, k) _dom_mouse_event_get_alt_key( \
|
||||
(dom_mouse_event *) (e), (bool *) (k))
|
||||
|
||||
dom_exception _dom_mouse_event_get_meta_key(dom_mouse_event *evt,
|
||||
bool *key);
|
||||
#define dom_mouse_event_get_meta_key(e, k) _dom_mouse_event_get_meta_key( \
|
||||
(dom_mouse_event *) (e), (bool *) (k))
|
||||
|
||||
dom_exception _dom_mouse_event_get_button(dom_mouse_event *evt,
|
||||
unsigned short *button);
|
||||
#define dom_mouse_event_get_button(e, b) _dom_mouse_event_get_button(\
|
||||
(dom_mouse_event *) (e), (unsigned short *) (b))
|
||||
|
||||
dom_exception _dom_mouse_event_get_related_target(dom_mouse_event *evt,
|
||||
dom_event_target **et);
|
||||
#define dom_mouse_event_get_related_target(e, t) \
|
||||
_dom_mouse_event_get_related_target((dom_mouse_event *) (e),\
|
||||
(dom_event_target **) (t))
|
||||
|
||||
dom_exception _dom_mouse_event_get_modifier_state(dom_mouse_event *evt,
|
||||
dom_string *m, bool *state);
|
||||
#define dom_mouse_event_get_modifier_state(e, m, s) \
|
||||
_dom_mouse_event_get_modifier_state((dom_mouse_event *) (e), \
|
||||
(dom_string *) (m), (bool *) (s))
|
||||
|
||||
dom_exception _dom_mouse_event_init(dom_mouse_event *evt,
|
||||
dom_string *type, bool bubble, bool cancelable,
|
||||
struct dom_abstract_view *view, int32_t detail, int32_t screen_x,
|
||||
int32_t screen_y, int32_t client_x, int32_t client_y, bool ctrl,
|
||||
bool alt, bool shift, bool meta, unsigned short button,
|
||||
dom_event_target *et);
|
||||
#define dom_mouse_event_init(e, t, b, c, v, d, sx, sy, cx, cy, ctrl, alt, \
|
||||
shift, meta, button, et) \
|
||||
_dom_mouse_event_init((dom_mouse_event *) (e), \
|
||||
(dom_string *) (t), (bool) (b), (bool) (c),\
|
||||
(struct dom_abstract_view *) (v), (int32_t) (d), (int32_t) (sx), \
|
||||
(int32_t) (sy), (int32_t) (cx), (int32_t) (cy), (bool) (ctrl),\
|
||||
(bool) (alt), (bool) (shift), (bool) (meta), \
|
||||
(unsigned short) (button), (dom_event_target *) (et))
|
||||
|
||||
dom_exception _dom_mouse_event_init_ns(dom_mouse_event *evt,
|
||||
dom_string *namespace, dom_string *type,
|
||||
bool bubble, bool cancelable, struct dom_abstract_view *view,
|
||||
int32_t detail, int32_t screen_x, int32_t screen_y, int32_t client_x,
|
||||
int32_t client_y, bool ctrl, bool alt, bool shift, bool meta,
|
||||
unsigned short button, dom_event_target *et);
|
||||
#define dom_mouse_event_init_ns(e, n, t, b, c, v, d, sx, sy, cx, cy, ctrl, alt,\
|
||||
shift, meta, button, et) \
|
||||
_dom_mouse_event_init_ns((dom_mouse_event *) (e), \
|
||||
(dom_string *) (n), (dom_string *) (t),\
|
||||
(bool) (b), (bool) (c), (struct dom_abstract_view *) (v),\
|
||||
(int32_t) (d), (int32_t) (sx), (int32_t) (sy), (int32_t) (cx),\
|
||||
(int32_t) (cy), (bool) (ctrl), (bool) (alt), (bool) (shift),\
|
||||
(bool) (meta), (unsigned short) (button),\
|
||||
(dom_event_target *) (et))
|
||||
|
||||
#endif
|
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef dom_events_mouse_multi_wheel_event_h_
|
||||
#define dom_events_mouse_multi_wheel_event_h_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/string.h>
|
||||
#include <dom/events/event_target.h>
|
||||
|
||||
struct dom_abstract_view;
|
||||
|
||||
typedef struct dom_mouse_multi_wheel_event dom_mouse_multi_wheel_event;
|
||||
|
||||
dom_exception _dom_mouse_multi_wheel_event_get_wheel_delta_x(
|
||||
dom_mouse_multi_wheel_event *evt, int32_t *x);
|
||||
#define dom_mouse_multi_wheel_event_get_wheel_delta_x(e, x) \
|
||||
_dom_mouse_multi_wheel_event_get_wheel_delta_x( \
|
||||
(dom_mouse_multi_wheel_event *) (e), (int32_t *) (x))
|
||||
|
||||
dom_exception _dom_mouse_multi_wheel_event_get_wheel_delta_y(
|
||||
dom_mouse_multi_wheel_event *evt, int32_t *y);
|
||||
#define dom_mouse_multi_wheel_event_get_wheel_delta_y(e, y) \
|
||||
_dom_mouse_multi_wheel_event_get_wheel_delta_y( \
|
||||
(dom_mouse_multi_wheel_event *) (e), (int32_t *) (y))
|
||||
|
||||
dom_exception _dom_mouse_multi_wheel_event_get_wheel_delta_z(
|
||||
dom_mouse_multi_wheel_event *evt, int32_t *z);
|
||||
#define dom_mouse_multi_wheel_event_get_wheel_delta_z(e, z) \
|
||||
_dom_mouse_multi_wheel_event_get_wheel_delta_z( \
|
||||
(dom_mouse_multi_wheel_event *) (e), (int32_t *) (z))
|
||||
|
||||
dom_exception _dom_mouse_multi_wheel_event_init_ns(
|
||||
dom_mouse_multi_wheel_event *evt, dom_string *namespace,
|
||||
dom_string *type, bool bubble, bool cancelable,
|
||||
struct dom_abstract_view *view, int32_t detail, int32_t screen_x,
|
||||
int32_t screen_y, int32_t client_x, int32_t client_y,
|
||||
unsigned short button, dom_event_target *et,
|
||||
dom_string *modifier_list, int32_t wheel_delta_x,
|
||||
int32_t wheel_delta_y, int32_t wheel_delta_z);
|
||||
#define dom_mouse_multi_wheel_event_init_ns(e, n, t, b, c, v, \
|
||||
d, sx, sy, cx, cy, button, et, ml, x, y, z) \
|
||||
_dom_mouse_multi_wheel_event_init_ns( \
|
||||
(dom_mouse_multi_wheel_event *) (e), (dom_string *) (n),\
|
||||
(dom_string *) (t), (bool) (b), (bool) (c), \
|
||||
(struct dom_abstract_view *) (v), (int32_t) (d), (int32_t) (sx), \
|
||||
(int32_t) (sy), (int32_t) (cx), (int32_t) (cy),\
|
||||
(unsigned short) (button), (dom_event_target *) (et),\
|
||||
(dom_string *) (ml), (int32_t) (x), (int32_t) (y), (int32_t) (z))
|
||||
|
||||
#endif
|
@ -0,0 +1,42 @@
|
||||
/* * This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef dom_events_mouse_wheel_event_h_
|
||||
#define dom_events_mouse_wheel_event_h_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/string.h>
|
||||
#include <dom/events/event_target.h>
|
||||
|
||||
struct dom_abstract_view;
|
||||
|
||||
typedef struct dom_mouse_wheel_event dom_mouse_wheel_event;
|
||||
|
||||
dom_exception _dom_mouse_wheel_event_get_wheel_delta(
|
||||
dom_mouse_wheel_event *evt, int32_t *d);
|
||||
#define dom_mouse_wheel_event_get_wheel_delta(e, d) \
|
||||
_dom_mouse_wheel_event_get_wheel_delta( \
|
||||
(dom_mouse_wheel_event *) (e), (int32_t *) (d))
|
||||
|
||||
dom_exception _dom_mouse_wheel_event_init_ns(
|
||||
dom_mouse_wheel_event *evt, dom_string *namespace,
|
||||
dom_string *type, bool bubble, bool cancelable,
|
||||
struct dom_abstract_view *view, int32_t detail, int32_t screen_x,
|
||||
int32_t screen_y, int32_t client_x, int32_t client_y,
|
||||
unsigned short button, dom_event_target *et,
|
||||
dom_string *modifier_list, int32_t wheel_delta);
|
||||
#define dom_mouse_wheel_event_init_ns(e, n, t, b, c, v, \
|
||||
d, sx, sy, cx, cy, button, et, ml, dt) \
|
||||
_dom_mouse_wheel_event_init_ns((dom_mouse_wheel_event *) (e), \
|
||||
(dom_string *) (n), (dom_string *) (t), \
|
||||
(bool) (b), (bool) (c), (struct dom_abstract_view *) (v),\
|
||||
(int32_t) (d), (int32_t) (sx), (int32_t) (sy), (int32_t) (cx), (int32_t) (cy),\
|
||||
(unsigned short) (button), (dom_event_target *) (et),\
|
||||
(dom_string *) (ml), (int32_t) (dt))
|
||||
|
||||
#endif
|
||||
|
80
programs/network/netsurf/include/dom/events/mutation_event.h
Normal file
80
programs/network/netsurf/include/dom/events/mutation_event.h
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef dom_events_mutation_event_h_
|
||||
#define dom_events_mutation_event_h_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/string.h>
|
||||
|
||||
struct dom_node;
|
||||
|
||||
typedef enum {
|
||||
DOM_MUTATION_MODIFICATION = 1,
|
||||
DOM_MUTATION_ADDITION = 2,
|
||||
DOM_MUTATION_REMOVAL = 3
|
||||
} dom_mutation_type;
|
||||
|
||||
typedef struct dom_mutation_event dom_mutation_event;
|
||||
|
||||
dom_exception _dom_mutation_event_get_related_node(dom_mutation_event *evt,
|
||||
struct dom_node **node);
|
||||
#define dom_mutation_event_get_related_node(e, n) \
|
||||
_dom_mutation_event_get_related_node(\
|
||||
(dom_mutation_event *) (e), (struct dom_node **) (n))
|
||||
|
||||
dom_exception _dom_mutation_event_get_prev_value(dom_mutation_event *evt,
|
||||
dom_string **ret);
|
||||
#define dom_mutation_event_get_prev_value(e, r) \
|
||||
_dom_mutation_event_get_prev_value((dom_mutation_event *) (e), \
|
||||
(dom_string **) (r))
|
||||
|
||||
dom_exception _dom_mutation_event_get_new_value(dom_mutation_event *evt,
|
||||
dom_string **ret);
|
||||
#define dom_mutation_event_get_new_value(e, r) \
|
||||
_dom_mutation_event_get_new_value((dom_mutation_event *) (e), \
|
||||
(dom_string **) (r))
|
||||
|
||||
dom_exception _dom_mutation_event_get_attr_name(dom_mutation_event *evt,
|
||||
dom_string **ret);
|
||||
#define dom_mutation_event_get_attr_name(e, r) \
|
||||
_dom_mutation_event_get_attr_name((dom_mutation_event *) (e), \
|
||||
(dom_string **) (r))
|
||||
|
||||
dom_exception _dom_mutation_event_get_attr_change(dom_mutation_event *evt,
|
||||
dom_mutation_type *type);
|
||||
#define dom_mutation_event_get_attr_change(e, t) \
|
||||
_dom_mutation_event_get_attr_change((dom_mutation_event *) (e),\
|
||||
(dom_mutation_type *) (t))
|
||||
|
||||
dom_exception _dom_mutation_event_init(dom_mutation_event *evt,
|
||||
dom_string *type, bool bubble, bool cancelable,
|
||||
struct dom_node *node, dom_string *prev_value,
|
||||
dom_string *new_value, dom_string *attr_name,
|
||||
dom_mutation_type change);
|
||||
#define dom_mutation_event_init(e, t, b, c, n, p, nv, a, ch) \
|
||||
_dom_mutation_event_init((dom_mutation_event *) (e), \
|
||||
(dom_string *) (t), (bool) (b), (bool) (c), \
|
||||
(struct dom_node *) (n), (dom_string *) (p), \
|
||||
(dom_string *) (nv), (dom_string *) (a), \
|
||||
(dom_mutation_type) (ch))
|
||||
|
||||
dom_exception _dom_mutation_event_init_ns(dom_mutation_event *evt,
|
||||
dom_string *namespace, dom_string *type,
|
||||
bool bubble, bool cancelable, struct dom_node *node,
|
||||
dom_string *prev_value, dom_string *new_value,
|
||||
dom_string *attr_name, dom_mutation_type change);
|
||||
#define dom_mutation_event_init_ns(e, n, t, b, c, nd, p, nv, a, ch) \
|
||||
_dom_mutation_event_init_ns((dom_mutation_event *) (e), \
|
||||
(dom_string *) (n), (dom_string *) (t),\
|
||||
(bool) (b), (bool) (c), (struct dom_node *) (nd), \
|
||||
(dom_string *) (p), (dom_string *) (nv),\
|
||||
(dom_string *) (a), (dom_mutation_type) (ch))
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef dom_events_mutation_name_event_h_
|
||||
#define dom_events_mutation_name_event_h_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/string.h>
|
||||
|
||||
struct dom_node;
|
||||
|
||||
typedef struct dom_mutation_name_event dom_mutation_name_event;
|
||||
|
||||
dom_exception _dom_mutation_name_event_get_prev_namespace(
|
||||
dom_mutation_name_event *evt, dom_string **namespace);
|
||||
#define dom_mutation_name_event_get_prev_namespace(e, n) \
|
||||
_dom_mutation_name_event_get_prev_namespace(\
|
||||
(dom_mutation_name_event *) (e), (dom_string **) (n))
|
||||
|
||||
dom_exception _dom_mutation_name_event_get_prev_node_name(
|
||||
dom_mutation_name_event *evt, dom_string **name);
|
||||
#define dom_mutation_name_event_get_prev_node_name(e, n) \
|
||||
_dom_mutation_name_event_get_prev_node_name(\
|
||||
(dom_mutation_name_event *) (e), (dom_string **) (n))
|
||||
|
||||
dom_exception _dom_mutation_name_event_init(dom_mutation_name_event *evt,
|
||||
dom_string *type, bool bubble, bool cancelable,
|
||||
struct dom_node *node, dom_string *prev_ns,
|
||||
dom_string *prev_name);
|
||||
#define dom_mutation_name_event_init(e, t, b, c, n, p, pn) \
|
||||
_dom_mutation_name_event_init((dom_mutation_name_event *) (e), \
|
||||
(dom_string *) (t), (bool) (b), (bool) (c), \
|
||||
(struct dom_node *) (n), (dom_string *) (p), \
|
||||
(dom_string *) (pn))
|
||||
|
||||
dom_exception _dom_mutation_name_event_init_ns(dom_mutation_name_event *evt,
|
||||
dom_string *namespace, dom_string *type,
|
||||
bool bubble, bool cancelable, struct dom_node *node,
|
||||
dom_string *prev_ns, dom_string *prev_name);
|
||||
#define dom_mutation_name_event_init_ns(e, n, t, b, c, nv, p, pn) \
|
||||
_dom_mutation_name_event_init_ns(\
|
||||
(dom_mutation_name_event *) (e), (dom_string *) (n),\
|
||||
(dom_string *) (t), (bool) (b), (bool) (c),\
|
||||
(struct dom_node *) (nv), (dom_string *) (p), \
|
||||
(dom_string *) (pn))
|
||||
|
||||
#endif
|
||||
|
||||
|
41
programs/network/netsurf/include/dom/events/text_event.h
Normal file
41
programs/network/netsurf/include/dom/events/text_event.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef dom_events_text_event_h_
|
||||
#define dom_events_text_event_h_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/string.h>
|
||||
|
||||
struct dom_abstract_view;
|
||||
|
||||
typedef struct dom_text_event dom_text_event;
|
||||
|
||||
dom_exception _dom_text_event_get_data(dom_text_event *evt,
|
||||
dom_string **data);
|
||||
#define dom_text_event_get_data(e, d) _dom_text_event_get_data(\
|
||||
(dom_text_event *) (e), (dom_string **) (d))
|
||||
|
||||
dom_exception _dom_text_event_init(dom_text_event *evt,
|
||||
dom_string *type, bool bubble, bool cancelable,
|
||||
struct dom_abstract_view *view, dom_string *data);
|
||||
#define dom_text_event_init(e, t, b, c, v, d) _dom_text_event_init( \
|
||||
(dom_text_event *) (e), (dom_string *) (t), (bool) (b), \
|
||||
(bool) (c), (struct dom_abstract_view *) (v),\
|
||||
(dom_string *) (d))
|
||||
|
||||
dom_exception _dom_text_event_init_ns(dom_text_event *evt,
|
||||
dom_string *namespace_name, dom_string *type,
|
||||
bool bubble, bool cancelable, struct dom_abstract_view *view,
|
||||
dom_string *data);
|
||||
#define dom_text_event_init_ns(e, n, t, b, c, v, d) _dom_text_event_init_ns( \
|
||||
(dom_text_event *) (e), (dom_string *) (n), \
|
||||
(dom_string *) (t), (bool) (b), (bool) (c), \
|
||||
(struct dom_abstract_view *) (v), (dom_string *) (d))
|
||||
|
||||
#endif
|
45
programs/network/netsurf/include/dom/events/ui_event.h
Normal file
45
programs/network/netsurf/include/dom/events/ui_event.h
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef dom_events_ui_event_h_
|
||||
#define dom_events_ui_event_h_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/string.h>
|
||||
|
||||
struct dom_abstract_view;
|
||||
|
||||
typedef struct dom_ui_event dom_ui_event;
|
||||
|
||||
dom_exception _dom_ui_event_get_view(dom_ui_event *evt,
|
||||
struct dom_abstract_view **view);
|
||||
#define dom_ui_event_get_view(e, v) _dom_ui_event_get_view( \
|
||||
(dom_ui_event *) (e), (struct dom_abstract_view **) (v))
|
||||
|
||||
dom_exception _dom_ui_event_get_detail(dom_ui_event *evt,
|
||||
int32_t *detail);
|
||||
#define dom_ui_event_get_detail(e, d) _dom_ui_event_get_detail(\
|
||||
(dom_ui_event *) (e), (int32_t *) (d))
|
||||
|
||||
dom_exception _dom_ui_event_init(dom_ui_event *evt, dom_string *type,
|
||||
bool bubble, bool cancelable, struct dom_abstract_view *view,
|
||||
int32_t detail);
|
||||
#define dom_ui_event_init(e, t, b, c, v, d) _dom_ui_event_init( \
|
||||
(dom_ui_event *) (e), (dom_string *) (t), (bool) (b), \
|
||||
(bool) (c), (struct dom_abstract_view *) (v), (int32_t) (d))
|
||||
|
||||
dom_exception _dom_ui_event_init_ns(dom_ui_event *evt,
|
||||
dom_string *namespace, dom_string *type,
|
||||
bool bubble, bool cancelable, struct dom_abstract_view *view,
|
||||
int32_t detail);
|
||||
#define dom_ui_event_init_ns(e, n, t, b, c, v, d) _dom_ui_event_init_ns( \
|
||||
(dom_ui_event *) (e), (dom_string *) (n), \
|
||||
(dom_string *) (t), (bool) (b), (bool) (c), \
|
||||
(struct dom_abstract_view *) (v), (int32_t) (d))
|
||||
|
||||
#endif
|
33
programs/network/netsurf/include/dom/functypes.h
Normal file
33
programs/network/netsurf/include/dom/functypes.h
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef dom_functypes_h_
|
||||
#define dom_functypes_h_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
/**
|
||||
* Severity levels for dom_msg function, based on syslog(3)
|
||||
*/
|
||||
enum {
|
||||
DOM_MSG_DEBUG,
|
||||
DOM_MSG_INFO,
|
||||
DOM_MSG_NOTICE,
|
||||
DOM_MSG_WARNING,
|
||||
DOM_MSG_ERROR,
|
||||
DOM_MSG_CRITICAL,
|
||||
DOM_MSG_ALERT,
|
||||
DOM_MSG_EMERGENCY
|
||||
};
|
||||
|
||||
/**
|
||||
* Type of DOM message function
|
||||
*/
|
||||
typedef void (*dom_msg)(uint32_t severity, void *ctx, const char *msg, ...);
|
||||
|
||||
#endif
|
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2012 Daniel Silverstone <dsilvers@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef dom_html_body_element_h_
|
||||
#define dom_html_body_element_h_
|
||||
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/string.h>
|
||||
|
||||
typedef struct dom_html_body_element dom_html_body_element;
|
||||
|
||||
dom_exception dom_html_body_element_get_a_link(dom_html_body_element *ele,
|
||||
dom_string **a_link);
|
||||
|
||||
dom_exception dom_html_body_element_set_a_link(dom_html_body_element *ele,
|
||||
dom_string *a_link);
|
||||
|
||||
dom_exception dom_html_body_element_get_v_link(dom_html_body_element *ele,
|
||||
dom_string **v_link);
|
||||
|
||||
dom_exception dom_html_body_element_set_v_link(dom_html_body_element *ele,
|
||||
dom_string *v_link);
|
||||
|
||||
dom_exception dom_html_body_element_get_background(dom_html_body_element *ele,
|
||||
dom_string **background);
|
||||
|
||||
dom_exception dom_html_body_element_set_background(dom_html_body_element *ele,
|
||||
dom_string *background);
|
||||
|
||||
dom_exception dom_html_body_element_get_bg_color(dom_html_body_element *ele,
|
||||
dom_string **bg_color);
|
||||
|
||||
dom_exception dom_html_body_element_set_bg_color(dom_html_body_element *ele,
|
||||
dom_string *bg_color);
|
||||
|
||||
dom_exception dom_html_body_element_get_link(dom_html_body_element *ele,
|
||||
dom_string **link);
|
||||
|
||||
dom_exception dom_html_body_element_set_link(dom_html_body_element *ele,
|
||||
dom_string *link);
|
||||
|
||||
dom_exception dom_html_body_element_get_text(dom_html_body_element *ele,
|
||||
dom_string **text);
|
||||
|
||||
dom_exception dom_html_body_element_set_text(dom_html_body_element *ele,
|
||||
dom_string *text);
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2012 Daniel Silverstone <dsilvers@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef dom_html_button_element_h_
|
||||
#define dom_html_button_element_h_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/string.h>
|
||||
#include <dom/html/html_form_element.h>
|
||||
|
||||
typedef struct dom_html_button_element dom_html_button_element;
|
||||
|
||||
dom_exception dom_html_button_element_get_form(
|
||||
dom_html_button_element *button, dom_html_form_element **form);
|
||||
|
||||
dom_exception dom_html_button_element_get_access_key(
|
||||
dom_html_button_element *button, dom_string **access_key);
|
||||
|
||||
dom_exception dom_html_button_element_set_access_key(
|
||||
dom_html_button_element *button, dom_string *access_key);
|
||||
|
||||
dom_exception dom_html_button_element_get_disabled(
|
||||
dom_html_button_element *button, bool *disabled);
|
||||
|
||||
dom_exception dom_html_button_element_set_disabled(
|
||||
dom_html_button_element *button, bool disabled);
|
||||
|
||||
dom_exception dom_html_button_element_get_name(
|
||||
dom_html_button_element *button, dom_string **name);
|
||||
|
||||
dom_exception dom_html_button_element_set_name(
|
||||
dom_html_button_element *button, dom_string *name);
|
||||
|
||||
dom_exception dom_html_button_element_get_tab_index(
|
||||
dom_html_button_element *button, int32_t *tab_index);
|
||||
|
||||
dom_exception dom_html_button_element_set_tab_index(
|
||||
dom_html_button_element *button, uint32_t tab_index);
|
||||
|
||||
dom_exception dom_html_button_element_get_type(
|
||||
dom_html_button_element *button, dom_string **type);
|
||||
|
||||
dom_exception dom_html_button_element_get_value(
|
||||
dom_html_button_element *button, dom_string **value);
|
||||
|
||||
dom_exception dom_html_button_element_set_value(
|
||||
dom_html_button_element *button, dom_string *value);
|
||||
|
||||
#endif
|
29
programs/network/netsurf/include/dom/html/html_collection.h
Normal file
29
programs/network/netsurf/include/dom/html/html_collection.h
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef dom_html_collection_h_
|
||||
#define dom_html_collection_h_
|
||||
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/string.h>
|
||||
|
||||
struct dom_node;
|
||||
|
||||
typedef struct dom_html_collection dom_html_collection;
|
||||
|
||||
dom_exception dom_html_collection_get_length(dom_html_collection *col,
|
||||
uint32_t *len);
|
||||
dom_exception dom_html_collection_item(dom_html_collection *col,
|
||||
uint32_t index, struct dom_node **node);
|
||||
dom_exception dom_html_collection_named_item(dom_html_collection *col,
|
||||
dom_string *name, struct dom_node **node);
|
||||
|
||||
void dom_html_collection_ref(dom_html_collection *col);
|
||||
void dom_html_collection_unref(dom_html_collection *col);
|
||||
|
||||
#endif
|
||||
|
245
programs/network/netsurf/include/dom/html/html_document.h
Normal file
245
programs/network/netsurf/include/dom/html/html_document.h
Normal file
@ -0,0 +1,245 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef dom_html_document_h_
|
||||
#define dom_html_document_h_
|
||||
|
||||
#include <dom/core/document.h>
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/functypes.h>
|
||||
#include <dom/events/document_event.h>
|
||||
|
||||
struct dom_element;
|
||||
struct dom_html_collection;
|
||||
struct dom_html_element;
|
||||
struct dom_nodelist;
|
||||
|
||||
typedef struct dom_html_document dom_html_document;
|
||||
|
||||
typedef struct dom_html_document_vtable {
|
||||
struct dom_document_vtable base;
|
||||
|
||||
dom_exception (*get_title)(dom_html_document *doc,
|
||||
dom_string **title);
|
||||
dom_exception (*set_title)(dom_html_document *doc,
|
||||
dom_string *title);
|
||||
dom_exception (*get_referrer)(dom_html_document *doc,
|
||||
dom_string **referrer);
|
||||
dom_exception (*get_domain)(dom_html_document *doc,
|
||||
dom_string **domain);
|
||||
dom_exception (*get_url)(dom_html_document *doc,
|
||||
dom_string **url);
|
||||
dom_exception (*get_body)(dom_html_document *doc,
|
||||
struct dom_html_element **body);
|
||||
dom_exception (*set_body)(dom_html_document *doc,
|
||||
struct dom_html_element *body);
|
||||
dom_exception (*get_images)(dom_html_document *doc,
|
||||
struct dom_html_collection **col);
|
||||
dom_exception (*get_applets)(dom_html_document *doc,
|
||||
struct dom_html_collection **col);
|
||||
dom_exception (*get_links)(dom_html_document *doc,
|
||||
struct dom_html_collection **col);
|
||||
dom_exception (*get_forms)(dom_html_document *doc,
|
||||
struct dom_html_collection **col);
|
||||
dom_exception (*get_anchors)(dom_html_document *doc,
|
||||
struct dom_html_collection **col);
|
||||
dom_exception (*get_cookie)(dom_html_document *doc,
|
||||
dom_string **cookie);
|
||||
dom_exception (*set_cookie)(dom_html_document *doc,
|
||||
dom_string *cookie);
|
||||
|
||||
dom_exception (*open)(dom_html_document *doc);
|
||||
dom_exception (*close)(dom_html_document *doc);
|
||||
dom_exception (*write)(dom_html_document *doc,
|
||||
dom_string *text);
|
||||
dom_exception (*writeln)(dom_html_document *doc,
|
||||
dom_string *text);
|
||||
dom_exception (*get_elements_by_name)(dom_html_document *doc,
|
||||
dom_string *name, struct dom_nodelist **list);
|
||||
} dom_html_document_vtable;
|
||||
|
||||
static inline dom_exception dom_html_document_get_title(
|
||||
dom_html_document *doc, dom_string **title)
|
||||
{
|
||||
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
get_title(doc, title);
|
||||
}
|
||||
#define dom_html_document_get_title(d, t) \
|
||||
dom_html_document_get_title((dom_html_document *) (d), (t))
|
||||
|
||||
static inline dom_exception dom_html_document_set_title(dom_html_document *doc,
|
||||
dom_string *title)
|
||||
{
|
||||
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
set_title(doc, title);
|
||||
}
|
||||
#define dom_html_document_set_title(d, t) \
|
||||
dom_html_document_set_title((dom_html_document *) (d), (t))
|
||||
|
||||
static inline dom_exception dom_html_document_get_referrer(dom_html_document *doc,
|
||||
dom_string **referrer)
|
||||
{
|
||||
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
get_referrer(doc, referrer);
|
||||
}
|
||||
#define dom_html_document_get_referrer(d, r) \
|
||||
dom_html_document_get_referrer((dom_html_document *) (d), (r))
|
||||
|
||||
static inline dom_exception dom_html_document_get_domain(dom_html_document *doc,
|
||||
dom_string **domain)
|
||||
{
|
||||
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
get_domain(doc, domain);
|
||||
}
|
||||
#define dom_html_document_get_domain(d, t) \
|
||||
dom_html_document_get_domain((dom_html_document *) (d), (t))
|
||||
|
||||
static inline dom_exception dom_html_document_get_url(dom_html_document *doc,
|
||||
dom_string **url)
|
||||
{
|
||||
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
get_url(doc, url);
|
||||
}
|
||||
#define dom_html_document_get_url(d, u) \
|
||||
dom_html_document_get_url((dom_html_document *) (d), (u))
|
||||
|
||||
static inline dom_exception dom_html_document_get_body(dom_html_document *doc,
|
||||
struct dom_html_element **body)
|
||||
{
|
||||
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
get_body(doc, body);
|
||||
}
|
||||
#define dom_html_document_get_body(d, b) \
|
||||
dom_html_document_get_title((dom_html_document *) (d), \
|
||||
(struct dom_html_element **) (b))
|
||||
|
||||
static inline dom_exception dom_html_document_set_body(dom_html_document *doc,
|
||||
struct dom_html_element *body)
|
||||
{
|
||||
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
set_body(doc, body);
|
||||
}
|
||||
#define dom_html_document_set_body(d, b) \
|
||||
dom_html_document_set_body((dom_html_document *) (d), \
|
||||
(struct dom_html_element **) (b))
|
||||
|
||||
static inline dom_exception dom_html_document_get_images(dom_html_document *doc,
|
||||
struct dom_html_collection **col)
|
||||
{
|
||||
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
get_images(doc, col);
|
||||
}
|
||||
#define dom_html_document_get_images(d, c) \
|
||||
dom_html_document_get_images((dom_html_document *) (d), \
|
||||
(struct dom_html_collection **) (c))
|
||||
|
||||
static inline dom_exception dom_html_document_get_applets(dom_html_document *doc,
|
||||
struct dom_html_collection **col)
|
||||
{
|
||||
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
get_applets(doc, col);
|
||||
}
|
||||
#define dom_html_document_get_applets(d, c) \
|
||||
dom_html_document_get_applets((dom_html_document *) (d), \
|
||||
(struct dom_html_collection **) (c))
|
||||
|
||||
static inline dom_exception dom_html_document_get_links(dom_html_document *doc,
|
||||
struct dom_html_collection **col)
|
||||
{
|
||||
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
get_links(doc, col);
|
||||
}
|
||||
#define dom_html_document_get_links(d, c) \
|
||||
dom_html_document_get_links((dom_html_document *) (d), \
|
||||
(struct dom_html_collection **) (c))
|
||||
|
||||
static inline dom_exception dom_html_document_get_forms(dom_html_document *doc,
|
||||
struct dom_html_collection **col)
|
||||
{
|
||||
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
get_forms(doc, col);
|
||||
}
|
||||
#define dom_html_document_get_forms(d, c) \
|
||||
dom_html_document_get_forms((dom_html_document *) (d), \
|
||||
(struct dom_html_collection **) (c))
|
||||
|
||||
static inline dom_exception dom_html_document_get_anchors(dom_html_document *doc,
|
||||
struct dom_html_collection **col)
|
||||
{
|
||||
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
get_anchors(doc, col);
|
||||
}
|
||||
#define dom_html_document_get_anchors(d, c) \
|
||||
dom_html_document_get_title((dom_html_document *) (d), \
|
||||
(struct dom_html_collection **) (c))
|
||||
|
||||
static inline dom_exception dom_html_document_get_cookie(dom_html_document *doc,
|
||||
dom_string **cookie)
|
||||
{
|
||||
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
get_cookie(doc, cookie);
|
||||
}
|
||||
#define dom_html_document_get_cookie(d, c) \
|
||||
dom_html_document_get_title((dom_html_document *) (d), (c))
|
||||
|
||||
static inline dom_exception dom_html_document_set_cookie(dom_html_document *doc,
|
||||
dom_string *cookie)
|
||||
{
|
||||
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
set_cookie(doc, cookie);
|
||||
}
|
||||
#define dom_html_document_set_cookie(d, c) \
|
||||
dom_html_document_set_cookie((dom_html_document *) (d), (c))
|
||||
|
||||
|
||||
static inline dom_exception dom_html_document_open(dom_html_document *doc)
|
||||
{
|
||||
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
open(doc);
|
||||
}
|
||||
#define dom_html_document_open(d) \
|
||||
dom_html_document_open((dom_html_document *) (d))
|
||||
|
||||
static inline dom_exception dom_html_document_close(dom_html_document *doc)
|
||||
{
|
||||
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
close(doc);
|
||||
}
|
||||
#define dom_html_document_close(d) \
|
||||
dom_html_document_close((dom_html_document *) (d))
|
||||
|
||||
|
||||
static inline dom_exception dom_html_document_write(dom_html_document *doc,
|
||||
dom_string *text)
|
||||
{
|
||||
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
write(doc, text);
|
||||
}
|
||||
#define dom_html_document_write(d, t) \
|
||||
dom_html_document_write((dom_html_document *) (d), (t))
|
||||
|
||||
static inline dom_exception dom_html_document_writeln(dom_html_document *doc,
|
||||
dom_string *text)
|
||||
{
|
||||
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
writeln(doc, text);
|
||||
}
|
||||
#define dom_html_document_writeln(d, t) \
|
||||
dom_html_document_writeln((dom_html_document *) (d), (t))
|
||||
|
||||
static inline dom_exception dom_html_document_get_elements_by_name(dom_html_document *doc,
|
||||
dom_string *name, struct dom_nodelist **list)
|
||||
{
|
||||
return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)->
|
||||
get_elements_by_name(doc, name, list);
|
||||
}
|
||||
#define dom_html_document_get_elements_by_name(d, n, l) \
|
||||
dom_html_document_get_element_by_name((dom_html_document *) (d), \
|
||||
(n), (struct dom_nodelist **) (l))
|
||||
|
||||
#endif
|
||||
|
131
programs/network/netsurf/include/dom/html/html_element.h
Normal file
131
programs/network/netsurf/include/dom/html/html_element.h
Normal file
@ -0,0 +1,131 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef dom_html_element_h_
|
||||
#define dom_html_element_h_
|
||||
|
||||
#include <dom/core/element.h>
|
||||
|
||||
typedef struct dom_html_element dom_html_element;
|
||||
|
||||
typedef struct dom_html_element_vtable {
|
||||
struct dom_element_vtable base;
|
||||
|
||||
dom_exception (*dom_html_element_get_id)(struct dom_html_element *element,
|
||||
dom_string **id);
|
||||
dom_exception (*dom_html_element_set_id)(struct dom_html_element *element,
|
||||
dom_string *id);
|
||||
dom_exception (*dom_html_element_get_title)(struct dom_html_element *element,
|
||||
dom_string **title);
|
||||
dom_exception (*dom_html_element_set_title)(struct dom_html_element *element,
|
||||
dom_string *title);
|
||||
dom_exception (*dom_html_element_get_lang)(struct dom_html_element *element,
|
||||
dom_string **lang);
|
||||
dom_exception (*dom_html_element_set_lang)(struct dom_html_element *element,
|
||||
dom_string *lang);
|
||||
dom_exception (*dom_html_element_get_dir)(struct dom_html_element *element,
|
||||
dom_string **dir);
|
||||
dom_exception (*dom_html_element_set_dir)(struct dom_html_element *element,
|
||||
dom_string *dir);
|
||||
dom_exception (*dom_html_element_get_class_name)(struct dom_html_element *element,
|
||||
dom_string **class_name);
|
||||
dom_exception (*dom_html_element_set_class_name)(struct dom_html_element *element,
|
||||
dom_string *class_name);
|
||||
} dom_html_element_vtable;
|
||||
|
||||
static inline dom_exception dom_html_element_get_id(struct dom_html_element *element,
|
||||
dom_string **id)
|
||||
{
|
||||
return ((dom_html_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_html_element_get_id(element, id);
|
||||
}
|
||||
#define dom_html_element_get_id(e, id) dom_html_element_get_id( \
|
||||
(dom_html_element *) (e), (id))
|
||||
|
||||
static inline dom_exception dom_html_element_set_id(struct dom_html_element *element,
|
||||
dom_string *id)
|
||||
{
|
||||
return ((dom_html_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_html_element_set_id(element, id);
|
||||
}
|
||||
#define dom_html_element_set_id(e, id) dom_html_element_set_id( \
|
||||
(dom_html_element *) (e), (id))
|
||||
|
||||
static inline dom_exception dom_html_element_get_title(struct dom_html_element *element,
|
||||
dom_string **title)
|
||||
{
|
||||
return ((dom_html_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_html_element_get_title(element, title);
|
||||
}
|
||||
#define dom_html_element_get_title(e, title) dom_html_element_get_title( \
|
||||
(dom_html_element *) (e), (title))
|
||||
|
||||
static inline dom_exception dom_html_element_set_title(struct dom_html_element *element,
|
||||
dom_string *title)
|
||||
{
|
||||
return ((dom_html_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_html_element_set_title(element, title);
|
||||
}
|
||||
#define dom_html_element_set_title(e, title) dom_html_element_set_title( \
|
||||
(dom_html_element *) (e), (title))
|
||||
|
||||
static inline dom_exception dom_html_element_get_lang(struct dom_html_element *element,
|
||||
dom_string **lang)
|
||||
{
|
||||
return ((dom_html_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_html_element_get_lang(element, lang);
|
||||
}
|
||||
#define dom_html_element_get_lang(e, lang) dom_html_element_get_lang( \
|
||||
(dom_html_element *) (e), (lang))
|
||||
|
||||
static inline dom_exception dom_html_element_set_lang(struct dom_html_element *element,
|
||||
dom_string *lang)
|
||||
{
|
||||
return ((dom_html_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_html_element_set_lang(element, lang);
|
||||
}
|
||||
#define dom_html_element_set_lang(e, lang) dom_html_element_set_lang( \
|
||||
(dom_html_element *) (e), (lang))
|
||||
|
||||
static inline dom_exception dom_html_element_get_dir(struct dom_html_element *element,
|
||||
dom_string **dir)
|
||||
{
|
||||
return ((dom_html_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_html_element_get_dir(element, dir);
|
||||
}
|
||||
#define dom_html_element_get_dir(e, dir) dom_html_element_get_dir( \
|
||||
(dom_html_element *) (e), (dir))
|
||||
|
||||
static inline dom_exception dom_html_element_set_dir(struct dom_html_element *element,
|
||||
dom_string *dir)
|
||||
{
|
||||
return ((dom_html_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_html_element_set_dir(element, dir);
|
||||
}
|
||||
#define dom_html_element_set_dir(e, dir) dom_html_element_set_dir( \
|
||||
(dom_html_element *) (e), (dir))
|
||||
|
||||
static inline dom_exception dom_html_element_get_class_name(struct dom_html_element *element,
|
||||
dom_string **class_name)
|
||||
{
|
||||
return ((dom_html_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_html_element_get_class_name(element, class_name);
|
||||
}
|
||||
#define dom_html_element_get_class_name(e, class_name) dom_html_element_get_class_name( \
|
||||
(dom_html_element *) (e), (class_name))
|
||||
|
||||
static inline dom_exception dom_html_element_set_class_name(struct dom_html_element *element,
|
||||
dom_string *class_name)
|
||||
{
|
||||
return ((dom_html_element_vtable *) ((dom_node *) element)->vtable)->
|
||||
dom_html_element_set_class_name(element, class_name);
|
||||
}
|
||||
#define dom_html_element_set_class_name(e, class_name) dom_html_element_set_class_name( \
|
||||
(dom_html_element *) (e), (class_name))
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 Bo Yang <struggleyb.nku.com>
|
||||
*/
|
||||
|
||||
#ifndef dom_html_form_element_h_
|
||||
#define dom_html_form_element_h_
|
||||
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/string.h>
|
||||
|
||||
struct dom_html_collection;
|
||||
|
||||
typedef struct dom_html_form_element dom_html_form_element;
|
||||
|
||||
dom_exception dom_html_form_element_get_elements(dom_html_form_element *ele,
|
||||
struct dom_html_collection **col);
|
||||
dom_exception dom_html_form_element_get_length(dom_html_form_element *ele,
|
||||
uint32_t *len);
|
||||
|
||||
dom_exception dom_html_form_element_get_accept_charset(
|
||||
dom_html_form_element *ele, dom_string **accept_charset);
|
||||
|
||||
dom_exception dom_html_form_element_set_accept_charset(
|
||||
dom_html_form_element *ele, dom_string *accept_charset);
|
||||
|
||||
dom_exception dom_html_form_element_get_action(
|
||||
dom_html_form_element *ele, dom_string **action);
|
||||
|
||||
dom_exception dom_html_form_element_set_action(
|
||||
dom_html_form_element *ele, dom_string *action);
|
||||
|
||||
dom_exception dom_html_form_element_get_enctype(
|
||||
dom_html_form_element *ele, dom_string **enctype);
|
||||
|
||||
dom_exception dom_html_form_element_set_enctype(
|
||||
dom_html_form_element *ele, dom_string *enctype);
|
||||
|
||||
dom_exception dom_html_form_element_get_method(
|
||||
dom_html_form_element *ele, dom_string **method);
|
||||
|
||||
dom_exception dom_html_form_element_set_method(
|
||||
dom_html_form_element *ele, dom_string *method);
|
||||
|
||||
dom_exception dom_html_form_element_get_target(
|
||||
dom_html_form_element *ele, dom_string **target);
|
||||
|
||||
dom_exception dom_html_form_element_set_target(
|
||||
dom_html_form_element *ele, dom_string *target);
|
||||
|
||||
dom_exception dom_html_form_element_submit(dom_html_form_element *ele);
|
||||
dom_exception dom_html_form_element_reset(dom_html_form_element *ele);
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 Bo Yang <struggleyb.nku.com>
|
||||
*/
|
||||
|
||||
#ifndef dom_html_head_element_h_
|
||||
#define dom_html_head_element_h_
|
||||
|
||||
#include <dom/html/html_element.h>
|
||||
|
||||
typedef struct dom_html_head_element dom_html_head_element;
|
||||
|
||||
dom_exception dom_html_head_element_get_profile(
|
||||
struct dom_html_head_element *element, dom_string **profile);
|
||||
dom_exception dom_html_head_element_set_profile(
|
||||
struct dom_html_head_element *element, dom_string *profile);
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 Bo Yang <struggleyb.nku.com>
|
||||
*/
|
||||
|
||||
#ifndef dom_html_html_element_h_
|
||||
#define dom_html_html_element_h_
|
||||
|
||||
#include <dom/html/html_element.h>
|
||||
|
||||
typedef struct dom_html_html_element dom_html_html_element;
|
||||
|
||||
dom_exception dom_html_html_element_get_version(
|
||||
struct dom_html_html_element *element, dom_string **version);
|
||||
dom_exception dom_html_html_element_set_version(
|
||||
struct dom_html_html_element *element, dom_string *version);
|
||||
|
||||
|
||||
#endif
|
||||
|
125
programs/network/netsurf/include/dom/html/html_input_element.h
Normal file
125
programs/network/netsurf/include/dom/html/html_input_element.h
Normal file
@ -0,0 +1,125 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2012 Daniel Silverstone <dsilvers@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef dom_html_input_element_h_
|
||||
#define dom_html_input_element_h_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/string.h>
|
||||
#include <dom/html/html_form_element.h>
|
||||
|
||||
typedef struct dom_html_input_element dom_html_input_element;
|
||||
|
||||
dom_exception dom_html_input_element_get_default_value(
|
||||
dom_html_input_element *input, dom_string **default_value);
|
||||
|
||||
dom_exception dom_html_input_element_set_default_value(
|
||||
dom_html_input_element *input, dom_string *default_value);
|
||||
|
||||
dom_exception dom_html_input_element_get_default_checked(
|
||||
dom_html_input_element *input, bool *default_checked);
|
||||
|
||||
dom_exception dom_html_input_element_set_default_checked(
|
||||
dom_html_input_element *input, bool default_checked);
|
||||
|
||||
dom_exception dom_html_input_element_get_form(
|
||||
dom_html_input_element *input, dom_html_form_element **form);
|
||||
|
||||
dom_exception dom_html_input_element_get_accept(
|
||||
dom_html_input_element *input, dom_string **accept);
|
||||
|
||||
dom_exception dom_html_input_element_set_accept(
|
||||
dom_html_input_element *input, dom_string *accept);
|
||||
|
||||
dom_exception dom_html_input_element_get_access_key(
|
||||
dom_html_input_element *input, dom_string **access_key);
|
||||
|
||||
dom_exception dom_html_input_element_set_access_key(
|
||||
dom_html_input_element *input, dom_string *access_key);
|
||||
|
||||
dom_exception dom_html_input_element_get_align(
|
||||
dom_html_input_element *input, dom_string **align);
|
||||
|
||||
dom_exception dom_html_input_element_set_align(
|
||||
dom_html_input_element *input, dom_string *align);
|
||||
|
||||
dom_exception dom_html_input_element_get_alt(
|
||||
dom_html_input_element *input, dom_string **alt);
|
||||
|
||||
dom_exception dom_html_input_element_set_alt(
|
||||
dom_html_input_element *input, dom_string *alt);
|
||||
|
||||
dom_exception dom_html_input_element_get_checked(
|
||||
dom_html_input_element *input, bool *checked);
|
||||
|
||||
dom_exception dom_html_input_element_set_checked(
|
||||
dom_html_input_element *input, bool checked);
|
||||
|
||||
dom_exception dom_html_input_element_get_disabled(
|
||||
dom_html_input_element *input, bool *disabled);
|
||||
|
||||
dom_exception dom_html_input_element_set_disabled(
|
||||
dom_html_input_element *input, bool disabled);
|
||||
|
||||
dom_exception dom_html_input_element_get_max_length(
|
||||
dom_html_input_element *input, int32_t *max_length);
|
||||
|
||||
dom_exception dom_html_input_element_set_max_length(
|
||||
dom_html_input_element *input, uint32_t max_length);
|
||||
|
||||
dom_exception dom_html_input_element_get_name(
|
||||
dom_html_input_element *input, dom_string **name);
|
||||
|
||||
dom_exception dom_html_input_element_set_name(
|
||||
dom_html_input_element *input, dom_string *name);
|
||||
|
||||
dom_exception dom_html_input_element_get_read_only(
|
||||
dom_html_input_element *input, bool *read_only);
|
||||
|
||||
dom_exception dom_html_input_element_set_read_only(
|
||||
dom_html_input_element *input, bool read_only);
|
||||
|
||||
dom_exception dom_html_input_element_get_size(
|
||||
dom_html_input_element *input, dom_string **size);
|
||||
|
||||
dom_exception dom_html_input_element_set_size(
|
||||
dom_html_input_element *input, dom_string *size);
|
||||
|
||||
dom_exception dom_html_input_element_get_src(
|
||||
dom_html_input_element *input, dom_string **src);
|
||||
|
||||
dom_exception dom_html_input_element_set_src(
|
||||
dom_html_input_element *input, dom_string *src);
|
||||
|
||||
dom_exception dom_html_input_element_get_tab_index(
|
||||
dom_html_input_element *input, int32_t *tab_index);
|
||||
|
||||
dom_exception dom_html_input_element_set_tab_index(
|
||||
dom_html_input_element *input, uint32_t tab_index);
|
||||
|
||||
dom_exception dom_html_input_element_get_type(
|
||||
dom_html_input_element *input, dom_string **type);
|
||||
|
||||
dom_exception dom_html_input_element_get_use_map(
|
||||
dom_html_input_element *input, dom_string **use_map);
|
||||
|
||||
dom_exception dom_html_input_element_set_use_map(
|
||||
dom_html_input_element *input, dom_string *use_map);
|
||||
|
||||
dom_exception dom_html_input_element_get_value(
|
||||
dom_html_input_element *input, dom_string **value);
|
||||
|
||||
dom_exception dom_html_input_element_set_value(
|
||||
dom_html_input_element *input, dom_string *value);
|
||||
|
||||
dom_exception dom_html_input_element_blur(dom_html_input_element *ele);
|
||||
dom_exception dom_html_input_element_focus(dom_html_input_element *ele);
|
||||
dom_exception dom_html_input_element_select(dom_html_input_element *ele);
|
||||
dom_exception dom_html_input_element_click(dom_html_input_element *ele);
|
||||
|
||||
#endif
|
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 Bo Yang <struggleyb.nku.com>
|
||||
*/
|
||||
|
||||
#ifndef dom_html_link_element_h_
|
||||
#define dom_html_link_element_h_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/string.h>
|
||||
|
||||
typedef struct dom_html_link_element dom_html_link_element;
|
||||
|
||||
dom_exception dom_html_link_element_get_disabled(dom_html_link_element *ele,
|
||||
bool *disabled);
|
||||
|
||||
dom_exception dom_html_link_element_set_disabled(dom_html_link_element *ele,
|
||||
bool disabled);
|
||||
|
||||
dom_exception dom_html_link_element_get_charset(dom_html_link_element *ele,
|
||||
dom_string **charset);
|
||||
|
||||
dom_exception dom_html_link_element_set_charset(dom_html_link_element *ele,
|
||||
dom_string *charset);
|
||||
|
||||
dom_exception dom_html_link_element_get_href(dom_html_link_element *ele,
|
||||
dom_string **href);
|
||||
|
||||
dom_exception dom_html_link_element_set_href(dom_html_link_element *ele,
|
||||
dom_string *href);
|
||||
|
||||
dom_exception dom_html_link_element_get_hreflang(dom_html_link_element *ele,
|
||||
dom_string **hreflang);
|
||||
|
||||
dom_exception dom_html_link_element_set_hreflang(dom_html_link_element *ele,
|
||||
dom_string *hreflang);
|
||||
|
||||
dom_exception dom_html_link_element_get_media(dom_html_link_element *ele,
|
||||
dom_string **media);
|
||||
|
||||
dom_exception dom_html_link_element_set_media(dom_html_link_element *ele,
|
||||
dom_string *media);
|
||||
|
||||
dom_exception dom_html_link_element_get_rel(dom_html_link_element *ele,
|
||||
dom_string **rel);
|
||||
|
||||
dom_exception dom_html_link_element_set_rel(dom_html_link_element *ele,
|
||||
dom_string *rel);
|
||||
|
||||
dom_exception dom_html_link_element_get_rev(dom_html_link_element *ele,
|
||||
dom_string **rev);
|
||||
|
||||
dom_exception dom_html_link_element_set_rev(dom_html_link_element *ele,
|
||||
dom_string *rev);
|
||||
|
||||
dom_exception dom_html_link_element_get_target(dom_html_link_element *ele,
|
||||
dom_string **target);
|
||||
|
||||
dom_exception dom_html_link_element_set_target(dom_html_link_element *ele,
|
||||
dom_string *target);
|
||||
|
||||
dom_exception dom_html_link_element_get_type(dom_html_link_element *ele,
|
||||
dom_string **type);
|
||||
|
||||
dom_exception dom_html_link_element_set_type(dom_html_link_element *ele,
|
||||
dom_string *type);
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 Bo Yang <struggleyb.nku.com>
|
||||
*/
|
||||
|
||||
#ifndef dom_html_meta_element_h_
|
||||
#define dom_html_meta_element_h_
|
||||
|
||||
#include <dom/core/string.h>
|
||||
|
||||
typedef struct dom_html_meta_element dom_html_meta_element;
|
||||
|
||||
dom_exception dom_html_meta_element_get_content(dom_html_meta_element *ele,
|
||||
dom_string **content);
|
||||
|
||||
dom_exception dom_html_meta_element_set_content(dom_html_meta_element *ele,
|
||||
dom_string *content);
|
||||
|
||||
dom_exception dom_html_meta_element_get_http_equiv(dom_html_meta_element *ele,
|
||||
dom_string **http_equiv);
|
||||
|
||||
dom_exception dom_html_meta_element_set_http_equiv(dom_html_meta_element *ele,
|
||||
dom_string *http_equiv);
|
||||
|
||||
dom_exception dom_html_meta_element_get_name(dom_html_meta_element *ele,
|
||||
dom_string **name);
|
||||
|
||||
dom_exception dom_html_meta_element_set_name(dom_html_meta_element *ele,
|
||||
dom_string *name);
|
||||
|
||||
dom_exception dom_html_meta_element_get_scheme(dom_html_meta_element *ele,
|
||||
dom_string **scheme);
|
||||
|
||||
dom_exception dom_html_meta_element_set_scheme(dom_html_meta_element *ele,
|
||||
dom_string *scheme);
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2012 Daniel Silverstone <dsilvers@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef dom_html_opt_group_element_h_
|
||||
#define dom_html_opt_group_element_h_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/string.h>
|
||||
#include <dom/html/html_form_element.h>
|
||||
|
||||
typedef struct dom_html_opt_group_element dom_html_opt_group_element;
|
||||
|
||||
dom_exception dom_html_opt_group_element_get_form(
|
||||
dom_html_opt_group_element *opt_group, dom_html_form_element **form);
|
||||
|
||||
dom_exception dom_html_opt_group_element_get_disabled(
|
||||
dom_html_opt_group_element *opt_group, bool *disabled);
|
||||
|
||||
dom_exception dom_html_opt_group_element_set_disabled(
|
||||
dom_html_opt_group_element *opt_group, bool disabled);
|
||||
|
||||
dom_exception dom_html_opt_group_element_get_label(
|
||||
dom_html_opt_group_element *opt_group, dom_string **label);
|
||||
|
||||
dom_exception dom_html_opt_group_element_set_label(
|
||||
dom_html_opt_group_element *opt_group, dom_string *label);
|
||||
|
||||
#endif
|
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2012 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef dom_html_option_element_h_
|
||||
#define dom_html_option_element_h_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/string.h>
|
||||
#include <dom/html/html_form_element.h>
|
||||
|
||||
typedef struct dom_html_option_element dom_html_option_element;
|
||||
|
||||
dom_exception dom_html_option_element_get_form(
|
||||
dom_html_option_element *option, dom_html_form_element **form);
|
||||
|
||||
dom_exception dom_html_option_element_get_default_selected(
|
||||
dom_html_option_element *option, bool *default_selected);
|
||||
|
||||
dom_exception dom_html_option_element_set_default_selected(
|
||||
dom_html_option_element *option, bool default_selected);
|
||||
|
||||
dom_exception dom_html_option_element_get_text(
|
||||
dom_html_option_element *option, dom_string **text);
|
||||
|
||||
dom_exception dom_html_option_element_get_index(
|
||||
dom_html_option_element *option, unsigned long *index);
|
||||
|
||||
dom_exception dom_html_option_element_get_disabled(
|
||||
dom_html_option_element *option, bool *disabled);
|
||||
|
||||
dom_exception dom_html_option_element_set_disabled(
|
||||
dom_html_option_element *option, bool disabled);
|
||||
|
||||
dom_exception dom_html_option_element_get_label(
|
||||
dom_html_option_element *option, dom_string **label);
|
||||
|
||||
dom_exception dom_html_option_element_set_label(
|
||||
dom_html_option_element *option, dom_string *label);
|
||||
|
||||
dom_exception dom_html_option_element_get_selected(
|
||||
dom_html_option_element *option, bool *selected);
|
||||
|
||||
dom_exception dom_html_option_element_set_selected(
|
||||
dom_html_option_element *option, bool selected);
|
||||
|
||||
dom_exception dom_html_option_element_get_value(
|
||||
dom_html_option_element *option, dom_string **value);
|
||||
|
||||
dom_exception dom_html_option_element_set_value(
|
||||
dom_html_option_element *option, dom_string *value);
|
||||
|
||||
#endif
|
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef dom_html_select_element_h_
|
||||
#define dom_html_select_element_h_
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <dom/core/exceptions.h>
|
||||
|
||||
#include <dom/html/html_form_element.h>
|
||||
|
||||
typedef struct dom_html_select_element dom_html_select_element;
|
||||
|
||||
struct dom_html_options_collection;
|
||||
struct dom_html_element;
|
||||
|
||||
dom_exception dom_html_select_element_get_type(
|
||||
dom_html_select_element *ele, dom_string **type);
|
||||
|
||||
dom_exception dom_html_select_element_get_selected_index(
|
||||
dom_html_select_element *ele, int32_t *index);
|
||||
dom_exception dom_html_select_element_set_selected_index(
|
||||
dom_html_select_element *ele, int32_t index);
|
||||
|
||||
dom_exception dom_html_select_element_get_value(
|
||||
dom_html_select_element *ele, dom_string **value);
|
||||
dom_exception dom_html_select_element_set_value(
|
||||
dom_html_select_element *ele, dom_string *value);
|
||||
|
||||
dom_exception dom_html_select_element_get_length(
|
||||
dom_html_select_element *ele, uint32_t *len);
|
||||
dom_exception dom_html_select_element_set_length(
|
||||
dom_html_select_element *ele, uint32_t len);
|
||||
|
||||
dom_exception dom_html_select_element_get_form(
|
||||
dom_html_select_element *ele, dom_html_form_element **form);
|
||||
|
||||
dom_exception dom__html_select_element_get_options(
|
||||
dom_html_select_element *ele,
|
||||
struct dom_html_options_collection **col);
|
||||
#define dom_html_select_element_get_options(e, c) \
|
||||
dom__html_select_element_get_options((dom_html_select_element *) (e), \
|
||||
(struct dom_html_options_collection **) (c))
|
||||
|
||||
dom_exception dom_html_select_element_get_disabled(
|
||||
dom_html_select_element *ele, bool *disabled);
|
||||
dom_exception dom_html_select_element_set_disabled(
|
||||
dom_html_select_element *ele, bool disabled);
|
||||
|
||||
dom_exception dom_html_select_element_get_multiple(
|
||||
dom_html_select_element *ele, bool *multiple);
|
||||
dom_exception dom_html_select_element_set_multiple(
|
||||
dom_html_select_element *ele, bool multiple);
|
||||
|
||||
dom_exception dom_html_select_element_get_name(
|
||||
dom_html_select_element *ele, dom_string **name);
|
||||
dom_exception dom_html_select_element_set_name(
|
||||
dom_html_select_element *ele, dom_string *name);
|
||||
|
||||
dom_exception dom_html_select_element_get_size(
|
||||
dom_html_select_element *ele, int32_t *size);
|
||||
dom_exception dom_html_select_element_set_size(
|
||||
dom_html_select_element *ele, int32_t size);
|
||||
|
||||
dom_exception dom_html_select_element_get_tab_index(
|
||||
dom_html_select_element *ele, int32_t *tab_index);
|
||||
dom_exception dom_html_select_element_set_tab_index(
|
||||
dom_html_select_element *ele, int32_t tab_index);
|
||||
|
||||
/* Functions */
|
||||
dom_exception dom__html_select_element_add(dom_html_select_element *select,
|
||||
struct dom_html_element *ele, struct dom_html_element *before);
|
||||
#define dom_html_select_element_add(s, e, b) \
|
||||
dom__html_select_element_add((dom_html_select_element *) (s), \
|
||||
(struct dom_html_element *) (e), \
|
||||
(struct dom_html_element *) (b))
|
||||
dom_exception dom_html_select_element_remove(dom_html_select_element *ele,
|
||||
int32_t index);
|
||||
dom_exception dom_html_select_element_blur(struct dom_html_select_element *ele);
|
||||
dom_exception dom_html_select_element_focus(struct dom_html_select_element *ele);
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,82 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2012 Daniel Silverstone <dsilvers@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef dom_html_text_area_element_h_
|
||||
#define dom_html_text_area_element_h_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/string.h>
|
||||
#include <dom/html/html_form_element.h>
|
||||
|
||||
typedef struct dom_html_text_area_element dom_html_text_area_element;
|
||||
|
||||
dom_exception dom_html_text_area_element_get_default_value(
|
||||
dom_html_text_area_element *text_area, dom_string **default_value);
|
||||
|
||||
dom_exception dom_html_text_area_element_set_default_value(
|
||||
dom_html_text_area_element *text_area, dom_string *default_value);
|
||||
|
||||
dom_exception dom_html_text_area_element_get_form(
|
||||
dom_html_text_area_element *text_area, dom_html_form_element **form);
|
||||
|
||||
dom_exception dom_html_text_area_element_get_access_key(
|
||||
dom_html_text_area_element *text_area, dom_string **access_key);
|
||||
|
||||
dom_exception dom_html_text_area_element_set_access_key(
|
||||
dom_html_text_area_element *text_area, dom_string *access_key);
|
||||
|
||||
dom_exception dom_html_text_area_element_get_disabled(
|
||||
dom_html_text_area_element *text_area, bool *disabled);
|
||||
|
||||
dom_exception dom_html_text_area_element_set_disabled(
|
||||
dom_html_text_area_element *text_area, bool disabled);
|
||||
|
||||
dom_exception dom_html_text_area_element_get_cols(
|
||||
dom_html_text_area_element *text_area, int32_t *cols);
|
||||
|
||||
dom_exception dom_html_text_area_element_set_cols(
|
||||
dom_html_text_area_element *text_area, uint32_t cols);
|
||||
|
||||
dom_exception dom_html_text_area_element_get_rows(
|
||||
dom_html_text_area_element *text_area, int32_t *rows);
|
||||
|
||||
dom_exception dom_html_text_area_element_set_rows(
|
||||
dom_html_text_area_element *text_area, uint32_t rows);
|
||||
|
||||
dom_exception dom_html_text_area_element_get_name(
|
||||
dom_html_text_area_element *text_area, dom_string **name);
|
||||
|
||||
dom_exception dom_html_text_area_element_set_name(
|
||||
dom_html_text_area_element *text_area, dom_string *name);
|
||||
|
||||
dom_exception dom_html_text_area_element_get_read_only(
|
||||
dom_html_text_area_element *text_area, bool *read_only);
|
||||
|
||||
dom_exception dom_html_text_area_element_set_read_only(
|
||||
dom_html_text_area_element *text_area, bool read_only);
|
||||
|
||||
dom_exception dom_html_text_area_element_get_tab_index(
|
||||
dom_html_text_area_element *text_area, int32_t *tab_index);
|
||||
|
||||
dom_exception dom_html_text_area_element_set_tab_index(
|
||||
dom_html_text_area_element *text_area, uint32_t tab_index);
|
||||
|
||||
dom_exception dom_html_text_area_element_get_type(
|
||||
dom_html_text_area_element *text_area, dom_string **type);
|
||||
|
||||
dom_exception dom_html_text_area_element_get_value(
|
||||
dom_html_text_area_element *text_area, dom_string **value);
|
||||
|
||||
dom_exception dom_html_text_area_element_set_value(
|
||||
dom_html_text_area_element *text_area, dom_string *value);
|
||||
|
||||
dom_exception dom_html_text_area_element_blur(dom_html_text_area_element *ele);
|
||||
dom_exception dom_html_text_area_element_focus(dom_html_text_area_element *ele);
|
||||
dom_exception dom_html_text_area_element_select(dom_html_text_area_element *ele);
|
||||
|
||||
#endif
|
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* This file is part of libdom.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 Bo Yang <struggleyb.nku.com>
|
||||
*/
|
||||
|
||||
#ifndef dom_html_title_element_h_
|
||||
#define dom_html_title_element_h_
|
||||
|
||||
#include <dom/core/exceptions.h>
|
||||
#include <dom/core/string.h>
|
||||
|
||||
typedef struct dom_html_title_element dom_html_title_element;
|
||||
|
||||
dom_exception dom_html_title_element_get_text(dom_html_title_element *ele,
|
||||
dom_string **text);
|
||||
|
||||
dom_exception dom_html_title_element_set_text(dom_html_title_element *ele,
|
||||
dom_string *text);
|
||||
|
||||
#endif
|
||||
|
42
programs/network/netsurf/include/hubbub/errors.h
Normal file
42
programs/network/netsurf/include/hubbub/errors.h
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* This file is part of Hubbub.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef hubbub_errors_h_
|
||||
#define hubbub_errors_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
typedef enum hubbub_error {
|
||||
HUBBUB_OK = 0, /**< No error */
|
||||
HUBBUB_REPROCESS = 1,
|
||||
HUBBUB_ENCODINGCHANGE = 2,
|
||||
HUBBUB_PAUSED = 3, /**< tokenisation is paused */
|
||||
|
||||
HUBBUB_NOMEM = 5,
|
||||
HUBBUB_BADPARM = 6,
|
||||
HUBBUB_INVALID = 7,
|
||||
HUBBUB_FILENOTFOUND = 8,
|
||||
HUBBUB_NEEDDATA = 9,
|
||||
HUBBUB_BADENCODING = 10,
|
||||
|
||||
HUBBUB_UNKNOWN = 11
|
||||
} hubbub_error;
|
||||
|
||||
/* Convert a hubbub error value to a string */
|
||||
const char *hubbub_error_to_string(hubbub_error error);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
60
programs/network/netsurf/include/hubbub/functypes.h
Normal file
60
programs/network/netsurf/include/hubbub/functypes.h
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* This file is part of Hubbub.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007-8 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef hubbub_functypes_h_
|
||||
#define hubbub_functypes_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <hubbub/types.h>
|
||||
|
||||
/**
|
||||
* Type of allocation function for hubbub
|
||||
*
|
||||
* The semantics of this function are the same as for realloc().
|
||||
*
|
||||
* \param ptr Pointer to object to reallocate, or NULL for a new allocation
|
||||
* \param size Required length in bytes, or zero to free ::ptr
|
||||
* \param pw Pointer to client data
|
||||
* \return Pointer to allocated object, or NULL on failure
|
||||
*/
|
||||
typedef void *(*hubbub_allocator_fn)(void *ptr, size_t size, void *pw);
|
||||
|
||||
/**
|
||||
* Type of token handling function
|
||||
*
|
||||
* \param token Pointer to token to handle
|
||||
* \param pw Pointer to client data
|
||||
* \return HUBBUB_OK on success, appropriate error otherwise.
|
||||
*/
|
||||
typedef hubbub_error (*hubbub_token_handler)(
|
||||
const hubbub_token *token, void *pw);
|
||||
|
||||
/**
|
||||
* Type of parse error handling function
|
||||
*
|
||||
* \param line Source line on which error occurred
|
||||
* \param col Column in ::line of start of erroneous input
|
||||
* \param message Error message
|
||||
* \param pw Pointer to client data
|
||||
*/
|
||||
typedef void (*hubbub_error_handler)(uint32_t line, uint32_t col,
|
||||
const char *message, void *pw);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
25
programs/network/netsurf/include/hubbub/hubbub.h
Normal file
25
programs/network/netsurf/include/hubbub/hubbub.h
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* This file is part of Hubbub.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef hubbub_h_
|
||||
#define hubbub_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <hubbub/errors.h>
|
||||
#include <hubbub/functypes.h>
|
||||
#include <hubbub/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
110
programs/network/netsurf/include/hubbub/parser.h
Normal file
110
programs/network/netsurf/include/hubbub/parser.h
Normal file
@ -0,0 +1,110 @@
|
||||
/*
|
||||
* This file is part of Hubbub.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007-8 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef hubbub_parser_h_
|
||||
#define hubbub_parser_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <hubbub/errors.h>
|
||||
#include <hubbub/functypes.h>
|
||||
#include <hubbub/tree.h>
|
||||
#include <hubbub/types.h>
|
||||
|
||||
typedef struct hubbub_parser hubbub_parser;
|
||||
|
||||
/**
|
||||
* Hubbub parser option types
|
||||
*/
|
||||
typedef enum hubbub_parser_opttype {
|
||||
HUBBUB_PARSER_TOKEN_HANDLER,
|
||||
HUBBUB_PARSER_ERROR_HANDLER,
|
||||
HUBBUB_PARSER_CONTENT_MODEL,
|
||||
HUBBUB_PARSER_TREE_HANDLER,
|
||||
HUBBUB_PARSER_DOCUMENT_NODE,
|
||||
HUBBUB_PARSER_ENABLE_SCRIPTING,
|
||||
HUBBUB_PARSER_PAUSE
|
||||
} hubbub_parser_opttype;
|
||||
|
||||
/**
|
||||
* Hubbub parser option parameters
|
||||
*/
|
||||
typedef union hubbub_parser_optparams {
|
||||
struct {
|
||||
hubbub_token_handler handler;
|
||||
void *pw;
|
||||
} token_handler; /**< Token handling callback */
|
||||
|
||||
struct {
|
||||
hubbub_error_handler handler;
|
||||
void *pw;
|
||||
} error_handler; /**< Error handling callback */
|
||||
|
||||
struct {
|
||||
hubbub_content_model model;
|
||||
} content_model; /**< Current content model */
|
||||
|
||||
hubbub_tree_handler *tree_handler; /**< Tree handling callbacks */
|
||||
|
||||
void *document_node; /**< Document node */
|
||||
|
||||
bool enable_scripting; /**< Whether to enable scripting */
|
||||
|
||||
bool pause_parse; /**< Pause parsing */
|
||||
} hubbub_parser_optparams;
|
||||
|
||||
/* Create a hubbub parser */
|
||||
hubbub_error hubbub_parser_create(const char *enc, bool fix_enc,
|
||||
hubbub_allocator_fn alloc, void *pw, hubbub_parser **parser);
|
||||
/* Destroy a hubbub parser */
|
||||
hubbub_error hubbub_parser_destroy(hubbub_parser *parser);
|
||||
|
||||
/* Configure a hubbub parser */
|
||||
hubbub_error hubbub_parser_setopt(hubbub_parser *parser,
|
||||
hubbub_parser_opttype type,
|
||||
hubbub_parser_optparams *params);
|
||||
|
||||
/* Pass a chunk of data to a hubbub parser for parsing */
|
||||
/* This data is encoded in the input charset */
|
||||
hubbub_error hubbub_parser_parse_chunk(hubbub_parser *parser,
|
||||
const uint8_t *data, size_t len);
|
||||
|
||||
/**
|
||||
* Insert a chunk of data into a hubbub parser input stream
|
||||
*
|
||||
* This data is encoded in the input charset
|
||||
*
|
||||
* Inserts the given data into the input stream ready for parsing but
|
||||
* does not cause any additional processing of the input. This is
|
||||
* useful to allow hubbub callbacks to add computed data to the input.
|
||||
*
|
||||
* \param parser Parser instance to use
|
||||
* \param data Data to parse (encoded in the input charset)
|
||||
* \param len Length, in bytes, of data
|
||||
* \return HUBBUB_OK on success, appropriate error otherwise
|
||||
*/
|
||||
hubbub_error hubbub_parser_insert_chunk(hubbub_parser *parser,
|
||||
const uint8_t *data, size_t len);
|
||||
/* Inform the parser that the last chunk of data has been parsed */
|
||||
hubbub_error hubbub_parser_completed(hubbub_parser *parser);
|
||||
|
||||
/* Read the document charset */
|
||||
const char *hubbub_parser_read_charset(hubbub_parser *parser,
|
||||
hubbub_charset_source *source);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
300
programs/network/netsurf/include/hubbub/tree.h
Normal file
300
programs/network/netsurf/include/hubbub/tree.h
Normal file
@ -0,0 +1,300 @@
|
||||
/*
|
||||
* This file is part of Hubbub.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2008 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef hubbub_tree_h_
|
||||
#define hubbub_tree_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <hubbub/functypes.h>
|
||||
|
||||
/**
|
||||
* Create a comment node
|
||||
*
|
||||
* \param ctx Client's context
|
||||
* \param data String content of node
|
||||
* \param result Pointer to location to receive created node
|
||||
* \return HUBBUB_OK on success, appropriate error otherwise.
|
||||
*
|
||||
* Postcondition: if successful, result's reference count must be 1.
|
||||
*/
|
||||
typedef hubbub_error (*hubbub_tree_create_comment)(void *ctx,
|
||||
const hubbub_string *data,
|
||||
void **result);
|
||||
|
||||
/**
|
||||
* Create a doctype node
|
||||
*
|
||||
* \param ctx Client's context
|
||||
* \param doctype Data for doctype node (name, public id, system id)
|
||||
* \param result Pointer to location to receive created node
|
||||
* \return HUBBUB_OK on success, appropriate error otherwise.
|
||||
*
|
||||
* Postcondition: if successful, result's reference count must be 1.
|
||||
*/
|
||||
typedef hubbub_error (*hubbub_tree_create_doctype)(void *ctx,
|
||||
const hubbub_doctype *doctype,
|
||||
void **result);
|
||||
|
||||
/**
|
||||
* Create an element node
|
||||
*
|
||||
* \param ctx Client's context
|
||||
* \param tag Data for element node (namespace, name, attributes)
|
||||
* \param result Pointer to location to receive created node
|
||||
* \return HUBBUB_OK on success, appropriate error otherwise.
|
||||
*
|
||||
* Postcondition: if successful, result's reference count must be 1.
|
||||
*/
|
||||
typedef hubbub_error (*hubbub_tree_create_element)(void *ctx,
|
||||
const hubbub_tag *tag,
|
||||
void **result);
|
||||
|
||||
/**
|
||||
* Create a text node
|
||||
*
|
||||
* \param ctx Client's context
|
||||
* \param data String content of node
|
||||
* \param result Pointer to location to receive created node
|
||||
* \return HUBBUB_OK on success, appropriate error otherwise.
|
||||
*
|
||||
* Postcondition: if successful, result's reference count must be 1.
|
||||
*/
|
||||
typedef hubbub_error (*hubbub_tree_create_text)(void *ctx,
|
||||
const hubbub_string *data,
|
||||
void **result);
|
||||
|
||||
/**
|
||||
* Increase a node's reference count
|
||||
*
|
||||
* \param ctx Client's context
|
||||
* \param node Node to reference
|
||||
* \return HUBBUB_OK on success, appropriate error otherwise.
|
||||
*
|
||||
* Postcondition: node's reference count is one larger than before
|
||||
*/
|
||||
typedef hubbub_error (*hubbub_tree_ref_node)(void *ctx, void *node);
|
||||
|
||||
/**
|
||||
* Decrease a node's reference count
|
||||
*
|
||||
* \param ctx Client's context
|
||||
* \param node Node to reference
|
||||
* \return HUBBUB_OK on success, appropriate error otherwise.
|
||||
*
|
||||
* Postcondition: If the node's reference count becomes zero, and it has no
|
||||
* parent, and it is not the document node, then it is destroyed. Otherwise,
|
||||
* the reference count is one less than before.
|
||||
*/
|
||||
typedef hubbub_error (*hubbub_tree_unref_node)(void *ctx, void *node);
|
||||
|
||||
/**
|
||||
* Append a node to the end of another's child list
|
||||
*
|
||||
* \param ctx Client's context
|
||||
* \param parent The node to append to
|
||||
* \param child The node to append
|
||||
* \param result Pointer to location to receive appended node
|
||||
* \return HUBBUB_OK on success, appropriate error otherwise.
|
||||
*
|
||||
* Postcondition: if successful, result's reference count is increased by 1
|
||||
*
|
||||
* Important: *result may not == child (e.g. if text nodes got coalesced)
|
||||
*/
|
||||
typedef hubbub_error (*hubbub_tree_append_child)(void *ctx,
|
||||
void *parent,
|
||||
void *child,
|
||||
void **result);
|
||||
|
||||
/**
|
||||
* Insert a node into another's child list
|
||||
*
|
||||
* \param ctx Client's context
|
||||
* \param parent The node to insert into
|
||||
* \param child The node to insert
|
||||
* \param ref_child The node to insert before
|
||||
* \param result Pointer to location to receive inserted node
|
||||
* \return HUBBUB_OK on success, appropriate error otherwise.
|
||||
*
|
||||
* Postcondition: if successful, result's reference count is increased by 1
|
||||
*
|
||||
* Important: *result may not == child (e.g. if text nodes got coalesced)
|
||||
*/
|
||||
typedef hubbub_error (*hubbub_tree_insert_before)(void *ctx,
|
||||
void *parent,
|
||||
void *child,
|
||||
void *ref_child,
|
||||
void **result);
|
||||
|
||||
/**
|
||||
* Remove a node from another's child list
|
||||
*
|
||||
* \param ctx Client context
|
||||
* \param parent The node to remove from
|
||||
* \param child The node to remove
|
||||
* \param result Pointer to location to receive removed node
|
||||
* \return HUBBUB_OK on success, appropriate error otherwise.
|
||||
*
|
||||
* Postcondition: if successful, result's reference count is increased by 1
|
||||
*/
|
||||
typedef hubbub_error (*hubbub_tree_remove_child)(void *ctx,
|
||||
void *parent,
|
||||
void *child,
|
||||
void **result);
|
||||
|
||||
/**
|
||||
* Clone a node
|
||||
*
|
||||
* \param ctx Client's context
|
||||
* \param node The node to clone
|
||||
* \param deep True to clone entire subtree, false to clone only the node
|
||||
* \param result Pointer to location to receive clone
|
||||
* \return HUBBUB_OK on success, appropriate error otherwise.
|
||||
*
|
||||
* Postcondition: if successful, result's reference count must be 1.
|
||||
*/
|
||||
typedef hubbub_error (*hubbub_tree_clone_node)(void *ctx,
|
||||
void *node,
|
||||
bool deep,
|
||||
void **result);
|
||||
|
||||
/**
|
||||
* Move all the children of one node to another
|
||||
*
|
||||
* \param ctx Client's context
|
||||
* \param node The initial parent node
|
||||
* \param new_parent The new parent node
|
||||
* \return HUBBUB_OK on success, appropriate error otherwise.
|
||||
*/
|
||||
typedef hubbub_error (*hubbub_tree_reparent_children)(void *ctx,
|
||||
void *node,
|
||||
void *new_parent);
|
||||
|
||||
/**
|
||||
* Retrieve the parent of a node
|
||||
*
|
||||
* \param ctx Client context
|
||||
* \param node Node to retrieve the parent of
|
||||
* \param element_only True if the parent must be an element, false otherwise
|
||||
* \param result Pointer to location to receive parent node
|
||||
* \return HUBBUB_OK on success, appropriate error otherwise.
|
||||
*
|
||||
* If there is a parent node, but it is not an element node and element_only
|
||||
* is true, then act as if no parent existed.
|
||||
*
|
||||
* Postcondition: if there is a parent, then result's reference count must be
|
||||
* increased.
|
||||
*/
|
||||
typedef hubbub_error (*hubbub_tree_get_parent)(void *ctx,
|
||||
void *node,
|
||||
bool element_only,
|
||||
void **result);
|
||||
|
||||
/**
|
||||
* Determine if a node has children
|
||||
*
|
||||
* \param ctx Client's context
|
||||
* \param node The node to inspect
|
||||
* \param result Location to receive result
|
||||
* \return HUBBUB_OK on success, appropriate error otherwise.
|
||||
*/
|
||||
typedef hubbub_error (*hubbub_tree_has_children)(void *ctx,
|
||||
void *node,
|
||||
bool *result);
|
||||
|
||||
/**
|
||||
* Associate a node with a form
|
||||
*
|
||||
* \param ctx Client's context
|
||||
* \param form The form to associate with
|
||||
* \param node The node to associate
|
||||
* \return HUBBUB_OK on success, appropriate error otherwise.
|
||||
*/
|
||||
typedef hubbub_error (*hubbub_tree_form_associate)(void *ctx,
|
||||
void *form,
|
||||
void *node);
|
||||
|
||||
/**
|
||||
* Add attributes to a node
|
||||
*
|
||||
* \param ctx Client's context
|
||||
* \param node The node to add to
|
||||
* \param attributes Array of attributes to add
|
||||
* \param n_attributes Number of entries in array
|
||||
* \return HUBBUB_OK on success, appropriate error otherwise.
|
||||
*/
|
||||
typedef hubbub_error (*hubbub_tree_add_attributes)(void *ctx,
|
||||
void *node,
|
||||
const hubbub_attribute *attributes,
|
||||
uint32_t n_attributes);
|
||||
|
||||
/**
|
||||
* Notification of the quirks mode of a document
|
||||
*
|
||||
* \param ctx Client's context
|
||||
* \param mode The quirks mode
|
||||
* \return HUBBUB_OK on success, appropriate error otherwise.
|
||||
*/
|
||||
typedef hubbub_error (*hubbub_tree_set_quirks_mode)(void *ctx,
|
||||
hubbub_quirks_mode mode);
|
||||
|
||||
/**
|
||||
* Notification that a potential encoding change is required
|
||||
*
|
||||
* \param ctx Client's context
|
||||
* \param charset The new charset for the source data
|
||||
* \return HUBBUB_OK to continue using the current input handler,
|
||||
* HUBBUB_ENCODINGCHANGE to stop processing immediately and
|
||||
* return control to the client,
|
||||
* appropriate error otherwise.
|
||||
*/
|
||||
typedef hubbub_error (*hubbub_tree_encoding_change)(void *ctx,
|
||||
const char *encname);
|
||||
|
||||
/**
|
||||
* Complete script processing
|
||||
*
|
||||
* \param ctx Client's context
|
||||
* \param script The script
|
||||
* \return HUBBUB_OK on success, appropriate error otherwise.
|
||||
*/
|
||||
typedef hubbub_error (*hubbub_tree_complete_script)(void *ctx, void *script);
|
||||
|
||||
/**
|
||||
* Hubbub tree handler
|
||||
*/
|
||||
typedef struct hubbub_tree_handler {
|
||||
hubbub_tree_create_comment create_comment; /**< Create comment */
|
||||
hubbub_tree_create_doctype create_doctype; /**< Create doctype */
|
||||
hubbub_tree_create_element create_element; /**< Create element */
|
||||
hubbub_tree_create_text create_text; /**< Create text */
|
||||
hubbub_tree_ref_node ref_node; /**< Reference node */
|
||||
hubbub_tree_unref_node unref_node; /**< Unreference node */
|
||||
hubbub_tree_append_child append_child; /**< Append child */
|
||||
hubbub_tree_insert_before insert_before; /**< Insert before */
|
||||
hubbub_tree_remove_child remove_child; /**< Remove child */
|
||||
hubbub_tree_clone_node clone_node; /**< Clone node */
|
||||
hubbub_tree_reparent_children reparent_children;/**< Reparent children*/
|
||||
hubbub_tree_get_parent get_parent; /**< Get parent */
|
||||
hubbub_tree_has_children has_children; /**< Has children? */
|
||||
hubbub_tree_form_associate form_associate; /**< Form associate */
|
||||
hubbub_tree_add_attributes add_attributes; /**< Add attributes */
|
||||
hubbub_tree_set_quirks_mode set_quirks_mode; /**< Set quirks mode */
|
||||
hubbub_tree_encoding_change encoding_change; /**< Change encoding */
|
||||
hubbub_tree_complete_script complete_script; /**< Script Complete */
|
||||
void *ctx; /**< Context pointer */
|
||||
} hubbub_tree_handler;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
137
programs/network/netsurf/include/hubbub/types.h
Normal file
137
programs/network/netsurf/include/hubbub/types.h
Normal file
@ -0,0 +1,137 @@
|
||||
/*
|
||||
* This file is part of Hubbub.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef hubbub_types_h_
|
||||
#define hubbub_types_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
/** Source of charset information, in order of importance
|
||||
* A client-dictated charset will override all others.
|
||||
* A document-specified charset will override autodetection or the default */
|
||||
typedef enum hubbub_charset_source {
|
||||
HUBBUB_CHARSET_UNKNOWN = 0, /**< Unknown */
|
||||
HUBBUB_CHARSET_TENTATIVE = 1, /**< Charset may be changed
|
||||
* with further data */
|
||||
HUBBUB_CHARSET_CONFIDENT = 2 /**< Charset definite */
|
||||
} hubbub_charset_source;
|
||||
|
||||
/**
|
||||
* Content model flag
|
||||
*/
|
||||
typedef enum hubbub_content_model {
|
||||
HUBBUB_CONTENT_MODEL_PCDATA,
|
||||
HUBBUB_CONTENT_MODEL_RCDATA,
|
||||
HUBBUB_CONTENT_MODEL_CDATA,
|
||||
HUBBUB_CONTENT_MODEL_PLAINTEXT
|
||||
} hubbub_content_model;
|
||||
|
||||
/**
|
||||
* Quirks mode flag
|
||||
*/
|
||||
typedef enum hubbub_quirks_mode {
|
||||
HUBBUB_QUIRKS_MODE_NONE,
|
||||
HUBBUB_QUIRKS_MODE_LIMITED,
|
||||
HUBBUB_QUIRKS_MODE_FULL
|
||||
} hubbub_quirks_mode;
|
||||
|
||||
/**
|
||||
* Type of an emitted token
|
||||
*/
|
||||
typedef enum hubbub_token_type {
|
||||
HUBBUB_TOKEN_DOCTYPE,
|
||||
HUBBUB_TOKEN_START_TAG,
|
||||
HUBBUB_TOKEN_END_TAG,
|
||||
HUBBUB_TOKEN_COMMENT,
|
||||
HUBBUB_TOKEN_CHARACTER,
|
||||
HUBBUB_TOKEN_EOF
|
||||
} hubbub_token_type;
|
||||
|
||||
/**
|
||||
* Possible namespaces
|
||||
*/
|
||||
typedef enum hubbub_ns {
|
||||
HUBBUB_NS_NULL,
|
||||
HUBBUB_NS_HTML,
|
||||
HUBBUB_NS_MATHML,
|
||||
HUBBUB_NS_SVG,
|
||||
HUBBUB_NS_XLINK,
|
||||
HUBBUB_NS_XML,
|
||||
HUBBUB_NS_XMLNS
|
||||
} hubbub_ns;
|
||||
|
||||
/**
|
||||
* Tokeniser string type
|
||||
*/
|
||||
typedef struct hubbub_string {
|
||||
const uint8_t *ptr; /**< Pointer to data */
|
||||
size_t len; /**< Byte length of string */
|
||||
} hubbub_string;
|
||||
|
||||
/**
|
||||
* Tag attribute data
|
||||
*/
|
||||
typedef struct hubbub_attribute {
|
||||
hubbub_ns ns; /**< Attribute namespace */
|
||||
hubbub_string name; /**< Attribute name */
|
||||
hubbub_string value; /**< Attribute value */
|
||||
} hubbub_attribute;
|
||||
|
||||
/**
|
||||
* Data for doctype token
|
||||
*/
|
||||
typedef struct hubbub_doctype {
|
||||
hubbub_string name; /**< Doctype name */
|
||||
|
||||
bool public_missing; /**< Whether the public id is missing */
|
||||
hubbub_string public_id; /**< Doctype public identifier */
|
||||
|
||||
bool system_missing; /**< Whether the system id is missing */
|
||||
hubbub_string system_id; /**< Doctype system identifier */
|
||||
|
||||
bool force_quirks; /**< Doctype force-quirks flag */
|
||||
} hubbub_doctype;
|
||||
|
||||
/**
|
||||
* Data for a tag
|
||||
*/
|
||||
typedef struct hubbub_tag {
|
||||
hubbub_ns ns; /**< Tag namespace */
|
||||
hubbub_string name; /**< Tag name */
|
||||
uint32_t n_attributes; /**< Count of attributes */
|
||||
hubbub_attribute *attributes; /**< Array of attribute data */
|
||||
bool self_closing; /**< Whether the tag can have children */
|
||||
} hubbub_tag;
|
||||
|
||||
/**
|
||||
* Token data
|
||||
*/
|
||||
typedef struct hubbub_token {
|
||||
hubbub_token_type type; /**< The token type */
|
||||
|
||||
union {
|
||||
hubbub_doctype doctype;
|
||||
|
||||
hubbub_tag tag;
|
||||
|
||||
hubbub_string comment;
|
||||
|
||||
hubbub_string character;
|
||||
} data; /**< Type-specific data */
|
||||
} hubbub_token;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
403
programs/network/netsurf/include/libcss/computed.h
Normal file
403
programs/network/netsurf/include/libcss/computed.h
Normal file
@ -0,0 +1,403 @@
|
||||
/*
|
||||
* This file is part of LibCSS
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef libcss_computed_h_
|
||||
#define libcss_computed_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <libwapcaplet/libwapcaplet.h>
|
||||
|
||||
#include <libcss/errors.h>
|
||||
#include <libcss/functypes.h>
|
||||
#include <libcss/properties.h>
|
||||
#include <libcss/types.h>
|
||||
|
||||
struct css_hint;
|
||||
struct css_select_handler;
|
||||
|
||||
typedef struct css_computed_counter {
|
||||
lwc_string *name;
|
||||
css_fixed value;
|
||||
} css_computed_counter;
|
||||
|
||||
typedef struct css_computed_clip_rect {
|
||||
css_fixed top;
|
||||
css_fixed right;
|
||||
css_fixed bottom;
|
||||
css_fixed left;
|
||||
|
||||
css_unit tunit;
|
||||
css_unit runit;
|
||||
css_unit bunit;
|
||||
css_unit lunit;
|
||||
|
||||
bool top_auto;
|
||||
bool right_auto;
|
||||
bool bottom_auto;
|
||||
bool left_auto;
|
||||
} css_computed_clip_rect;
|
||||
|
||||
enum css_computed_content_type {
|
||||
CSS_COMPUTED_CONTENT_NONE = 0,
|
||||
CSS_COMPUTED_CONTENT_STRING = 1,
|
||||
CSS_COMPUTED_CONTENT_URI = 2,
|
||||
CSS_COMPUTED_CONTENT_COUNTER = 3,
|
||||
CSS_COMPUTED_CONTENT_COUNTERS = 4,
|
||||
CSS_COMPUTED_CONTENT_ATTR = 5,
|
||||
CSS_COMPUTED_CONTENT_OPEN_QUOTE = 6,
|
||||
CSS_COMPUTED_CONTENT_CLOSE_QUOTE = 7,
|
||||
CSS_COMPUTED_CONTENT_NO_OPEN_QUOTE = 8,
|
||||
CSS_COMPUTED_CONTENT_NO_CLOSE_QUOTE = 9
|
||||
};
|
||||
|
||||
typedef struct css_computed_content_item {
|
||||
uint8_t type;
|
||||
union {
|
||||
lwc_string *string;
|
||||
lwc_string *uri;
|
||||
lwc_string *attr;
|
||||
struct {
|
||||
lwc_string *name;
|
||||
uint8_t style;
|
||||
} counter;
|
||||
struct {
|
||||
lwc_string *name;
|
||||
lwc_string *sep;
|
||||
uint8_t style;
|
||||
} counters;
|
||||
} data;
|
||||
} css_computed_content_item;
|
||||
|
||||
css_error css_computed_style_create(css_allocator_fn alloc, void *pw,
|
||||
css_computed_style **result);
|
||||
css_error css_computed_style_destroy(css_computed_style *style);
|
||||
|
||||
css_error css_computed_style_initialise(css_computed_style *style,
|
||||
struct css_select_handler *handler, void *pw);
|
||||
|
||||
css_error css_computed_style_compose(const css_computed_style *parent,
|
||||
const css_computed_style *child,
|
||||
css_error (*compute_font_size)(void *pw,
|
||||
const struct css_hint *parent,
|
||||
struct css_hint *size),
|
||||
void *pw,
|
||||
css_computed_style *result);
|
||||
|
||||
/******************************************************************************
|
||||
* Property accessors below here *
|
||||
******************************************************************************/
|
||||
|
||||
uint8_t css_computed_letter_spacing(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_outline_color(
|
||||
const css_computed_style *style, css_color *color);
|
||||
|
||||
uint8_t css_computed_outline_width(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_border_spacing(
|
||||
const css_computed_style *style,
|
||||
css_fixed *hlength, css_unit *hunit,
|
||||
css_fixed *vlength, css_unit *vunit);
|
||||
|
||||
uint8_t css_computed_word_spacing(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_counter_increment(
|
||||
const css_computed_style *style,
|
||||
const css_computed_counter **counters);
|
||||
|
||||
uint8_t css_computed_counter_reset(
|
||||
const css_computed_style *style,
|
||||
const css_computed_counter **counters);
|
||||
|
||||
uint8_t css_computed_cursor(
|
||||
const css_computed_style *style,
|
||||
lwc_string ***urls);
|
||||
|
||||
uint8_t css_computed_clip(
|
||||
const css_computed_style *style,
|
||||
css_computed_clip_rect *rect);
|
||||
|
||||
uint8_t css_computed_content(
|
||||
const css_computed_style *style,
|
||||
const css_computed_content_item **content);
|
||||
|
||||
uint8_t css_computed_vertical_align(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_font_size(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_border_top_width(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_border_right_width(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_border_bottom_width(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_border_left_width(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_background_image(
|
||||
const css_computed_style *style,
|
||||
lwc_string **url);
|
||||
|
||||
uint8_t css_computed_color(
|
||||
const css_computed_style *style,
|
||||
css_color *color);
|
||||
|
||||
uint8_t css_computed_list_style_image(
|
||||
const css_computed_style *style,
|
||||
lwc_string **url);
|
||||
|
||||
uint8_t css_computed_quotes(
|
||||
const css_computed_style *style,
|
||||
lwc_string ***quotes);
|
||||
|
||||
uint8_t css_computed_top(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_right(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_bottom(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_left(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_border_top_color(
|
||||
const css_computed_style *style,
|
||||
css_color *color);
|
||||
|
||||
uint8_t css_computed_border_right_color(
|
||||
const css_computed_style *style,
|
||||
css_color *color);
|
||||
|
||||
uint8_t css_computed_border_bottom_color(
|
||||
const css_computed_style *style,
|
||||
css_color *color);
|
||||
|
||||
uint8_t css_computed_border_left_color(
|
||||
const css_computed_style *style,
|
||||
css_color *color);
|
||||
|
||||
uint8_t css_computed_height(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_line_height(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_background_color(
|
||||
const css_computed_style *style,
|
||||
css_color *color);
|
||||
|
||||
uint8_t css_computed_z_index(
|
||||
const css_computed_style *style,
|
||||
int32_t *z_index);
|
||||
|
||||
uint8_t css_computed_margin_top(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_margin_right(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_margin_bottom(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_margin_left(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_background_attachment(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_border_collapse(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_caption_side(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_direction(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_max_height(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_max_width(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_width(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_empty_cells(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_float(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_font_style(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_min_height(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_min_width(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_background_repeat(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_clear(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_padding_top(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_padding_right(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_padding_bottom(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_padding_left(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_overflow(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_position(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_opacity(
|
||||
const css_computed_style *style,
|
||||
css_fixed *opacity);
|
||||
|
||||
uint8_t css_computed_text_transform(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_text_indent(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_white_space(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_background_position(
|
||||
const css_computed_style *style,
|
||||
css_fixed *hlength, css_unit *hunit,
|
||||
css_fixed *vlength, css_unit *vunit);
|
||||
|
||||
uint8_t css_computed_display(
|
||||
const css_computed_style *style, bool root);
|
||||
|
||||
uint8_t css_computed_display_static(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_font_variant(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_text_decoration(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_font_family(
|
||||
const css_computed_style *style,
|
||||
lwc_string ***names);
|
||||
|
||||
uint8_t css_computed_border_top_style(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_border_right_style(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_border_bottom_style(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_border_left_style(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_font_weight(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_list_style_type(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_outline_style(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_table_layout(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_unicode_bidi(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_visibility(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_list_style_position(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_text_align(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_page_break_after(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_page_break_before(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_page_break_inside(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_orphans(
|
||||
const css_computed_style *style,
|
||||
int32_t *orphans);
|
||||
|
||||
uint8_t css_computed_widows(
|
||||
const css_computed_style *style,
|
||||
int32_t *widows);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
40
programs/network/netsurf/include/libcss/errors.h
Normal file
40
programs/network/netsurf/include/libcss/errors.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* This file is part of LibCSS.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef libcss_errors_h_
|
||||
#define libcss_errors_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
typedef enum css_error {
|
||||
CSS_OK = 0,
|
||||
|
||||
CSS_NOMEM = 1,
|
||||
CSS_BADPARM = 2,
|
||||
CSS_INVALID = 3,
|
||||
CSS_FILENOTFOUND = 4,
|
||||
CSS_NEEDDATA = 5,
|
||||
CSS_BADCHARSET = 6,
|
||||
CSS_EOF = 7,
|
||||
CSS_IMPORTS_PENDING = 8,
|
||||
CSS_PROPERTY_NOT_SET = 9
|
||||
} css_error;
|
||||
|
||||
/* Convert a libcss error value to a string */
|
||||
const char *css_error_to_string(css_error error);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
79
programs/network/netsurf/include/libcss/font_face.h
Normal file
79
programs/network/netsurf/include/libcss/font_face.h
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* This file is part of LibCSS.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2011 Things Made Out Of Other Things Ltd.
|
||||
* Written by James Montgomerie <jamie@th.ingsmadeoutofotherthin.gs>
|
||||
*/
|
||||
|
||||
#ifndef libcss_font_face_h_
|
||||
#define libcss_font_face_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <libwapcaplet/libwapcaplet.h>
|
||||
|
||||
#include <libcss/errors.h>
|
||||
#include <libcss/functypes.h>
|
||||
#include <libcss/properties.h>
|
||||
#include <libcss/types.h>
|
||||
|
||||
typedef enum css_font_face_format {
|
||||
CSS_FONT_FACE_FORMAT_UNSPECIFIED = 0x00,
|
||||
|
||||
CSS_FONT_FACE_FORMAT_WOFF = 0x01,
|
||||
/* WOFF (Web Open Font Format); .woff */
|
||||
CSS_FONT_FACE_FORMAT_OPENTYPE = 0x02,
|
||||
/* TrueType or OpenType; .ttf, .otf */
|
||||
CSS_FONT_FACE_FORMAT_EMBEDDED_OPENTYPE = 0x04,
|
||||
/* Embedded OpenType; .eot */
|
||||
CSS_FONT_FACE_FORMAT_SVG = 0x08,
|
||||
/* SVG Font; .svg, .svgz */
|
||||
|
||||
CSS_FONT_FACE_FORMAT_UNKNOWN = 0x10,
|
||||
/* Format specified, but not recognised */
|
||||
|
||||
/* We don't define CSS_FONT_FACE_SRC_FORMAT_TRUETYPE as might be
|
||||
* expected, because the CSS3 specification
|
||||
* (http://www.w3.org/TR/css3-fonts/, §4.3) says:
|
||||
* "Given the overlap in common usage between TrueType and
|
||||
* OpenType, the format hints "truetype" and "opentype" must be
|
||||
* considered as synonymous"
|
||||
* so we compute a hint of 'truetype' to css_font_face_format_opentype.
|
||||
*/
|
||||
} css_font_face_format;
|
||||
|
||||
typedef enum css_font_face_location_type {
|
||||
CSS_FONT_FACE_LOCATION_TYPE_UNSPECIFIED = 0,
|
||||
CSS_FONT_FACE_LOCATION_TYPE_LOCAL = 1,
|
||||
CSS_FONT_FACE_LOCATION_TYPE_URI = 2,
|
||||
} css_font_face_location_type;
|
||||
|
||||
|
||||
css_error css_font_face_get_font_family(
|
||||
const css_font_face *font_face,
|
||||
lwc_string **font_family);
|
||||
|
||||
css_error css_font_face_count_srcs(const css_font_face *font_face,
|
||||
uint32_t *count);
|
||||
css_error css_font_face_get_src(const css_font_face *font_face, uint32_t index,
|
||||
const css_font_face_src **src);
|
||||
|
||||
css_error css_font_face_src_get_location(const css_font_face_src *src,
|
||||
lwc_string **location);
|
||||
|
||||
css_font_face_location_type css_font_face_src_location_type(
|
||||
const css_font_face_src *src);
|
||||
css_font_face_format css_font_face_src_format(const css_font_face_src *src);
|
||||
|
||||
uint8_t css_font_face_font_style(const css_font_face *font_face);
|
||||
uint8_t css_font_face_font_weight(const css_font_face *font_face);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
158
programs/network/netsurf/include/libcss/fpmath.h
Normal file
158
programs/network/netsurf/include/libcss/fpmath.h
Normal file
@ -0,0 +1,158 @@
|
||||
/*
|
||||
* This file is part of LibCSS.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2008 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef libcss_fpmath_h_
|
||||
#define libcss_fpmath_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <limits.h>
|
||||
|
||||
/* 22:10 fixed point math */
|
||||
#define CSS_RADIX_POINT 10
|
||||
|
||||
/* type for fixed point numbers */
|
||||
typedef int32_t css_fixed;
|
||||
|
||||
static inline css_fixed
|
||||
css_add_fixed(const css_fixed x, const css_fixed y) {
|
||||
int32_t ux = x;
|
||||
int32_t uy = y;
|
||||
int32_t res = ux + uy;
|
||||
|
||||
/* Calculate overflowed result. (Don't change the sign bit of ux) */
|
||||
ux = (ux >> 31) + INT_MAX;
|
||||
|
||||
/* Force compiler to use cmovns instruction */
|
||||
if ((int32_t) ((ux ^ uy) | ~(uy ^ res)) >= 0) {
|
||||
res = ux;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline css_fixed
|
||||
css_subtract_fixed(const css_fixed x, const css_fixed y) {
|
||||
int32_t ux = x;
|
||||
int32_t uy = y;
|
||||
int32_t res = ux - uy;
|
||||
|
||||
ux = (ux >> 31) + INT_MAX;
|
||||
|
||||
/* Force compiler to use cmovns instruction */
|
||||
if ((int32_t)((ux ^ uy) & (ux ^ res)) < 0) {
|
||||
res = ux;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline css_fixed
|
||||
css_divide_fixed(const css_fixed x, const css_fixed y) {
|
||||
int64_t xx = ((int64_t)x << CSS_RADIX_POINT) / y;
|
||||
|
||||
if (xx < INT_MIN)
|
||||
xx = INT_MIN;
|
||||
|
||||
if (xx > INT_MAX)
|
||||
xx = INT_MAX;
|
||||
|
||||
return xx;
|
||||
}
|
||||
|
||||
static inline css_fixed
|
||||
css_multiply_fixed(const css_fixed x, const css_fixed y) {
|
||||
int64_t xx = ((int64_t)x * (int64_t)y) >> CSS_RADIX_POINT;
|
||||
|
||||
if (xx < INT_MIN)
|
||||
xx = INT_MIN;
|
||||
|
||||
if (xx > INT_MAX)
|
||||
xx = INT_MAX;
|
||||
|
||||
return xx;
|
||||
}
|
||||
|
||||
static inline css_fixed
|
||||
css_int_to_fixed(const int a) {
|
||||
int64_t xx = ((int64_t) a) << CSS_RADIX_POINT;
|
||||
|
||||
if (xx < INT_MIN)
|
||||
xx = INT_MIN;
|
||||
|
||||
if (xx > INT_MAX)
|
||||
xx = INT_MAX;
|
||||
|
||||
return xx;
|
||||
}
|
||||
|
||||
static inline css_fixed
|
||||
css_float_to_fixed(const float a) {
|
||||
float xx = a * (float) (1 << CSS_RADIX_POINT);
|
||||
|
||||
if (xx < INT_MIN)
|
||||
xx = INT_MIN;
|
||||
|
||||
if (xx > INT_MAX)
|
||||
xx = INT_MAX;
|
||||
|
||||
return (css_fixed) xx;
|
||||
}
|
||||
|
||||
/* Add two fixed point values */
|
||||
#define FADD(a, b) (css_add_fixed((a), (b)))
|
||||
/* Subtract two fixed point values */
|
||||
#define FSUB(a, b) (css_subtract_fixed((a), (b)))
|
||||
/* Multiply two fixed point values */
|
||||
#define FMUL(a, b) (css_multiply_fixed((a), (b)))
|
||||
/* Divide two fixed point values */
|
||||
#define FDIV(a, b) (css_divide_fixed((a), (b)))
|
||||
|
||||
/* Convert a floating point value to fixed point */
|
||||
#define FLTTOFIX(a) ((css_fixed) ((a) * (float) (1 << CSS_RADIX_POINT)))
|
||||
/* Convert a fixed point value to floating point */
|
||||
#define FIXTOFLT(a) ((float) (a) / (float) (1 << CSS_RADIX_POINT))
|
||||
|
||||
/* Convert an integer to a fixed point value */
|
||||
#define INTTOFIX(a) (css_int_to_fixed(a))
|
||||
/* Convert a fixed point value to an integer */
|
||||
#define FIXTOINT(a) ((a) >> CSS_RADIX_POINT)
|
||||
|
||||
/* truncate a fixed point value */
|
||||
#define TRUNCATEFIX(a) (a & ~((1 << CSS_RADIX_POINT)- 1 ))
|
||||
|
||||
/* Useful values */
|
||||
#define F_PI_2 0x00000648 /* 1.5708 (PI/2) */
|
||||
#define F_PI 0x00000c91 /* 3.1415 (PI) */
|
||||
#define F_3PI_2 0x000012d9 /* 4.7124 (3PI/2) */
|
||||
#define F_2PI 0x00001922 /* 6.2831 (2 PI) */
|
||||
|
||||
#define F_90 0x00016800 /* 90 */
|
||||
#define F_180 0x0002d000 /* 180 */
|
||||
#define F_270 0x00043800 /* 270 */
|
||||
#define F_360 0x0005a000 /* 360 */
|
||||
|
||||
#define F_0_5 0x00000200 /* 0.5 */
|
||||
#define F_1 0x00000400 /* 1 */
|
||||
#define F_10 0x00002800 /* 10 */
|
||||
#define F_72 0x00012000 /* 72 */
|
||||
#define F_100 0x00019000 /* 100 */
|
||||
#define F_200 0x00032000 /* 200 */
|
||||
#define F_255 0x0003FC00 /* 255 */
|
||||
#define F_300 0x0004b000 /* 300 */
|
||||
#define F_400 0x00064000 /* 400 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
30
programs/network/netsurf/include/libcss/functypes.h
Normal file
30
programs/network/netsurf/include/libcss/functypes.h
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* This file is part of LibCSS.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007-8 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef libcss_functypes_h_
|
||||
#define libcss_functypes_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <libcss/types.h>
|
||||
|
||||
/* Type of allocation function for libcss */
|
||||
typedef void *(*css_allocator_fn)(void *ptr, size_t size, void *pw);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
59
programs/network/netsurf/include/libcss/hint.h
Normal file
59
programs/network/netsurf/include/libcss/hint.h
Normal file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* This file is part of LibCSS
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef libcss_hint_h_
|
||||
#define libcss_hint_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <libwapcaplet/libwapcaplet.h>
|
||||
|
||||
#include <libcss/computed.h>
|
||||
#include <libcss/errors.h>
|
||||
#include <libcss/functypes.h>
|
||||
#include <libcss/types.h>
|
||||
|
||||
/**
|
||||
* Length object for use in presentational hints
|
||||
*/
|
||||
typedef struct css_hint_length {
|
||||
css_fixed value;
|
||||
css_unit unit;
|
||||
} css_hint_length;
|
||||
|
||||
/**
|
||||
* Presentational hints
|
||||
*/
|
||||
typedef struct css_hint {
|
||||
/* Ownership of all data is passed to libcss */
|
||||
union {
|
||||
css_computed_clip_rect *clip;
|
||||
css_color color;
|
||||
css_computed_content_item *content;
|
||||
css_computed_counter *counter;
|
||||
css_fixed fixed;
|
||||
int32_t integer;
|
||||
css_hint_length length;
|
||||
struct {
|
||||
css_hint_length h;
|
||||
css_hint_length v;
|
||||
} position;
|
||||
lwc_string *string;
|
||||
lwc_string **strings;
|
||||
} data;
|
||||
|
||||
uint8_t status;
|
||||
} css_hint;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
32
programs/network/netsurf/include/libcss/libcss.h
Normal file
32
programs/network/netsurf/include/libcss/libcss.h
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* This file is part of LibCSS.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef libcss_h_
|
||||
#define libcss_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <libwapcaplet/libwapcaplet.h>
|
||||
|
||||
#include <libcss/errors.h>
|
||||
#include <libcss/types.h>
|
||||
#include <libcss/functypes.h>
|
||||
#include <libcss/computed.h>
|
||||
#include <libcss/properties.h>
|
||||
#include <libcss/select.h>
|
||||
#include <libcss/stylesheet.h>
|
||||
#include <libcss/font_face.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
753
programs/network/netsurf/include/libcss/properties.h
Normal file
753
programs/network/netsurf/include/libcss/properties.h
Normal file
@ -0,0 +1,753 @@
|
||||
/*
|
||||
* This file is part of LibCSS
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef libcss_properties_h_
|
||||
#define libcss_properties_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
enum css_properties_e {
|
||||
CSS_PROP_AZIMUTH = 0x000,
|
||||
CSS_PROP_BACKGROUND_ATTACHMENT = 0x001,
|
||||
CSS_PROP_BACKGROUND_COLOR = 0x002,
|
||||
CSS_PROP_BACKGROUND_IMAGE = 0x003,
|
||||
CSS_PROP_BACKGROUND_POSITION = 0x004,
|
||||
CSS_PROP_BACKGROUND_REPEAT = 0x005,
|
||||
CSS_PROP_BORDER_COLLAPSE = 0x006,
|
||||
CSS_PROP_BORDER_SPACING = 0x007,
|
||||
CSS_PROP_BORDER_TOP_COLOR = 0x008,
|
||||
CSS_PROP_BORDER_RIGHT_COLOR = 0x009,
|
||||
CSS_PROP_BORDER_BOTTOM_COLOR = 0x00a,
|
||||
CSS_PROP_BORDER_LEFT_COLOR = 0x00b,
|
||||
CSS_PROP_BORDER_TOP_STYLE = 0x00c,
|
||||
CSS_PROP_BORDER_RIGHT_STYLE = 0x00d,
|
||||
CSS_PROP_BORDER_BOTTOM_STYLE = 0x00e,
|
||||
CSS_PROP_BORDER_LEFT_STYLE = 0x00f,
|
||||
CSS_PROP_BORDER_TOP_WIDTH = 0x010,
|
||||
CSS_PROP_BORDER_RIGHT_WIDTH = 0x011,
|
||||
CSS_PROP_BORDER_BOTTOM_WIDTH = 0x012,
|
||||
CSS_PROP_BORDER_LEFT_WIDTH = 0x013,
|
||||
CSS_PROP_BOTTOM = 0x014,
|
||||
CSS_PROP_CAPTION_SIDE = 0x015,
|
||||
CSS_PROP_CLEAR = 0x016,
|
||||
CSS_PROP_CLIP = 0x017,
|
||||
CSS_PROP_COLOR = 0x018,
|
||||
CSS_PROP_CONTENT = 0x019,
|
||||
CSS_PROP_COUNTER_INCREMENT = 0x01a,
|
||||
CSS_PROP_COUNTER_RESET = 0x01b,
|
||||
CSS_PROP_CUE_AFTER = 0x01c,
|
||||
CSS_PROP_CUE_BEFORE = 0x01d,
|
||||
CSS_PROP_CURSOR = 0x01e,
|
||||
CSS_PROP_DIRECTION = 0x01f,
|
||||
CSS_PROP_DISPLAY = 0x020,
|
||||
CSS_PROP_ELEVATION = 0x021,
|
||||
CSS_PROP_EMPTY_CELLS = 0x022,
|
||||
CSS_PROP_FLOAT = 0x023,
|
||||
CSS_PROP_FONT_FAMILY = 0x024,
|
||||
CSS_PROP_FONT_SIZE = 0x025,
|
||||
CSS_PROP_FONT_STYLE = 0x026,
|
||||
CSS_PROP_FONT_VARIANT = 0x027,
|
||||
CSS_PROP_FONT_WEIGHT = 0x028,
|
||||
CSS_PROP_HEIGHT = 0x029,
|
||||
CSS_PROP_LEFT = 0x02a,
|
||||
CSS_PROP_LETTER_SPACING = 0x02b,
|
||||
CSS_PROP_LINE_HEIGHT = 0x02c,
|
||||
CSS_PROP_LIST_STYLE_IMAGE = 0x02d,
|
||||
CSS_PROP_LIST_STYLE_POSITION = 0x02e,
|
||||
CSS_PROP_LIST_STYLE_TYPE = 0x02f,
|
||||
CSS_PROP_MARGIN_TOP = 0x030,
|
||||
CSS_PROP_MARGIN_RIGHT = 0x031,
|
||||
CSS_PROP_MARGIN_BOTTOM = 0x032,
|
||||
CSS_PROP_MARGIN_LEFT = 0x033,
|
||||
CSS_PROP_MAX_HEIGHT = 0x034,
|
||||
CSS_PROP_MAX_WIDTH = 0x035,
|
||||
CSS_PROP_MIN_HEIGHT = 0x036,
|
||||
CSS_PROP_MIN_WIDTH = 0x037,
|
||||
CSS_PROP_ORPHANS = 0x038,
|
||||
CSS_PROP_OUTLINE_COLOR = 0x039,
|
||||
CSS_PROP_OUTLINE_STYLE = 0x03a,
|
||||
CSS_PROP_OUTLINE_WIDTH = 0x03b,
|
||||
CSS_PROP_OVERFLOW = 0x03c,
|
||||
CSS_PROP_PADDING_TOP = 0x03d,
|
||||
CSS_PROP_PADDING_RIGHT = 0x03e,
|
||||
CSS_PROP_PADDING_BOTTOM = 0x03f,
|
||||
CSS_PROP_PADDING_LEFT = 0x040,
|
||||
CSS_PROP_PAGE_BREAK_AFTER = 0x041,
|
||||
CSS_PROP_PAGE_BREAK_BEFORE = 0x042,
|
||||
CSS_PROP_PAGE_BREAK_INSIDE = 0x043,
|
||||
CSS_PROP_PAUSE_AFTER = 0x044,
|
||||
CSS_PROP_PAUSE_BEFORE = 0x045,
|
||||
CSS_PROP_PITCH_RANGE = 0x046,
|
||||
CSS_PROP_PITCH = 0x047,
|
||||
CSS_PROP_PLAY_DURING = 0x048,
|
||||
CSS_PROP_POSITION = 0x049,
|
||||
CSS_PROP_QUOTES = 0x04a,
|
||||
CSS_PROP_RICHNESS = 0x04b,
|
||||
CSS_PROP_RIGHT = 0x04c,
|
||||
CSS_PROP_SPEAK_HEADER = 0x04d,
|
||||
CSS_PROP_SPEAK_NUMERAL = 0x04e,
|
||||
CSS_PROP_SPEAK_PUNCTUATION = 0x04f,
|
||||
CSS_PROP_SPEAK = 0x050,
|
||||
CSS_PROP_SPEECH_RATE = 0x051,
|
||||
CSS_PROP_STRESS = 0x052,
|
||||
CSS_PROP_TABLE_LAYOUT = 0x053,
|
||||
CSS_PROP_TEXT_ALIGN = 0x054,
|
||||
CSS_PROP_TEXT_DECORATION = 0x055,
|
||||
CSS_PROP_TEXT_INDENT = 0x056,
|
||||
CSS_PROP_TEXT_TRANSFORM = 0x057,
|
||||
CSS_PROP_TOP = 0x058,
|
||||
CSS_PROP_UNICODE_BIDI = 0x059,
|
||||
CSS_PROP_VERTICAL_ALIGN = 0x05a,
|
||||
CSS_PROP_VISIBILITY = 0x05b,
|
||||
CSS_PROP_VOICE_FAMILY = 0x05c,
|
||||
CSS_PROP_VOLUME = 0x05d,
|
||||
CSS_PROP_WHITE_SPACE = 0x05e,
|
||||
CSS_PROP_WIDOWS = 0x05f,
|
||||
CSS_PROP_WIDTH = 0x060,
|
||||
CSS_PROP_WORD_SPACING = 0x061,
|
||||
CSS_PROP_Z_INDEX = 0x062,
|
||||
CSS_PROP_OPACITY = 0x063,
|
||||
CSS_PROP_BREAK_AFTER = 0x064,
|
||||
CSS_PROP_BREAK_BEFORE = 0x065,
|
||||
CSS_PROP_BREAK_INSIDE = 0x066,
|
||||
CSS_PROP_COLUMN_COUNT = 0x067,
|
||||
CSS_PROP_COLUMN_FILL = 0x068,
|
||||
CSS_PROP_COLUMN_GAP = 0x069,
|
||||
CSS_PROP_COLUMN_RULE_COLOR = 0x06a,
|
||||
CSS_PROP_COLUMN_RULE_STYLE = 0x06b,
|
||||
CSS_PROP_COLUMN_RULE_WIDTH = 0x06c,
|
||||
CSS_PROP_COLUMN_SPAN = 0x06d,
|
||||
CSS_PROP_COLUMN_WIDTH = 0x06e,
|
||||
|
||||
CSS_N_PROPERTIES
|
||||
};
|
||||
|
||||
|
||||
enum css_background_attachment_e {
|
||||
CSS_BACKGROUND_ATTACHMENT_INHERIT = 0x0,
|
||||
CSS_BACKGROUND_ATTACHMENT_FIXED = 0x1,
|
||||
CSS_BACKGROUND_ATTACHMENT_SCROLL = 0x2
|
||||
};
|
||||
|
||||
enum css_background_color_e {
|
||||
CSS_BACKGROUND_COLOR_INHERIT = 0x0,
|
||||
CSS_BACKGROUND_COLOR_COLOR = 0x1,
|
||||
CSS_BACKGROUND_COLOR_CURRENT_COLOR = 0x2
|
||||
};
|
||||
|
||||
enum css_background_image_e {
|
||||
CSS_BACKGROUND_IMAGE_INHERIT = 0x0,
|
||||
/* Consult pointer in struct to determine which */
|
||||
CSS_BACKGROUND_IMAGE_NONE = 0x1,
|
||||
CSS_BACKGROUND_IMAGE_IMAGE = 0x1
|
||||
};
|
||||
|
||||
enum css_background_position_e {
|
||||
CSS_BACKGROUND_POSITION_INHERIT = 0x0,
|
||||
CSS_BACKGROUND_POSITION_SET = 0x1
|
||||
};
|
||||
|
||||
enum css_background_repeat_e {
|
||||
CSS_BACKGROUND_REPEAT_INHERIT = 0x0,
|
||||
CSS_BACKGROUND_REPEAT_REPEAT_X = 0x1,
|
||||
CSS_BACKGROUND_REPEAT_REPEAT_Y = 0x2,
|
||||
CSS_BACKGROUND_REPEAT_REPEAT = 0x3,
|
||||
CSS_BACKGROUND_REPEAT_NO_REPEAT = 0x4
|
||||
};
|
||||
|
||||
enum css_border_collapse_e {
|
||||
CSS_BORDER_COLLAPSE_INHERIT = 0x0,
|
||||
CSS_BORDER_COLLAPSE_SEPARATE = 0x1,
|
||||
CSS_BORDER_COLLAPSE_COLLAPSE = 0x2
|
||||
};
|
||||
|
||||
enum css_border_spacing_e {
|
||||
CSS_BORDER_SPACING_INHERIT = 0x0,
|
||||
CSS_BORDER_SPACING_SET = 0x1
|
||||
};
|
||||
|
||||
enum css_border_color_e {
|
||||
CSS_BORDER_COLOR_INHERIT = CSS_BACKGROUND_COLOR_INHERIT,
|
||||
CSS_BORDER_COLOR_COLOR = CSS_BACKGROUND_COLOR_COLOR,
|
||||
CSS_BORDER_COLOR_CURRENT_COLOR = CSS_BACKGROUND_COLOR_CURRENT_COLOR
|
||||
};
|
||||
|
||||
enum css_border_style_e {
|
||||
CSS_BORDER_STYLE_INHERIT = 0x0,
|
||||
CSS_BORDER_STYLE_NONE = 0x1,
|
||||
CSS_BORDER_STYLE_HIDDEN = 0x2,
|
||||
CSS_BORDER_STYLE_DOTTED = 0x3,
|
||||
CSS_BORDER_STYLE_DASHED = 0x4,
|
||||
CSS_BORDER_STYLE_SOLID = 0x5,
|
||||
CSS_BORDER_STYLE_DOUBLE = 0x6,
|
||||
CSS_BORDER_STYLE_GROOVE = 0x7,
|
||||
CSS_BORDER_STYLE_RIDGE = 0x8,
|
||||
CSS_BORDER_STYLE_INSET = 0x9,
|
||||
CSS_BORDER_STYLE_OUTSET = 0xa
|
||||
};
|
||||
|
||||
enum css_border_width_e {
|
||||
CSS_BORDER_WIDTH_INHERIT = 0x0,
|
||||
CSS_BORDER_WIDTH_THIN = 0x1,
|
||||
CSS_BORDER_WIDTH_MEDIUM = 0x2,
|
||||
CSS_BORDER_WIDTH_THICK = 0x3,
|
||||
CSS_BORDER_WIDTH_WIDTH = 0x4
|
||||
};
|
||||
|
||||
enum css_bottom_e {
|
||||
CSS_BOTTOM_INHERIT = 0x0,
|
||||
CSS_BOTTOM_SET = 0x1,
|
||||
CSS_BOTTOM_AUTO = 0x2
|
||||
};
|
||||
|
||||
enum css_break_after_e {
|
||||
CSS_BREAK_AFTER_INHERIT = 0x0,
|
||||
CSS_BREAK_AFTER_AUTO = 0x1,
|
||||
CSS_BREAK_AFTER_AVOID = 0x2,
|
||||
CSS_BREAK_AFTER_ALWAYS = 0x3,
|
||||
CSS_BREAK_AFTER_LEFT = 0x4,
|
||||
CSS_BREAK_AFTER_RIGHT = 0x5,
|
||||
CSS_BREAK_AFTER_PAGE = 0x6,
|
||||
CSS_BREAK_AFTER_COLUMN = 0x7,
|
||||
CSS_BREAK_AFTER_AVOID_PAGE = 0x8,
|
||||
CSS_BREAK_AFTER_AVOID_COLUMN = 0x9
|
||||
};
|
||||
|
||||
enum css_break_before_e {
|
||||
CSS_BREAK_BEFORE_INHERIT = CSS_BREAK_AFTER_INHERIT,
|
||||
CSS_BREAK_BEFORE_AUTO = CSS_BREAK_AFTER_AUTO,
|
||||
CSS_BREAK_BEFORE_AVOID = CSS_BREAK_AFTER_AVOID,
|
||||
CSS_BREAK_BEFORE_ALWAYS = CSS_BREAK_AFTER_ALWAYS,
|
||||
CSS_BREAK_BEFORE_LEFT = CSS_BREAK_AFTER_LEFT,
|
||||
CSS_BREAK_BEFORE_RIGHT = CSS_BREAK_AFTER_RIGHT,
|
||||
CSS_BREAK_BEFORE_PAGE = CSS_BREAK_AFTER_PAGE,
|
||||
CSS_BREAK_BEFORE_COLUMN = CSS_BREAK_AFTER_COLUMN,
|
||||
CSS_BREAK_BEFORE_AVOID_PAGE = CSS_BREAK_AFTER_AVOID_PAGE,
|
||||
CSS_BREAK_BEFORE_AVOID_COLUMN = CSS_BREAK_AFTER_AVOID_COLUMN
|
||||
};
|
||||
|
||||
enum css_break_inside_e {
|
||||
CSS_BREAK_INSIDE_INHERIT = CSS_BREAK_AFTER_INHERIT,
|
||||
CSS_BREAK_INSIDE_AUTO = CSS_BREAK_AFTER_AUTO,
|
||||
CSS_BREAK_INSIDE_AVOID = CSS_BREAK_AFTER_AVOID,
|
||||
CSS_BREAK_INSIDE_AVOID_PAGE = CSS_BREAK_AFTER_AVOID_PAGE,
|
||||
CSS_BREAK_INSIDE_AVOID_COLUMN = CSS_BREAK_AFTER_AVOID_COLUMN
|
||||
};
|
||||
|
||||
enum css_caption_side_e {
|
||||
CSS_CAPTION_SIDE_INHERIT = 0x0,
|
||||
CSS_CAPTION_SIDE_TOP = 0x1,
|
||||
CSS_CAPTION_SIDE_BOTTOM = 0x2
|
||||
};
|
||||
|
||||
enum css_clear_e {
|
||||
CSS_CLEAR_INHERIT = 0x0,
|
||||
CSS_CLEAR_NONE = 0x1,
|
||||
CSS_CLEAR_LEFT = 0x2,
|
||||
CSS_CLEAR_RIGHT = 0x3,
|
||||
CSS_CLEAR_BOTH = 0x4
|
||||
};
|
||||
|
||||
enum css_clip_e {
|
||||
CSS_CLIP_INHERIT = 0x0,
|
||||
CSS_CLIP_AUTO = 0x1,
|
||||
CSS_CLIP_RECT = 0x2
|
||||
};
|
||||
|
||||
enum css_color_e {
|
||||
CSS_COLOR_INHERIT = 0x0,
|
||||
CSS_COLOR_COLOR = 0x1
|
||||
};
|
||||
|
||||
enum css_column_count_e {
|
||||
CSS_COLUMN_COUNT_INHERIT = 0x0,
|
||||
CSS_COLUMN_COUNT_AUTO = 0x1,
|
||||
CSS_COLUMN_COUNT_SET = 0x2
|
||||
};
|
||||
|
||||
enum css_column_fill_e {
|
||||
CSS_COLUMN_FILL_INHERIT = 0x0,
|
||||
CSS_COLUMN_FILL_BALANCE = 0x1,
|
||||
CSS_COLUMN_FILL_AUTO = 0x2
|
||||
};
|
||||
|
||||
enum css_column_gap_e {
|
||||
CSS_COLUMN_GAP_INHERIT = 0x0,
|
||||
CSS_COLUMN_GAP_NORMAL = 0x1,
|
||||
CSS_COLUMN_GAP_SET = 0x2
|
||||
};
|
||||
|
||||
enum css_column_rule_color_e {
|
||||
CSS_COLUMN_RULE_COLOR_INHERIT = CSS_BACKGROUND_COLOR_INHERIT,
|
||||
CSS_COLUMN_RULE_COLOR_COLOR = CSS_BACKGROUND_COLOR_COLOR,
|
||||
CSS_COLUMN_RULE_COLOR_CURRENT_COLOR = CSS_BACKGROUND_COLOR_CURRENT_COLOR
|
||||
};
|
||||
|
||||
enum css_column_rule_style_e {
|
||||
CSS_COLUMN_RULE_STYLE_INHERIT = CSS_BORDER_STYLE_INHERIT,
|
||||
CSS_COLUMN_RULE_STYLE_NONE = CSS_BORDER_STYLE_NONE,
|
||||
CSS_COLUMN_RULE_STYLE_DOTTED = CSS_BORDER_STYLE_DOTTED,
|
||||
CSS_COLUMN_RULE_STYLE_DASHED = CSS_BORDER_STYLE_DASHED,
|
||||
CSS_COLUMN_RULE_STYLE_SOLID = CSS_BORDER_STYLE_SOLID,
|
||||
CSS_COLUMN_RULE_STYLE_DOUBLE = CSS_BORDER_STYLE_DOUBLE,
|
||||
CSS_COLUMN_RULE_STYLE_GROOVE = CSS_BORDER_STYLE_GROOVE,
|
||||
CSS_COLUMN_RULE_STYLE_RIDGE = CSS_BORDER_STYLE_RIDGE,
|
||||
CSS_COLUMN_RULE_STYLE_INSET = CSS_BORDER_STYLE_INSET,
|
||||
CSS_COLUMN_RULE_STYLE_OUTSET = CSS_BORDER_STYLE_OUTSET
|
||||
};
|
||||
|
||||
enum css_column_rule_width_e {
|
||||
CSS_COLUMN_RULE_WIDTH_INHERIT = CSS_BORDER_WIDTH_INHERIT,
|
||||
CSS_COLUMN_RULE_WIDTH_THIN = CSS_BORDER_WIDTH_THIN,
|
||||
CSS_COLUMN_RULE_WIDTH_MEDIUM = CSS_BORDER_WIDTH_MEDIUM,
|
||||
CSS_COLUMN_RULE_WIDTH_THICK = CSS_BORDER_WIDTH_THICK,
|
||||
CSS_COLUMN_RULE_WIDTH_WIDTH = CSS_BORDER_WIDTH_WIDTH
|
||||
};
|
||||
|
||||
enum css_column_span_e {
|
||||
CSS_COLUMN_SPAN_INHERIT = 0x0,
|
||||
CSS_COLUMN_SPAN_NONE = 0x1,
|
||||
CSS_COLUMN_SPAN_ALL = 0x2
|
||||
};
|
||||
|
||||
enum css_column_width_e {
|
||||
CSS_COLUMN_WIDTH_INHERIT = 0x0,
|
||||
CSS_COLUMN_WIDTH_AUTO = 0x1,
|
||||
CSS_COLUMN_WIDTH_SET = 0x2
|
||||
};
|
||||
|
||||
enum css_content_e {
|
||||
CSS_CONTENT_INHERIT = 0x0,
|
||||
CSS_CONTENT_NONE = 0x1,
|
||||
CSS_CONTENT_NORMAL = 0x2,
|
||||
CSS_CONTENT_SET = 0x3
|
||||
};
|
||||
|
||||
enum css_counter_increment_e {
|
||||
CSS_COUNTER_INCREMENT_INHERIT = 0x0,
|
||||
/* Consult pointer in struct to determine which */
|
||||
CSS_COUNTER_INCREMENT_NAMED = 0x1,
|
||||
CSS_COUNTER_INCREMENT_NONE = 0x1
|
||||
};
|
||||
|
||||
enum css_counter_reset_e {
|
||||
CSS_COUNTER_RESET_INHERIT = 0x0,
|
||||
/* Consult pointer in struct to determine which */
|
||||
CSS_COUNTER_RESET_NAMED = 0x1,
|
||||
CSS_COUNTER_RESET_NONE = 0x1
|
||||
};
|
||||
|
||||
enum css_cursor_e {
|
||||
CSS_CURSOR_INHERIT = 0x00,
|
||||
/* URLs exist if pointer is non-NULL */
|
||||
CSS_CURSOR_AUTO = 0x01,
|
||||
CSS_CURSOR_CROSSHAIR = 0x02,
|
||||
CSS_CURSOR_DEFAULT = 0x03,
|
||||
CSS_CURSOR_POINTER = 0x04,
|
||||
CSS_CURSOR_MOVE = 0x05,
|
||||
CSS_CURSOR_E_RESIZE = 0x06,
|
||||
CSS_CURSOR_NE_RESIZE = 0x07,
|
||||
CSS_CURSOR_NW_RESIZE = 0x08,
|
||||
CSS_CURSOR_N_RESIZE = 0x09,
|
||||
CSS_CURSOR_SE_RESIZE = 0x0a,
|
||||
CSS_CURSOR_SW_RESIZE = 0x0b,
|
||||
CSS_CURSOR_S_RESIZE = 0x0c,
|
||||
CSS_CURSOR_W_RESIZE = 0x0d,
|
||||
CSS_CURSOR_TEXT = 0x0e,
|
||||
CSS_CURSOR_WAIT = 0x0f,
|
||||
CSS_CURSOR_HELP = 0x10,
|
||||
CSS_CURSOR_PROGRESS = 0x11
|
||||
};
|
||||
|
||||
enum css_direction_e {
|
||||
CSS_DIRECTION_INHERIT = 0x0,
|
||||
CSS_DIRECTION_LTR = 0x1,
|
||||
CSS_DIRECTION_RTL = 0x2
|
||||
};
|
||||
|
||||
enum css_display_e {
|
||||
CSS_DISPLAY_INHERIT = 0x00,
|
||||
CSS_DISPLAY_INLINE = 0x01,
|
||||
CSS_DISPLAY_BLOCK = 0x02,
|
||||
CSS_DISPLAY_LIST_ITEM = 0x03,
|
||||
CSS_DISPLAY_RUN_IN = 0x04,
|
||||
CSS_DISPLAY_INLINE_BLOCK = 0x05,
|
||||
CSS_DISPLAY_TABLE = 0x06,
|
||||
CSS_DISPLAY_INLINE_TABLE = 0x07,
|
||||
CSS_DISPLAY_TABLE_ROW_GROUP = 0x08,
|
||||
CSS_DISPLAY_TABLE_HEADER_GROUP = 0x09,
|
||||
CSS_DISPLAY_TABLE_FOOTER_GROUP = 0x0a,
|
||||
CSS_DISPLAY_TABLE_ROW = 0x0b,
|
||||
CSS_DISPLAY_TABLE_COLUMN_GROUP = 0x0c,
|
||||
CSS_DISPLAY_TABLE_COLUMN = 0x0d,
|
||||
CSS_DISPLAY_TABLE_CELL = 0x0e,
|
||||
CSS_DISPLAY_TABLE_CAPTION = 0x0f,
|
||||
CSS_DISPLAY_NONE = 0x10
|
||||
};
|
||||
|
||||
enum css_empty_cells_e {
|
||||
CSS_EMPTY_CELLS_INHERIT = 0x0,
|
||||
CSS_EMPTY_CELLS_SHOW = 0x1,
|
||||
CSS_EMPTY_CELLS_HIDE = 0x2
|
||||
};
|
||||
|
||||
enum css_float_e {
|
||||
CSS_FLOAT_INHERIT = 0x0,
|
||||
CSS_FLOAT_LEFT = 0x1,
|
||||
CSS_FLOAT_RIGHT = 0x2,
|
||||
CSS_FLOAT_NONE = 0x3
|
||||
};
|
||||
|
||||
enum css_font_family_e {
|
||||
CSS_FONT_FAMILY_INHERIT = 0x0,
|
||||
/* Named fonts exist if pointer is non-NULL */
|
||||
CSS_FONT_FAMILY_SERIF = 0x1,
|
||||
CSS_FONT_FAMILY_SANS_SERIF = 0x2,
|
||||
CSS_FONT_FAMILY_CURSIVE = 0x3,
|
||||
CSS_FONT_FAMILY_FANTASY = 0x4,
|
||||
CSS_FONT_FAMILY_MONOSPACE = 0x5
|
||||
};
|
||||
|
||||
enum css_font_size_e {
|
||||
CSS_FONT_SIZE_INHERIT = 0x0,
|
||||
CSS_FONT_SIZE_XX_SMALL = 0x1,
|
||||
CSS_FONT_SIZE_X_SMALL = 0x2,
|
||||
CSS_FONT_SIZE_SMALL = 0x3,
|
||||
CSS_FONT_SIZE_MEDIUM = 0x4,
|
||||
CSS_FONT_SIZE_LARGE = 0x5,
|
||||
CSS_FONT_SIZE_X_LARGE = 0x6,
|
||||
CSS_FONT_SIZE_XX_LARGE = 0x7,
|
||||
CSS_FONT_SIZE_LARGER = 0x8,
|
||||
CSS_FONT_SIZE_SMALLER = 0x9,
|
||||
CSS_FONT_SIZE_DIMENSION = 0xa
|
||||
};
|
||||
|
||||
enum css_font_style_e {
|
||||
CSS_FONT_STYLE_INHERIT = 0x0,
|
||||
CSS_FONT_STYLE_NORMAL = 0x1,
|
||||
CSS_FONT_STYLE_ITALIC = 0x2,
|
||||
CSS_FONT_STYLE_OBLIQUE = 0x3
|
||||
};
|
||||
|
||||
enum css_font_variant_e {
|
||||
CSS_FONT_VARIANT_INHERIT = 0x0,
|
||||
CSS_FONT_VARIANT_NORMAL = 0x1,
|
||||
CSS_FONT_VARIANT_SMALL_CAPS = 0x2
|
||||
};
|
||||
|
||||
enum css_font_weight_e {
|
||||
CSS_FONT_WEIGHT_INHERIT = 0x0,
|
||||
CSS_FONT_WEIGHT_NORMAL = 0x1,
|
||||
CSS_FONT_WEIGHT_BOLD = 0x2,
|
||||
CSS_FONT_WEIGHT_BOLDER = 0x3,
|
||||
CSS_FONT_WEIGHT_LIGHTER = 0x4,
|
||||
CSS_FONT_WEIGHT_100 = 0x5,
|
||||
CSS_FONT_WEIGHT_200 = 0x6,
|
||||
CSS_FONT_WEIGHT_300 = 0x7,
|
||||
CSS_FONT_WEIGHT_400 = 0x8,
|
||||
CSS_FONT_WEIGHT_500 = 0x9,
|
||||
CSS_FONT_WEIGHT_600 = 0xa,
|
||||
CSS_FONT_WEIGHT_700 = 0xb,
|
||||
CSS_FONT_WEIGHT_800 = 0xc,
|
||||
CSS_FONT_WEIGHT_900 = 0xd
|
||||
};
|
||||
|
||||
enum css_height_e {
|
||||
CSS_HEIGHT_INHERIT = 0x0,
|
||||
CSS_HEIGHT_SET = 0x1,
|
||||
CSS_HEIGHT_AUTO = 0x2
|
||||
};
|
||||
|
||||
enum css_left_e {
|
||||
CSS_LEFT_INHERIT = 0x0,
|
||||
CSS_LEFT_SET = 0x1,
|
||||
CSS_LEFT_AUTO = 0x2
|
||||
};
|
||||
|
||||
enum css_letter_spacing_e {
|
||||
CSS_LETTER_SPACING_INHERIT = 0x0,
|
||||
CSS_LETTER_SPACING_SET = 0x1,
|
||||
CSS_LETTER_SPACING_NORMAL = 0x2
|
||||
};
|
||||
|
||||
enum css_line_height_e {
|
||||
CSS_LINE_HEIGHT_INHERIT = 0x0,
|
||||
CSS_LINE_HEIGHT_NUMBER = 0x1,
|
||||
CSS_LINE_HEIGHT_DIMENSION = 0x2,
|
||||
CSS_LINE_HEIGHT_NORMAL = 0x3
|
||||
};
|
||||
|
||||
enum css_list_style_image_e {
|
||||
CSS_LIST_STYLE_IMAGE_INHERIT = 0x0,
|
||||
/* Consult pointer in struct to determine which */
|
||||
CSS_LIST_STYLE_IMAGE_URI = 0x1,
|
||||
CSS_LIST_STYLE_IMAGE_NONE = 0x1
|
||||
};
|
||||
|
||||
enum css_list_style_position_e {
|
||||
CSS_LIST_STYLE_POSITION_INHERIT = 0x0,
|
||||
CSS_LIST_STYLE_POSITION_INSIDE = 0x1,
|
||||
CSS_LIST_STYLE_POSITION_OUTSIDE = 0x2
|
||||
};
|
||||
|
||||
enum css_list_style_type_e {
|
||||
CSS_LIST_STYLE_TYPE_INHERIT = 0x0,
|
||||
CSS_LIST_STYLE_TYPE_DISC = 0x1,
|
||||
CSS_LIST_STYLE_TYPE_CIRCLE = 0x2,
|
||||
CSS_LIST_STYLE_TYPE_SQUARE = 0x3,
|
||||
CSS_LIST_STYLE_TYPE_DECIMAL = 0x4,
|
||||
CSS_LIST_STYLE_TYPE_DECIMAL_LEADING_ZERO= 0x5,
|
||||
CSS_LIST_STYLE_TYPE_LOWER_ROMAN = 0x6,
|
||||
CSS_LIST_STYLE_TYPE_UPPER_ROMAN = 0x7,
|
||||
CSS_LIST_STYLE_TYPE_LOWER_GREEK = 0x8,
|
||||
CSS_LIST_STYLE_TYPE_LOWER_LATIN = 0x9,
|
||||
CSS_LIST_STYLE_TYPE_UPPER_LATIN = 0xa,
|
||||
CSS_LIST_STYLE_TYPE_ARMENIAN = 0xb,
|
||||
CSS_LIST_STYLE_TYPE_GEORGIAN = 0xc,
|
||||
CSS_LIST_STYLE_TYPE_LOWER_ALPHA = 0xd,
|
||||
CSS_LIST_STYLE_TYPE_UPPER_ALPHA = 0xe,
|
||||
CSS_LIST_STYLE_TYPE_NONE = 0xf
|
||||
};
|
||||
|
||||
enum css_margin_e {
|
||||
CSS_MARGIN_INHERIT = 0x0,
|
||||
CSS_MARGIN_SET = 0x1,
|
||||
CSS_MARGIN_AUTO = 0x2
|
||||
};
|
||||
|
||||
enum css_max_height_e {
|
||||
CSS_MAX_HEIGHT_INHERIT = 0x0,
|
||||
CSS_MAX_HEIGHT_SET = 0x1,
|
||||
CSS_MAX_HEIGHT_NONE = 0x2
|
||||
};
|
||||
|
||||
enum css_max_width_e {
|
||||
CSS_MAX_WIDTH_INHERIT = 0x0,
|
||||
CSS_MAX_WIDTH_SET = 0x1,
|
||||
CSS_MAX_WIDTH_NONE = 0x2
|
||||
};
|
||||
|
||||
enum css_min_height_e {
|
||||
CSS_MIN_HEIGHT_INHERIT = 0x0,
|
||||
CSS_MIN_HEIGHT_SET = 0x1
|
||||
};
|
||||
|
||||
enum css_min_width_e {
|
||||
CSS_MIN_WIDTH_INHERIT = 0x0,
|
||||
CSS_MIN_WIDTH_SET = 0x1
|
||||
};
|
||||
|
||||
enum css_opacity_e {
|
||||
CSS_OPACITY_INHERIT = 0x0,
|
||||
CSS_OPACITY_SET = 0x1
|
||||
};
|
||||
|
||||
enum css_outline_color_e {
|
||||
CSS_OUTLINE_COLOR_INHERIT = CSS_BACKGROUND_COLOR_INHERIT,
|
||||
CSS_OUTLINE_COLOR_COLOR = CSS_BACKGROUND_COLOR_COLOR,
|
||||
CSS_OUTLINE_COLOR_CURRENT_COLOR = CSS_BACKGROUND_COLOR_CURRENT_COLOR,
|
||||
CSS_OUTLINE_COLOR_INVERT = 0x3
|
||||
};
|
||||
|
||||
enum css_outline_style_e {
|
||||
CSS_OUTLINE_STYLE_INHERIT = CSS_BORDER_STYLE_INHERIT,
|
||||
CSS_OUTLINE_STYLE_NONE = CSS_BORDER_STYLE_NONE,
|
||||
CSS_OUTLINE_STYLE_DOTTED = CSS_BORDER_STYLE_DOTTED,
|
||||
CSS_OUTLINE_STYLE_DASHED = CSS_BORDER_STYLE_DASHED,
|
||||
CSS_OUTLINE_STYLE_SOLID = CSS_BORDER_STYLE_SOLID,
|
||||
CSS_OUTLINE_STYLE_DOUBLE = CSS_BORDER_STYLE_DOUBLE,
|
||||
CSS_OUTLINE_STYLE_GROOVE = CSS_BORDER_STYLE_GROOVE,
|
||||
CSS_OUTLINE_STYLE_RIDGE = CSS_BORDER_STYLE_RIDGE,
|
||||
CSS_OUTLINE_STYLE_INSET = CSS_BORDER_STYLE_INSET,
|
||||
CSS_OUTLINE_STYLE_OUTSET = CSS_BORDER_STYLE_OUTSET
|
||||
};
|
||||
|
||||
enum css_outline_width_e {
|
||||
CSS_OUTLINE_WIDTH_INHERIT = CSS_BORDER_WIDTH_INHERIT,
|
||||
CSS_OUTLINE_WIDTH_THIN = CSS_BORDER_WIDTH_THIN,
|
||||
CSS_OUTLINE_WIDTH_MEDIUM = CSS_BORDER_WIDTH_MEDIUM,
|
||||
CSS_OUTLINE_WIDTH_THICK = CSS_BORDER_WIDTH_THICK,
|
||||
CSS_OUTLINE_WIDTH_WIDTH = CSS_BORDER_WIDTH_WIDTH
|
||||
};
|
||||
|
||||
enum css_overflow_e {
|
||||
CSS_OVERFLOW_INHERIT = 0x0,
|
||||
CSS_OVERFLOW_VISIBLE = 0x1,
|
||||
CSS_OVERFLOW_HIDDEN = 0x2,
|
||||
CSS_OVERFLOW_SCROLL = 0x3,
|
||||
CSS_OVERFLOW_AUTO = 0x4
|
||||
};
|
||||
|
||||
enum css_orphans_e {
|
||||
CSS_ORPHANS_INHERIT = 0x0,
|
||||
CSS_ORPHANS_SET = 0x1
|
||||
};
|
||||
|
||||
enum css_padding_e {
|
||||
CSS_PADDING_INHERIT = 0x0,
|
||||
CSS_PADDING_SET = 0x1
|
||||
};
|
||||
|
||||
enum css_page_break_after_e {
|
||||
CSS_PAGE_BREAK_AFTER_INHERIT = CSS_BREAK_AFTER_INHERIT,
|
||||
CSS_PAGE_BREAK_AFTER_AUTO = CSS_BREAK_AFTER_AUTO,
|
||||
CSS_PAGE_BREAK_AFTER_AVOID = CSS_BREAK_AFTER_AVOID,
|
||||
CSS_PAGE_BREAK_AFTER_ALWAYS = CSS_BREAK_AFTER_ALWAYS,
|
||||
CSS_PAGE_BREAK_AFTER_LEFT = CSS_BREAK_AFTER_LEFT,
|
||||
CSS_PAGE_BREAK_AFTER_RIGHT = CSS_BREAK_AFTER_RIGHT
|
||||
};
|
||||
|
||||
enum css_page_break_before_e {
|
||||
CSS_PAGE_BREAK_BEFORE_INHERIT = CSS_BREAK_AFTER_INHERIT,
|
||||
CSS_PAGE_BREAK_BEFORE_AUTO = CSS_BREAK_AFTER_AUTO,
|
||||
CSS_PAGE_BREAK_BEFORE_AVOID = CSS_BREAK_AFTER_AVOID,
|
||||
CSS_PAGE_BREAK_BEFORE_ALWAYS = CSS_BREAK_AFTER_ALWAYS,
|
||||
CSS_PAGE_BREAK_BEFORE_LEFT = CSS_BREAK_AFTER_LEFT,
|
||||
CSS_PAGE_BREAK_BEFORE_RIGHT = CSS_BREAK_AFTER_RIGHT
|
||||
};
|
||||
|
||||
enum css_page_break_inside_e {
|
||||
CSS_PAGE_BREAK_INSIDE_INHERIT = CSS_BREAK_AFTER_INHERIT,
|
||||
CSS_PAGE_BREAK_INSIDE_AUTO = CSS_BREAK_AFTER_AUTO,
|
||||
CSS_PAGE_BREAK_INSIDE_AVOID = CSS_BREAK_AFTER_AVOID
|
||||
};
|
||||
|
||||
enum css_position_e {
|
||||
CSS_POSITION_INHERIT = 0x0,
|
||||
CSS_POSITION_STATIC = 0x1,
|
||||
CSS_POSITION_RELATIVE = 0x2,
|
||||
CSS_POSITION_ABSOLUTE = 0x3,
|
||||
CSS_POSITION_FIXED = 0x4
|
||||
};
|
||||
|
||||
enum css_quotes_e {
|
||||
CSS_QUOTES_INHERIT = 0x0,
|
||||
/* Consult pointer in struct to determine which */
|
||||
CSS_QUOTES_STRING = 0x1,
|
||||
CSS_QUOTES_NONE = 0x1
|
||||
};
|
||||
|
||||
enum css_right_e {
|
||||
CSS_RIGHT_INHERIT = 0x0,
|
||||
CSS_RIGHT_SET = 0x1,
|
||||
CSS_RIGHT_AUTO = 0x2
|
||||
};
|
||||
|
||||
enum css_table_layout_e {
|
||||
CSS_TABLE_LAYOUT_INHERIT = 0x0,
|
||||
CSS_TABLE_LAYOUT_AUTO = 0x1,
|
||||
CSS_TABLE_LAYOUT_FIXED = 0x2
|
||||
};
|
||||
|
||||
enum css_text_align_e {
|
||||
CSS_TEXT_ALIGN_INHERIT = 0x0,
|
||||
CSS_TEXT_ALIGN_INHERIT_IF_NON_MAGIC = 0x1,
|
||||
CSS_TEXT_ALIGN_LEFT = 0x2,
|
||||
CSS_TEXT_ALIGN_RIGHT = 0x3,
|
||||
CSS_TEXT_ALIGN_CENTER = 0x4,
|
||||
CSS_TEXT_ALIGN_JUSTIFY = 0x5,
|
||||
CSS_TEXT_ALIGN_DEFAULT = 0x6,
|
||||
CSS_TEXT_ALIGN_LIBCSS_LEFT = 0x7,
|
||||
CSS_TEXT_ALIGN_LIBCSS_CENTER = 0x8,
|
||||
CSS_TEXT_ALIGN_LIBCSS_RIGHT = 0x9
|
||||
};
|
||||
|
||||
enum css_text_decoration_e {
|
||||
CSS_TEXT_DECORATION_INHERIT = 0x00,
|
||||
CSS_TEXT_DECORATION_NONE = 0x10,
|
||||
CSS_TEXT_DECORATION_BLINK = (1<<3),
|
||||
CSS_TEXT_DECORATION_LINE_THROUGH = (1<<2),
|
||||
CSS_TEXT_DECORATION_OVERLINE = (1<<1),
|
||||
CSS_TEXT_DECORATION_UNDERLINE = (1<<0)
|
||||
};
|
||||
|
||||
enum css_text_indent_e {
|
||||
CSS_TEXT_INDENT_INHERIT = 0x0,
|
||||
CSS_TEXT_INDENT_SET = 0x1
|
||||
};
|
||||
|
||||
enum css_text_transform_e {
|
||||
CSS_TEXT_TRANSFORM_INHERIT = 0x0,
|
||||
CSS_TEXT_TRANSFORM_CAPITALIZE = 0x1,
|
||||
CSS_TEXT_TRANSFORM_UPPERCASE = 0x2,
|
||||
CSS_TEXT_TRANSFORM_LOWERCASE = 0x3,
|
||||
CSS_TEXT_TRANSFORM_NONE = 0x4
|
||||
};
|
||||
|
||||
enum css_top_e {
|
||||
CSS_TOP_INHERIT = 0x0,
|
||||
CSS_TOP_SET = 0x1,
|
||||
CSS_TOP_AUTO = 0x2
|
||||
};
|
||||
|
||||
enum css_unicode_bidi_e {
|
||||
CSS_UNICODE_BIDI_INHERIT = 0x0,
|
||||
CSS_UNICODE_BIDI_NORMAL = 0x1,
|
||||
CSS_UNICODE_BIDI_EMBED = 0x2,
|
||||
CSS_UNICODE_BIDI_BIDI_OVERRIDE = 0x3
|
||||
};
|
||||
|
||||
enum css_vertical_align_e {
|
||||
CSS_VERTICAL_ALIGN_INHERIT = 0x0,
|
||||
CSS_VERTICAL_ALIGN_BASELINE = 0x1,
|
||||
CSS_VERTICAL_ALIGN_SUB = 0x2,
|
||||
CSS_VERTICAL_ALIGN_SUPER = 0x3,
|
||||
CSS_VERTICAL_ALIGN_TOP = 0x4,
|
||||
CSS_VERTICAL_ALIGN_TEXT_TOP = 0x5,
|
||||
CSS_VERTICAL_ALIGN_MIDDLE = 0x6,
|
||||
CSS_VERTICAL_ALIGN_BOTTOM = 0x7,
|
||||
CSS_VERTICAL_ALIGN_TEXT_BOTTOM = 0x8,
|
||||
CSS_VERTICAL_ALIGN_SET = 0x9
|
||||
};
|
||||
|
||||
enum css_visibility_e {
|
||||
CSS_VISIBILITY_INHERIT = 0x0,
|
||||
CSS_VISIBILITY_VISIBLE = 0x1,
|
||||
CSS_VISIBILITY_HIDDEN = 0x2,
|
||||
CSS_VISIBILITY_COLLAPSE = 0x3
|
||||
};
|
||||
|
||||
enum css_white_space_e {
|
||||
CSS_WHITE_SPACE_INHERIT = 0x0,
|
||||
CSS_WHITE_SPACE_NORMAL = 0x1,
|
||||
CSS_WHITE_SPACE_PRE = 0x2,
|
||||
CSS_WHITE_SPACE_NOWRAP = 0x3,
|
||||
CSS_WHITE_SPACE_PRE_WRAP = 0x4,
|
||||
CSS_WHITE_SPACE_PRE_LINE = 0x5
|
||||
};
|
||||
|
||||
enum css_widows_e {
|
||||
CSS_WIDOWS_INHERIT = 0x0,
|
||||
CSS_WIDOWS_SET = 0x1
|
||||
};
|
||||
|
||||
enum css_width_e {
|
||||
CSS_WIDTH_INHERIT = 0x0,
|
||||
CSS_WIDTH_SET = 0x1,
|
||||
CSS_WIDTH_AUTO = 0x2
|
||||
};
|
||||
|
||||
enum css_word_spacing_e {
|
||||
CSS_WORD_SPACING_INHERIT = 0x0,
|
||||
CSS_WORD_SPACING_SET = 0x1,
|
||||
CSS_WORD_SPACING_NORMAL = 0x2
|
||||
};
|
||||
|
||||
enum css_z_index_e {
|
||||
CSS_Z_INDEX_INHERIT = 0x0,
|
||||
CSS_Z_INDEX_SET = 0x1,
|
||||
CSS_Z_INDEX_AUTO = 0x2
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
180
programs/network/netsurf/include/libcss/select.h
Normal file
180
programs/network/netsurf/include/libcss/select.h
Normal file
@ -0,0 +1,180 @@
|
||||
/*
|
||||
* This file is part of LibCSS
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef libcss_select_h_
|
||||
#define libcss_select_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <libcss/errors.h>
|
||||
#include <libcss/functypes.h>
|
||||
#include <libcss/hint.h>
|
||||
#include <libcss/types.h>
|
||||
#include <libcss/computed.h>
|
||||
|
||||
typedef enum css_pseudo_element {
|
||||
CSS_PSEUDO_ELEMENT_NONE = 0,
|
||||
CSS_PSEUDO_ELEMENT_FIRST_LINE = 1,
|
||||
CSS_PSEUDO_ELEMENT_FIRST_LETTER = 2,
|
||||
CSS_PSEUDO_ELEMENT_BEFORE = 3,
|
||||
CSS_PSEUDO_ELEMENT_AFTER = 4,
|
||||
|
||||
CSS_PSEUDO_ELEMENT_COUNT = 5 /**< Number of pseudo elements */
|
||||
} css_pseudo_element;
|
||||
|
||||
/**
|
||||
* Style selection result set
|
||||
*/
|
||||
typedef struct css_select_results {
|
||||
css_allocator_fn alloc;
|
||||
void *pw;
|
||||
|
||||
/**
|
||||
* Array of pointers to computed styles,
|
||||
* indexed by css_pseudo_element. If there
|
||||
* was no styling for a given pseudo element,
|
||||
* then no computed style will be created and
|
||||
* the corresponding pointer will be set to NULL
|
||||
*/
|
||||
css_computed_style *styles[CSS_PSEUDO_ELEMENT_COUNT];
|
||||
} css_select_results;
|
||||
|
||||
typedef enum css_select_handler_version {
|
||||
CSS_SELECT_HANDLER_VERSION_1 = 1
|
||||
} css_select_handler_version;
|
||||
|
||||
typedef struct css_select_handler {
|
||||
/** ABI version of this structure */
|
||||
uint32_t handler_version;
|
||||
|
||||
css_error (*node_name)(void *pw, void *node,
|
||||
css_qname *qname);
|
||||
css_error (*node_classes)(void *pw, void *node,
|
||||
lwc_string ***classes,
|
||||
uint32_t *n_classes);
|
||||
css_error (*node_id)(void *pw, void *node,
|
||||
lwc_string **id);
|
||||
|
||||
css_error (*named_ancestor_node)(void *pw, void *node,
|
||||
const css_qname *qname, void **ancestor);
|
||||
css_error (*named_parent_node)(void *pw, void *node,
|
||||
const css_qname *qname, void **parent);
|
||||
css_error (*named_sibling_node)(void *pw, void *node,
|
||||
const css_qname *qname, void **sibling);
|
||||
css_error (*named_generic_sibling_node)(void *pw, void *node,
|
||||
const css_qname *qname, void **sibling);
|
||||
|
||||
css_error (*parent_node)(void *pw, void *node, void **parent);
|
||||
css_error (*sibling_node)(void *pw, void *node, void **sibling);
|
||||
|
||||
css_error (*node_has_name)(void *pw, void *node,
|
||||
const css_qname *qname, bool *match);
|
||||
css_error (*node_has_class)(void *pw, void *node,
|
||||
lwc_string *name, bool *match);
|
||||
css_error (*node_has_id)(void *pw, void *node,
|
||||
lwc_string *name, bool *match);
|
||||
css_error (*node_has_attribute)(void *pw, void *node,
|
||||
const css_qname *qname, bool *match);
|
||||
css_error (*node_has_attribute_equal)(void *pw, void *node,
|
||||
const css_qname *qname, lwc_string *value,
|
||||
bool *match);
|
||||
css_error (*node_has_attribute_dashmatch)(void *pw, void *node,
|
||||
const css_qname *qname, lwc_string *value,
|
||||
bool *match);
|
||||
css_error (*node_has_attribute_includes)(void *pw, void *node,
|
||||
const css_qname *qname, lwc_string *value,
|
||||
bool *match);
|
||||
css_error (*node_has_attribute_prefix)(void *pw, void *node,
|
||||
const css_qname *qname, lwc_string *value,
|
||||
bool *match);
|
||||
css_error (*node_has_attribute_suffix)(void *pw, void *node,
|
||||
const css_qname *qname, lwc_string *value,
|
||||
bool *match);
|
||||
css_error (*node_has_attribute_substring)(void *pw, void *node,
|
||||
const css_qname *qname, lwc_string *value,
|
||||
bool *match);
|
||||
|
||||
css_error (*node_is_root)(void *pw, void *node, bool *match);
|
||||
css_error (*node_count_siblings)(void *pw, void *node,
|
||||
bool same_name, bool after, int32_t *count);
|
||||
css_error (*node_is_empty)(void *pw, void *node, bool *match);
|
||||
|
||||
css_error (*node_is_link)(void *pw, void *node, bool *match);
|
||||
css_error (*node_is_visited)(void *pw, void *node, bool *match);
|
||||
css_error (*node_is_hover)(void *pw, void *node, bool *match);
|
||||
css_error (*node_is_active)(void *pw, void *node, bool *match);
|
||||
css_error (*node_is_focus)(void *pw, void *node, bool *match);
|
||||
|
||||
css_error (*node_is_enabled)(void *pw, void *node, bool *match);
|
||||
css_error (*node_is_disabled)(void *pw, void *node, bool *match);
|
||||
css_error (*node_is_checked)(void *pw, void *node, bool *match);
|
||||
|
||||
css_error (*node_is_target)(void *pw, void *node, bool *match);
|
||||
css_error (*node_is_lang)(void *pw, void *node,
|
||||
lwc_string *lang, bool *match);
|
||||
|
||||
css_error (*node_presentational_hint)(void *pw, void *node,
|
||||
uint32_t property, css_hint *hint);
|
||||
|
||||
css_error (*ua_default_for_property)(void *pw, uint32_t property,
|
||||
css_hint *hint);
|
||||
|
||||
css_error (*compute_font_size)(void *pw, const css_hint *parent,
|
||||
css_hint *size);
|
||||
} css_select_handler;
|
||||
|
||||
/**
|
||||
* Font face selection result set
|
||||
*/
|
||||
typedef struct css_select_font_faces_results {
|
||||
css_allocator_fn alloc;
|
||||
void *pw;
|
||||
|
||||
/**
|
||||
* Array of pointers to computed font faces.
|
||||
*/
|
||||
css_font_face **font_faces;
|
||||
uint32_t n_font_faces;
|
||||
} css_select_font_faces_results;
|
||||
|
||||
css_error css_select_ctx_create(css_allocator_fn alloc, void *pw,
|
||||
css_select_ctx **result);
|
||||
css_error css_select_ctx_destroy(css_select_ctx *ctx);
|
||||
|
||||
css_error css_select_ctx_append_sheet(css_select_ctx *ctx,
|
||||
const css_stylesheet *sheet,
|
||||
css_origin origin, uint64_t media);
|
||||
css_error css_select_ctx_insert_sheet(css_select_ctx *ctx,
|
||||
const css_stylesheet *sheet, uint32_t index,
|
||||
css_origin origin, uint64_t media);
|
||||
css_error css_select_ctx_remove_sheet(css_select_ctx *ctx,
|
||||
const css_stylesheet *sheet);
|
||||
|
||||
css_error css_select_ctx_count_sheets(css_select_ctx *ctx, uint32_t *count);
|
||||
css_error css_select_ctx_get_sheet(css_select_ctx *ctx, uint32_t index,
|
||||
const css_stylesheet **sheet);
|
||||
|
||||
css_error css_select_style(css_select_ctx *ctx, void *node,
|
||||
uint64_t media, const css_stylesheet *inline_style,
|
||||
css_select_handler *handler, void *pw,
|
||||
css_select_results **result);
|
||||
css_error css_select_results_destroy(css_select_results *results);
|
||||
|
||||
css_error css_select_font_faces(css_select_ctx *ctx,
|
||||
uint64_t media, lwc_string *font_family,
|
||||
css_select_font_faces_results **result);
|
||||
css_error css_select_font_faces_results_destroy(
|
||||
css_select_font_faces_results *results);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
170
programs/network/netsurf/include/libcss/stylesheet.h
Normal file
170
programs/network/netsurf/include/libcss/stylesheet.h
Normal file
@ -0,0 +1,170 @@
|
||||
/*
|
||||
* This file is part of LibCSS.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2008 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef libcss_stylesheet_h_
|
||||
#define libcss_stylesheet_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <libcss/errors.h>
|
||||
#include <libcss/types.h>
|
||||
#include <libcss/properties.h>
|
||||
|
||||
/**
|
||||
* Callback to resolve an URL
|
||||
*
|
||||
* \param pw Client data
|
||||
* \param dict String internment context
|
||||
* \param base Base URI (absolute)
|
||||
* \param rel URL to resolve, either absolute or relative to base
|
||||
* \param abs Pointer to location to receive result
|
||||
* \return CSS_OK on success, appropriate error otherwise.
|
||||
*/
|
||||
typedef css_error (*css_url_resolution_fn)(void *pw,
|
||||
const char *base, lwc_string *rel, lwc_string **abs);
|
||||
|
||||
/**
|
||||
* Callback to be notified of the need for an imported stylesheet
|
||||
*
|
||||
* \param pw Client data
|
||||
* \param parent Stylesheet requesting the import
|
||||
* \param url URL of the imported sheet
|
||||
* \param media Applicable media for the imported sheet
|
||||
* \return CSS_OK on success, appropriate error otherwise
|
||||
*
|
||||
* \note This function will be invoked for notification purposes
|
||||
* only. The client may use this to trigger a parallel fetch
|
||||
* of the imported stylesheet. The imported sheet must be
|
||||
* registered with its parent using the post-parse import
|
||||
* registration API.
|
||||
*/
|
||||
typedef css_error (*css_import_notification_fn)(void *pw,
|
||||
css_stylesheet *parent, lwc_string *url, uint64_t media);
|
||||
|
||||
/**
|
||||
* Callback use to resolve system colour names to RGB values
|
||||
*
|
||||
* \param pw Client data
|
||||
* \param name System colour name
|
||||
* \param color Pointer to location to receive color value
|
||||
* \return CSS_OK on success,
|
||||
* CSS_INVALID if the name is unknown.
|
||||
*/
|
||||
typedef css_error (*css_color_resolution_fn)(void *pw,
|
||||
lwc_string *name, css_color *color);
|
||||
|
||||
/** System font callback result data. */
|
||||
typedef struct css_system_font {
|
||||
enum css_font_style_e style;
|
||||
enum css_font_variant_e variant;
|
||||
enum css_font_weight_e weight;
|
||||
struct {
|
||||
css_fixed size;
|
||||
css_unit unit;
|
||||
} size;
|
||||
struct {
|
||||
css_fixed size;
|
||||
css_unit unit;
|
||||
} line_height;
|
||||
/* Note: must be a single family name only */
|
||||
lwc_string *family;
|
||||
} css_system_font;
|
||||
|
||||
/**
|
||||
* Callback use to resolve system font names to font values
|
||||
*
|
||||
* \param pw Client data
|
||||
* \param name System font identifier
|
||||
* \param system_font Pointer to system font descriptor to be filled
|
||||
* \return CSS_OK on success,
|
||||
* CSS_INVALID if the name is unknown.
|
||||
*/
|
||||
typedef css_error (*css_font_resolution_fn)(void *pw,
|
||||
lwc_string *name, css_system_font *system_font);
|
||||
|
||||
typedef enum css_stylesheet_params_version {
|
||||
CSS_STYLESHEET_PARAMS_VERSION_1 = 1
|
||||
} css_stylesheet_params_version;
|
||||
|
||||
/**
|
||||
* Parameter block for css_stylesheet_create()
|
||||
*/
|
||||
typedef struct css_stylesheet_params {
|
||||
/** ABI version of this structure */
|
||||
uint32_t params_version;
|
||||
|
||||
/** The language level of the stylesheet */
|
||||
css_language_level level;
|
||||
|
||||
/** The charset of the stylesheet data, or NULL to detect */
|
||||
const char *charset;
|
||||
/** URL of stylesheet */
|
||||
const char *url;
|
||||
/** Title of stylesheet */
|
||||
const char *title;
|
||||
|
||||
/** Permit quirky parsing of stylesheet */
|
||||
bool allow_quirks;
|
||||
/** This stylesheet is an inline style */
|
||||
bool inline_style;
|
||||
|
||||
/** URL resolution function */
|
||||
css_url_resolution_fn resolve;
|
||||
/** Client private data for resolve */
|
||||
void *resolve_pw;
|
||||
|
||||
/** Import notification function */
|
||||
css_import_notification_fn import;
|
||||
/** Client private data for import */
|
||||
void *import_pw;
|
||||
|
||||
/** Colour resolution function */
|
||||
css_color_resolution_fn color;
|
||||
/** Client private data for color */
|
||||
void *color_pw;
|
||||
|
||||
/** Font resolution function */
|
||||
css_font_resolution_fn font;
|
||||
/** Client private data for font */
|
||||
void *font_pw;
|
||||
} css_stylesheet_params;
|
||||
|
||||
css_error css_stylesheet_create(const css_stylesheet_params *params,
|
||||
css_allocator_fn alloc, void *alloc_pw,
|
||||
css_stylesheet **stylesheet);
|
||||
css_error css_stylesheet_destroy(css_stylesheet *sheet);
|
||||
|
||||
css_error css_stylesheet_append_data(css_stylesheet *sheet,
|
||||
const uint8_t *data, size_t len);
|
||||
css_error css_stylesheet_data_done(css_stylesheet *sheet);
|
||||
|
||||
css_error css_stylesheet_next_pending_import(css_stylesheet *parent,
|
||||
lwc_string **url, uint64_t *media);
|
||||
css_error css_stylesheet_register_import(css_stylesheet *parent,
|
||||
css_stylesheet *child);
|
||||
|
||||
css_error css_stylesheet_get_language_level(css_stylesheet *sheet,
|
||||
css_language_level *level);
|
||||
css_error css_stylesheet_get_url(css_stylesheet *sheet, const char **url);
|
||||
css_error css_stylesheet_get_title(css_stylesheet *sheet, const char **title);
|
||||
css_error css_stylesheet_quirks_allowed(css_stylesheet *sheet, bool *allowed);
|
||||
css_error css_stylesheet_used_quirks(css_stylesheet *sheet, bool *quirks);
|
||||
|
||||
css_error css_stylesheet_get_disabled(css_stylesheet *sheet, bool *disabled);
|
||||
css_error css_stylesheet_set_disabled(css_stylesheet *sheet, bool disabled);
|
||||
|
||||
css_error css_stylesheet_size(css_stylesheet *sheet, size_t *size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
138
programs/network/netsurf/include/libcss/types.h
Normal file
138
programs/network/netsurf/include/libcss/types.h
Normal file
@ -0,0 +1,138 @@
|
||||
/*
|
||||
* This file is part of LibCSS.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef libcss_types_h_
|
||||
#define libcss_types_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <libwapcaplet/libwapcaplet.h>
|
||||
|
||||
#include <libcss/fpmath.h>
|
||||
|
||||
/**
|
||||
* Source of charset information, in order of importance.
|
||||
* A client-dictated charset will override all others.
|
||||
* A document-specified charset will override autodetection or the default.
|
||||
*/
|
||||
typedef enum css_charset_source {
|
||||
CSS_CHARSET_DEFAULT = 0, /**< Default setting */
|
||||
CSS_CHARSET_REFERRED = 1, /**< From referring document */
|
||||
CSS_CHARSET_METADATA = 2, /**< From linking metadata */
|
||||
CSS_CHARSET_DOCUMENT = 3, /**< Defined in document */
|
||||
CSS_CHARSET_DICTATED = 4 /**< Dictated by client */
|
||||
} css_charset_source;
|
||||
|
||||
/**
|
||||
* Stylesheet language level -- defines parsing rules and supported properties
|
||||
*/
|
||||
typedef enum css_language_level {
|
||||
CSS_LEVEL_1 = 0, /**< CSS 1 */
|
||||
CSS_LEVEL_2 = 1, /**< CSS 2 */
|
||||
CSS_LEVEL_21 = 2, /**< CSS 2.1 */
|
||||
CSS_LEVEL_3 = 3, /**< CSS 3 */
|
||||
CSS_LEVEL_DEFAULT = CSS_LEVEL_21 /**< Default level */
|
||||
} css_language_level;
|
||||
|
||||
/**
|
||||
* Stylesheet media types
|
||||
*/
|
||||
typedef enum css_media_type {
|
||||
CSS_MEDIA_AURAL = (1 << 0),
|
||||
CSS_MEDIA_BRAILLE = (1 << 1),
|
||||
CSS_MEDIA_EMBOSSED = (1 << 2),
|
||||
CSS_MEDIA_HANDHELD = (1 << 3),
|
||||
CSS_MEDIA_PRINT = (1 << 4),
|
||||
CSS_MEDIA_PROJECTION = (1 << 5),
|
||||
CSS_MEDIA_SCREEN = (1 << 6),
|
||||
CSS_MEDIA_SPEECH = (1 << 7),
|
||||
CSS_MEDIA_TTY = (1 << 8),
|
||||
CSS_MEDIA_TV = (1 << 9),
|
||||
CSS_MEDIA_ALL = CSS_MEDIA_AURAL | CSS_MEDIA_BRAILLE |
|
||||
CSS_MEDIA_EMBOSSED | CSS_MEDIA_HANDHELD |
|
||||
CSS_MEDIA_PRINT | CSS_MEDIA_PROJECTION |
|
||||
CSS_MEDIA_SCREEN | CSS_MEDIA_SPEECH |
|
||||
CSS_MEDIA_TTY | CSS_MEDIA_TV
|
||||
} css_media_type;
|
||||
|
||||
/**
|
||||
* Stylesheet origin
|
||||
*/
|
||||
typedef enum css_origin {
|
||||
CSS_ORIGIN_UA = 0, /**< User agent stylesheet */
|
||||
CSS_ORIGIN_USER = 1, /**< User stylesheet */
|
||||
CSS_ORIGIN_AUTHOR = 2 /**< Author stylesheet */
|
||||
} css_origin;
|
||||
|
||||
/** CSS colour -- AARRGGBB */
|
||||
typedef uint32_t css_color;
|
||||
|
||||
/* CSS unit */
|
||||
typedef enum css_unit {
|
||||
CSS_UNIT_PX = 0x0,
|
||||
CSS_UNIT_EX = 0x1,
|
||||
CSS_UNIT_EM = 0x2,
|
||||
CSS_UNIT_IN = 0x3,
|
||||
CSS_UNIT_CM = 0x4,
|
||||
CSS_UNIT_MM = 0x5,
|
||||
CSS_UNIT_PT = 0x6,
|
||||
CSS_UNIT_PC = 0x7,
|
||||
|
||||
CSS_UNIT_PCT = 0x8, /* Percentage */
|
||||
|
||||
CSS_UNIT_DEG = 0x9,
|
||||
CSS_UNIT_GRAD = 0xa,
|
||||
CSS_UNIT_RAD = 0xb,
|
||||
|
||||
CSS_UNIT_MS = 0xc,
|
||||
CSS_UNIT_S = 0xd,
|
||||
|
||||
CSS_UNIT_HZ = 0xe,
|
||||
CSS_UNIT_KHZ = 0xf
|
||||
} css_unit;
|
||||
|
||||
/**
|
||||
* Type of a qualified name
|
||||
*/
|
||||
typedef struct css_qname {
|
||||
/**
|
||||
* Namespace URI:
|
||||
*
|
||||
* NULL for no namespace
|
||||
* '*' for any namespace (including none)
|
||||
* URI for a specific namespace
|
||||
*/
|
||||
lwc_string *ns;
|
||||
|
||||
/**
|
||||
* Local part of qualified name
|
||||
*/
|
||||
lwc_string *name;
|
||||
} css_qname;
|
||||
|
||||
typedef struct css_stylesheet css_stylesheet;
|
||||
|
||||
typedef struct css_select_ctx css_select_ctx;
|
||||
|
||||
typedef struct css_computed_style css_computed_style;
|
||||
|
||||
typedef struct css_font_face css_font_face;
|
||||
|
||||
typedef struct css_font_face_src css_font_face_src;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
254
programs/network/netsurf/include/libwapcaplet/libwapcaplet.h
Normal file
254
programs/network/netsurf/include/libwapcaplet/libwapcaplet.h
Normal file
@ -0,0 +1,254 @@
|
||||
/* libwapcaplet.h
|
||||
*
|
||||
* String internment and management tools.
|
||||
*
|
||||
* Copyright 2009 The NetSurf Browser Project.
|
||||
* Daniel Silverstone <dsilvers@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef libwapcaplet_h_
|
||||
#define libwapcaplet_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* The type of a reference counter used in libwapcaplet.
|
||||
*/
|
||||
typedef uint32_t lwc_refcounter;
|
||||
|
||||
/**
|
||||
* The type of a hash value used in libwapcaplet.
|
||||
*/
|
||||
typedef uint32_t lwc_hash;
|
||||
|
||||
/**
|
||||
* An interned string.
|
||||
*
|
||||
* NOTE: The contents of this struct are considered *PRIVATE* and may
|
||||
* change in future revisions. Do not rely on them whatsoever.
|
||||
* They're only here at all so that the ref, unref and matches etc can
|
||||
* use them.
|
||||
*/
|
||||
typedef struct lwc_string_s {
|
||||
struct lwc_string_s ** prevptr;
|
||||
struct lwc_string_s * next;
|
||||
size_t len;
|
||||
lwc_hash hash;
|
||||
lwc_refcounter refcnt;
|
||||
struct lwc_string_s * insensitive;
|
||||
} lwc_string;
|
||||
|
||||
/**
|
||||
* String iteration function
|
||||
*
|
||||
* @param str A string which has been interned.
|
||||
* @param pw The private pointer for the allocator.
|
||||
*/
|
||||
typedef void (*lwc_iteration_callback_fn)(lwc_string *str, void *pw);
|
||||
|
||||
/**
|
||||
* Result codes which libwapcaplet might return.
|
||||
*/
|
||||
typedef enum lwc_error_e {
|
||||
lwc_error_ok = 0, /**< No error. */
|
||||
lwc_error_oom = 1, /**< Out of memory. */
|
||||
lwc_error_range = 2 /**< Substring internment out of range. */
|
||||
} lwc_error;
|
||||
|
||||
/**
|
||||
* Intern a string.
|
||||
*
|
||||
* Take a copy of the string data referred to by \a s and \a slen and
|
||||
* intern it. The resulting ::lwc_string can be used for simple and
|
||||
* caseless comparisons by ::lwc_string_isequal and
|
||||
* ::lwc_string_caseless_isequal respectively.
|
||||
*
|
||||
* @param s Pointer to the start of the string to intern.
|
||||
* @param slen Length of the string in characters. (Not including any
|
||||
* terminators)
|
||||
* @param ret Pointer to ::lwc_string pointer to fill out.
|
||||
* @return Result of operation, if not OK then the value pointed
|
||||
* to by \a ret will not be valid.
|
||||
*
|
||||
* @note The memory pointed to by \a s is not referenced by the result.
|
||||
* @note If the string was already present, its reference count is
|
||||
* incremented rather than allocating more memory.
|
||||
*
|
||||
* @note The returned string is currently NULL-terminated but this
|
||||
* will not necessarily be the case in future. Try not to rely
|
||||
* on it.
|
||||
*/
|
||||
extern lwc_error lwc_intern_string(const char *s, size_t slen,
|
||||
lwc_string **ret);
|
||||
|
||||
/**
|
||||
* Intern a substring.
|
||||
*
|
||||
* Intern a subsequence of the provided ::lwc_string.
|
||||
*
|
||||
* @param str String to acquire substring from.
|
||||
* @param ssoffset Substring offset into \a str.
|
||||
* @param sslen Substring length.
|
||||
* @param ret Pointer to pointer to ::lwc_string to fill out.
|
||||
* @return Result of operation, if not OK then the value
|
||||
* pointed to by \a ret will not be valid.
|
||||
*/
|
||||
extern lwc_error lwc_intern_substring(lwc_string *str,
|
||||
size_t ssoffset, size_t sslen,
|
||||
lwc_string **ret);
|
||||
|
||||
/**
|
||||
* Increment the reference count on an lwc_string.
|
||||
*
|
||||
* This increases the reference count on the given string. You should
|
||||
* use this when copying a string pointer into a persistent data
|
||||
* structure.
|
||||
*
|
||||
* @verb
|
||||
* myobject->str = lwc_string_ref(myparent->str);
|
||||
* @endverb
|
||||
*
|
||||
* @param str The string to create another reference to.
|
||||
* @return The string pointer to use in your new data structure.
|
||||
*
|
||||
* @note Use this if copying the string and intending both sides to retain
|
||||
* ownership.
|
||||
*/
|
||||
#define lwc_string_ref(str) ({lwc_string *__lwc_s = (str); __lwc_s->refcnt++; __lwc_s;})
|
||||
|
||||
/**
|
||||
* Release a reference on an lwc_string.
|
||||
*
|
||||
* This decreases the reference count on the given ::lwc_string.
|
||||
*
|
||||
* @param str The string to unref.
|
||||
*
|
||||
* @note If the reference count reaches zero then the string will be
|
||||
* freed. (Ref count of 1 where string is its own insensitve match
|
||||
* will also result in the string being freed.)
|
||||
*/
|
||||
#define lwc_string_unref(str) { \
|
||||
lwc_string *__lwc_s = (str); \
|
||||
__lwc_s->refcnt--; \
|
||||
if ((__lwc_s->refcnt == 0) || \
|
||||
((__lwc_s->refcnt == 1) && (__lwc_s->insensitive == __lwc_s))) \
|
||||
lwc_string_destroy(__lwc_s); \
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy an unreffed lwc_string.
|
||||
*
|
||||
* This destroys an lwc_string whose reference count indicates that it should be.
|
||||
*
|
||||
* @param str The string to unref.
|
||||
*/
|
||||
extern void lwc_string_destroy(lwc_string *str);
|
||||
|
||||
/**
|
||||
* Check if two interned strings are equal.
|
||||
*
|
||||
* @param str1 The first string in the comparison.
|
||||
* @param str2 The second string in the comparison.
|
||||
* @param ret A pointer to a boolean to be filled out with the result.
|
||||
* @return Result of operation, if not ok then value pointed to
|
||||
* by \a ret will not be valid.
|
||||
*/
|
||||
#define lwc_string_isequal(str1, str2, ret) \
|
||||
((*(ret) = ((str1) == (str2))), lwc_error_ok)
|
||||
|
||||
/**
|
||||
* Check if two interned strings are case-insensitively equal.
|
||||
*
|
||||
* @param str1 The first string in the comparison.
|
||||
* @param str2 The second string in the comparison.
|
||||
* @param ret A pointer to a boolean to be filled out with the result.
|
||||
* @return Result of operation, if not ok then value pointed to
|
||||
* by \a ret will not be valid.
|
||||
*/
|
||||
#define lwc_string_caseless_isequal(_str1,_str2,_ret) ({ \
|
||||
lwc_error __lwc_err = lwc_error_ok; \
|
||||
lwc_string *__lwc_str1 = (_str1); \
|
||||
lwc_string *__lwc_str2 = (_str2); \
|
||||
bool *__lwc_ret = (_ret); \
|
||||
\
|
||||
if (__lwc_str1->insensitive == NULL) { \
|
||||
__lwc_err = lwc__intern_caseless_string(__lwc_str1); \
|
||||
} \
|
||||
if (__lwc_err == lwc_error_ok && __lwc_str2->insensitive == NULL) { \
|
||||
__lwc_err = lwc__intern_caseless_string(__lwc_str2); \
|
||||
} \
|
||||
if (__lwc_err == lwc_error_ok) \
|
||||
*__lwc_ret = (__lwc_str1->insensitive == __lwc_str2->insensitive); \
|
||||
__lwc_err; \
|
||||
})
|
||||
|
||||
/**
|
||||
* Intern a caseless copy of the passed string.
|
||||
*
|
||||
* @param str The string to intern the caseless copy of.
|
||||
*
|
||||
* @return lwc_error_ok if successful, otherwise the
|
||||
* error code describing the issue.,
|
||||
*
|
||||
* @note This is for "internal" use by the caseless comparison
|
||||
* macro and not for users.
|
||||
*/
|
||||
extern lwc_error
|
||||
lwc__intern_caseless_string(lwc_string *str);
|
||||
|
||||
/**
|
||||
* Retrieve the data pointer for an interned string.
|
||||
*
|
||||
* @param str The string to retrieve the data pointer for.
|
||||
* @return The C string data pointer for \a str.
|
||||
*
|
||||
* @note The data we point at belongs to the string and will
|
||||
* die with the string. Keep a ref if you need it.
|
||||
* @note You may not rely on the NULL termination of the strings
|
||||
* in future. Any code relying on it currently should be
|
||||
* modified to use ::lwc_string_length if possible.
|
||||
*/
|
||||
#define lwc_string_data(str) ((const char *)((str)+1))
|
||||
|
||||
/**
|
||||
* Retrieve the data length for an interned string.
|
||||
*
|
||||
* @param str The string to retrieve the length of.
|
||||
* @return The length of \a str.
|
||||
*/
|
||||
#define lwc_string_length(str) ((str)->len)
|
||||
|
||||
/**
|
||||
* Retrieve (or compute if unavailable) a hash value for the content of the string.
|
||||
*
|
||||
* @param str The string to get the hash for.
|
||||
* @return The 32 bit hash of \a str.
|
||||
*
|
||||
* @note This API should only be used as a convenient way to retrieve a hash
|
||||
* value for the string. This hash value should not be relied on to be
|
||||
* unique within an invocation of the program, nor should it be relied upon
|
||||
* to be stable between invocations of the program. Never use the hash
|
||||
* value as a way to directly identify the value of the string.
|
||||
*/
|
||||
#define lwc_string_hash_value(str) ((str)->hash)
|
||||
|
||||
/**
|
||||
* Iterate the context and return every string in it.
|
||||
*
|
||||
* @param cb The callback to give the string to.
|
||||
* @param pw The private word for the callback.
|
||||
*/
|
||||
extern void lwc_iterate_strings(lwc_iteration_callback_fn cb, void *pw);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* libwapcaplet_h_ */
|
125
programs/network/netsurf/include/parserutils/charset/codec.h
Normal file
125
programs/network/netsurf/include/parserutils/charset/codec.h
Normal file
@ -0,0 +1,125 @@
|
||||
/*
|
||||
* This file is part of LibParserUtils.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef parserutils_charset_codec_h_
|
||||
#define parserutils_charset_codec_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <parserutils/errors.h>
|
||||
#include <parserutils/functypes.h>
|
||||
|
||||
typedef struct parserutils_charset_codec parserutils_charset_codec;
|
||||
|
||||
#define PARSERUTILS_CHARSET_CODEC_NULL (0xffffffffU)
|
||||
|
||||
/**
|
||||
* Charset codec error mode
|
||||
*
|
||||
* A codec's error mode determines its behaviour in the face of:
|
||||
*
|
||||
* + characters which are unrepresentable in the destination charset (if
|
||||
* encoding data) or which cannot be converted to UCS-4 (if decoding data).
|
||||
* + invalid byte sequences (both encoding and decoding)
|
||||
*
|
||||
* The options provide a choice between the following approaches:
|
||||
*
|
||||
* + draconian, "stop processing" ("strict")
|
||||
* + "replace the unrepresentable character with something else" ("loose")
|
||||
* + "attempt to transliterate, or replace if unable" ("translit")
|
||||
*
|
||||
* The default error mode is "loose".
|
||||
*
|
||||
*
|
||||
* In the "loose" case, the replacement character will depend upon:
|
||||
*
|
||||
* + Whether the operation was encoding or decoding
|
||||
* + If encoding, what the destination charset is.
|
||||
*
|
||||
* If decoding, the replacement character will be:
|
||||
*
|
||||
* U+FFFD (REPLACEMENT CHARACTER)
|
||||
*
|
||||
* If encoding, the replacement character will be:
|
||||
*
|
||||
* U+003F (QUESTION MARK) if the destination charset is not UTF-(8|16|32)
|
||||
* U+FFFD (REPLACEMENT CHARACTER) otherwise.
|
||||
*
|
||||
*
|
||||
* In the "translit" case, the codec will attempt to transliterate into
|
||||
* the destination charset, if encoding. If decoding, or if transliteration
|
||||
* fails, this option is identical to "loose".
|
||||
*/
|
||||
typedef enum parserutils_charset_codec_errormode {
|
||||
/** Abort processing if unrepresentable character encountered */
|
||||
PARSERUTILS_CHARSET_CODEC_ERROR_STRICT = 0,
|
||||
/** Replace unrepresentable characters with single alternate */
|
||||
PARSERUTILS_CHARSET_CODEC_ERROR_LOOSE = 1,
|
||||
/** Transliterate unrepresentable characters, if possible */
|
||||
PARSERUTILS_CHARSET_CODEC_ERROR_TRANSLIT = 2
|
||||
} parserutils_charset_codec_errormode;
|
||||
|
||||
/**
|
||||
* Charset codec option types
|
||||
*/
|
||||
typedef enum parserutils_charset_codec_opttype {
|
||||
/** Set codec error mode */
|
||||
PARSERUTILS_CHARSET_CODEC_ERROR_MODE = 1
|
||||
} parserutils_charset_codec_opttype;
|
||||
|
||||
/**
|
||||
* Charset codec option parameters
|
||||
*/
|
||||
typedef union parserutils_charset_codec_optparams {
|
||||
/** Parameters for error mode setting */
|
||||
struct {
|
||||
/** The desired error handling mode */
|
||||
parserutils_charset_codec_errormode mode;
|
||||
} error_mode;
|
||||
} parserutils_charset_codec_optparams;
|
||||
|
||||
|
||||
/* Create a charset codec */
|
||||
parserutils_error parserutils_charset_codec_create(const char *charset,
|
||||
parserutils_alloc alloc, void *pw,
|
||||
parserutils_charset_codec **codec);
|
||||
/* Destroy a charset codec */
|
||||
parserutils_error parserutils_charset_codec_destroy(
|
||||
parserutils_charset_codec *codec);
|
||||
|
||||
/* Configure a charset codec */
|
||||
parserutils_error parserutils_charset_codec_setopt(
|
||||
parserutils_charset_codec *codec,
|
||||
parserutils_charset_codec_opttype type,
|
||||
parserutils_charset_codec_optparams *params);
|
||||
|
||||
/* Encode a chunk of UCS-4 data into a codec's charset */
|
||||
parserutils_error parserutils_charset_codec_encode(
|
||||
parserutils_charset_codec *codec,
|
||||
const uint8_t **source, size_t *sourcelen,
|
||||
uint8_t **dest, size_t *destlen);
|
||||
|
||||
/* Decode a chunk of data in a codec's charset into UCS-4 */
|
||||
parserutils_error parserutils_charset_codec_decode(
|
||||
parserutils_charset_codec *codec,
|
||||
const uint8_t **source, size_t *sourcelen,
|
||||
uint8_t **dest, size_t *destlen);
|
||||
|
||||
/* Reset a charset codec */
|
||||
parserutils_error parserutils_charset_codec_reset(
|
||||
parserutils_charset_codec *codec);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* This file is part of LibParserUtils.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef parserutils_charset_mibenum_h_
|
||||
#define parserutils_charset_mibenum_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <parserutils/errors.h>
|
||||
#include <parserutils/functypes.h>
|
||||
|
||||
/* Convert an encoding alias to a MIB enum value */
|
||||
uint16_t parserutils_charset_mibenum_from_name(const char *alias, size_t len);
|
||||
/* Convert a MIB enum value into an encoding alias */
|
||||
const char *parserutils_charset_mibenum_to_name(uint16_t mibenum);
|
||||
/* Determine if a MIB enum value represents a Unicode variant */
|
||||
bool parserutils_charset_mibenum_is_unicode(uint16_t mibenum);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
47
programs/network/netsurf/include/parserutils/charset/utf16.h
Normal file
47
programs/network/netsurf/include/parserutils/charset/utf16.h
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* This file is part of LibParserUtils.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* UTF-16 manipulation functions (interface).
|
||||
*/
|
||||
|
||||
#ifndef parserutils_charset_utf16_h_
|
||||
#define parserutils_charset_utf16_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <parserutils/errors.h>
|
||||
|
||||
parserutils_error parserutils_charset_utf16_to_ucs4(const uint8_t *s,
|
||||
size_t len, uint32_t *ucs4, size_t *clen);
|
||||
parserutils_error parserutils_charset_utf16_from_ucs4(uint32_t ucs4,
|
||||
uint8_t *s, size_t *len);
|
||||
|
||||
parserutils_error parserutils_charset_utf16_length(const uint8_t *s,
|
||||
size_t max, size_t *len);
|
||||
parserutils_error parserutils_charset_utf16_char_byte_length(const uint8_t *s,
|
||||
size_t *len);
|
||||
|
||||
parserutils_error parserutils_charset_utf16_prev(const uint8_t *s,
|
||||
uint32_t off, uint32_t *prevoff);
|
||||
parserutils_error parserutils_charset_utf16_next(const uint8_t *s,
|
||||
uint32_t len, uint32_t off, uint32_t *nextoff);
|
||||
|
||||
parserutils_error parserutils_charset_utf16_next_paranoid(const uint8_t *s,
|
||||
uint32_t len, uint32_t off, uint32_t *nextoff);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
47
programs/network/netsurf/include/parserutils/charset/utf8.h
Normal file
47
programs/network/netsurf/include/parserutils/charset/utf8.h
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* This file is part of LibParserUtils.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* UTF-8 manipulation functions (interface).
|
||||
*/
|
||||
|
||||
#ifndef parserutils_charset_utf8_h_
|
||||
#define parserutils_charset_utf8_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <parserutils/errors.h>
|
||||
|
||||
parserutils_error parserutils_charset_utf8_to_ucs4(const uint8_t *s, size_t len,
|
||||
uint32_t *ucs4, size_t *clen);
|
||||
parserutils_error parserutils_charset_utf8_from_ucs4(uint32_t ucs4, uint8_t **s,
|
||||
size_t *len);
|
||||
|
||||
parserutils_error parserutils_charset_utf8_length(const uint8_t *s, size_t max,
|
||||
size_t *len);
|
||||
parserutils_error parserutils_charset_utf8_char_byte_length(const uint8_t *s,
|
||||
size_t *len);
|
||||
|
||||
parserutils_error parserutils_charset_utf8_prev(const uint8_t *s, uint32_t off,
|
||||
uint32_t *prevoff);
|
||||
parserutils_error parserutils_charset_utf8_next(const uint8_t *s, uint32_t len,
|
||||
uint32_t off, uint32_t *nextoff);
|
||||
|
||||
parserutils_error parserutils_charset_utf8_next_paranoid(const uint8_t *s,
|
||||
uint32_t len, uint32_t off, uint32_t *nextoff);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
40
programs/network/netsurf/include/parserutils/errors.h
Normal file
40
programs/network/netsurf/include/parserutils/errors.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* This file is part of LibParserUtils.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef parserutils_errors_h_
|
||||
#define parserutils_errors_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
typedef enum parserutils_error {
|
||||
PARSERUTILS_OK = 0,
|
||||
|
||||
PARSERUTILS_NOMEM = 1,
|
||||
PARSERUTILS_BADPARM = 2,
|
||||
PARSERUTILS_INVALID = 3,
|
||||
PARSERUTILS_FILENOTFOUND = 4,
|
||||
PARSERUTILS_NEEDDATA = 5,
|
||||
PARSERUTILS_BADENCODING = 6,
|
||||
PARSERUTILS_EOF = 7
|
||||
} parserutils_error;
|
||||
|
||||
/* Convert a parserutils error value to a string */
|
||||
const char *parserutils_error_to_string(parserutils_error error);
|
||||
/* Convert a string to a parserutils error value */
|
||||
parserutils_error parserutils_error_from_string(const char *str, size_t len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
30
programs/network/netsurf/include/parserutils/functypes.h
Normal file
30
programs/network/netsurf/include/parserutils/functypes.h
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* This file is part of LibParserUtils.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007-8 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef parserutils_functypes_h_
|
||||
#define parserutils_functypes_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <parserutils/types.h>
|
||||
|
||||
/* Type of allocation function for parserutils */
|
||||
typedef void *(*parserutils_alloc)(void *ptr, size_t size, void *pw);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
188
programs/network/netsurf/include/parserutils/input/inputstream.h
Normal file
188
programs/network/netsurf/include/parserutils/input/inputstream.h
Normal file
@ -0,0 +1,188 @@
|
||||
/*
|
||||
* This file is part of LibParserUtils.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef parserutils_input_inputstream_h_
|
||||
#define parserutils_input_inputstream_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#ifndef NDEBUG
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <parserutils/errors.h>
|
||||
#include <parserutils/functypes.h>
|
||||
#include <parserutils/types.h>
|
||||
#include <parserutils/charset/utf8.h>
|
||||
#include <parserutils/utils/buffer.h>
|
||||
|
||||
/**
|
||||
* Type of charset detection function
|
||||
*/
|
||||
typedef parserutils_error (*parserutils_charset_detect_func)(
|
||||
const uint8_t *data, size_t len,
|
||||
uint16_t *mibenum, uint32_t *source);
|
||||
|
||||
/**
|
||||
* Input stream object
|
||||
*/
|
||||
typedef struct parserutils_inputstream
|
||||
{
|
||||
parserutils_buffer *utf8; /**< Buffer containing UTF-8 data */
|
||||
|
||||
uint32_t cursor; /**< Byte offset of current position */
|
||||
|
||||
bool had_eof; /**< Whether EOF has been reached */
|
||||
} parserutils_inputstream;
|
||||
|
||||
/* Create an input stream */
|
||||
parserutils_error parserutils_inputstream_create(const char *enc,
|
||||
uint32_t encsrc, parserutils_charset_detect_func csdetect,
|
||||
parserutils_alloc alloc, void *pw,
|
||||
parserutils_inputstream **stream);
|
||||
/* Destroy an input stream */
|
||||
parserutils_error parserutils_inputstream_destroy(
|
||||
parserutils_inputstream *stream);
|
||||
|
||||
/* Append data to an input stream */
|
||||
parserutils_error parserutils_inputstream_append(
|
||||
parserutils_inputstream *stream,
|
||||
const uint8_t *data, size_t len);
|
||||
/* Insert data into stream at current location */
|
||||
parserutils_error parserutils_inputstream_insert(
|
||||
parserutils_inputstream *stream,
|
||||
const uint8_t *data, size_t len);
|
||||
|
||||
/* Slow form of css_inputstream_peek. */
|
||||
parserutils_error parserutils_inputstream_peek_slow(
|
||||
parserutils_inputstream *stream,
|
||||
size_t offset, const uint8_t **ptr, size_t *length);
|
||||
|
||||
/**
|
||||
* Look at the character in the stream that starts at
|
||||
* offset bytes from the cursor
|
||||
*
|
||||
* \param stream Stream to look in
|
||||
* \param offset Byte offset of start of character
|
||||
* \param ptr Pointer to location to receive pointer to character data
|
||||
* \param length Pointer to location to receive character length (in bytes)
|
||||
* \return PARSERUTILS_OK on success,
|
||||
* _NEEDDATA on reaching the end of available input,
|
||||
* _EOF on reaching the end of all input,
|
||||
* _BADENCODING if the input cannot be decoded,
|
||||
* _NOMEM on memory exhaustion,
|
||||
* _BADPARM if bad parameters are passed.
|
||||
*
|
||||
* Once the character pointed to by the result of this call has been advanced
|
||||
* past (i.e. parserutils_inputstream_advance has caused the stream cursor to
|
||||
* pass over the character), then no guarantee is made as to the validity of
|
||||
* the data pointed to. Thus, any attempt to dereference the pointer after
|
||||
* advancing past the data it points to is a bug.
|
||||
*/
|
||||
static inline parserutils_error parserutils_inputstream_peek(
|
||||
parserutils_inputstream *stream, size_t offset,
|
||||
const uint8_t **ptr, size_t *length)
|
||||
{
|
||||
parserutils_error error = PARSERUTILS_OK;
|
||||
const parserutils_buffer *utf8;
|
||||
const uint8_t *utf8_data;
|
||||
size_t len, off, utf8_len;
|
||||
|
||||
if (stream == NULL || ptr == NULL || length == NULL)
|
||||
return PARSERUTILS_BADPARM;
|
||||
|
||||
#ifndef NDEBUG
|
||||
#ifdef VERBOSE_INPUTSTREAM
|
||||
fprintf(stdout, "Peek: len: %zu cur: %u off: %zu\n",
|
||||
stream->utf8->length, stream->cursor, offset);
|
||||
#endif
|
||||
#ifdef RANDOMISE_INPUTSTREAM
|
||||
parserutils_buffer_randomise(stream->utf8);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
utf8 = stream->utf8;
|
||||
utf8_data = utf8->data;
|
||||
utf8_len = utf8->length;
|
||||
off = stream->cursor + offset;
|
||||
|
||||
#define IS_ASCII(x) (((x) & 0x80) == 0)
|
||||
|
||||
if (off < utf8_len) {
|
||||
if (IS_ASCII(utf8_data[off])) {
|
||||
/* Early exit for ASCII case */
|
||||
(*length) = 1;
|
||||
(*ptr) = (utf8_data + off);
|
||||
return PARSERUTILS_OK;
|
||||
} else {
|
||||
error = parserutils_charset_utf8_char_byte_length(
|
||||
utf8_data + off, &len);
|
||||
|
||||
if (error == PARSERUTILS_OK) {
|
||||
(*length) = len;
|
||||
(*ptr) = (utf8_data + off);
|
||||
return PARSERUTILS_OK;
|
||||
} else if (error != PARSERUTILS_NEEDDATA) {
|
||||
return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#undef IS_ASCII
|
||||
|
||||
if (off != utf8_len && error != PARSERUTILS_NEEDDATA)
|
||||
abort();
|
||||
|
||||
return parserutils_inputstream_peek_slow(stream, offset, ptr, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Advance the stream's current position
|
||||
*
|
||||
* \param stream The stream whose position to advance
|
||||
* \param bytes The number of bytes to advance
|
||||
*/
|
||||
static inline void parserutils_inputstream_advance(
|
||||
parserutils_inputstream *stream, size_t bytes)
|
||||
{
|
||||
if (stream == NULL)
|
||||
return;
|
||||
|
||||
#if !defined(NDEBUG) && defined(VERBOSE_INPUTSTREAM)
|
||||
fprintf(stdout, "Advance: len: %zu cur: %u bytes: %zu\n",
|
||||
stream->utf8->length, stream->cursor, bytes);
|
||||
#endif
|
||||
|
||||
if (bytes > stream->utf8->length - stream->cursor)
|
||||
abort();
|
||||
|
||||
if (stream->cursor == stream->utf8->length)
|
||||
return;
|
||||
|
||||
stream->cursor += bytes;
|
||||
}
|
||||
|
||||
/* Read the document charset */
|
||||
const char *parserutils_inputstream_read_charset(
|
||||
parserutils_inputstream *stream, uint32_t *source);
|
||||
/* Change the document charset */
|
||||
parserutils_error parserutils_inputstream_change_charset(
|
||||
parserutils_inputstream *stream,
|
||||
const char *enc, uint32_t source);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
25
programs/network/netsurf/include/parserutils/parserutils.h
Normal file
25
programs/network/netsurf/include/parserutils/parserutils.h
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* This file is part of LibParserUtils.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef parserutils_parserutils_h_
|
||||
#define parserutils_parserutils_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <parserutils/errors.h>
|
||||
#include <parserutils/functypes.h>
|
||||
#include <parserutils/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
24
programs/network/netsurf/include/parserutils/types.h
Normal file
24
programs/network/netsurf/include/parserutils/types.h
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* This file is part of LibParserUtils.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef parserutils_types_h_
|
||||
#define parserutils_types_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
50
programs/network/netsurf/include/parserutils/utils/buffer.h
Normal file
50
programs/network/netsurf/include/parserutils/utils/buffer.h
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* This file is part of LibParserUtils.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2008 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef parserutils_utils_buffer_h_
|
||||
#define parserutils_utils_buffer_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <parserutils/errors.h>
|
||||
#include <parserutils/functypes.h>
|
||||
|
||||
struct parserutils_buffer
|
||||
{
|
||||
uint8_t *data;
|
||||
size_t length;
|
||||
size_t allocated;
|
||||
|
||||
parserutils_alloc alloc;
|
||||
void *pw;
|
||||
};
|
||||
typedef struct parserutils_buffer parserutils_buffer;
|
||||
|
||||
parserutils_error parserutils_buffer_create(parserutils_alloc alloc,
|
||||
void *pw, parserutils_buffer **buffer);
|
||||
parserutils_error parserutils_buffer_destroy(parserutils_buffer *buffer);
|
||||
|
||||
parserutils_error parserutils_buffer_append(parserutils_buffer *buffer,
|
||||
const uint8_t *data, size_t len);
|
||||
parserutils_error parserutils_buffer_insert(parserutils_buffer *buffer,
|
||||
size_t offset, const uint8_t *data, size_t len);
|
||||
parserutils_error parserutils_buffer_discard(parserutils_buffer *buffer,
|
||||
size_t offset, size_t len);
|
||||
|
||||
parserutils_error parserutils_buffer_grow(parserutils_buffer *buffer);
|
||||
|
||||
parserutils_error parserutils_buffer_randomise(parserutils_buffer *buffer);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
39
programs/network/netsurf/include/parserutils/utils/stack.h
Normal file
39
programs/network/netsurf/include/parserutils/utils/stack.h
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* This file is part of LibParserUtils.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2008 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef parserutils_utils_stack_h_
|
||||
#define parserutils_utils_stack_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <parserutils/errors.h>
|
||||
#include <parserutils/functypes.h>
|
||||
|
||||
struct parserutils_stack;
|
||||
typedef struct parserutils_stack parserutils_stack;
|
||||
|
||||
parserutils_error parserutils_stack_create(size_t item_size, size_t chunk_size,
|
||||
parserutils_alloc alloc, void *pw, parserutils_stack **stack);
|
||||
parserutils_error parserutils_stack_destroy(parserutils_stack *stack);
|
||||
|
||||
parserutils_error parserutils_stack_push(parserutils_stack *stack,
|
||||
const void *item);
|
||||
parserutils_error parserutils_stack_pop(parserutils_stack *stack, void *item);
|
||||
|
||||
void *parserutils_stack_get_current(parserutils_stack *stack);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
45
programs/network/netsurf/include/parserutils/utils/vector.h
Normal file
45
programs/network/netsurf/include/parserutils/utils/vector.h
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* This file is part of LibParserUtils.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2008 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef parserutils_utils_vector_h_
|
||||
#define parserutils_utils_vector_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <parserutils/errors.h>
|
||||
#include <parserutils/functypes.h>
|
||||
|
||||
struct parserutils_vector;
|
||||
typedef struct parserutils_vector parserutils_vector;
|
||||
|
||||
parserutils_error parserutils_vector_create(size_t item_size,
|
||||
size_t chunk_size, parserutils_alloc alloc, void *pw,
|
||||
parserutils_vector **vector);
|
||||
parserutils_error parserutils_vector_destroy(parserutils_vector *vector);
|
||||
|
||||
parserutils_error parserutils_vector_append(parserutils_vector *vector,
|
||||
void *item);
|
||||
parserutils_error parserutils_vector_clear(parserutils_vector *vector);
|
||||
parserutils_error parserutils_vector_remove_last(parserutils_vector *vector);
|
||||
parserutils_error parserutils_vector_get_length(parserutils_vector *vector, size_t *length);
|
||||
|
||||
const void *parserutils_vector_iterate(const parserutils_vector *vector,
|
||||
int32_t *ctx);
|
||||
const void *parserutils_vector_peek(const parserutils_vector *vector,
|
||||
int32_t ctx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
3
programs/network/netsurf/libcss/.gitignore
vendored
Normal file
3
programs/network/netsurf/libcss/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
build-*
|
||||
Makefile.config.override
|
||||
|
19
programs/network/netsurf/libcss/COPYING
Normal file
19
programs/network/netsurf/libcss/COPYING
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (C) 2007 J-M Bell
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
61
programs/network/netsurf/libcss/Makefile
Normal file
61
programs/network/netsurf/libcss/Makefile
Normal file
@ -0,0 +1,61 @@
|
||||
# Component settings
|
||||
COMPONENT := css
|
||||
COMPONENT_VERSION := 0.1.2
|
||||
# Default to a static library
|
||||
COMPONENT_TYPE ?= lib-static
|
||||
|
||||
# Setup the tooling
|
||||
PREFIX ?= /opt/netsurf
|
||||
NSSHARED ?= $(PREFIX)/share/netsurf-buildsystem
|
||||
include $(NSSHARED)/makefiles/Makefile.tools
|
||||
|
||||
TESTRUNNER := $(PERL) $(NSTESTTOOLS)/testrunner.pl
|
||||
|
||||
# Toolchain flags
|
||||
WARNFLAGS := -Wall -W -Wundef -Wpointer-arith -Wcast-align \
|
||||
-Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \
|
||||
-Wmissing-declarations -Wnested-externs
|
||||
# BeOS/Haiku/AmigaOS4 standard library headers create warnings
|
||||
ifneq ($(TARGET),beos)
|
||||
ifneq ($(TARGET),amiga)
|
||||
WARNFLAGS := $(WARNFLAGS) -Werror
|
||||
endif
|
||||
endif
|
||||
CFLAGS := -D_BSD_SOURCE -I$(CURDIR)/include/ \
|
||||
-I$(CURDIR)/src $(WARNFLAGS) $(CFLAGS)
|
||||
ifneq ($(GCCVER),2)
|
||||
CFLAGS := $(CFLAGS) -std=c99
|
||||
else
|
||||
# __inline__ is a GCCism
|
||||
CFLAGS := $(CFLAGS) -Dinline="__inline__"
|
||||
endif
|
||||
|
||||
# Parserutils & wapcaplet
|
||||
ifneq ($(findstring clean,$(MAKECMDGOALS)),clean)
|
||||
ifneq ($(PKGCONFIG),)
|
||||
CFLAGS := $(CFLAGS) $(shell $(PKGCONFIG) libparserutils libwapcaplet --cflags)
|
||||
LDFLAGS := $(LDFLAGS) $(shell $(PKGCONFIG) libparserutils libwapcaplet --libs)
|
||||
else
|
||||
CFLAGS := $(CFLAGS) -I$(PREFIX)/include
|
||||
LDFLAGS := $(LDFLAGS) -lparserutils -lwapcaplet
|
||||
endif
|
||||
endif
|
||||
|
||||
include $(NSBUILD)/Makefile.top
|
||||
|
||||
# Extra installation rules
|
||||
I := /include/libcss
|
||||
|
||||
INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/libcss/computed.h
|
||||
INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/libcss/errors.h
|
||||
INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/libcss/font_face.h
|
||||
INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/libcss/fpmath.h
|
||||
INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/libcss/functypes.h
|
||||
INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/libcss/hint.h
|
||||
INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/libcss/libcss.h
|
||||
INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/libcss/properties.h
|
||||
INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/libcss/select.h
|
||||
INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/libcss/stylesheet.h
|
||||
INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/libcss/types.h
|
||||
INSTALL_ITEMS := $(INSTALL_ITEMS) /lib/pkgconfig:lib$(COMPONENT).pc.in
|
||||
INSTALL_ITEMS := $(INSTALL_ITEMS) /lib:$(OUTPUT)
|
4
programs/network/netsurf/libcss/Makefile.config
Normal file
4
programs/network/netsurf/libcss/Makefile.config
Normal file
@ -0,0 +1,4 @@
|
||||
# Configuration Makefile fragment
|
||||
|
||||
# Cater for local configuration changes
|
||||
-include Makefile.config.override
|
46
programs/network/netsurf/libcss/README
Normal file
46
programs/network/netsurf/libcss/README
Normal file
@ -0,0 +1,46 @@
|
||||
LibCSS -- a CSS parser and selection engine
|
||||
===========================================
|
||||
|
||||
Overview
|
||||
--------
|
||||
|
||||
LibCSS is a CSS parser and selection engine. It aims to parse the forward
|
||||
compatible CSS grammar.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
LibCSS requires the following tools:
|
||||
|
||||
+ A C99 capable C compiler
|
||||
+ GNU make or compatible
|
||||
+ Pkg-config
|
||||
+ Perl (for the testcases)
|
||||
|
||||
LibCSS also requires the following libraries to be installed:
|
||||
|
||||
+ LibParserUtils
|
||||
+ LibWapcaplet
|
||||
|
||||
Compilation
|
||||
-----------
|
||||
|
||||
If necessary, modify the toolchain settings in the Makefile.
|
||||
Invoke make:
|
||||
$ make
|
||||
|
||||
Verification
|
||||
------------
|
||||
|
||||
To verify that the parser is working, it is necessary to specify a
|
||||
different makefile target than that used for normal compilation, thus:
|
||||
|
||||
$ make test
|
||||
|
||||
API documentation
|
||||
-----------------
|
||||
|
||||
Currently, there is none. However, the code is well commented and the
|
||||
public API may be found in the "include" directory. The testcase sources
|
||||
may also be of use in working out how to use it.
|
||||
|
73
programs/network/netsurf/libcss/build/mkprops.pl
Executable file
73
programs/network/netsurf/libcss/build/mkprops.pl
Executable file
@ -0,0 +1,73 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
# Auto-generate stub handlers for CSS properties.
|
||||
|
||||
my @PROPS = split(/ /, "azimuth background_attachment background_color background_image background_position background_repeat border_bottom_color border_bottom_style border_bottom_width border_collapse border_left_color border_left_style border_left_width border_right_color border_right_style border_right_width border_spacing border_top_color border_top_style border_top_width bottom caption_side clear clip color content counter_increment counter_reset cue_after cue_before cursor direction display elevation empty_cells float font_family font_size font_style font_variant font_weight height left letter_spacing line_height list_style_image list_style_position list_style_type margin_bottom margin_left margin_right margin_top max_height max_width min_height min_width orphans outline_color outline_style outline_width overflow padding_bottom padding_left padding_right padding_top page_break_after page_break_before page_break_inside pause_after pause_before pitch_range pitch play_during position quotes richness right speak_header speak_numeral speak_punctuation speak speech_rate stress table_layout text_align text_decoration text_indent text_transform top unicode_bidi vertical_align visibility voice_family volume white_space widows width word_spacing z_index");
|
||||
|
||||
print <<EOF
|
||||
/*
|
||||
* This file is part of LibCSS.
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2008 John-Mark Bell <jmb\@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef css_parse_css21props_c_
|
||||
#define css_parse_css21props_c_
|
||||
|
||||
EOF
|
||||
;
|
||||
|
||||
foreach my $prop (@PROPS) {
|
||||
print <<EOF
|
||||
static css_error parse_$prop(css_css21 *c,
|
||||
const parserutils_vector *vector, int *ctx,
|
||||
css_style **result);
|
||||
EOF
|
||||
}
|
||||
|
||||
print <<EOF
|
||||
|
||||
/**
|
||||
* Type of property handler function
|
||||
*/
|
||||
typedef css_error (*css_prop_handler)(css_css21 *c,
|
||||
const parserutils_vector *vector, int *ctx,
|
||||
css_style **result);
|
||||
|
||||
/**
|
||||
* Dispatch table of property handlers, indexed by property enum
|
||||
*/
|
||||
static const css_prop_handler property_handlers[LAST_KNOWN - FIRST_PROP] =
|
||||
{
|
||||
EOF
|
||||
;
|
||||
|
||||
foreach my $prop (@PROPS) {
|
||||
print "\tparse_$prop,\n";
|
||||
}
|
||||
|
||||
print "};\n";
|
||||
|
||||
foreach my $prop (@PROPS) {
|
||||
print <<EOF
|
||||
|
||||
css_error parse_$prop(css_css21 *c,
|
||||
const parserutils_vector *vector, int *ctx,
|
||||
css_style **result)
|
||||
{
|
||||
UNUSED(c);
|
||||
UNUSED(vector);
|
||||
UNUSED(ctx);
|
||||
UNUSED(result);
|
||||
|
||||
return CSS_OK;
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
print "\n#endif\n";
|
||||
|
281
programs/network/netsurf/libcss/docs/API
Normal file
281
programs/network/netsurf/libcss/docs/API
Normal file
@ -0,0 +1,281 @@
|
||||
Using the LibCSS API
|
||||
====================
|
||||
|
||||
This document explains how to use LibCSS. In addition to this document, please
|
||||
see the examples and the headers (found in /usr/local/include/libcss or a
|
||||
similar location). Experience with C is assumed.
|
||||
|
||||
Using the library consists of the following general steps:
|
||||
|
||||
1. Initialize the library.
|
||||
2. Load one or more CSS files.
|
||||
3. Use the Selection API to determine styles.
|
||||
4. Use the computed styles.
|
||||
5. Shut down the library.
|
||||
|
||||
Please see example1.c for a demonstration of these steps.
|
||||
|
||||
|
||||
Initialize the library
|
||||
----------------------
|
||||
|
||||
The library is initialized using css_initialise():
|
||||
|
||||
css_initialise("Aliases", myrealloc, 0);
|
||||
|
||||
The first argument is the pathname of an Aliases file, which maps character
|
||||
encoding names to their canonical form. For an example, see test/data/Aliases.
|
||||
|
||||
The 2nd argument is an allocation function. All allocations required by library
|
||||
initialization will be made by calling this function. It takes the same
|
||||
arguments as realloc(); a pointer and a size. If pointer is NULL a new block is
|
||||
being requested. If size is 0 the block should be freed. Otherwise an existing
|
||||
block is being resized. In many cases this function can simply call realloc().
|
||||
|
||||
The allocation function also takes a private data pointer, which is the third
|
||||
argument to css_initialise(). This is not used by LibCSS but may be used to
|
||||
communicate context to the allocation function.
|
||||
|
||||
The allocation function pointer and private data pointer are arguments to many
|
||||
LibCSS functions and work in the same way.
|
||||
|
||||
css_initialise() returns a css_error value. It is CSS_OK if everything worked,
|
||||
and an error code otherwise. The error codes are defined in libcss/errors.h.
|
||||
|
||||
Many LibCSS functions return a css_error value. Checking the return value of
|
||||
every call that does is advised, for example:
|
||||
|
||||
css_error code;
|
||||
code = css_initialise("../test/data/Aliases", myrealloc, 0);
|
||||
if (code != CSS_OK) {
|
||||
fprintf(stderr, "ERROR: css_initialise failed: %s\n",
|
||||
css_error_to_string(code));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
LibCSS depends on LibWapcaplet. This must be initialized before LibCSS. For
|
||||
example:
|
||||
|
||||
lwc_code = lwc_initialise(myrealloc, NULL, 0);
|
||||
if (lwc_code != lwc_error_ok)
|
||||
...
|
||||
|
||||
|
||||
Load one or more CSS files
|
||||
--------------------------
|
||||
|
||||
A stylesheet is represented by the opaque type css_stylesheet. To create one,
|
||||
use css_stylesheet_create(), for example:
|
||||
|
||||
css_stylesheet *sheet;
|
||||
code = css_stylesheet_create(CSS_LEVEL_DEFAULT, "UTF-8", "", NULL,
|
||||
false, false, myrealloc, 0, resolve_url, 0, &sheet);
|
||||
if (code != CSS_OK)
|
||||
...
|
||||
|
||||
The arguments are as follows:
|
||||
|
||||
css_language_level level
|
||||
Which version of CSS the stylesheet should be treated as. It currently has
|
||||
no effect and is reserved for future use. The recommended value is
|
||||
CSS_LEVEL_DEFAULT.
|
||||
|
||||
const char *charset
|
||||
The encoding of the stylesheet data, or NULL if LibCSS should attempt to
|
||||
detect it. If the encoding is known, for example from the Content-Type
|
||||
header or a file attribute, then it should be supplied here.
|
||||
|
||||
const char *url
|
||||
The URL that the stylesheet was retrieved from. LibCSS uses this along with
|
||||
the resolve function (see below) to convert relative URLs in the stylesheet
|
||||
(e.g. imports, background images) to absolute URLs. If the stylesheet has
|
||||
no URL, use "".
|
||||
|
||||
const char *title
|
||||
This is intended for the stylesheet title (for example from the <link> tag).
|
||||
The title is not used by LibCSS but may be retrieved using
|
||||
css_stylesheet_get_title(). May be NULL if there is no title.
|
||||
|
||||
bool allow_quirks
|
||||
|
||||
|
||||
bool inline_style
|
||||
|
||||
|
||||
css_allocator_fn alloc
|
||||
void *alloc_pw
|
||||
|
||||
|
||||
css_url_resolution_fn resolve
|
||||
void *resolve_pw
|
||||
|
||||
|
||||
css_stylesheet **stylesheet
|
||||
Updated with the newly created stylesheet object.
|
||||
|
||||
Once the stylesheet has been created, CSS source data can be added to it. LibCSS
|
||||
parses the data into internal structures. Only data in memory is supported; you
|
||||
must handle reading from files or the network if required. Data is added using
|
||||
css_stylesheet_append_data(), for example:
|
||||
|
||||
code = css_stylesheet_append_data(sheet, data, length);
|
||||
if (code != CSS_OK && code != CSS_NEEDDATA)
|
||||
...
|
||||
|
||||
The second argument is a pointer to a buffer containing some CSS to be parsed,
|
||||
with length in bytes given in the 3rd argument.
|
||||
|
||||
This function may be called repeatedly with more data from the same stylesheet,
|
||||
for example as data arrives over the network.
|
||||
|
||||
The return value may be CSS_NEEDDATA instead of CSS_OK. This indicates that more
|
||||
data may be expected. The two states can be treated identically.
|
||||
|
||||
When all the data has been supplied, css_stylesheet_data_done() completes the
|
||||
processing:
|
||||
|
||||
code = css_stylesheet_data_done(sheet);
|
||||
if (code != CSS_OK)
|
||||
...
|
||||
|
||||
The stylesheet is now in memory and ready for further use.
|
||||
|
||||
|
||||
Use the Selection API to determine styles
|
||||
-----------------------------------------
|
||||
|
||||
The Selection API is currently the only way to get information about styles from
|
||||
stylesheets that have been loaded. It takes a document node as input and returns
|
||||
the computed style that applies to that node. For example, it can be used to
|
||||
answer the question "What style should this <h1> element have?"
|
||||
|
||||
CSS selectors can be complex and apply to certain arrangments of elements within
|
||||
a document tree. Therefore LibCSS has to be able to navigate your document tree
|
||||
and read attributes of it to determine if a style applies. It does this through
|
||||
a series of functions that you supply. In this way LibCSS is independent of the
|
||||
representation of the document. For example, with the style rule:
|
||||
|
||||
table h2 { color: red; }
|
||||
|
||||
when requesting the style for an h2 element node, LibCSS will search its
|
||||
ancestors for a table element to determine if this style applies.
|
||||
|
||||
The first step in using the Selection API is creating a selection context. This
|
||||
is a list of the stylesheets to be used. A context is created using
|
||||
css_select_ctx_create():
|
||||
|
||||
css_select_ctx *select_ctx;
|
||||
code = css_select_ctx_create(myrealloc, 0, &select_ctx);
|
||||
if (code != CSS_OK)
|
||||
...
|
||||
|
||||
Stylesheets are added to the context using css_select_ctx_append_sheet():
|
||||
|
||||
code = css_select_ctx_append_sheet(select_ctx, sheet, CSS_ORIGIN_AUTHOR,
|
||||
CSS_MEDIA_ALL);
|
||||
if (code != CSS_OK)
|
||||
...
|
||||
|
||||
When adding a stylesheet, the origin and media can be specified. These are used
|
||||
in the computation of styles as defined in the CSS specification.
|
||||
|
||||
Alternatively stylesheets may be added using css_select_ctx_insert_sheet().
|
||||
|
||||
After the context has been prepared, an empty computed style is created:
|
||||
|
||||
css_computed_style *style;
|
||||
code = css_computed_style_create(myrealloc, 0, &style);
|
||||
if (code != CSS_OK)
|
||||
...
|
||||
|
||||
The style is then determined for a document node using css_select_style():
|
||||
|
||||
code = css_select_style(select_ctx, element_node, 0,
|
||||
CSS_MEDIA_SCREEN, NULL, style,
|
||||
&select_handler, 0);
|
||||
if (code != CSS_OK)
|
||||
...
|
||||
|
||||
The arguments are as follows:
|
||||
|
||||
css_select_ctx *ctx
|
||||
The selection context, as described above.
|
||||
|
||||
void *node
|
||||
A pointer to the document node for which the style is required. This is a
|
||||
void pointer and may therefore be of any desired type. LibCSS can not use it
|
||||
directly; instead it gets information about it through the functions given
|
||||
in the handler argument, described below. Usually this will be a node in a
|
||||
document tree.
|
||||
|
||||
uint32_t pseudo_element
|
||||
|
||||
uint64_t media
|
||||
The media that the style should apply to. The computed style will only
|
||||
consider stylesheets or @media blocks that include this media. See the CSS
|
||||
specification for more details.
|
||||
|
||||
const css_stylesheet *inline_style
|
||||
|
||||
css_computed_style *result
|
||||
Updated to the computed style for the node.
|
||||
|
||||
css_select_handler *handler
|
||||
This is a table of functions that are used to get information from and to
|
||||
navigate the document tree, in order to determine if a CSS selector matches
|
||||
the document node. Further details are below.
|
||||
|
||||
void *pw
|
||||
A private data pointer that is passed to each of the handler functions.
|
||||
|
||||
The types of the handler functions that need to be supplied and the definition
|
||||
of css_select_handler are given in libcss/select.h. The functions all have the
|
||||
following in common:
|
||||
|
||||
* the first argument is the private data pointer that was the last argument to
|
||||
css_select_style()
|
||||
|
||||
* the second argument is the document node that is being queried is some way
|
||||
|
||||
* the last one or two arguments are pointers that must be updated with the
|
||||
required information
|
||||
|
||||
* the return value is a css_error and should be CSS_OK if everything worked and
|
||||
an error code otherwise
|
||||
|
||||
For example, the node_name function, which determines the element name of a
|
||||
node, could be this:
|
||||
|
||||
css_error node_name(void *pw, void *n, lwc_string **name)
|
||||
{
|
||||
my_document_node *node = n;
|
||||
*name = lwc_string_ref(node->name);
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
where my_document_node is your document tree node type (e.g. a struct of some
|
||||
sort).
|
||||
|
||||
|
||||
Use the computed styles
|
||||
-----------------------
|
||||
|
||||
After the style has been computed by css_select_style() the CSS properties can
|
||||
finally be retrieved. This is done using the property accessor functions
|
||||
declared in libcss/computed.h.
|
||||
|
||||
Note that although struct css_computed_style is declared in computed.h, its
|
||||
members must not be used directly. The accessors carry out various additional
|
||||
work to read the properties correctly.
|
||||
|
||||
For example, the css_computed_color() accessor retrieves the color property:
|
||||
|
||||
uint8_t color_type;
|
||||
css_color color_shade;
|
||||
color_type = css_computed_color(style, &color_shade);
|
||||
|
||||
In this case color_type can be CSS_COLOR_INHERIT or CSS_COLOR_COLOR. In the
|
||||
latter case, color_shade contains the actual color in RRGGBBAA format. Together
|
||||
these two variables encode the possible values for the property given by the
|
||||
CSS specification.
|
||||
|
1237
programs/network/netsurf/libcss/docs/Bytecode
Normal file
1237
programs/network/netsurf/libcss/docs/Bytecode
Normal file
File diff suppressed because it is too large
Load Diff
10
programs/network/netsurf/libcss/docs/Colour
Normal file
10
programs/network/netsurf/libcss/docs/Colour
Normal file
@ -0,0 +1,10 @@
|
||||
The exported representation of colours is an unsigned 32bit value in host order
|
||||
|
||||
The value is divided into four 8bit channels. These are:
|
||||
|
||||
Bits Name Desciption
|
||||
0-7 Blue The blue intensity of the colour 0 is off 0xff is fully on
|
||||
8-15 Green The green intensity of the colour 0 is off 0xff is fully on
|
||||
16-23 Red The red intensity of the colour 0 is off 0xff is fully on
|
||||
24-31 Alpha The Alpha component represents the opacity of the colour 0 is fully transparent and 0xff is opaque
|
||||
|
210
programs/network/netsurf/libcss/docs/Grammar
Normal file
210
programs/network/netsurf/libcss/docs/Grammar
Normal file
@ -0,0 +1,210 @@
|
||||
Expanded grammar rules
|
||||
======================
|
||||
|
||||
This file provides a fully-expanded version of (a slightly modified)
|
||||
forward-compatible CSS grammar. See CSS3 Syntax $4.3.2 for the compact version.
|
||||
|
||||
start -> ws stylesheet EOF
|
||||
|
||||
stylesheet -> CDO ws stylesheet
|
||||
stylesheet -> CDC ws stylesheet
|
||||
stylesheet -> statement stylesheet
|
||||
stylesheet ->
|
||||
|
||||
statement -> ruleset
|
||||
statement -> at-rule
|
||||
|
||||
ruleset -> selector '{' ws ruleset-end
|
||||
ruleset -> '{' ws ruleset-end
|
||||
|
||||
ruleset-end -> declaration decl-list '}' ws
|
||||
ruleset-end -> decl-list '}' ws
|
||||
|
||||
at-rule -> ATKEYWORD ws any0 at-rule-end
|
||||
|
||||
at-rule-end -> block
|
||||
at-rule-end -> ';' ws
|
||||
|
||||
block -> '{' ws block-content '}' ws
|
||||
|
||||
block-content -> any block-content
|
||||
block-content -> block block-content
|
||||
block-content -> ATKEYWORD ws block-content
|
||||
block-content -> ';' ws block-content
|
||||
block-content ->
|
||||
|
||||
selector -> any1
|
||||
|
||||
declaration -> property ':' ws value1
|
||||
|
||||
decl-list -> ';' ws decl-list-end
|
||||
decl-list ->
|
||||
|
||||
decl-list-end -> declaration decl-list
|
||||
decl-list-end -> decl-list
|
||||
|
||||
property -> IDENT ws
|
||||
|
||||
value0 -> value value0
|
||||
value0 ->
|
||||
|
||||
value1 -> value value0
|
||||
|
||||
value -> any
|
||||
value -> block
|
||||
value -> ATKEYWORD ws
|
||||
|
||||
any0 -> any any0
|
||||
any0 ->
|
||||
|
||||
any1 -> any any0
|
||||
|
||||
any -> IDENT ws
|
||||
any -> NUMBER ws
|
||||
any -> PERCENTAGE ws
|
||||
any -> DIMENSION ws
|
||||
any -> STRING ws
|
||||
any -> CHAR ws
|
||||
any -> URI ws
|
||||
any -> HASH ws
|
||||
any -> UNICODE-RANGE ws
|
||||
any -> INCLUDES ws
|
||||
any -> DASHMATCH ws
|
||||
any -> PREFIXMATCH ws
|
||||
any -> SUFFIXMATCH ws
|
||||
any -> SUBSTRINGMATCH ws
|
||||
any -> FUNCTION ws any0 ')' ws
|
||||
any -> '(' ws any0 ')' ws
|
||||
any -> '[' ws any0 ']' ws
|
||||
|
||||
ws -> S ws
|
||||
ws ->
|
||||
|
||||
Differences from the specification
|
||||
----------------------------------
|
||||
|
||||
1) The start non-terminal has been introduced. It eats any leading whitespace
|
||||
and handles EOF.
|
||||
2) The "stylesheet -> S stylesheet" production has been removed.
|
||||
3) The "stylesheet -> CDO stylesheet" production has been changed to
|
||||
"stylesheet -> CDO ws stylesheet".
|
||||
4) The "stylesheet -> CDC stylesheet" production has been changed to
|
||||
"stylesheet -> CDC ws stylesheet".
|
||||
|
||||
Essentially, the above changes remove the expectation of leading whitespace
|
||||
from the stylesheet non-terminal. This is handled by either the start
|
||||
non-terminal, or by the changes made to the production rules for the stylesheet
|
||||
non-terminal. Note that the "stylesheet -> statement stylesheet" production
|
||||
does not require modification as the statement production rule already consumes
|
||||
any whitespace following the statement.
|
||||
|
||||
If '{', '}', '[', ']', '(', ')', and ';' are omitted from any, then the above
|
||||
grammar is LL(1).
|
||||
|
||||
Nullable productions
|
||||
--------------------
|
||||
|
||||
stylesheet, block-content, decl-list, decl-list-end, value0, any0, ws
|
||||
|
||||
FIRST sets
|
||||
----------
|
||||
|
||||
start CDO, CDC, S, IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING,
|
||||
CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH,
|
||||
PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(',
|
||||
'[', '{', ATKEYWORD, EOF
|
||||
stylesheet CDO, CDC, IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING,
|
||||
CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH,
|
||||
PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(',
|
||||
'[', '{', ATKEYWORD
|
||||
statement IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH,
|
||||
UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH,
|
||||
SUBSTRINGMATCH, FUNCTION, '(', '[', '{', ATKEYWORD
|
||||
ruleset IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH,
|
||||
UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH,
|
||||
SUBSTRINGMATCH, FUNCTION, '(', '[', '{'
|
||||
ruleset-end IDENT, ';'
|
||||
at-rule ATKEYWORD
|
||||
at-rule-end '{', ';'
|
||||
block '{'
|
||||
block-content IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH,
|
||||
UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH,
|
||||
SUBSTRINGMATCH, FUNCTION, '(', '[', '{', ATKEYWORD, ';'
|
||||
selector IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH,
|
||||
UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH,
|
||||
SUBSTRINGMATCH, FUNCTION, '(', '['
|
||||
declaration IDENT
|
||||
decl-list ';', '}'
|
||||
decl-list-end IDENT, ';', '}'
|
||||
property IDENT
|
||||
value0 IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH,
|
||||
UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH,
|
||||
SUBSTRINGMATCH, FUNCTION, '(', '[', '{', ATKEYWORD
|
||||
value1 IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH,
|
||||
UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH,
|
||||
SUBSTRINGMATCH, FUNCTION, '(', '[', '{', ATKEYWORD
|
||||
value IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH,
|
||||
UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH,
|
||||
SUBSTRINGMATCH, FUNCTION, '(', '[', '{', ATKEYWORD
|
||||
any0 IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH,
|
||||
UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH,
|
||||
SUBSTRINGMATCH, FUNCTION, '(', '['
|
||||
any1 IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH,
|
||||
UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH,
|
||||
SUBSTRINGMATCH, FUNCTION, '(', '['
|
||||
any IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH,
|
||||
UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH,
|
||||
SUBSTRINGMATCH, FUNCTION, '(', '['
|
||||
ws S
|
||||
|
||||
FOLLOW sets
|
||||
-----------
|
||||
|
||||
start
|
||||
stylesheet EOF
|
||||
statement CDO, CDC, IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING,
|
||||
CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH,
|
||||
PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(',
|
||||
'[', '{', ATKEYWORD, EOF
|
||||
ruleset CDO, CDC, IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING,
|
||||
CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH,
|
||||
PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(',
|
||||
'[', '{', ATKEYWORD, EOF
|
||||
ruleset-end CDO, CDC, IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING,
|
||||
CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH,
|
||||
PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(',
|
||||
'[', '{', ATKEYWORD, EOF
|
||||
at-rule CDO, CDC, IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING,
|
||||
CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH,
|
||||
PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(',
|
||||
'[', '{', ATKEYWORD, EOF
|
||||
at-rule-end CDO, CDC, IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING,
|
||||
CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH,
|
||||
PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(',
|
||||
'[', '{', ATKEYWORD, EOF
|
||||
block CDO, CDC, IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING,
|
||||
CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH,
|
||||
PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(',
|
||||
'[', '{', ATKEYWORD, EOF, ';', '}'
|
||||
block-content '}'
|
||||
selector '{'
|
||||
declaration ';', '}'
|
||||
decl-list '}'
|
||||
decl-list-end '}'
|
||||
property ':'
|
||||
value0 ';', '}'
|
||||
value1 ';', '}'
|
||||
value IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH,
|
||||
UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH,
|
||||
SUBSTRINGMATCH, FUNCTION, '(', '[', '{', ATKEYWORD, ';', '}'
|
||||
any0 '{', ';', ')', ']'
|
||||
any1 '{'
|
||||
any IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH,
|
||||
UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH,
|
||||
SUBSTRINGMATCH, FUNCTION, '(', '[', '{', ';', ATKEYWORD, '}'
|
||||
ws CDO, CDC, IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING,
|
||||
CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH,
|
||||
PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(',
|
||||
'[', '{', ATKEYWORD, EOF, ';', '}', ':'
|
||||
|
||||
|
31
programs/network/netsurf/libcss/docs/Lexer
Normal file
31
programs/network/netsurf/libcss/docs/Lexer
Normal file
@ -0,0 +1,31 @@
|
||||
Lexical analyser
|
||||
================
|
||||
|
||||
This document contains various snippets of information about the lexer
|
||||
implementation.
|
||||
|
||||
First sets
|
||||
----------
|
||||
|
||||
IDENT [a-zA-Z] | '-' | '_' | [^#x0-#x7F] | '\'
|
||||
ATKEYWORD '@'
|
||||
STRING '"' | "'"
|
||||
INVALID_STRING '"' | "'"
|
||||
HASH '#'
|
||||
NUMBER [0-9] | '.' | '-' | '+'
|
||||
PERCENTAGE [0-9] | '.' | '-' | '+'
|
||||
DIMENSION [0-9] | '.'
|
||||
URI [Uu]
|
||||
UNICODE-RANGE [Uu]
|
||||
CDO '<'
|
||||
CDC '-'
|
||||
S #x9 | #xA | #xC | #xD | #x20
|
||||
COMMENT '/'
|
||||
FUNCTION [a-zA-Z] | '-' | '_' | [^#x0-#x7F] | '\'
|
||||
INCLUDES '~'
|
||||
DASHMATCH '|'
|
||||
PREFIXMATCH '^'
|
||||
SUFFIXMATCH '$'
|
||||
SUBSTRINGMATCH '*'
|
||||
CHAR anything except " or '
|
||||
|
98
programs/network/netsurf/libcss/docs/Representation
Normal file
98
programs/network/netsurf/libcss/docs/Representation
Normal file
@ -0,0 +1,98 @@
|
||||
LibCSS internal stylesheet representation
|
||||
=========================================
|
||||
|
||||
Selector:
|
||||
|
||||
struct selector {
|
||||
selector_type type; /**< Type of selector */
|
||||
|
||||
struct {
|
||||
const uint8_t *name;
|
||||
size_t name_len;
|
||||
|
||||
const uint8_t *value;
|
||||
size_t value_len;
|
||||
} data; /**< Selector data */
|
||||
|
||||
struct selector *specifics; /**< Selector specifics */
|
||||
|
||||
combinator combinator_type; /**< Type of combinator */
|
||||
struct selector *combinator; /**< Combining selector */
|
||||
|
||||
struct rule *rule; /**< Owning rule */
|
||||
|
||||
struct style *style; /**< Applicable style */
|
||||
|
||||
struct selector *next; /**< Next selector in list */
|
||||
struct selector *prev; /**< Previous selector */
|
||||
};
|
||||
|
||||
Rule:
|
||||
|
||||
struct rule {
|
||||
rule_type type; /**< Type of rule */
|
||||
|
||||
union {
|
||||
struct {
|
||||
uint32_t selector_count;
|
||||
struct selector **selectors;
|
||||
} selector;
|
||||
struct {
|
||||
uint32_t media;
|
||||
uint32_t rule_count;
|
||||
struct rule **rules;
|
||||
} media;
|
||||
struct {
|
||||
struct style *style;
|
||||
} font_face;
|
||||
struct {
|
||||
uint32_t selector_count;
|
||||
struct selector **selectors;
|
||||
struct style *style;
|
||||
} page;
|
||||
struct {
|
||||
struct stylesheet *sheet;
|
||||
} import;
|
||||
struct {
|
||||
char *encoding;
|
||||
} charset;
|
||||
} data; /**< Rule data */
|
||||
|
||||
uint32_t index; /**< Index of rule in sheet */
|
||||
|
||||
struct stylesheet *owner; /**< Owning sheet */
|
||||
|
||||
struct rule *parent; /**< Parent rule */
|
||||
struct rule *first_child; /**< First in child list */
|
||||
struct rule *last_child; /**< Last in child list */
|
||||
struct rule *next; /**< Next rule */
|
||||
struct rule *prev; /**< Previous rule */
|
||||
};
|
||||
|
||||
Stylesheet:
|
||||
|
||||
struct stylesheet {
|
||||
#define HASH_SIZE (37)
|
||||
struct selector *selectors[HASH_SIZE]; /**< Hashtable of selectors */
|
||||
|
||||
uint32_t rule_count; /**< Number of rules in sheet */
|
||||
struct rule *rule_list; /**< List of rules in sheet */
|
||||
|
||||
bool disabled; /**< Whether this sheet is
|
||||
* disabled */
|
||||
|
||||
char *url; /**< URL of this sheet */
|
||||
char *title; /**< Title of this sheet */
|
||||
|
||||
uint32_t media; /**< Bitfield of media types */
|
||||
|
||||
void *ownerNode; /**< Owning node in document */
|
||||
struct rule *ownerRule; /**< Owning rule in parent */
|
||||
|
||||
struct stylesheet *parent; /**< Parent sheet */
|
||||
struct stylesheet *first_child; /**< First in child list */
|
||||
struct stylesheet *last_child; /**< Last in child list */
|
||||
struct stylesheet *next; /**< Next in sibling list */
|
||||
struct stylesheet *prev; /**< Previous in sibling list */
|
||||
};
|
||||
|
66
programs/network/netsurf/libcss/docs/Tokens
Normal file
66
programs/network/netsurf/libcss/docs/Tokens
Normal file
@ -0,0 +1,66 @@
|
||||
Production rules for lexical tokens
|
||||
===================================
|
||||
|
||||
This file provides a complete set of production rules for the tokens generated
|
||||
by the lexer. In case of ambiguity, the longest match wins.
|
||||
|
||||
Components
|
||||
----------
|
||||
|
||||
ident ::= '-'? nmstart nmchar*
|
||||
name ::= nmchar+
|
||||
nmstart ::= [a-zA-Z] | '_' | nonascii | escape
|
||||
nonascii ::= [#x80-#xD7FF#xE000-#xFFFD#x10000-#x10FFFF]
|
||||
unicode ::= '\' [0-9a-fA-F]{1,6} wc?
|
||||
escape ::= unicode | '\' [^\n\r\f0-9a-fA-F]
|
||||
nmchar ::= [a-zA-Z0-9] | '-' | '_' | nonascii | escape
|
||||
num ::= [-+]? ([0-9]+ | [0-9]* '.' [0-9]+)
|
||||
string ::= '"' (stringchar | "'")* '"' | "'" (stringchar | '"')* "'"
|
||||
stringchar ::= urlchar | #x20 | #x29 | '\' nl
|
||||
urlchar ::= [#x9#x21#x23-#x26#x28#x2A-#x7E] | nonascii | escape
|
||||
nl ::= #xA | #xD #xA | #xD | #xC
|
||||
w ::= wc*
|
||||
wc ::= #x9 | #xA | #xC | #xD | #x20
|
||||
|
||||
Tokens
|
||||
------
|
||||
|
||||
IDENT ::= ident
|
||||
ATKEYWORD ::= '@' ident
|
||||
STRING ::= string
|
||||
INVALID_STRING ::= '"' (stringchar | "'")* [^"] | "'" (stringchar | '"')* [^']
|
||||
HASH ::= '#' name
|
||||
NUMBER ::= num
|
||||
PERCENTAGE ::= num '%'
|
||||
DIMENSION ::= num ident
|
||||
URI ::= "url(" w (string | urlchar*) w ')'
|
||||
UNICODE-RANGE ::= [Uu] '+' [0-9a-fA-F?]{1,6} ('-' [0-9a-fA-F]{1,6})?
|
||||
CDO ::= "<!--"
|
||||
CDC ::= "-->"
|
||||
S ::= wc+
|
||||
COMMENT ::= "/*" [^*]* '*'+ ([^/] [^*]* '*'+) '/'
|
||||
FUNCTION ::= ident '('
|
||||
INCLUDES ::= "~="
|
||||
DASHMATCH ::= "|="
|
||||
PREFIXMATCH ::= "^="
|
||||
SUFFIXMATCH ::= "$="
|
||||
SUBSTRINGMATCH ::= "*="
|
||||
CHAR ::= any other character, except " or '
|
||||
|
||||
Differences from the CSS3 Syntax module specification
|
||||
-----------------------------------------------------
|
||||
|
||||
1) UNICODE-RANGE is case insensitive (it's uppercase only in the spec)
|
||||
2) escape follows CSS2.1. CSS3 defines it as:
|
||||
escape ::= unicode | '\' [#x20-#x7E#x80-#xD7FF#xE000-#xFFFD#x10000-#x10FFFF]
|
||||
3) urlchar omits ' and ):
|
||||
a) If ' is permitted verbatim then, as stringchar inherits from urlchar,
|
||||
single quoted strings may contain verbatim single quotes. This is
|
||||
clearly nonsense.
|
||||
b) If ) is permitted verbatim then it becomes impossible to determine the
|
||||
true end of URI. Thus, for sanity's sake, it's omitted here.
|
||||
4) stringchar explicitly includes ). See 3(b) for why it won't inherit it
|
||||
from urlchar as the spec implies.
|
||||
5) BOM ::= #xFEFF is omitted. It is assumed that any leading BOM will be
|
||||
stripped from the document before lexing occurs.
|
||||
|
957
programs/network/netsurf/libcss/examples/example1.c
Normal file
957
programs/network/netsurf/libcss/examples/example1.c
Normal file
@ -0,0 +1,957 @@
|
||||
/*
|
||||
* LibCSS - example1.c
|
||||
*
|
||||
* Compile this using a command such as:
|
||||
* gcc -g -W -Wall -o example1 example1.c `pkg-config --cflags --libs libcss`
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/* The entire API is available through this header. */
|
||||
#include <libcss/libcss.h>
|
||||
|
||||
|
||||
/* This macro is used to silence compiler warnings about unused function
|
||||
* arguments. */
|
||||
#define UNUSED(x) ((x) = (x))
|
||||
|
||||
|
||||
/* Function declarations. */
|
||||
static void *myrealloc(void *ptr, size_t len, void *pw);
|
||||
static css_error resolve_url(void *pw,
|
||||
const char *base, lwc_string *rel, lwc_string **abs);
|
||||
static void die(const char *text, css_error code);
|
||||
|
||||
static css_error node_name(void *pw, void *node,
|
||||
css_qname *qname);
|
||||
static css_error node_classes(void *pw, void *node,
|
||||
lwc_string ***classes, uint32_t *n_classes);
|
||||
static css_error node_id(void *pw, void *node,
|
||||
lwc_string **id);
|
||||
static css_error named_ancestor_node(void *pw, void *node,
|
||||
const css_qname *qname,
|
||||
void **ancestor);
|
||||
static css_error named_parent_node(void *pw, void *node,
|
||||
const css_qname *qname,
|
||||
void **parent);
|
||||
static css_error named_sibling_node(void *pw, void *node,
|
||||
const css_qname *qname,
|
||||
void **sibling);
|
||||
static css_error named_generic_sibling_node(void *pw, void *node,
|
||||
const css_qname *qname,
|
||||
void **sibling);
|
||||
static css_error parent_node(void *pw, void *node, void **parent);
|
||||
static css_error sibling_node(void *pw, void *node, void **sibling);
|
||||
static css_error node_has_name(void *pw, void *node,
|
||||
const css_qname *qname,
|
||||
bool *match);
|
||||
static css_error node_has_class(void *pw, void *node,
|
||||
lwc_string *name,
|
||||
bool *match);
|
||||
static css_error node_has_id(void *pw, void *node,
|
||||
lwc_string *name,
|
||||
bool *match);
|
||||
static css_error node_has_attribute(void *pw, void *node,
|
||||
const css_qname *qname,
|
||||
bool *match);
|
||||
static css_error node_has_attribute_equal(void *pw, void *node,
|
||||
const css_qname *qname,
|
||||
lwc_string *value,
|
||||
bool *match);
|
||||
static css_error node_has_attribute_dashmatch(void *pw, void *node,
|
||||
const css_qname *qname,
|
||||
lwc_string *value,
|
||||
bool *match);
|
||||
static css_error node_has_attribute_includes(void *pw, void *node,
|
||||
const css_qname *qname,
|
||||
lwc_string *value,
|
||||
bool *match);
|
||||
static css_error node_has_attribute_prefix(void *pw, void *node,
|
||||
const css_qname *qname,
|
||||
lwc_string *value,
|
||||
bool *match);
|
||||
static css_error node_has_attribute_suffix(void *pw, void *node,
|
||||
const css_qname *qname,
|
||||
lwc_string *value,
|
||||
bool *match);
|
||||
static css_error node_has_attribute_substring(void *pw, void *node,
|
||||
const css_qname *qname,
|
||||
lwc_string *value,
|
||||
bool *match);
|
||||
static css_error node_is_root(void *pw, void *node, bool *match);
|
||||
static css_error node_count_siblings(void *pw, void *node,
|
||||
bool same_name, bool after, int32_t *count);
|
||||
static css_error node_is_empty(void *pw, void *node, bool *match);
|
||||
static css_error node_is_link(void *pw, void *node, bool *match);
|
||||
static css_error node_is_visited(void *pw, void *node, bool *match);
|
||||
static css_error node_is_hover(void *pw, void *node, bool *match);
|
||||
static css_error node_is_active(void *pw, void *node, bool *match);
|
||||
static css_error node_is_focus(void *pw, void *node, bool *match);
|
||||
static css_error node_is_enabled(void *pw, void *node, bool *match);
|
||||
static css_error node_is_disabled(void *pw, void *node, bool *match);
|
||||
static css_error node_is_checked(void *pw, void *node, bool *match);
|
||||
static css_error node_is_target(void *pw, void *node, bool *match);
|
||||
static css_error node_is_lang(void *pw, void *node,
|
||||
lwc_string *lang, bool *match);
|
||||
static css_error node_presentational_hint(void *pw, void *node,
|
||||
uint32_t property, css_hint *hint);
|
||||
static css_error ua_default_for_property(void *pw, uint32_t property,
|
||||
css_hint *hint);
|
||||
static css_error compute_font_size(void *pw, const css_hint *parent,
|
||||
css_hint *size);
|
||||
|
||||
/* Table of function pointers for the LibCSS Select API. */
|
||||
static css_select_handler select_handler = {
|
||||
CSS_SELECT_HANDLER_VERSION_1,
|
||||
|
||||
node_name,
|
||||
node_classes,
|
||||
node_id,
|
||||
named_ancestor_node,
|
||||
named_parent_node,
|
||||
named_sibling_node,
|
||||
named_generic_sibling_node,
|
||||
parent_node,
|
||||
sibling_node,
|
||||
node_has_name,
|
||||
node_has_class,
|
||||
node_has_id,
|
||||
node_has_attribute,
|
||||
node_has_attribute_equal,
|
||||
node_has_attribute_dashmatch,
|
||||
node_has_attribute_includes,
|
||||
node_has_attribute_prefix,
|
||||
node_has_attribute_suffix,
|
||||
node_has_attribute_substring,
|
||||
node_is_root,
|
||||
node_count_siblings,
|
||||
node_is_empty,
|
||||
node_is_link,
|
||||
node_is_visited,
|
||||
node_is_hover,
|
||||
node_is_active,
|
||||
node_is_focus,
|
||||
node_is_enabled,
|
||||
node_is_disabled,
|
||||
node_is_checked,
|
||||
node_is_target,
|
||||
node_is_lang,
|
||||
node_presentational_hint,
|
||||
ua_default_for_property,
|
||||
compute_font_size
|
||||
};
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
css_error code;
|
||||
css_stylesheet *sheet;
|
||||
size_t size;
|
||||
const char data[] = "body {\
|
||||
color: #333333;\
|
||||
background: #F4F5F5;\
|
||||
line-height: 2em;\
|
||||
font-size: 11.5pt;\
|
||||
margin: 0;\
|
||||
padding: 0;\
|
||||
font-family: \"Source Sans Pro\", \"Open Sans\", sans-serif;\
|
||||
}\
|
||||
\
|
||||
a {\
|
||||
text-decoration: underline;\
|
||||
color: #1F1F1F;\
|
||||
}\
|
||||
\
|
||||
a:hover {\
|
||||
text-decoration: none;\
|
||||
}\
|
||||
\
|
||||
a img {\
|
||||
filter: alpha(opacity=80);\
|
||||
..-opacity:0.8;\
|
||||
opacity: 0.8;\
|
||||
-khtml-opacity: 0.8;\
|
||||
}\
|
||||
\
|
||||
a img:hover {\
|
||||
filter: alpha(opacity=100);\
|
||||
..-opacity:1.0;\
|
||||
opacity: 1.0;\
|
||||
-khtml-opacity: 1.0;\
|
||||
}\
|
||||
\
|
||||
#logo {\
|
||||
opacity: 1;\
|
||||
filter: alpha(opacity=100);\
|
||||
border-radius: 2px;\
|
||||
border: solid 5px white;\
|
||||
box-shadow: 0px 0px 0px 1px #D4D5D5, 0px 0px 10px 0px rgba(0,0,0,0.1);\
|
||||
}\
|
||||
\
|
||||
#show {\
|
||||
width:800px;\
|
||||
height:600px;\
|
||||
cursor:pointer;\
|
||||
box-shadow: 0px 0px 0px 1px #D4D5D5, 0px 0px 10px 0px rgba(0,0,0,0.1);\
|
||||
}\
|
||||
\
|
||||
.minislide, .minislide_a {\
|
||||
width: 80px;\
|
||||
height: 60px;\
|
||||
padding: 1px;\
|
||||
}\
|
||||
\
|
||||
.minislide { border: 1px solid #ccc; }\
|
||||
.minislide_a {\
|
||||
border: 1px solid #222;\
|
||||
opacity: 1;\
|
||||
filter: alpha(opacity=100);\
|
||||
}\
|
||||
\
|
||||
.download_img {\
|
||||
width: 32px;\
|
||||
height: 32px;\
|
||||
border: 0px;\
|
||||
}\
|
||||
\
|
||||
.icon_cell {\
|
||||
width: 32px;\
|
||||
height:32px;\
|
||||
background-repeat: no-repeat;\
|
||||
}\
|
||||
\
|
||||
#footer {\
|
||||
padding: 30px 0 30px 0;\
|
||||
text-align: center;\
|
||||
color: #848585;\
|
||||
-khtml-text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);\
|
||||
-webkit-text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);\
|
||||
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);\
|
||||
}\
|
||||
\
|
||||
#footer a {\
|
||||
color: #848585;\
|
||||
}\
|
||||
\
|
||||
#page {\
|
||||
position: relative;\
|
||||
margin: 0;\
|
||||
background-attachment: scroll;\
|
||||
background-repeat: no-repeat;\
|
||||
background-position: right bottom;\
|
||||
color: #333333;\
|
||||
padding: 5px 35px 5px 35px;\
|
||||
width: 910px;\
|
||||
}\
|
||||
\
|
||||
\
|
||||
#inner {\
|
||||
background: #fff;\
|
||||
border-radius: 4px;\
|
||||
box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.1);\
|
||||
border: solid 1px #D4D5D5;\
|
||||
}\
|
||||
\
|
||||
*+html #inner { /*IE 7*/\
|
||||
background: #fff;\
|
||||
filter:\
|
||||
progid:DXImageTransform.Microsoft.Shadow(color='#e5e6e6', Direction=45, Strength=3)\
|
||||
progid:DXImageTransform.Microsoft.Shadow(color='#e5e6e6', Direction=135, Strength=3)\
|
||||
progid:DXImageTransform.Microsoft.Shadow(color='#e5e6e6', Direction=225, Strength=3)\
|
||||
progid:DXImageTransform.Microsoft.Shadow(color='#e5e6e6', Direction=315, Strength=3);\
|
||||
position: relative;\
|
||||
top: -6px;\
|
||||
left: -6px;\
|
||||
zoom: 1;\
|
||||
}\
|
||||
\
|
||||
*+html #logo { /*IE 7*/\
|
||||
border: 1px solid #D4D5D5;\
|
||||
}\
|
||||
\
|
||||
@media \0screen { /*IE 8*/\
|
||||
#inner {\
|
||||
background: #fff;\
|
||||
filter:\
|
||||
progid:DXImageTransform.Microsoft.Shadow(color='#e5e6e6', Direction=45, Strength=3)\
|
||||
progid:DXImageTransform.Microsoft.Shadow(color='#e5e6e6', Direction=135, Strength=3)\
|
||||
progid:DXImageTransform.Microsoft.Shadow(color='#e5e6e6', Direction=225, Strength=3)\
|
||||
progid:DXImageTransform.Microsoft.Shadow(color='#e5e6e6', Direction=315, Strength=3);\
|
||||
position: relative;\
|
||||
top: -6px;\
|
||||
left: -6px;\
|
||||
zoom: 1;\
|
||||
}\
|
||||
#logo {\
|
||||
position: relative;\
|
||||
top: 9px;\
|
||||
left: 9px;\
|
||||
border: 1px solid #D4D5D5;\
|
||||
}\
|
||||
}\
|
||||
\
|
||||
#splash {\
|
||||
margin: 0;\
|
||||
position: relative;\
|
||||
padding: 35px 35px 5px 35px;\
|
||||
}\
|
||||
\
|
||||
#wrapper {\
|
||||
width: 980px;\
|
||||
position: relative;\
|
||||
margin-right: auto;\
|
||||
margin-bottom: 0;\
|
||||
margin-left: auto;\
|
||||
}\
|
||||
\
|
||||
#floatbar {\
|
||||
position: fixed; \
|
||||
top:0;\
|
||||
right:0;\
|
||||
bottom:100px;\
|
||||
left:0;\
|
||||
float: center !important; \
|
||||
text-align:center;\
|
||||
z-index:9998;\
|
||||
height: 30px !important;\
|
||||
}\
|
||||
\
|
||||
#idsel {\
|
||||
dispaly: inline;\
|
||||
color: white !important; \
|
||||
font-weight: bold !important;\
|
||||
text-decoration: none !important; \
|
||||
}\
|
||||
\
|
||||
#archnavbar {\
|
||||
height: 30px !important;\
|
||||
padding: 10px 15px !important;\
|
||||
background: #333 !important;\
|
||||
border-bottom: 1px #888 solid !important;\
|
||||
box-shadow: 0 0 5px black;\
|
||||
box-shadow: 0 0 10px rgba(0,0,0,0.4);\
|
||||
-moz-box-shadow: 0 0 10px rgba(0,0,0,0.4);\
|
||||
-webkit-box-shadow: 0 0 10px rgba(0,0,0,0.4);\
|
||||
position: relative;\
|
||||
}\
|
||||
\
|
||||
#archnavbarlist { \
|
||||
width: 980px;\
|
||||
height: 30px !important;\
|
||||
position: relative;\
|
||||
margin-top: 0px;\
|
||||
margin-right: auto;\
|
||||
margin-bottom: 0px;\
|
||||
margin-left: auto;\
|
||||
float: center !important; \
|
||||
list-style: none !important; \
|
||||
padding: 0 !important;\
|
||||
}\
|
||||
\
|
||||
#archnavbarlist ul { \
|
||||
text-align:center; \
|
||||
}\
|
||||
\
|
||||
#archnavbarlist li { \
|
||||
display: inline-block;\
|
||||
float: center !important; \
|
||||
font-size: 14px !important; \
|
||||
line-height: 25px !important; \
|
||||
padding-right: 15px !important; \
|
||||
padding-left: 15px !important;\
|
||||
}\
|
||||
\
|
||||
#archnavbarlist li a { \
|
||||
color: #999; \
|
||||
font-weight: bold !important;\
|
||||
text-decoration: none !important;\
|
||||
}\
|
||||
\
|
||||
#archnavbarlist li a:hover { \
|
||||
color: white !important; \
|
||||
font-weight: bold !important;\
|
||||
text-decoration: none !important; \
|
||||
}\
|
||||
\
|
||||
strong {\
|
||||
color: #000;\
|
||||
}";
|
||||
css_select_ctx *select_ctx;
|
||||
uint32_t count;
|
||||
unsigned int hh;
|
||||
css_stylesheet_params params;
|
||||
|
||||
UNUSED(argc);
|
||||
UNUSED(argv);
|
||||
|
||||
params.params_version = CSS_STYLESHEET_PARAMS_VERSION_1;
|
||||
params.level = CSS_LEVEL_21;
|
||||
params.charset = "UTF-8";
|
||||
params.url = "foo";
|
||||
params.title = "foo";
|
||||
params.allow_quirks = false;
|
||||
params.inline_style = false;
|
||||
params.resolve = resolve_url;
|
||||
params.resolve_pw = NULL;
|
||||
params.import = NULL;
|
||||
params.import_pw = NULL;
|
||||
params.color = NULL;
|
||||
params.color_pw = NULL;
|
||||
params.font = NULL;
|
||||
params.font_pw = NULL;
|
||||
|
||||
/* create a stylesheet */
|
||||
code = css_stylesheet_create(¶ms, myrealloc, NULL, &sheet);
|
||||
if (code != CSS_OK)
|
||||
die("css_stylesheet_create", code);
|
||||
code = css_stylesheet_size(sheet, &size);
|
||||
if (code != CSS_OK)
|
||||
die("css_stylesheet_size", code);
|
||||
printf("created stylesheet, size %zu\n", size);
|
||||
|
||||
|
||||
/* parse some CSS source */
|
||||
code = css_stylesheet_append_data(sheet, (const uint8_t *) data,
|
||||
sizeof data);
|
||||
if (code != CSS_OK && code != CSS_NEEDDATA)
|
||||
die("css_stylesheet_append_data", code);
|
||||
code = css_stylesheet_data_done(sheet);
|
||||
if (code != CSS_OK)
|
||||
die("css_stylesheet_data_done", code);
|
||||
code = css_stylesheet_size(sheet, &size);
|
||||
if (code != CSS_OK)
|
||||
die("css_stylesheet_size", code);
|
||||
printf("appended data, size now %zu\n", size);
|
||||
|
||||
|
||||
/* prepare a selection context containing the stylesheet */
|
||||
code = css_select_ctx_create(myrealloc, 0, &select_ctx);
|
||||
if (code != CSS_OK)
|
||||
die("css_select_ctx_create", code);
|
||||
code = css_select_ctx_append_sheet(select_ctx, sheet, CSS_ORIGIN_AUTHOR,
|
||||
CSS_MEDIA_ALL);
|
||||
if (code != CSS_OK)
|
||||
die("css_select_ctx_append_sheet", code);
|
||||
code = css_select_ctx_count_sheets(select_ctx, &count);
|
||||
if (code != CSS_OK)
|
||||
die("css_select_ctx_count_sheets", code);
|
||||
printf("created selection context with %i sheets\n", count);
|
||||
|
||||
|
||||
/* select style for each of h1 to h6 */
|
||||
//for (hh = 1; hh != 7; hh++) {
|
||||
hh=1;
|
||||
css_select_results *style;
|
||||
char element[20];
|
||||
lwc_string *element_name;
|
||||
uint8_t color_type;
|
||||
css_color color_shade;
|
||||
|
||||
/* in this very simple example our "document tree" is just one
|
||||
* node and is in fact a libwapcaplet string containing the
|
||||
* element name */
|
||||
//snprintf(element, sizeof element, "%i", hh);
|
||||
snprintf(element, sizeof element, "a");
|
||||
|
||||
lwc_intern_string(element, strlen(element), &element_name);
|
||||
|
||||
code = css_select_style(select_ctx, element_name,
|
||||
CSS_MEDIA_SCREEN, NULL,
|
||||
&select_handler, 0,
|
||||
&style);
|
||||
if (code != CSS_OK)
|
||||
die("css_select_style", code);
|
||||
|
||||
lwc_string_unref(element_name);
|
||||
|
||||
color_type = css_computed_color(
|
||||
style->styles[CSS_PSEUDO_ELEMENT_NONE],
|
||||
&color_shade);
|
||||
if (color_type == CSS_COLOR_INHERIT)
|
||||
printf("color of h%i is 'inherit'\n", hh);
|
||||
else
|
||||
printf("color of A is %x\n", color_shade);
|
||||
|
||||
code = css_select_results_destroy(style);
|
||||
if (code != CSS_OK)
|
||||
die("css_computed_style_destroy", code);
|
||||
//}
|
||||
|
||||
|
||||
/* free everything and shut down libcss */
|
||||
code = css_select_ctx_destroy(select_ctx);
|
||||
if (code != CSS_OK)
|
||||
die("css_select_ctx_destroy", code);
|
||||
code = css_stylesheet_destroy(sheet);
|
||||
if (code != CSS_OK)
|
||||
die("css_stylesheet_destroy", code);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void *myrealloc(void *ptr, size_t len, void *pw)
|
||||
{
|
||||
UNUSED(pw);
|
||||
/*printf("myrealloc(%p, %zu)\n", ptr, len);*/
|
||||
|
||||
return realloc(ptr, len);
|
||||
}
|
||||
|
||||
|
||||
css_error resolve_url(void *pw,
|
||||
const char *base, lwc_string *rel, lwc_string **abs)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(base);
|
||||
|
||||
/* About as useless as possible */
|
||||
*abs = lwc_string_ref(rel);
|
||||
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
|
||||
void die(const char *text, css_error code)
|
||||
{
|
||||
fprintf(stderr, "ERROR: %s: %i: %s\n",
|
||||
text, code, css_error_to_string(code));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Select handlers. Our "document tree" is actually just a single node, which is
|
||||
* a libwapcaplet string containing the element name. Therefore all the
|
||||
* functions below except those getting or testing the element name return empty
|
||||
* data or false attributes. */
|
||||
css_error node_name(void *pw, void *n, css_qname *qname)
|
||||
{
|
||||
lwc_string *node = n;
|
||||
|
||||
UNUSED(pw);
|
||||
|
||||
qname->name = lwc_string_ref(node);
|
||||
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error node_classes(void *pw, void *n,
|
||||
lwc_string ***classes, uint32_t *n_classes)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
*classes = NULL;
|
||||
*n_classes = 0;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error node_id(void *pw, void *n, lwc_string **id)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
*id = NULL;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error named_ancestor_node(void *pw, void *n,
|
||||
const css_qname *qname,
|
||||
void **ancestor)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
UNUSED(qname);
|
||||
*ancestor = NULL;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error named_parent_node(void *pw, void *n,
|
||||
const css_qname *qname,
|
||||
void **parent)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
UNUSED(qname);
|
||||
*parent = NULL;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error named_generic_sibling_node(void *pw, void *n,
|
||||
const css_qname *qname,
|
||||
void **sibling)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
UNUSED(qname);
|
||||
*sibling = NULL;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error named_sibling_node(void *pw, void *n,
|
||||
const css_qname *qname,
|
||||
void **sibling)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
UNUSED(qname);
|
||||
*sibling = NULL;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error parent_node(void *pw, void *n, void **parent)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
*parent = NULL;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error sibling_node(void *pw, void *n, void **sibling)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
*sibling = NULL;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error node_has_name(void *pw, void *n,
|
||||
const css_qname *qname,
|
||||
bool *match)
|
||||
{
|
||||
lwc_string *node = n;
|
||||
UNUSED(pw);
|
||||
assert(lwc_string_caseless_isequal(node, qname->name, match) ==
|
||||
lwc_error_ok);
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error node_has_class(void *pw, void *n,
|
||||
lwc_string *name,
|
||||
bool *match)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
UNUSED(name);
|
||||
*match = false;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error node_has_id(void *pw, void *n,
|
||||
lwc_string *name,
|
||||
bool *match)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
UNUSED(name);
|
||||
*match = false;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error node_has_attribute(void *pw, void *n,
|
||||
const css_qname *qname,
|
||||
bool *match)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
UNUSED(qname);
|
||||
*match = false;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error node_has_attribute_equal(void *pw, void *n,
|
||||
const css_qname *qname,
|
||||
lwc_string *value,
|
||||
bool *match)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
UNUSED(qname);
|
||||
UNUSED(value);
|
||||
*match = false;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error node_has_attribute_dashmatch(void *pw, void *n,
|
||||
const css_qname *qname,
|
||||
lwc_string *value,
|
||||
bool *match)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
UNUSED(qname);
|
||||
UNUSED(value);
|
||||
*match = false;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error node_has_attribute_includes(void *pw, void *n,
|
||||
const css_qname *qname,
|
||||
lwc_string *value,
|
||||
bool *match)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
UNUSED(qname);
|
||||
UNUSED(value);
|
||||
*match = false;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error node_has_attribute_prefix(void *pw, void *n,
|
||||
const css_qname *qname,
|
||||
lwc_string *value,
|
||||
bool *match)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
UNUSED(qname);
|
||||
UNUSED(value);
|
||||
*match = false;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error node_has_attribute_suffix(void *pw, void *n,
|
||||
const css_qname *qname,
|
||||
lwc_string *value,
|
||||
bool *match)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
UNUSED(qname);
|
||||
UNUSED(value);
|
||||
*match = false;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error node_has_attribute_substring(void *pw, void *n,
|
||||
const css_qname *qname,
|
||||
lwc_string *value,
|
||||
bool *match)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
UNUSED(qname);
|
||||
UNUSED(value);
|
||||
*match = false;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error node_is_first_child(void *pw, void *n, bool *match)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
*match = false;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error node_is_root(void *pw, void *n, bool *match)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
*match = false;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error node_count_siblings(void *pw, void *n,
|
||||
bool same_name, bool after, int32_t *count)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
UNUSED(same_name);
|
||||
UNUSED(after);
|
||||
*count = 1;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error node_is_empty(void *pw, void *n, bool *match)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
*match = false;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error node_is_link(void *pw, void *n, bool *match)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
*match = false;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error node_is_visited(void *pw, void *n, bool *match)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
*match = false;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error node_is_hover(void *pw, void *n, bool *match)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
*match = false;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error node_is_active(void *pw, void *n, bool *match)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
*match = false;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error node_is_focus(void *pw, void *n, bool *match)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
*match = false;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error node_is_enabled(void *pw, void *n, bool *match)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
*match = false;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error node_is_disabled(void *pw, void *n, bool *match)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
*match = false;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error node_is_checked(void *pw, void *n, bool *match)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
*match = false;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error node_is_target(void *pw, void *n, bool *match)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
*match = false;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
|
||||
css_error node_is_lang(void *pw, void *n,
|
||||
lwc_string *lang,
|
||||
bool *match)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(n);
|
||||
UNUSED(lang);
|
||||
*match = false;
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error node_presentational_hint(void *pw, void *node,
|
||||
uint32_t property, css_hint *hint)
|
||||
{
|
||||
UNUSED(pw);
|
||||
UNUSED(node);
|
||||
UNUSED(property);
|
||||
UNUSED(hint);
|
||||
return CSS_PROPERTY_NOT_SET;
|
||||
}
|
||||
|
||||
css_error ua_default_for_property(void *pw, uint32_t property, css_hint *hint)
|
||||
{
|
||||
UNUSED(pw);
|
||||
|
||||
if (property == CSS_PROP_COLOR) {
|
||||
hint->data.color = 0x00000000;
|
||||
hint->status = CSS_COLOR_COLOR;
|
||||
} else if (property == CSS_PROP_FONT_FAMILY) {
|
||||
hint->data.strings = NULL;
|
||||
hint->status = CSS_FONT_FAMILY_SANS_SERIF;
|
||||
} else if (property == CSS_PROP_QUOTES) {
|
||||
/* Not exactly useful :) */
|
||||
hint->data.strings = NULL;
|
||||
hint->status = CSS_QUOTES_NONE;
|
||||
} else if (property == CSS_PROP_VOICE_FAMILY) {
|
||||
/** \todo Fix this when we have voice-family done */
|
||||
hint->data.strings = NULL;
|
||||
hint->status = 0;
|
||||
} else {
|
||||
return CSS_INVALID;
|
||||
}
|
||||
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
css_error compute_font_size(void *pw, const css_hint *parent, css_hint *size)
|
||||
{
|
||||
static css_hint_length sizes[] = {
|
||||
{ FLTTOFIX(6.75), CSS_UNIT_PT },
|
||||
{ FLTTOFIX(7.50), CSS_UNIT_PT },
|
||||
{ FLTTOFIX(9.75), CSS_UNIT_PT },
|
||||
{ FLTTOFIX(12.0), CSS_UNIT_PT },
|
||||
{ FLTTOFIX(13.5), CSS_UNIT_PT },
|
||||
{ FLTTOFIX(18.0), CSS_UNIT_PT },
|
||||
{ FLTTOFIX(24.0), CSS_UNIT_PT }
|
||||
};
|
||||
const css_hint_length *parent_size;
|
||||
|
||||
UNUSED(pw);
|
||||
|
||||
/* Grab parent size, defaulting to medium if none */
|
||||
if (parent == NULL) {
|
||||
parent_size = &sizes[CSS_FONT_SIZE_MEDIUM - 1];
|
||||
} else {
|
||||
assert(parent->status == CSS_FONT_SIZE_DIMENSION);
|
||||
assert(parent->data.length.unit != CSS_UNIT_EM);
|
||||
assert(parent->data.length.unit != CSS_UNIT_EX);
|
||||
parent_size = &parent->data.length;
|
||||
}
|
||||
|
||||
assert(size->status != CSS_FONT_SIZE_INHERIT);
|
||||
|
||||
if (size->status < CSS_FONT_SIZE_LARGER) {
|
||||
/* Keyword -- simple */
|
||||
size->data.length = sizes[size->status - 1];
|
||||
} else if (size->status == CSS_FONT_SIZE_LARGER) {
|
||||
/** \todo Step within table, if appropriate */
|
||||
size->data.length.value =
|
||||
FMUL(parent_size->value, FLTTOFIX(1.2));
|
||||
size->data.length.unit = parent_size->unit;
|
||||
} else if (size->status == CSS_FONT_SIZE_SMALLER) {
|
||||
/** \todo Step within table, if appropriate */
|
||||
size->data.length.value =
|
||||
FMUL(parent_size->value, FLTTOFIX(1.2));
|
||||
size->data.length.unit = parent_size->unit;
|
||||
} else if (size->data.length.unit == CSS_UNIT_EM ||
|
||||
size->data.length.unit == CSS_UNIT_EX) {
|
||||
size->data.length.value =
|
||||
FMUL(size->data.length.value, parent_size->value);
|
||||
|
||||
if (size->data.length.unit == CSS_UNIT_EX) {
|
||||
size->data.length.value = FMUL(size->data.length.value,
|
||||
FLTTOFIX(0.6));
|
||||
}
|
||||
|
||||
size->data.length.unit = parent_size->unit;
|
||||
} else if (size->data.length.unit == CSS_UNIT_PCT) {
|
||||
size->data.length.value = FDIV(FMUL(size->data.length.value,
|
||||
parent_size->value), FLTTOFIX(100));
|
||||
size->data.length.unit = parent_size->unit;
|
||||
}
|
||||
|
||||
size->status = CSS_FONT_SIZE_DIMENSION;
|
||||
|
||||
return CSS_OK;
|
||||
}
|
||||
|
||||
|
229
programs/network/netsurf/libcss/examples/style.css
Normal file
229
programs/network/netsurf/libcss/examples/style.css
Normal file
@ -0,0 +1,229 @@
|
||||
body {
|
||||
color: #333333;
|
||||
background: #F4F5F5;
|
||||
line-height: 2em;
|
||||
font-size: 11.5pt;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: "Source Sans Pro", "Open Sans", sans-serif;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: underline;
|
||||
color: #1F1F1F;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a img {
|
||||
filter: alpha(opacity=80);
|
||||
..-opacity:0.8;
|
||||
opacity: 0.8;
|
||||
-khtml-opacity: 0.8;
|
||||
}
|
||||
|
||||
a img:hover {
|
||||
filter: alpha(opacity=100);
|
||||
..-opacity:1.0;
|
||||
opacity: 1.0;
|
||||
-khtml-opacity: 1.0;
|
||||
}
|
||||
|
||||
#logo {
|
||||
opacity: 1;
|
||||
filter: alpha(opacity=100);
|
||||
border-radius: 2px;
|
||||
border: solid 5px white;
|
||||
box-shadow: 0px 0px 0px 1px #D4D5D5, 0px 0px 10px 0px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
#show {
|
||||
width:800px;
|
||||
height:600px;
|
||||
cursor:pointer;
|
||||
box-shadow: 0px 0px 0px 1px #D4D5D5, 0px 0px 10px 0px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.minislide, .minislide_a {
|
||||
width: 80px;
|
||||
height: 60px;
|
||||
padding: 1px;
|
||||
}
|
||||
|
||||
.minislide { border: 1px solid #ccc; }
|
||||
.minislide_a {
|
||||
border: 1px solid #222;
|
||||
opacity: 1;
|
||||
filter: alpha(opacity=100);
|
||||
}
|
||||
|
||||
.download_img {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
.icon_cell {
|
||||
width: 32px;
|
||||
height:32px;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
#footer {
|
||||
padding: 30px 0 30px 0;
|
||||
text-align: center;
|
||||
color: #848585;
|
||||
-khtml-text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
|
||||
-webkit-text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
|
||||
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
|
||||
}
|
||||
|
||||
#footer a {
|
||||
color: #848585;
|
||||
}
|
||||
|
||||
#page {
|
||||
position: relative;
|
||||
margin: 0;
|
||||
background-attachment: scroll;
|
||||
background-repeat: no-repeat;
|
||||
background-position: right bottom;
|
||||
color: #333333;
|
||||
padding: 5px 35px 5px 35px;
|
||||
width: 910px;
|
||||
}
|
||||
|
||||
|
||||
#inner {
|
||||
background: #fff;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.1);
|
||||
border: solid 1px #D4D5D5;
|
||||
}
|
||||
|
||||
*+html #inner { /*IE 7*/
|
||||
background: #fff;
|
||||
filter:
|
||||
progid:DXImageTransform.Microsoft.Shadow(color='#e5e6e6', Direction=45, Strength=3)
|
||||
progid:DXImageTransform.Microsoft.Shadow(color='#e5e6e6', Direction=135, Strength=3)
|
||||
progid:DXImageTransform.Microsoft.Shadow(color='#e5e6e6', Direction=225, Strength=3)
|
||||
progid:DXImageTransform.Microsoft.Shadow(color='#e5e6e6', Direction=315, Strength=3);
|
||||
position: relative;
|
||||
top: -6px;
|
||||
left: -6px;
|
||||
zoom: 1;
|
||||
}
|
||||
|
||||
*+html #logo { /*IE 7*/
|
||||
border: 1px solid #D4D5D5;
|
||||
}
|
||||
|
||||
@media \0screen { /*IE 8*/
|
||||
#inner {
|
||||
background: #fff;
|
||||
filter:
|
||||
progid:DXImageTransform.Microsoft.Shadow(color='#e5e6e6', Direction=45, Strength=3)
|
||||
progid:DXImageTransform.Microsoft.Shadow(color='#e5e6e6', Direction=135, Strength=3)
|
||||
progid:DXImageTransform.Microsoft.Shadow(color='#e5e6e6', Direction=225, Strength=3)
|
||||
progid:DXImageTransform.Microsoft.Shadow(color='#e5e6e6', Direction=315, Strength=3);
|
||||
position: relative;
|
||||
top: -6px;
|
||||
left: -6px;
|
||||
zoom: 1;
|
||||
}
|
||||
#logo {
|
||||
position: relative;
|
||||
top: 9px;
|
||||
left: 9px;
|
||||
border: 1px solid #D4D5D5;
|
||||
}
|
||||
}
|
||||
|
||||
#splash {
|
||||
margin: 0;
|
||||
position: relative;
|
||||
padding: 35px 35px 5px 35px;
|
||||
}
|
||||
|
||||
#wrapper {
|
||||
width: 980px;
|
||||
position: relative;
|
||||
margin-right: auto;
|
||||
margin-bottom: 0;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
#floatbar {
|
||||
position: fixed;
|
||||
top:0;
|
||||
right:0;
|
||||
bottom:100px;
|
||||
left:0;
|
||||
float: center !important;
|
||||
text-align:center;
|
||||
z-index:9998;
|
||||
height: 30px !important;
|
||||
}
|
||||
|
||||
#idsel {
|
||||
dispaly: inline;
|
||||
color: white !important;
|
||||
font-weight: bold !important;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
|
||||
#archnavbar {
|
||||
height: 30px !important;
|
||||
padding: 10px 15px !important;
|
||||
background: #333 !important;
|
||||
border-bottom: 1px #888 solid !important;
|
||||
box-shadow: 0 0 5px black;
|
||||
box-shadow: 0 0 10px rgba(0,0,0,0.4);
|
||||
-moz-box-shadow: 0 0 10px rgba(0,0,0,0.4);
|
||||
-webkit-box-shadow: 0 0 10px rgba(0,0,0,0.4);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#archnavbarlist {
|
||||
width: 980px;
|
||||
height: 30px !important;
|
||||
position: relative;
|
||||
margin-top: 0px;
|
||||
margin-right: auto;
|
||||
margin-bottom: 0px;
|
||||
margin-left: auto;
|
||||
float: center !important;
|
||||
list-style: none !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
#archnavbarlist ul {
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
#archnavbarlist li {
|
||||
display: inline-block;
|
||||
float: center !important;
|
||||
font-size: 14px !important;
|
||||
line-height: 25px !important;
|
||||
padding-right: 15px !important;
|
||||
padding-left: 15px !important;
|
||||
}
|
||||
|
||||
#archnavbarlist li a {
|
||||
color: #999;
|
||||
font-weight: bold !important;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
|
||||
#archnavbarlist li a:hover {
|
||||
color: white !important;
|
||||
font-weight: bold !important;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
|
||||
strong {
|
||||
color: #000;
|
||||
}
|
403
programs/network/netsurf/libcss/include/libcss/computed.h
Normal file
403
programs/network/netsurf/libcss/include/libcss/computed.h
Normal file
@ -0,0 +1,403 @@
|
||||
/*
|
||||
* This file is part of LibCSS
|
||||
* Licensed under the MIT License,
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* Copyright 2009 John-Mark Bell <jmb@netsurf-browser.org>
|
||||
*/
|
||||
|
||||
#ifndef libcss_computed_h_
|
||||
#define libcss_computed_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <libwapcaplet/libwapcaplet.h>
|
||||
|
||||
#include <libcss/errors.h>
|
||||
#include <libcss/functypes.h>
|
||||
#include <libcss/properties.h>
|
||||
#include <libcss/types.h>
|
||||
|
||||
struct css_hint;
|
||||
struct css_select_handler;
|
||||
|
||||
typedef struct css_computed_counter {
|
||||
lwc_string *name;
|
||||
css_fixed value;
|
||||
} css_computed_counter;
|
||||
|
||||
typedef struct css_computed_clip_rect {
|
||||
css_fixed top;
|
||||
css_fixed right;
|
||||
css_fixed bottom;
|
||||
css_fixed left;
|
||||
|
||||
css_unit tunit;
|
||||
css_unit runit;
|
||||
css_unit bunit;
|
||||
css_unit lunit;
|
||||
|
||||
bool top_auto;
|
||||
bool right_auto;
|
||||
bool bottom_auto;
|
||||
bool left_auto;
|
||||
} css_computed_clip_rect;
|
||||
|
||||
enum css_computed_content_type {
|
||||
CSS_COMPUTED_CONTENT_NONE = 0,
|
||||
CSS_COMPUTED_CONTENT_STRING = 1,
|
||||
CSS_COMPUTED_CONTENT_URI = 2,
|
||||
CSS_COMPUTED_CONTENT_COUNTER = 3,
|
||||
CSS_COMPUTED_CONTENT_COUNTERS = 4,
|
||||
CSS_COMPUTED_CONTENT_ATTR = 5,
|
||||
CSS_COMPUTED_CONTENT_OPEN_QUOTE = 6,
|
||||
CSS_COMPUTED_CONTENT_CLOSE_QUOTE = 7,
|
||||
CSS_COMPUTED_CONTENT_NO_OPEN_QUOTE = 8,
|
||||
CSS_COMPUTED_CONTENT_NO_CLOSE_QUOTE = 9
|
||||
};
|
||||
|
||||
typedef struct css_computed_content_item {
|
||||
uint8_t type;
|
||||
union {
|
||||
lwc_string *string;
|
||||
lwc_string *uri;
|
||||
lwc_string *attr;
|
||||
struct {
|
||||
lwc_string *name;
|
||||
uint8_t style;
|
||||
} counter;
|
||||
struct {
|
||||
lwc_string *name;
|
||||
lwc_string *sep;
|
||||
uint8_t style;
|
||||
} counters;
|
||||
} data;
|
||||
} css_computed_content_item;
|
||||
|
||||
css_error css_computed_style_create(css_allocator_fn alloc, void *pw,
|
||||
css_computed_style **result);
|
||||
css_error css_computed_style_destroy(css_computed_style *style);
|
||||
|
||||
css_error css_computed_style_initialise(css_computed_style *style,
|
||||
struct css_select_handler *handler, void *pw);
|
||||
|
||||
css_error css_computed_style_compose(const css_computed_style *parent,
|
||||
const css_computed_style *child,
|
||||
css_error (*compute_font_size)(void *pw,
|
||||
const struct css_hint *parent,
|
||||
struct css_hint *size),
|
||||
void *pw,
|
||||
css_computed_style *result);
|
||||
|
||||
/******************************************************************************
|
||||
* Property accessors below here *
|
||||
******************************************************************************/
|
||||
|
||||
uint8_t css_computed_letter_spacing(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_outline_color(
|
||||
const css_computed_style *style, css_color *color);
|
||||
|
||||
uint8_t css_computed_outline_width(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_border_spacing(
|
||||
const css_computed_style *style,
|
||||
css_fixed *hlength, css_unit *hunit,
|
||||
css_fixed *vlength, css_unit *vunit);
|
||||
|
||||
uint8_t css_computed_word_spacing(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_counter_increment(
|
||||
const css_computed_style *style,
|
||||
const css_computed_counter **counters);
|
||||
|
||||
uint8_t css_computed_counter_reset(
|
||||
const css_computed_style *style,
|
||||
const css_computed_counter **counters);
|
||||
|
||||
uint8_t css_computed_cursor(
|
||||
const css_computed_style *style,
|
||||
lwc_string ***urls);
|
||||
|
||||
uint8_t css_computed_clip(
|
||||
const css_computed_style *style,
|
||||
css_computed_clip_rect *rect);
|
||||
|
||||
uint8_t css_computed_content(
|
||||
const css_computed_style *style,
|
||||
const css_computed_content_item **content);
|
||||
|
||||
uint8_t css_computed_vertical_align(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_font_size(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_border_top_width(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_border_right_width(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_border_bottom_width(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_border_left_width(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_background_image(
|
||||
const css_computed_style *style,
|
||||
lwc_string **url);
|
||||
|
||||
uint8_t css_computed_color(
|
||||
const css_computed_style *style,
|
||||
css_color *color);
|
||||
|
||||
uint8_t css_computed_list_style_image(
|
||||
const css_computed_style *style,
|
||||
lwc_string **url);
|
||||
|
||||
uint8_t css_computed_quotes(
|
||||
const css_computed_style *style,
|
||||
lwc_string ***quotes);
|
||||
|
||||
uint8_t css_computed_top(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_right(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_bottom(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_left(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_border_top_color(
|
||||
const css_computed_style *style,
|
||||
css_color *color);
|
||||
|
||||
uint8_t css_computed_border_right_color(
|
||||
const css_computed_style *style,
|
||||
css_color *color);
|
||||
|
||||
uint8_t css_computed_border_bottom_color(
|
||||
const css_computed_style *style,
|
||||
css_color *color);
|
||||
|
||||
uint8_t css_computed_border_left_color(
|
||||
const css_computed_style *style,
|
||||
css_color *color);
|
||||
|
||||
uint8_t css_computed_height(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_line_height(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_background_color(
|
||||
const css_computed_style *style,
|
||||
css_color *color);
|
||||
|
||||
uint8_t css_computed_z_index(
|
||||
const css_computed_style *style,
|
||||
int32_t *z_index);
|
||||
|
||||
uint8_t css_computed_margin_top(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_margin_right(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_margin_bottom(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_margin_left(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_background_attachment(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_border_collapse(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_caption_side(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_direction(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_max_height(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_max_width(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_width(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_empty_cells(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_float(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_font_style(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_min_height(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_min_width(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_background_repeat(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_clear(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_padding_top(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_padding_right(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_padding_bottom(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_padding_left(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_overflow(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_position(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_opacity(
|
||||
const css_computed_style *style,
|
||||
css_fixed *opacity);
|
||||
|
||||
uint8_t css_computed_text_transform(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_text_indent(
|
||||
const css_computed_style *style,
|
||||
css_fixed *length, css_unit *unit);
|
||||
|
||||
uint8_t css_computed_white_space(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_background_position(
|
||||
const css_computed_style *style,
|
||||
css_fixed *hlength, css_unit *hunit,
|
||||
css_fixed *vlength, css_unit *vunit);
|
||||
|
||||
uint8_t css_computed_display(
|
||||
const css_computed_style *style, bool root);
|
||||
|
||||
uint8_t css_computed_display_static(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_font_variant(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_text_decoration(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_font_family(
|
||||
const css_computed_style *style,
|
||||
lwc_string ***names);
|
||||
|
||||
uint8_t css_computed_border_top_style(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_border_right_style(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_border_bottom_style(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_border_left_style(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_font_weight(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_list_style_type(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_outline_style(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_table_layout(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_unicode_bidi(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_visibility(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_list_style_position(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_text_align(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_page_break_after(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_page_break_before(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_page_break_inside(
|
||||
const css_computed_style *style);
|
||||
|
||||
uint8_t css_computed_orphans(
|
||||
const css_computed_style *style,
|
||||
int32_t *orphans);
|
||||
|
||||
uint8_t css_computed_widows(
|
||||
const css_computed_style *style,
|
||||
int32_t *widows);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user