2003-06-30 16:44:03 +04:00
|
|
|
/*
|
2004-02-14 02:07:42 +03:00
|
|
|
* Copyright 2004 James Bursa <bursa@users.sourceforge.net>
|
2004-08-02 01:56:47 +04:00
|
|
|
* Copyright 2004 John M Bell <jmb202@ecs.soton.ac.uk>
|
2007-08-08 20:16:03 +04:00
|
|
|
*
|
|
|
|
* This file is part of NetSurf, http://www.netsurf-browser.org/
|
|
|
|
*
|
|
|
|
* NetSurf is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; version 2 of the License.
|
|
|
|
*
|
|
|
|
* NetSurf is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2003-04-04 19:19:32 +04:00
|
|
|
*/
|
|
|
|
|
2003-12-27 23:15:23 +03:00
|
|
|
/** \file
|
|
|
|
* CSS handling (interface).
|
|
|
|
*
|
|
|
|
* This module aims to implement CSS 2.1.
|
|
|
|
*
|
|
|
|
* CSS stylesheets are held in a struct ::content with type CONTENT_CSS.
|
|
|
|
* Creation and parsing should be carried out via the content_* functions.
|
|
|
|
*
|
|
|
|
* Styles are stored in a struct ::css_style, which can be retrieved from a
|
|
|
|
* content using css_get_style().
|
|
|
|
*
|
|
|
|
* css_parse_property_list() constructs a struct ::css_style from a CSS
|
|
|
|
* property list, as found in HTML style attributes.
|
|
|
|
*/
|
|
|
|
|
2003-04-04 19:19:32 +04:00
|
|
|
#ifndef _NETSURF_CSS_CSS_H_
|
|
|
|
#define _NETSURF_CSS_CSS_H_
|
|
|
|
|
Merged revisions 5309-5406,5409-5422 via svnmerge from
svn://svn.netsurf-browser.org/branches/vince/netsurf-fb
........
r5309 | vince | 2008-09-13 10:59:10 +0100 (Sat, 13 Sep 2008) | 2 lines
first stab at framebuffer frontend
........
r5313 | vince | 2008-09-14 15:08:52 +0100 (Sun, 14 Sep 2008) | 2 lines
add line plotters
........
r5314 | vince | 2008-09-14 15:28:12 +0100 (Sun, 14 Sep 2008) | 2 lines
add rectangle plot to 16bpp plotters
........
r5315 | vince | 2008-09-14 19:58:57 +0100 (Sun, 14 Sep 2008) | 2 lines
improve 16bpp image plot
........
r5316 | vince | 2008-09-15 00:35:32 +0100 (Mon, 15 Sep 2008) | 2 lines
abstract the os specific framebuffer init
........
r5317 | vince | 2008-09-15 11:18:51 +0100 (Mon, 15 Sep 2008) | 2 lines
first cut of linux frontend
........
r5318 | vince | 2008-09-15 12:01:00 +0100 (Mon, 15 Sep 2008) | 2 lines
remove junk includes
........
r5319 | vince | 2008-09-15 12:09:02 +0100 (Mon, 15 Sep 2008) | 2 lines
make plotters OS agnostic again
........
r5322 | vince | 2008-09-15 15:55:01 +0100 (Mon, 15 Sep 2008) | 2 lines
Linux frontend operates
........
r5323 | vince | 2008-09-15 16:32:47 +0100 (Mon, 15 Sep 2008) | 2 lines
abstract out OS specific input
........
r5326 | vince | 2008-09-15 19:21:01 +0100 (Mon, 15 Sep 2008) | 2 lines
Improve linux mode setting
........
r5329 | vince | 2008-09-15 21:13:33 +0100 (Mon, 15 Sep 2008) | 2 lines
improve text clipping
........
r5339 | vince | 2008-09-16 00:07:57 +0100 (Tue, 16 Sep 2008) | 2 lines
possibly fix text clipping issue
........
r5342 | vince | 2008-09-16 00:39:36 +0100 (Tue, 16 Sep 2008) | 2 lines
consolidate polygon plotters
........
r5344 | dsilvers | 2008-09-16 10:21:06 +0100 (Tue, 16 Sep 2008) | 1 line
Fix up the framebuffer target makefile a bit more, add some config options for it
........
r5345 | dsilvers | 2008-09-16 10:22:19 +0100 (Tue, 16 Sep 2008) | 1 line
Ensure the appropriate frontend is selected when building framebuffer
........
r5346 | dsilvers | 2008-09-16 10:27:16 +0100 (Tue, 16 Sep 2008) | 1 line
Update build system to support targetting separate framebuffer frontends in different build trees, update executable to be nsfb-blah
........
r5350 | vince | 2008-09-16 17:15:04 +0100 (Tue, 16 Sep 2008) | 1 line
Add -g to provide symbols for framebuffer link
........
r5351 | vince | 2008-09-16 17:17:09 +0100 (Tue, 16 Sep 2008) | 1 line
framebuffer scheduler now works, plotters tweaked, gui tracks window redraw requirements better, keypresses not duplicated under linux fb
........
r5352 | dsilvers | 2008-09-16 17:38:53 +0100 (Tue, 16 Sep 2008) | 1 line
Ensure we only allow one fetcher at a time
........
r5361 | vince | 2008-09-17 11:48:44 +0100 (Wed, 17 Sep 2008) | 2 lines
initial cursor support
........
r5362 | vince | 2008-09-17 13:56:47 +0100 (Wed, 17 Sep 2008) | 2 lines
add mouse handling
........
r5363 | vince | 2008-09-17 14:14:44 +0100 (Wed, 17 Sep 2008) | 2 lines
add framebuffer resources
........
r5364 | vince | 2008-09-17 17:12:21 +0100 (Wed, 17 Sep 2008) | 2 lines
add reasonable pointer
........
r5366 | vince | 2008-09-17 17:17:25 +0100 (Wed, 17 Sep 2008) | 2 lines
fix pointer alpha
........
r5370 | vince | 2008-09-18 13:43:53 +0100 (Thu, 18 Sep 2008) | 2 lines
warning squash and cleanup ready for trunk merge
........
r5375 | vince | 2008-09-19 14:58:43 +0100 (Fri, 19 Sep 2008) | 2 lines
Working mouse navigation
........
r5377 | vince | 2008-09-20 14:06:22 +0100 (Sat, 20 Sep 2008) | 2 lines
Improve scrolling
........
r5378 | vince | 2008-09-20 14:46:46 +0100 (Sat, 20 Sep 2008) | 2 lines
fix redraw issues with scrolling
........
r5380 | vince | 2008-09-20 17:08:43 +0100 (Sat, 20 Sep 2008) | 3 lines
Alter panning to use its own flag so it doesnt cause invalid redraw
operations
........
r5381 | vince | 2008-09-20 21:52:45 +0100 (Sat, 20 Sep 2008) | 2 lines
add dummy framebuffer
........
r5383 | vince | 2008-09-21 00:00:15 +0100 (Sun, 21 Sep 2008) | 2 lines
fix segfault when cursor is off teh bottom of teh screen
........
r5384 | vince | 2008-09-21 00:06:08 +0100 (Sun, 21 Sep 2008) | 2 lines
fix off by one in pointer fix
........
r5385 | vince | 2008-09-21 00:25:09 +0100 (Sun, 21 Sep 2008) | 2 lines
when fixing bloody silly off by one errors remember to fix *both* references
........
r5387 | vince | 2008-09-21 00:38:13 +0100 (Sun, 21 Sep 2008) | 2 lines
last try at stopping the pointer segfault
........
r5388 | vince | 2008-09-21 16:24:18 +0100 (Sun, 21 Sep 2008) | 2 lines
improve vertical text clipping
........
r5392 | vince | 2008-09-21 23:11:51 +0100 (Sun, 21 Sep 2008) | 2 lines
Improve text plotters
........
r5393 | vince | 2008-09-21 23:34:38 +0100 (Sun, 21 Sep 2008) | 2 lines
fix 32bpp line plotting
........
r5394 | vince | 2008-09-22 00:00:03 +0100 (Mon, 22 Sep 2008) | 2 lines
Fix off by one error in line plotting clipping
........
r5397 | vince | 2008-09-22 13:46:22 +0100 (Mon, 22 Sep 2008) | 2 lines
Fix bitmap tileing
........
r5398 | vince | 2008-09-22 17:46:02 +0100 (Mon, 22 Sep 2008) | 2 lines
enable knockout renderer
........
r5399 | vince | 2008-09-22 18:43:48 +0100 (Mon, 22 Sep 2008) | 2 lines
ensure clipping region lies within window, caused by knockout renderer
........
r5400 | vince | 2008-09-22 19:20:25 +0100 (Mon, 22 Sep 2008) | 2 lines
update cursor to one swiped from X windows
........
r5405 | vince | 2008-09-23 09:09:05 +0100 (Tue, 23 Sep 2008) | 2 lines
fix vertical scroll limit
........
r5412 | dsilvers | 2008-09-23 10:53:14 +0100 (Tue, 23 Sep 2008) | 1 line
Revert noisy fetcher patch
........
r5413 | dsilvers | 2008-09-23 10:58:00 +0100 (Tue, 23 Sep 2008) | 1 line
Add header guards
........
r5414 | dsilvers | 2008-09-23 11:31:31 +0100 (Tue, 23 Sep 2008) | 1 line
Tidy the region clipping slightly
........
r5416 | dsilvers | 2008-09-23 12:05:00 +0100 (Tue, 23 Sep 2008) | 1 line
Rationalise how the framebuffer frontend finds resources and options
........
r5418 | dsilvers | 2008-09-23 13:59:00 +0100 (Tue, 23 Sep 2008) | 1 line
Ensure options are overridden after load, and squash an fb_gui.c warning
........
r5419 | dsilvers | 2008-09-23 14:20:07 +0100 (Tue, 23 Sep 2008) | 1 line
Support fb_mode and fb_device options
........
r5420 | dsilvers | 2008-09-23 14:21:48 +0100 (Tue, 23 Sep 2008) | 1 line
Support option_fb_device in the able frontend
........
r5421 | dsilvers | 2008-09-23 14:25:17 +0100 (Tue, 23 Sep 2008) | 1 line
Ensure target_blank is disabled
........
r5422 | dsilvers | 2008-09-23 14:39:00 +0100 (Tue, 23 Sep 2008) | 1 line
Rework linux fb frontend to support scanning and opening all event devices for input
........
svn path=/trunk/netsurf/; revision=5423
2008-09-23 18:00:40 +04:00
|
|
|
#include <stdint.h>
|
2003-10-17 21:39:29 +04:00
|
|
|
#include <stdbool.h>
|
2007-05-31 02:39:54 +04:00
|
|
|
#include <libxml/HTMLparser.h>
|
|
|
|
#include "css/css_enum.h"
|
2003-04-04 19:19:32 +04:00
|
|
|
|
|
|
|
|
Merged revisions 5309-5406,5409-5422 via svnmerge from
svn://svn.netsurf-browser.org/branches/vince/netsurf-fb
........
r5309 | vince | 2008-09-13 10:59:10 +0100 (Sat, 13 Sep 2008) | 2 lines
first stab at framebuffer frontend
........
r5313 | vince | 2008-09-14 15:08:52 +0100 (Sun, 14 Sep 2008) | 2 lines
add line plotters
........
r5314 | vince | 2008-09-14 15:28:12 +0100 (Sun, 14 Sep 2008) | 2 lines
add rectangle plot to 16bpp plotters
........
r5315 | vince | 2008-09-14 19:58:57 +0100 (Sun, 14 Sep 2008) | 2 lines
improve 16bpp image plot
........
r5316 | vince | 2008-09-15 00:35:32 +0100 (Mon, 15 Sep 2008) | 2 lines
abstract the os specific framebuffer init
........
r5317 | vince | 2008-09-15 11:18:51 +0100 (Mon, 15 Sep 2008) | 2 lines
first cut of linux frontend
........
r5318 | vince | 2008-09-15 12:01:00 +0100 (Mon, 15 Sep 2008) | 2 lines
remove junk includes
........
r5319 | vince | 2008-09-15 12:09:02 +0100 (Mon, 15 Sep 2008) | 2 lines
make plotters OS agnostic again
........
r5322 | vince | 2008-09-15 15:55:01 +0100 (Mon, 15 Sep 2008) | 2 lines
Linux frontend operates
........
r5323 | vince | 2008-09-15 16:32:47 +0100 (Mon, 15 Sep 2008) | 2 lines
abstract out OS specific input
........
r5326 | vince | 2008-09-15 19:21:01 +0100 (Mon, 15 Sep 2008) | 2 lines
Improve linux mode setting
........
r5329 | vince | 2008-09-15 21:13:33 +0100 (Mon, 15 Sep 2008) | 2 lines
improve text clipping
........
r5339 | vince | 2008-09-16 00:07:57 +0100 (Tue, 16 Sep 2008) | 2 lines
possibly fix text clipping issue
........
r5342 | vince | 2008-09-16 00:39:36 +0100 (Tue, 16 Sep 2008) | 2 lines
consolidate polygon plotters
........
r5344 | dsilvers | 2008-09-16 10:21:06 +0100 (Tue, 16 Sep 2008) | 1 line
Fix up the framebuffer target makefile a bit more, add some config options for it
........
r5345 | dsilvers | 2008-09-16 10:22:19 +0100 (Tue, 16 Sep 2008) | 1 line
Ensure the appropriate frontend is selected when building framebuffer
........
r5346 | dsilvers | 2008-09-16 10:27:16 +0100 (Tue, 16 Sep 2008) | 1 line
Update build system to support targetting separate framebuffer frontends in different build trees, update executable to be nsfb-blah
........
r5350 | vince | 2008-09-16 17:15:04 +0100 (Tue, 16 Sep 2008) | 1 line
Add -g to provide symbols for framebuffer link
........
r5351 | vince | 2008-09-16 17:17:09 +0100 (Tue, 16 Sep 2008) | 1 line
framebuffer scheduler now works, plotters tweaked, gui tracks window redraw requirements better, keypresses not duplicated under linux fb
........
r5352 | dsilvers | 2008-09-16 17:38:53 +0100 (Tue, 16 Sep 2008) | 1 line
Ensure we only allow one fetcher at a time
........
r5361 | vince | 2008-09-17 11:48:44 +0100 (Wed, 17 Sep 2008) | 2 lines
initial cursor support
........
r5362 | vince | 2008-09-17 13:56:47 +0100 (Wed, 17 Sep 2008) | 2 lines
add mouse handling
........
r5363 | vince | 2008-09-17 14:14:44 +0100 (Wed, 17 Sep 2008) | 2 lines
add framebuffer resources
........
r5364 | vince | 2008-09-17 17:12:21 +0100 (Wed, 17 Sep 2008) | 2 lines
add reasonable pointer
........
r5366 | vince | 2008-09-17 17:17:25 +0100 (Wed, 17 Sep 2008) | 2 lines
fix pointer alpha
........
r5370 | vince | 2008-09-18 13:43:53 +0100 (Thu, 18 Sep 2008) | 2 lines
warning squash and cleanup ready for trunk merge
........
r5375 | vince | 2008-09-19 14:58:43 +0100 (Fri, 19 Sep 2008) | 2 lines
Working mouse navigation
........
r5377 | vince | 2008-09-20 14:06:22 +0100 (Sat, 20 Sep 2008) | 2 lines
Improve scrolling
........
r5378 | vince | 2008-09-20 14:46:46 +0100 (Sat, 20 Sep 2008) | 2 lines
fix redraw issues with scrolling
........
r5380 | vince | 2008-09-20 17:08:43 +0100 (Sat, 20 Sep 2008) | 3 lines
Alter panning to use its own flag so it doesnt cause invalid redraw
operations
........
r5381 | vince | 2008-09-20 21:52:45 +0100 (Sat, 20 Sep 2008) | 2 lines
add dummy framebuffer
........
r5383 | vince | 2008-09-21 00:00:15 +0100 (Sun, 21 Sep 2008) | 2 lines
fix segfault when cursor is off teh bottom of teh screen
........
r5384 | vince | 2008-09-21 00:06:08 +0100 (Sun, 21 Sep 2008) | 2 lines
fix off by one in pointer fix
........
r5385 | vince | 2008-09-21 00:25:09 +0100 (Sun, 21 Sep 2008) | 2 lines
when fixing bloody silly off by one errors remember to fix *both* references
........
r5387 | vince | 2008-09-21 00:38:13 +0100 (Sun, 21 Sep 2008) | 2 lines
last try at stopping the pointer segfault
........
r5388 | vince | 2008-09-21 16:24:18 +0100 (Sun, 21 Sep 2008) | 2 lines
improve vertical text clipping
........
r5392 | vince | 2008-09-21 23:11:51 +0100 (Sun, 21 Sep 2008) | 2 lines
Improve text plotters
........
r5393 | vince | 2008-09-21 23:34:38 +0100 (Sun, 21 Sep 2008) | 2 lines
fix 32bpp line plotting
........
r5394 | vince | 2008-09-22 00:00:03 +0100 (Mon, 22 Sep 2008) | 2 lines
Fix off by one error in line plotting clipping
........
r5397 | vince | 2008-09-22 13:46:22 +0100 (Mon, 22 Sep 2008) | 2 lines
Fix bitmap tileing
........
r5398 | vince | 2008-09-22 17:46:02 +0100 (Mon, 22 Sep 2008) | 2 lines
enable knockout renderer
........
r5399 | vince | 2008-09-22 18:43:48 +0100 (Mon, 22 Sep 2008) | 2 lines
ensure clipping region lies within window, caused by knockout renderer
........
r5400 | vince | 2008-09-22 19:20:25 +0100 (Mon, 22 Sep 2008) | 2 lines
update cursor to one swiped from X windows
........
r5405 | vince | 2008-09-23 09:09:05 +0100 (Tue, 23 Sep 2008) | 2 lines
fix vertical scroll limit
........
r5412 | dsilvers | 2008-09-23 10:53:14 +0100 (Tue, 23 Sep 2008) | 1 line
Revert noisy fetcher patch
........
r5413 | dsilvers | 2008-09-23 10:58:00 +0100 (Tue, 23 Sep 2008) | 1 line
Add header guards
........
r5414 | dsilvers | 2008-09-23 11:31:31 +0100 (Tue, 23 Sep 2008) | 1 line
Tidy the region clipping slightly
........
r5416 | dsilvers | 2008-09-23 12:05:00 +0100 (Tue, 23 Sep 2008) | 1 line
Rationalise how the framebuffer frontend finds resources and options
........
r5418 | dsilvers | 2008-09-23 13:59:00 +0100 (Tue, 23 Sep 2008) | 1 line
Ensure options are overridden after load, and squash an fb_gui.c warning
........
r5419 | dsilvers | 2008-09-23 14:20:07 +0100 (Tue, 23 Sep 2008) | 1 line
Support fb_mode and fb_device options
........
r5420 | dsilvers | 2008-09-23 14:21:48 +0100 (Tue, 23 Sep 2008) | 1 line
Support option_fb_device in the able frontend
........
r5421 | dsilvers | 2008-09-23 14:25:17 +0100 (Tue, 23 Sep 2008) | 1 line
Ensure target_blank is disabled
........
r5422 | dsilvers | 2008-09-23 14:39:00 +0100 (Tue, 23 Sep 2008) | 1 line
Rework linux fb frontend to support scanning and opening all event devices for input
........
svn path=/trunk/netsurf/; revision=5423
2008-09-23 18:00:40 +04:00
|
|
|
typedef uint32_t colour; /* 0xbbggrr */
|
2009-07-14 14:57:07 +04:00
|
|
|
#define NS_TRANSPARENT 0x1000000
|
2003-04-04 19:19:32 +04:00
|
|
|
#define CSS_COLOR_INHERIT 0x2000000
|
2003-10-01 00:34:35 +04:00
|
|
|
#define CSS_COLOR_NONE 0x3000000
|
2005-01-11 22:39:49 +03:00
|
|
|
#define CSS_COLOR_NOT_SET 0x4000000
|
2004-02-02 03:22:59 +03:00
|
|
|
#define TOP 0
|
|
|
|
#define RIGHT 1
|
|
|
|
#define BOTTOM 2
|
|
|
|
#define LEFT 3
|
2005-05-22 03:30:19 +04:00
|
|
|
#define CSS_SPECIFICITY_UA 0x0000000
|
|
|
|
#define CSS_SPECIFICITY_USER 0x1000000
|
|
|
|
#define CSS_SPECIFICITY_AUTHOR 0x2000000
|
|
|
|
#define CSS_SPECIFICITY_ID 0x10000
|
|
|
|
#define CSS_SPECIFICITY_CLASS 0x100
|
|
|
|
#define CSS_SPECIFICITY_ATTR 0x100
|
|
|
|
#define CSS_SPECIFICITY_ELEMENT 0x1
|
|
|
|
|
|
|
|
|
|
|
|
struct css_working_stylesheet;
|
|
|
|
|
2003-04-04 19:19:32 +04:00
|
|
|
|
2003-12-27 23:15:23 +03:00
|
|
|
/** Representation of a CSS 2 length. */
|
2003-04-04 19:19:32 +04:00
|
|
|
struct css_length {
|
|
|
|
float value;
|
|
|
|
css_unit unit;
|
|
|
|
};
|
|
|
|
|
2003-11-05 19:25:35 +03:00
|
|
|
typedef enum {
|
|
|
|
CSS_TEXT_DECORATION_NONE = 0x0,
|
|
|
|
CSS_TEXT_DECORATION_INHERIT = 0x1,
|
|
|
|
CSS_TEXT_DECORATION_UNDERLINE = 0x2,
|
|
|
|
CSS_TEXT_DECORATION_BLINK = 0x4,
|
|
|
|
CSS_TEXT_DECORATION_LINE_THROUGH = 0x8,
|
|
|
|
CSS_TEXT_DECORATION_OVERLINE = 0x10,
|
2005-01-11 22:39:49 +03:00
|
|
|
CSS_TEXT_DECORATION_UNKNOWN = 0x1000,
|
|
|
|
CSS_TEXT_DECORATION_NOT_SET = 0x2000
|
2003-11-05 19:25:35 +03:00
|
|
|
} css_text_decoration;
|
|
|
|
|
2004-06-09 23:55:06 +04:00
|
|
|
typedef enum {
|
2004-06-25 18:28:29 +04:00
|
|
|
CSS_BACKGROUND_IMAGE_NONE,
|
|
|
|
CSS_BACKGROUND_IMAGE_INHERIT,
|
2005-01-11 22:39:49 +03:00
|
|
|
CSS_BACKGROUND_IMAGE_URI,
|
|
|
|
CSS_BACKGROUND_IMAGE_NOT_SET
|
2004-06-25 18:28:29 +04:00
|
|
|
} css_background_image_type;
|
|
|
|
|
|
|
|
/** Part of struct css_style, for convenience. */
|
|
|
|
struct css_background_position {
|
|
|
|
enum {
|
|
|
|
CSS_BACKGROUND_POSITION_LENGTH,
|
|
|
|
CSS_BACKGROUND_POSITION_PERCENT,
|
2005-01-11 22:39:49 +03:00
|
|
|
CSS_BACKGROUND_POSITION_INHERIT,
|
|
|
|
CSS_BACKGROUND_POSITION_NOT_SET
|
2004-06-25 18:28:29 +04:00
|
|
|
} pos;
|
|
|
|
union {
|
|
|
|
float percent;
|
|
|
|
struct css_length length;
|
|
|
|
} value;
|
|
|
|
};
|
|
|
|
|
2004-08-01 18:13:47 +04:00
|
|
|
struct css_border_width {
|
|
|
|
enum { CSS_BORDER_WIDTH_INHERIT,
|
2005-01-11 22:39:49 +03:00
|
|
|
CSS_BORDER_WIDTH_LENGTH,
|
|
|
|
CSS_BORDER_WIDTH_NOT_SET } width;
|
2004-08-01 18:13:47 +04:00
|
|
|
struct css_length value;
|
|
|
|
};
|
|
|
|
|
2005-04-14 23:54:24 +04:00
|
|
|
struct css_border {
|
|
|
|
colour color;
|
|
|
|
struct css_border_width width;
|
|
|
|
css_border_style style;
|
|
|
|
};
|
|
|
|
|
2005-01-17 00:39:21 +03:00
|
|
|
typedef enum {
|
|
|
|
CSS_CONTENT_STRING,
|
|
|
|
CSS_CONTENT_URI,
|
|
|
|
CSS_CONTENT_COUNTER,
|
|
|
|
CSS_CONTENT_ATTR,
|
|
|
|
CSS_CONTENT_OPEN_QUOTE,
|
|
|
|
CSS_CONTENT_CLOSE_QUOTE,
|
|
|
|
CSS_CONTENT_NO_OPEN_QUOTE,
|
|
|
|
CSS_CONTENT_NO_CLOSE_QUOTE
|
|
|
|
} css_content_type_generated;
|
|
|
|
|
2004-08-01 18:13:47 +04:00
|
|
|
typedef enum {
|
|
|
|
CSS_LIST_STYLE_IMAGE_INHERIT,
|
|
|
|
CSS_LIST_STYLE_IMAGE_NONE,
|
2005-01-11 22:39:49 +03:00
|
|
|
CSS_LIST_STYLE_IMAGE_URI,
|
|
|
|
CSS_LIST_STYLE_IMAGE_NOT_SET
|
2004-08-01 18:13:47 +04:00
|
|
|
} css_list_style_image_type;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
CSS_OUTLINE_COLOR_INHERIT,
|
|
|
|
CSS_OUTLINE_COLOR_COLOR,
|
2005-01-11 22:39:49 +03:00
|
|
|
CSS_OUTLINE_COLOR_INVERT,
|
|
|
|
CSS_OUTLINE_COLOR_NOT_SET
|
2004-08-01 18:13:47 +04:00
|
|
|
} css_outline_color_type;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
CSS_VERTICAL_ALIGN_INHERIT,
|
|
|
|
CSS_VERTICAL_ALIGN_BASELINE,
|
|
|
|
CSS_VERTICAL_ALIGN_SUB,
|
|
|
|
CSS_VERTICAL_ALIGN_SUPER,
|
|
|
|
CSS_VERTICAL_ALIGN_TOP,
|
|
|
|
CSS_VERTICAL_ALIGN_TEXT_TOP,
|
|
|
|
CSS_VERTICAL_ALIGN_MIDDLE,
|
|
|
|
CSS_VERTICAL_ALIGN_BOTTOM,
|
|
|
|
CSS_VERTICAL_ALIGN_TEXT_BOTTOM,
|
|
|
|
CSS_VERTICAL_ALIGN_LENGTH,
|
2005-01-11 22:39:49 +03:00
|
|
|
CSS_VERTICAL_ALIGN_PERCENT,
|
|
|
|
CSS_VERTICAL_ALIGN_NOT_SET
|
2004-08-01 18:13:47 +04:00
|
|
|
} css_vertical_align_type;
|
2005-01-16 03:03:45 +03:00
|
|
|
|
2008-07-29 13:18:53 +04:00
|
|
|
typedef enum {
|
|
|
|
CSS_FONT_SIZE_INHERIT,
|
|
|
|
CSS_FONT_SIZE_ABSOLUTE,
|
|
|
|
CSS_FONT_SIZE_LENGTH,
|
|
|
|
CSS_FONT_SIZE_PERCENT,
|
|
|
|
CSS_FONT_SIZE_NOT_SET
|
|
|
|
} css_font_size_type;
|
|
|
|
|
2005-01-17 00:39:21 +03:00
|
|
|
struct css_counter_control {
|
|
|
|
char *name;
|
|
|
|
int value;
|
|
|
|
struct css_counter_control *next;
|
|
|
|
};
|
2005-02-20 02:40:15 +03:00
|
|
|
|
2005-01-16 01:11:53 +03:00
|
|
|
struct css_counter {
|
2005-01-17 00:39:21 +03:00
|
|
|
char *name;
|
2005-01-16 01:11:53 +03:00
|
|
|
css_list_style_type style;
|
2005-01-17 00:39:21 +03:00
|
|
|
char *separator; /** NULL for counter() */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct css_content {
|
|
|
|
css_content_type_generated type;
|
|
|
|
union {
|
|
|
|
char *string;
|
|
|
|
char *uri;
|
|
|
|
struct css_counter counter;
|
|
|
|
char *attr;
|
|
|
|
} data;
|
|
|
|
struct css_content *next;
|
2005-01-16 01:11:53 +03:00
|
|
|
};
|
2004-06-09 23:55:06 +04:00
|
|
|
|
2003-12-27 23:15:23 +03:00
|
|
|
/** Representation of a complete CSS 2 style. */
|
2003-04-04 19:19:32 +04:00
|
|
|
struct css_style {
|
2004-08-01 18:13:47 +04:00
|
|
|
/* background properties */
|
2004-06-25 18:28:29 +04:00
|
|
|
css_background_attachment background_attachment;
|
2004-08-01 18:13:47 +04:00
|
|
|
colour background_color;
|
2004-06-09 23:55:06 +04:00
|
|
|
struct {
|
2004-06-25 18:28:29 +04:00
|
|
|
css_background_image_type type;
|
|
|
|
char *uri;
|
2004-06-09 23:55:06 +04:00
|
|
|
} background_image;
|
2004-06-25 18:28:29 +04:00
|
|
|
struct {
|
|
|
|
struct css_background_position horz;
|
|
|
|
struct css_background_position vert;
|
|
|
|
} background_position;
|
|
|
|
css_background_repeat background_repeat;
|
2004-06-09 23:55:06 +04:00
|
|
|
|
2004-08-01 18:13:47 +04:00
|
|
|
/* borders */
|
2005-04-14 23:54:24 +04:00
|
|
|
struct css_border border[4]; /**< top, right, bottom, left */
|
2004-08-01 18:13:47 +04:00
|
|
|
css_border_collapse border_collapse;
|
|
|
|
struct {
|
|
|
|
enum { CSS_BORDER_SPACING_INHERIT,
|
2005-01-11 22:39:49 +03:00
|
|
|
CSS_BORDER_SPACING_LENGTH,
|
|
|
|
CSS_BORDER_SPACING_NOT_SET } border_spacing;
|
2004-08-01 18:13:47 +04:00
|
|
|
struct css_length horz;
|
|
|
|
struct css_length vert;
|
|
|
|
} border_spacing;
|
2004-02-02 03:22:59 +03:00
|
|
|
|
2004-08-01 18:13:47 +04:00
|
|
|
css_caption_side caption_side;
|
2003-04-04 19:19:32 +04:00
|
|
|
css_clear clear;
|
2004-08-01 18:13:47 +04:00
|
|
|
|
|
|
|
struct {
|
|
|
|
enum { CSS_CLIP_INHERIT,
|
|
|
|
CSS_CLIP_AUTO,
|
2005-01-11 22:39:49 +03:00
|
|
|
CSS_CLIP_RECT,
|
|
|
|
CSS_CLIP_NOT_SET } clip;
|
2004-08-01 18:13:47 +04:00
|
|
|
struct {
|
|
|
|
enum { CSS_CLIP_RECT_AUTO,
|
|
|
|
CSS_CLIP_RECT_LENGTH } rect;
|
|
|
|
struct css_length value;
|
|
|
|
} rect[4]; /**< top, right, bottom, left */
|
|
|
|
} clip;
|
|
|
|
|
2003-04-04 19:19:32 +04:00
|
|
|
colour color;
|
2004-08-01 18:13:47 +04:00
|
|
|
|
2005-01-17 00:39:21 +03:00
|
|
|
/* generated content */
|
|
|
|
struct {
|
|
|
|
enum {
|
|
|
|
CSS_CONTENT_NORMAL,
|
|
|
|
CSS_CONTENT_INHERIT,
|
|
|
|
CSS_CONTENT_INTERPRET,
|
|
|
|
CSS_CONTENT_NOT_SET } type;
|
|
|
|
struct css_content *content;
|
|
|
|
} content;
|
2005-02-20 02:40:15 +03:00
|
|
|
|
2005-01-17 00:39:21 +03:00
|
|
|
/* counter controls */
|
|
|
|
struct {
|
|
|
|
enum {
|
|
|
|
CSS_COUNTER_RESET_NONE,
|
|
|
|
CSS_COUNTER_RESET_INHERIT,
|
|
|
|
CSS_COUNTER_RESET_INTERPRET,
|
|
|
|
CSS_COUNTER_RESET_NOT_SET } type;
|
|
|
|
struct css_counter_control *data;
|
|
|
|
} counter_reset;
|
|
|
|
struct {
|
|
|
|
enum {
|
|
|
|
CSS_COUNTER_INCREMENT_NONE,
|
|
|
|
CSS_COUNTER_INCREMENT_INHERIT,
|
|
|
|
CSS_COUNTER_INCREMENT_INTERPRET,
|
|
|
|
CSS_COUNTER_INCREMENT_NOT_SET } type;
|
|
|
|
struct css_counter_control *data;
|
|
|
|
} counter_increment;
|
2004-08-01 18:13:47 +04:00
|
|
|
|
2004-04-03 03:12:26 +04:00
|
|
|
css_cursor cursor;
|
2004-08-01 18:13:47 +04:00
|
|
|
css_direction direction;
|
2003-04-04 19:19:32 +04:00
|
|
|
css_display display;
|
2004-08-01 18:13:47 +04:00
|
|
|
css_empty_cells empty_cells;
|
2003-04-04 19:19:32 +04:00
|
|
|
css_float float_;
|
|
|
|
|
2004-08-01 18:13:47 +04:00
|
|
|
/* font properties */
|
|
|
|
css_font_family font_family;
|
2003-04-04 19:19:32 +04:00
|
|
|
struct {
|
2008-07-29 13:18:53 +04:00
|
|
|
css_font_size_type size;
|
2003-04-04 19:19:32 +04:00
|
|
|
union {
|
|
|
|
struct css_length length;
|
|
|
|
float absolute;
|
|
|
|
float percent;
|
|
|
|
} value;
|
|
|
|
} font_size;
|
|
|
|
css_font_style font_style;
|
2004-01-31 01:28:32 +03:00
|
|
|
css_font_variant font_variant;
|
2004-08-01 18:13:47 +04:00
|
|
|
css_font_weight font_weight;
|
2003-04-04 19:19:32 +04:00
|
|
|
|
|
|
|
struct {
|
|
|
|
enum { CSS_HEIGHT_INHERIT,
|
|
|
|
CSS_HEIGHT_AUTO,
|
2005-01-11 22:39:49 +03:00
|
|
|
CSS_HEIGHT_LENGTH,
|
2008-10-13 01:22:28 +04:00
|
|
|
CSS_HEIGHT_PERCENT,
|
2005-01-11 22:39:49 +03:00
|
|
|
CSS_HEIGHT_NOT_SET } height;
|
2008-10-13 01:22:28 +04:00
|
|
|
union {
|
|
|
|
struct css_length length;
|
|
|
|
float percent;
|
|
|
|
} value;
|
2003-04-04 19:19:32 +04:00
|
|
|
} height;
|
|
|
|
|
2004-08-01 18:13:47 +04:00
|
|
|
struct {
|
|
|
|
enum { CSS_LETTER_SPACING_INHERIT,
|
|
|
|
CSS_LETTER_SPACING_NORMAL,
|
2005-01-11 22:39:49 +03:00
|
|
|
CSS_LETTER_SPACING_LENGTH,
|
|
|
|
CSS_LETTER_SPACING_NOT_SET } letter_spacing;
|
2004-08-01 18:13:47 +04:00
|
|
|
struct css_length length;
|
|
|
|
} letter_spacing;
|
|
|
|
|
2003-04-04 19:19:32 +04:00
|
|
|
struct {
|
|
|
|
enum { CSS_LINE_HEIGHT_INHERIT,
|
|
|
|
CSS_LINE_HEIGHT_ABSOLUTE,
|
|
|
|
CSS_LINE_HEIGHT_LENGTH,
|
2005-01-11 22:39:49 +03:00
|
|
|
CSS_LINE_HEIGHT_PERCENT,
|
|
|
|
CSS_LINE_HEIGHT_NOT_SET } size;
|
2003-04-04 19:19:32 +04:00
|
|
|
union {
|
|
|
|
float absolute;
|
|
|
|
struct css_length length;
|
|
|
|
float percent;
|
|
|
|
} value;
|
|
|
|
} line_height;
|
|
|
|
|
2004-08-01 18:13:47 +04:00
|
|
|
/* list properties */
|
|
|
|
struct {
|
|
|
|
css_list_style_image_type type;
|
|
|
|
char *uri;
|
|
|
|
} list_style_image;
|
|
|
|
css_list_style_position list_style_position;
|
|
|
|
css_list_style_type list_style_type;
|
|
|
|
|
|
|
|
/* margins */
|
2004-02-02 03:22:59 +03:00
|
|
|
struct {
|
|
|
|
enum { CSS_MARGIN_INHERIT,
|
|
|
|
CSS_MARGIN_LENGTH,
|
|
|
|
CSS_MARGIN_PERCENT,
|
2005-01-11 22:39:49 +03:00
|
|
|
CSS_MARGIN_AUTO,
|
|
|
|
CSS_MARGIN_NOT_SET } margin;
|
2004-02-02 03:22:59 +03:00
|
|
|
union {
|
|
|
|
struct css_length length;
|
|
|
|
float percent;
|
|
|
|
} value;
|
|
|
|
} margin[4]; /**< top, right, bottom, left */
|
|
|
|
|
2004-08-01 18:13:47 +04:00
|
|
|
/* min/max width/height */
|
|
|
|
struct {
|
|
|
|
enum { CSS_MAX_HEIGHT_INHERIT,
|
|
|
|
CSS_MAX_HEIGHT_NONE,
|
|
|
|
CSS_MAX_HEIGHT_LENGTH,
|
2005-01-11 22:39:49 +03:00
|
|
|
CSS_MAX_HEIGHT_PERCENT,
|
|
|
|
CSS_MAX_HEIGHT_NOT_SET } max_height;
|
2004-08-01 18:13:47 +04:00
|
|
|
union {
|
|
|
|
struct css_length length;
|
|
|
|
float percent;
|
|
|
|
} value;
|
|
|
|
} max_height;
|
|
|
|
struct {
|
|
|
|
enum { CSS_MAX_WIDTH_INHERIT,
|
|
|
|
CSS_MAX_WIDTH_NONE,
|
|
|
|
CSS_MAX_WIDTH_LENGTH,
|
2005-01-11 22:39:49 +03:00
|
|
|
CSS_MAX_WIDTH_PERCENT,
|
|
|
|
CSS_MAX_WIDTH_NOT_SET } max_width;
|
2004-08-01 18:13:47 +04:00
|
|
|
union {
|
|
|
|
struct css_length length;
|
|
|
|
float percent;
|
|
|
|
} value;
|
|
|
|
} max_width;
|
|
|
|
struct {
|
|
|
|
enum { CSS_MIN_HEIGHT_INHERIT,
|
|
|
|
CSS_MIN_HEIGHT_LENGTH,
|
2005-01-11 22:39:49 +03:00
|
|
|
CSS_MIN_HEIGHT_PERCENT,
|
|
|
|
CSS_MIN_HEIGHT_NOT_SET } min_height;
|
2004-08-01 18:13:47 +04:00
|
|
|
union {
|
|
|
|
struct css_length length;
|
|
|
|
float percent;
|
|
|
|
} value;
|
|
|
|
} min_height;
|
|
|
|
struct {
|
|
|
|
enum { CSS_MIN_WIDTH_INHERIT,
|
|
|
|
CSS_MIN_WIDTH_LENGTH,
|
2005-01-11 22:39:49 +03:00
|
|
|
CSS_MIN_WIDTH_PERCENT,
|
|
|
|
CSS_MIN_WIDTH_NOT_SET } min_width;
|
2004-08-01 18:13:47 +04:00
|
|
|
union {
|
|
|
|
struct css_length length;
|
|
|
|
float percent;
|
|
|
|
} value;
|
|
|
|
} min_width;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
enum { CSS_ORPHANS_INHERIT,
|
2005-01-11 22:39:49 +03:00
|
|
|
CSS_ORPHANS_INTEGER,
|
|
|
|
CSS_ORPHANS_NOT_SET } orphans;
|
2004-08-01 18:13:47 +04:00
|
|
|
int value;
|
|
|
|
} orphans;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
struct {
|
|
|
|
css_outline_color_type color;
|
|
|
|
colour value;
|
|
|
|
} color;
|
|
|
|
struct css_border_width width;
|
|
|
|
css_border_style style;
|
|
|
|
} outline;
|
|
|
|
|
2004-07-17 00:22:31 +04:00
|
|
|
css_overflow overflow;
|
|
|
|
|
2004-08-01 18:13:47 +04:00
|
|
|
/* padding */
|
2004-02-02 03:22:59 +03:00
|
|
|
struct {
|
|
|
|
enum { CSS_PADDING_INHERIT,
|
|
|
|
CSS_PADDING_LENGTH,
|
2005-01-11 22:39:49 +03:00
|
|
|
CSS_PADDING_PERCENT,
|
|
|
|
CSS_PADDING_NOT_SET } padding;
|
2004-02-02 03:22:59 +03:00
|
|
|
union {
|
|
|
|
struct css_length length;
|
|
|
|
float percent;
|
|
|
|
} value;
|
|
|
|
} padding[4]; /**< top, right, bottom, left */
|
|
|
|
|
2004-08-01 18:13:47 +04:00
|
|
|
css_page_break_after page_break_after;
|
|
|
|
css_page_break_before page_break_before;
|
|
|
|
css_page_break_inside page_break_inside;
|
|
|
|
|
|
|
|
struct {
|
2004-08-02 01:56:47 +04:00
|
|
|
enum { CSS_POS_INHERIT,
|
|
|
|
CSS_POS_AUTO,
|
|
|
|
CSS_POS_PERCENT,
|
2005-01-11 22:39:49 +03:00
|
|
|
CSS_POS_LENGTH,
|
|
|
|
CSS_POS_NOT_SET } pos;
|
2004-08-01 18:13:47 +04:00
|
|
|
union {
|
|
|
|
struct css_length length;
|
|
|
|
float percent;
|
|
|
|
} value;
|
2004-08-02 01:56:47 +04:00
|
|
|
} pos[4]; /**< top, right, bottom, left */
|
|
|
|
|
|
|
|
css_position position;
|
|
|
|
|
|
|
|
/** \todo quotes */
|
2004-08-01 18:13:47 +04:00
|
|
|
|
|
|
|
css_table_layout table_layout;
|
|
|
|
|
|
|
|
/* text properties */
|
2003-04-04 19:19:32 +04:00
|
|
|
css_text_align text_align;
|
2003-10-18 03:47:13 +04:00
|
|
|
css_text_decoration text_decoration;
|
2004-02-02 01:42:40 +03:00
|
|
|
struct {
|
2004-06-25 18:28:29 +04:00
|
|
|
enum { CSS_TEXT_INDENT_INHERIT,
|
|
|
|
CSS_TEXT_INDENT_LENGTH,
|
2005-01-11 22:39:49 +03:00
|
|
|
CSS_TEXT_INDENT_PERCENT,
|
|
|
|
CSS_TEXT_INDENT_NOT_SET } size;
|
2004-06-25 18:28:29 +04:00
|
|
|
union {
|
|
|
|
struct css_length length;
|
|
|
|
float percent;
|
|
|
|
} value ;
|
|
|
|
} text_indent;
|
2004-02-01 00:18:44 +03:00
|
|
|
css_text_transform text_transform;
|
2003-04-04 19:19:32 +04:00
|
|
|
|
2004-08-01 18:13:47 +04:00
|
|
|
css_unicode_bidi unicode_bidi;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
css_vertical_align_type type;
|
|
|
|
union {
|
|
|
|
struct css_length length;
|
|
|
|
float percent;
|
|
|
|
} value;
|
|
|
|
} vertical_align;
|
|
|
|
|
2003-10-10 22:13:36 +04:00
|
|
|
css_visibility visibility;
|
|
|
|
|
2004-08-01 18:13:47 +04:00
|
|
|
css_white_space white_space;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
enum { CSS_WIDOWS_INHERIT,
|
2005-01-11 22:39:49 +03:00
|
|
|
CSS_WIDOWS_INTEGER,
|
|
|
|
CSS_WIDOWS_NOT_SET } widows;
|
2004-08-01 18:13:47 +04:00
|
|
|
int value;
|
|
|
|
} widows;
|
|
|
|
|
2003-04-04 19:19:32 +04:00
|
|
|
struct {
|
|
|
|
enum { CSS_WIDTH_INHERIT,
|
|
|
|
CSS_WIDTH_AUTO,
|
|
|
|
CSS_WIDTH_LENGTH,
|
2005-01-11 22:39:49 +03:00
|
|
|
CSS_WIDTH_PERCENT,
|
|
|
|
CSS_WIDTH_NOT_SET } width;
|
2003-04-04 19:19:32 +04:00
|
|
|
union {
|
|
|
|
struct css_length length;
|
|
|
|
float percent;
|
|
|
|
} value;
|
|
|
|
} width;
|
2003-10-08 01:34:27 +04:00
|
|
|
|
2004-08-01 18:13:47 +04:00
|
|
|
struct {
|
|
|
|
enum { CSS_WORD_SPACING_INHERIT,
|
|
|
|
CSS_WORD_SPACING_NORMAL,
|
2005-01-11 22:39:49 +03:00
|
|
|
CSS_WORD_SPACING_LENGTH,
|
|
|
|
CSS_WORD_SPACING_NOT_SET } word_spacing;
|
2004-08-01 18:13:47 +04:00
|
|
|
struct css_length length;
|
|
|
|
} word_spacing;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
enum { CSS_Z_INDEX_INHERIT,
|
|
|
|
CSS_Z_INDEX_AUTO,
|
2005-01-11 22:39:49 +03:00
|
|
|
CSS_Z_INDEX_INTEGER,
|
|
|
|
CSS_Z_INDEX_NOT_SET } z_index;
|
2004-08-01 18:13:47 +04:00
|
|
|
int value;
|
|
|
|
} z_index;
|
2003-04-04 19:19:32 +04:00
|
|
|
};
|
|
|
|
|
2008-02-25 19:37:48 +03:00
|
|
|
/** Author level CSS importance info for properties that may be set in HTML */
|
|
|
|
struct css_importance {
|
|
|
|
/* background properties */
|
|
|
|
bool background_color;
|
|
|
|
bool background_image;
|
|
|
|
|
|
|
|
/* borders */
|
|
|
|
bool border_style[4]; /**< top, right, bottom, left */
|
|
|
|
bool border_color[4];
|
|
|
|
bool border_width[4];
|
|
|
|
bool border_spacing;
|
|
|
|
|
|
|
|
bool color;
|
|
|
|
|
|
|
|
bool height;
|
|
|
|
|
|
|
|
/* margins */
|
|
|
|
bool margin[4]; /**< top, right, bottom, left */
|
|
|
|
|
|
|
|
/* padding */
|
|
|
|
bool padding[4]; /**< top, right, bottom, left */
|
|
|
|
|
|
|
|
bool width;
|
|
|
|
};
|
|
|
|
|
2003-04-04 19:19:32 +04:00
|
|
|
struct css_stylesheet;
|
|
|
|
|
2005-05-22 03:30:19 +04:00
|
|
|
typedef enum {
|
|
|
|
CSS_ORIGIN_AUTHOR,
|
|
|
|
CSS_ORIGIN_USER,
|
|
|
|
CSS_ORIGIN_UA
|
|
|
|
} css_origin;
|
|
|
|
|
2003-12-27 23:15:23 +03:00
|
|
|
/** Data specific to CONTENT_CSS. */
|
2003-09-08 01:08:13 +04:00
|
|
|
struct content_css_data {
|
2003-12-27 23:15:23 +03:00
|
|
|
struct css_stylesheet *css; /**< Opaque stylesheet data. */
|
|
|
|
unsigned int import_count; /**< Number of entries in import_url. */
|
|
|
|
struct content **import_content; /**< Imported stylesheet contents. */
|
2005-05-22 03:30:19 +04:00
|
|
|
css_origin origin; /**< Origin of stylesheet. */
|
2003-09-08 01:08:13 +04:00
|
|
|
};
|
|
|
|
|
2003-04-04 19:19:32 +04:00
|
|
|
|
|
|
|
extern const struct css_style css_base_style;
|
|
|
|
extern const struct css_style css_empty_style;
|
|
|
|
extern const struct css_style css_blank_style;
|
2007-08-19 14:08:49 +04:00
|
|
|
extern float css_screen_dpi;
|
2003-04-04 19:19:32 +04:00
|
|
|
|
|
|
|
|
|
|
|
#ifdef CSS_INTERNALS
|
|
|
|
|
2004-05-01 21:48:38 +04:00
|
|
|
/** Type of a css_selector. */
|
|
|
|
typedef enum {
|
|
|
|
CSS_SELECTOR_ELEMENT,
|
|
|
|
CSS_SELECTOR_ID,
|
|
|
|
CSS_SELECTOR_CLASS,
|
|
|
|
CSS_SELECTOR_ATTRIB,
|
|
|
|
CSS_SELECTOR_ATTRIB_EQ,
|
|
|
|
CSS_SELECTOR_ATTRIB_INC,
|
|
|
|
CSS_SELECTOR_ATTRIB_DM,
|
2004-07-31 01:53:52 +04:00
|
|
|
CSS_SELECTOR_ATTRIB_PRE,
|
|
|
|
CSS_SELECTOR_ATTRIB_SUF,
|
|
|
|
CSS_SELECTOR_ATTRIB_SUB,
|
2004-05-01 21:48:38 +04:00
|
|
|
CSS_SELECTOR_PSEUDO,
|
|
|
|
} css_selector_type;
|
|
|
|
|
|
|
|
/** Relationship to combiner in a css_selector. */
|
|
|
|
typedef enum {
|
|
|
|
CSS_COMB_NONE,
|
|
|
|
CSS_COMB_ANCESTOR,
|
|
|
|
CSS_COMB_PARENT,
|
|
|
|
CSS_COMB_PRECEDED,
|
|
|
|
} css_combinator;
|
|
|
|
|
|
|
|
/** Representation of a CSS selector. */
|
|
|
|
struct css_selector {
|
|
|
|
css_selector_type type;
|
|
|
|
const char *data;
|
|
|
|
unsigned int data_length;
|
|
|
|
const char *data2;
|
|
|
|
unsigned int data2_length;
|
|
|
|
struct css_selector *detail;
|
|
|
|
struct css_selector *combiner;
|
|
|
|
struct css_selector *next;
|
|
|
|
css_combinator comb;
|
|
|
|
struct css_style *style;
|
|
|
|
unsigned long specificity;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** Type of a css_node. */
|
2003-04-04 19:19:32 +04:00
|
|
|
typedef enum {
|
2003-10-08 01:34:27 +04:00
|
|
|
CSS_NODE_DECLARATION,
|
|
|
|
CSS_NODE_IDENT,
|
|
|
|
CSS_NODE_NUMBER,
|
|
|
|
CSS_NODE_PERCENTAGE,
|
|
|
|
CSS_NODE_DIMENSION,
|
|
|
|
CSS_NODE_STRING,
|
|
|
|
CSS_NODE_DELIM,
|
|
|
|
CSS_NODE_URI,
|
|
|
|
CSS_NODE_HASH,
|
|
|
|
CSS_NODE_UNICODE_RANGE,
|
|
|
|
CSS_NODE_INCLUDES,
|
|
|
|
CSS_NODE_FUNCTION,
|
|
|
|
CSS_NODE_DASHMATCH,
|
2004-07-31 01:53:52 +04:00
|
|
|
CSS_NODE_PREFIX,
|
|
|
|
CSS_NODE_SUFFIX,
|
|
|
|
CSS_NODE_SUBSTR,
|
2003-10-08 01:34:27 +04:00
|
|
|
CSS_NODE_COLON,
|
|
|
|
CSS_NODE_COMMA,
|
2003-10-17 21:39:29 +04:00
|
|
|
CSS_NODE_DOT,
|
2003-10-08 01:34:27 +04:00
|
|
|
CSS_NODE_PLUS,
|
|
|
|
CSS_NODE_GT,
|
|
|
|
CSS_NODE_PAREN,
|
|
|
|
CSS_NODE_BRAC,
|
|
|
|
} css_node_type;
|
2003-04-04 19:19:32 +04:00
|
|
|
|
2004-05-01 21:48:38 +04:00
|
|
|
/** A node in a CSS parse tree. */
|
2003-10-08 01:34:27 +04:00
|
|
|
struct css_node {
|
|
|
|
css_node_type type;
|
2004-05-01 21:48:38 +04:00
|
|
|
const char *data;
|
|
|
|
unsigned int data_length;
|
|
|
|
struct css_node *value;
|
2003-10-08 01:34:27 +04:00
|
|
|
struct css_node *next;
|
|
|
|
css_combinator comb;
|
2003-04-04 19:19:32 +04:00
|
|
|
struct css_style *style;
|
2003-09-28 21:37:43 +04:00
|
|
|
unsigned long specificity;
|
2004-06-09 23:55:06 +04:00
|
|
|
struct content *stylesheet;
|
2003-04-04 19:19:32 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-04-06 01:38:06 +04:00
|
|
|
#define HASH_SIZE (47 + 1)
|
2003-04-05 19:35:55 +04:00
|
|
|
|
2004-05-01 21:48:38 +04:00
|
|
|
/** Representation of a CSS 2 style sheet. */
|
2003-04-04 19:19:32 +04:00
|
|
|
struct css_stylesheet {
|
2004-05-01 21:48:38 +04:00
|
|
|
struct css_selector *rule[HASH_SIZE];
|
2003-04-04 19:19:32 +04:00
|
|
|
};
|
|
|
|
|
2004-05-01 21:48:38 +04:00
|
|
|
/** Parameters to and results from the CSS parser. */
|
|
|
|
struct css_parser_params {
|
|
|
|
bool ruleset_only;
|
2003-04-06 22:09:34 +04:00
|
|
|
struct content *stylesheet;
|
2003-10-08 01:34:27 +04:00
|
|
|
struct css_node *declaration;
|
2003-10-17 21:39:29 +04:00
|
|
|
bool syntax_error;
|
2004-05-01 21:48:38 +04:00
|
|
|
bool memory_error;
|
2005-08-01 02:06:03 +04:00
|
|
|
bool had_ruleset;
|
2004-05-01 21:48:38 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/** Token type for the CSS parser. */
|
|
|
|
struct css_parser_token {
|
|
|
|
const char *text;
|
|
|
|
unsigned int length;
|
2003-04-05 20:24:43 +04:00
|
|
|
};
|
|
|
|
|
2003-04-04 19:19:32 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2003-07-15 02:57:45 +04:00
|
|
|
struct content;
|
2003-04-04 19:19:32 +04:00
|
|
|
|
2004-06-11 00:41:26 +04:00
|
|
|
bool css_convert(struct content *c, int width, int height);
|
2003-04-04 19:19:32 +04:00
|
|
|
void css_destroy(struct content *c);
|
|
|
|
|
|
|
|
#ifdef CSS_INTERNALS
|
|
|
|
|
2004-06-09 23:55:06 +04:00
|
|
|
struct css_node * css_new_node(struct content *stylesheet,
|
2004-06-25 18:28:29 +04:00
|
|
|
css_node_type type,
|
2004-05-01 21:48:38 +04:00
|
|
|
const char *data, unsigned int data_length);
|
2003-10-08 01:34:27 +04:00
|
|
|
void css_free_node(struct css_node *node);
|
2004-05-01 21:48:38 +04:00
|
|
|
struct css_selector * css_new_selector(css_selector_type type,
|
|
|
|
const char *data, unsigned int data_length);
|
|
|
|
void css_free_selector(struct css_selector *node);
|
2003-10-08 01:34:27 +04:00
|
|
|
void css_atimport(struct content *c, struct css_node *node);
|
2003-04-06 22:09:34 +04:00
|
|
|
void css_add_ruleset(struct content *c,
|
2004-05-01 21:48:38 +04:00
|
|
|
struct css_selector *selector,
|
|
|
|
struct css_node *declaration);
|
|
|
|
void css_add_declarations(struct css_style *style,
|
2003-10-08 01:34:27 +04:00
|
|
|
struct css_node *declaration);
|
2004-05-01 21:48:38 +04:00
|
|
|
unsigned int css_hash(const char *s, int length);
|
|
|
|
|
|
|
|
int css_tokenise(unsigned char **buffer, unsigned char *end,
|
|
|
|
unsigned char **token_text);
|
2003-04-04 19:19:32 +04:00
|
|
|
|
|
|
|
void css_parser_Trace(FILE *TraceFILE, char *zTracePrompt);
|
2005-02-20 02:40:15 +03:00
|
|
|
void *css_parser_Alloc(void *(*mallocProc)(size_t));
|
2003-04-04 19:19:32 +04:00
|
|
|
void css_parser_Free(void *p, void (*freeProc)(void*));
|
2004-05-01 21:48:38 +04:00
|
|
|
void css_parser_(void *yyp, int yymajor, struct css_parser_token yyminor,
|
|
|
|
struct css_parser_params *param);
|
2004-06-11 00:41:26 +04:00
|
|
|
const char *css_parser_TokenName(int tokenType);
|
2003-04-04 19:19:32 +04:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2005-05-22 03:30:19 +04:00
|
|
|
void css_set_origin(struct content *c, css_origin origin);
|
|
|
|
struct css_working_stylesheet *css_make_working_stylesheet(
|
|
|
|
struct content **stylesheet_content,
|
|
|
|
unsigned int stylesheet_count);
|
|
|
|
void css_get_style(struct css_working_stylesheet *working_stylesheet,
|
2008-02-25 19:37:48 +03:00
|
|
|
xmlNode *element, struct css_style *style,
|
|
|
|
struct css_importance *author);
|
2005-01-16 03:03:45 +03:00
|
|
|
struct css_style *css_duplicate_style(const struct css_style * const style);
|
|
|
|
void css_free_style(struct css_style *style);
|
2005-01-17 00:39:21 +03:00
|
|
|
void css_deep_free_content(struct css_content *content);
|
|
|
|
void css_deep_free_counter_control(struct css_counter_control *control);
|
2004-05-01 21:48:38 +04:00
|
|
|
void css_cascade(struct css_style * const style,
|
2008-02-25 19:37:48 +03:00
|
|
|
const struct css_style * const apply,
|
|
|
|
struct css_importance * const author);
|
2004-05-01 21:48:38 +04:00
|
|
|
void css_merge(struct css_style * const style,
|
2008-02-25 19:37:48 +03:00
|
|
|
const struct css_style * const apply,
|
|
|
|
const unsigned long specificity,
|
|
|
|
struct css_importance * const author);
|
2004-06-11 16:51:40 +04:00
|
|
|
void css_parse_property_list(struct content *c, struct css_style * style,
|
2004-06-25 18:28:29 +04:00
|
|
|
char * str);
|
2003-04-13 16:50:10 +04:00
|
|
|
colour named_colour(const char *name);
|
2007-10-09 20:25:25 +04:00
|
|
|
colour hex_colour(const char *text, int length);
|
|
|
|
|
2008-07-09 15:49:27 +04:00
|
|
|
void css_dump_style(FILE *stream, const struct css_style * const style);
|
2003-12-27 03:11:57 +03:00
|
|
|
void css_dump_stylesheet(const struct css_stylesheet * stylesheet);
|
2003-07-05 01:18:24 +04:00
|
|
|
|
2005-02-20 02:40:15 +03:00
|
|
|
float css_len2px(const struct css_length *length,
|
|
|
|
const struct css_style *style);
|
2006-03-09 22:04:13 +03:00
|
|
|
float css_len2pt(const struct css_length *length,
|
|
|
|
const struct css_style *style);
|
2005-04-14 23:54:24 +04:00
|
|
|
struct css_border *css_eyecatching_border(struct css_border *test1,
|
|
|
|
struct css_style *style1, struct css_border *test2,
|
|
|
|
struct css_style *style2);
|
2003-04-04 19:19:32 +04:00
|
|
|
|
|
|
|
#endif
|