2003-06-30 16:44:03 +04:00
|
|
|
/*
|
|
|
|
* This file is part of NetSurf, http://netsurf.sourceforge.net/
|
|
|
|
* Licensed under the GNU General Public License,
|
|
|
|
* http://www.opensource.org/licenses/gpl-license
|
|
|
|
* Copyright 2003 James Bursa <bursa@users.sourceforge.net>
|
|
|
|
* Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net>
|
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>
|
2003-10-02 02:48:39 +04:00
|
|
|
#include <stdbool.h>
|
2002-08-12 03:01:02 +04:00
|
|
|
#include "libxml/HTMLparser.h"
|
2003-04-04 19:19:32 +04:00
|
|
|
#include "netsurf/css/css.h"
|
2003-07-18 03:01:02 +04:00
|
|
|
#include "netsurf/render/font.h"
|
2002-08-12 03:01:02 +04:00
|
|
|
|
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,
|
2003-09-22 02:47:08 +04:00
|
|
|
BOX_FLOAT_LEFT, BOX_FLOAT_RIGHT,
|
|
|
|
BOX_INLINE_BLOCK
|
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;
|
|
|
|
};
|
|
|
|
|
2003-09-23 01:55:08 +04:00
|
|
|
struct box;
|
|
|
|
|
2003-07-10 01:33:01 +04:00
|
|
|
/* parameters for <object> and related elements */
|
|
|
|
struct object_params {
|
|
|
|
char* data;
|
|
|
|
char* type;
|
|
|
|
char* codetype;
|
|
|
|
char* codebase;
|
|
|
|
char* classid;
|
2003-07-17 18:26:15 +04:00
|
|
|
struct plugin_params* params;
|
|
|
|
/* not a parameter, but stored here for convenience */
|
|
|
|
char* basehref;
|
|
|
|
char* filename;
|
2003-08-25 02:39:55 +04:00
|
|
|
int browser;
|
|
|
|
int plugin;
|
|
|
|
int browser_stream;
|
|
|
|
int plugin_stream;
|
|
|
|
unsigned int plugin_task;
|
2003-07-17 18:26:15 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct plugin_params {
|
|
|
|
|
|
|
|
char* name;
|
|
|
|
char* value;
|
|
|
|
char* type;
|
|
|
|
char* valuetype;
|
|
|
|
struct plugin_params* next;
|
2003-07-10 01:33:01 +04:00
|
|
|
};
|
|
|
|
|
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
|
|
|
struct css_style * style;
|
2003-09-29 20:32:17 +04:00
|
|
|
long x, y, width, height;
|
|
|
|
long min_width, max_width;
|
2003-02-09 15:58:15 +03:00
|
|
|
char * text;
|
2003-01-07 02:53:40 +03:00
|
|
|
unsigned int space : 1; /* 1 <=> followed by a space */
|
2003-09-10 01:43:44 +04:00
|
|
|
unsigned int clone : 1;
|
2003-09-20 01:23:19 +04:00
|
|
|
unsigned int style_clone : 1;
|
2003-02-09 15:58:15 +03:00
|
|
|
char * href;
|
2003-07-01 02:21:51 +04:00
|
|
|
char * title;
|
2002-05-04 23:57:18 +04:00
|
|
|
unsigned int length;
|
2002-09-18 23:36:28 +04:00
|
|
|
unsigned int columns;
|
2003-07-05 23:51:10 +04:00
|
|
|
unsigned int rows;
|
2003-07-07 01:10:12 +04:00
|
|
|
unsigned int start_column; /* start column of table cell */
|
2002-05-04 23:57:18 +04:00
|
|
|
struct box * next;
|
2003-01-02 16:26:43 +03:00
|
|
|
struct box * prev;
|
2002-05-04 23:57:18 +04:00
|
|
|
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-09-27 01:38:33 +04:00
|
|
|
struct font_data *font;
|
2003-10-25 04:35:49 +04:00
|
|
|
struct form_control* gadget;
|
2003-04-15 21:53:00 +04:00
|
|
|
struct content* object; /* usually an image */
|
2003-07-10 01:33:01 +04:00
|
|
|
struct object_params *object_params;
|
2003-07-17 18:26:15 +04:00
|
|
|
void* object_state; /* state of any object */
|
2002-05-04 23:57:18 +04:00
|
|
|
};
|
|
|
|
|
2003-01-11 20:36:40 +03:00
|
|
|
struct formsubmit
|
|
|
|
{
|
|
|
|
struct form* form;
|
2003-10-25 04:35:49 +04:00
|
|
|
struct form_control* items;
|
2003-01-11 20:36:40 +03:00
|
|
|
};
|
|
|
|
|
2002-12-31 01:56:30 +03:00
|
|
|
struct page_elements
|
|
|
|
{
|
|
|
|
struct form** forms;
|
2003-10-25 04:35:49 +04:00
|
|
|
struct form_control** gadgets;
|
2002-12-31 01:56:30 +03:00
|
|
|
struct img** images;
|
|
|
|
int numForms;
|
|
|
|
int numGadgets;
|
|
|
|
int numImages;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-09-19 23:54:43 +04:00
|
|
|
#define UNKNOWN_WIDTH ULONG_MAX
|
2002-09-18 23:36:28 +04:00
|
|
|
#define UNKNOWN_MAX_WIDTH ULONG_MAX
|
|
|
|
|
2002-05-04 23:57:18 +04:00
|
|
|
/**
|
|
|
|
* interface
|
|
|
|
*/
|
|
|
|
|
2003-04-15 21:53:00 +04:00
|
|
|
void xml_to_box(xmlNode *n, struct content *c);
|
2002-05-04 23:57:18 +04:00
|
|
|
void box_dump(struct box * box, unsigned int depth);
|
2003-09-23 22:35:44 +04:00
|
|
|
struct box * box_create(struct css_style * style,
|
|
|
|
char *href, char *title);
|
2003-10-09 19:22:48 +04:00
|
|
|
void box_add_child(struct box * parent, struct box * child);
|
|
|
|
void box_insert_sibling(struct box *box, struct box *new_box);
|
2002-09-08 22:11:56 +04:00
|
|
|
void box_free(struct box *box);
|
2003-09-03 21:52:45 +04:00
|
|
|
void box_coords(struct box *box, unsigned long *x, unsigned long *y);
|
2002-05-04 23:57:18 +04:00
|
|
|
|
2002-08-12 03:01:02 +04:00
|
|
|
#endif
|