2002-05-04 23:57:18 +04:00
|
|
|
/**
|
2002-09-18 23:36:28 +04:00
|
|
|
* $Id: box.h,v 1.9 2002/09/18 19:36:28 bursa Exp $
|
2002-05-04 23:57:18 +04:00
|
|
|
*/
|
|
|
|
|
2002-08-12 03:01:02 +04:00
|
|
|
#ifndef _NETSURF_RENDER_BOX_H_
|
|
|
|
#define _NETSURF_RENDER_BOX_H_
|
|
|
|
|
2002-09-18 23:36:28 +04:00
|
|
|
#include <limits.h>
|
2002-08-12 03:01:02 +04:00
|
|
|
#include "libxml/HTMLparser.h"
|
|
|
|
#include "netsurf/render/css.h"
|
|
|
|
|
2002-05-04 23:57:18 +04:00
|
|
|
/**
|
|
|
|
* structures
|
|
|
|
*/
|
|
|
|
|
2002-06-27 03:27:30 +04:00
|
|
|
typedef enum {
|
|
|
|
BOX_BLOCK, BOX_INLINE_CONTAINER, BOX_INLINE,
|
2002-06-29 00:14:04 +04:00
|
|
|
BOX_TABLE, BOX_TABLE_ROW, BOX_TABLE_CELL,
|
2002-08-18 20:46:45 +04:00
|
|
|
BOX_TABLE_ROW_GROUP,
|
2002-06-29 00:14:04 +04:00
|
|
|
BOX_FLOAT_LEFT, BOX_FLOAT_RIGHT
|
2002-06-27 03:27:30 +04:00
|
|
|
} box_type;
|
|
|
|
|
2002-09-18 23:36:28 +04:00
|
|
|
struct column {
|
|
|
|
enum { COLUMN_WIDTH_UNKNOWN = 0, COLUMN_WIDTH_FIXED,
|
|
|
|
COLUMN_WIDTH_AUTO, COLUMN_WIDTH_PERCENT } type;
|
|
|
|
unsigned long min, max, width;
|
|
|
|
};
|
|
|
|
|
2002-05-04 23:57:18 +04:00
|
|
|
struct box {
|
2002-06-27 03:27:30 +04:00
|
|
|
box_type type;
|
2002-05-04 23:57:18 +04:00
|
|
|
xmlNode * node;
|
|
|
|
struct css_style * style;
|
|
|
|
unsigned long x, y, width, height;
|
2002-09-18 23:36:28 +04:00
|
|
|
unsigned long min_width, max_width;
|
2002-05-04 23:57:18 +04:00
|
|
|
const char * text;
|
2002-08-12 03:01:02 +04:00
|
|
|
const char * href;
|
2002-05-04 23:57:18 +04:00
|
|
|
unsigned int length;
|
2002-09-18 23:36:28 +04:00
|
|
|
unsigned int columns;
|
2002-05-04 23:57:18 +04:00
|
|
|
struct box * next;
|
|
|
|
struct box * children;
|
|
|
|
struct box * last;
|
|
|
|
struct box * parent;
|
2002-05-28 03:21:11 +04:00
|
|
|
struct box * float_children;
|
|
|
|
struct box * next_float;
|
2002-09-18 23:36:28 +04:00
|
|
|
struct column *col;
|
2002-05-04 23:57:18 +04:00
|
|
|
};
|
|
|
|
|
2002-09-18 23:36:28 +04:00
|
|
|
#define UNKNOWN_MAX_WIDTH ULONG_MAX
|
|
|
|
|
2002-05-04 23:57:18 +04:00
|
|
|
/**
|
|
|
|
* interface
|
|
|
|
*/
|
|
|
|
|
2002-08-18 20:46:45 +04:00
|
|
|
void xml_to_box(xmlNode * n, struct css_style * parent_style, struct css_stylesheet * stylesheet,
|
2002-05-04 23:57:18 +04:00
|
|
|
struct css_selector ** selector, unsigned int depth,
|
2002-08-12 03:01:02 +04:00
|
|
|
struct box * parent, struct box * inline_container,
|
|
|
|
const char *href);
|
2002-05-04 23:57:18 +04:00
|
|
|
void box_dump(struct box * box, unsigned int depth);
|
2002-09-08 22:11:56 +04:00
|
|
|
void box_free(struct box *box);
|
2002-05-04 23:57:18 +04:00
|
|
|
|
2002-08-12 03:01:02 +04:00
|
|
|
#endif
|