summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-02-14 09:35:32 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-02-14 09:35:32 +0000
commitb740ed09f1f1a9319a6ffa1d99d0dc8849f75173 (patch)
tree8c3dfa143f1df2405a4d3bd64320f7eedc9e0be9 /include
parente12825e094f3bb40336e92ea208050fe001f78ba (diff)
downloadlibcss-b740ed09f1f1a9319a6ffa1d99d0dc8849f75173.tar.gz
libcss-b740ed09f1f1a9319a6ffa1d99d0dc8849f75173.tar.bz2
Pseudo classes are now matched by callbacks to the client. This is far saner, as any node may match a pseudo class, not just the immediate target of the selection.
Munge test data to no longer expect :active to match -- there's currently no way to specify which node(s) in the tree have which pseudo classes applying to them. The pseudo classes on @page are no longer supported (namely, :left, :right, :first). These, and @page itself, probably want a dedicated API, as they are nothing to do with normal selection. Probably something like css_error css_select_page_margins(ctx, CSS_PAGE_LEFT, &computed); svn path=/trunk/libcss/; revision=6476
Diffstat (limited to 'include')
-rw-r--r--include/libcss/select.h33
1 files changed, 15 insertions, 18 deletions
diff --git a/include/libcss/select.h b/include/libcss/select.h
index cb12b76..2dec80f 100644
--- a/include/libcss/select.h
+++ b/include/libcss/select.h
@@ -12,23 +12,12 @@
#include <libcss/functypes.h>
#include <libcss/types.h>
-enum css_pseudo_class {
- CSS_PSEUDO_CLASS_LINK = (1<<0),
- CSS_PSEUDO_CLASS_VISITED = (1<<1),
- CSS_PSEUDO_CLASS_HOVER = (1<<2),
- CSS_PSEUDO_CLASS_ACTIVE = (1<<3),
- CSS_PSEUDO_CLASS_FOCUS = (1<<4),
- /** \todo CSS_PSEUDO_CLASS_LANG = (1<<5), */
- CSS_PSEUDO_CLASS_LEFT = (1<<6),
- CSS_PSEUDO_CLASS_RIGHT = (1<<7),
- CSS_PSEUDO_CLASS_FIRST = (1<<8)
-};
-
enum css_pseudo_element {
- CSS_PSEUDO_ELEMENT_FIRST_LINE = (1<<0),
- CSS_PSEUDO_ELEMENT_FIRST_LETTER = (1<<1),
- CSS_PSEUDO_ELEMENT_BEFORE = (1<<2),
- CSS_PSEUDO_ELEMENT_AFTER = (1<<3)
+ 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
};
typedef struct css_select_handler {
@@ -71,6 +60,14 @@ typedef struct css_select_handler {
bool *match);
css_error (*node_is_first_child)(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_lang)(void *pw, void *node,
+ const uint8_t *lang, size_t len,
+ bool *match);
} css_select_handler;
css_error css_select_ctx_create(css_alloc alloc, void *pw,
@@ -89,8 +86,8 @@ 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 pseudo_element, uint64_t pseudo_classes,
- uint64_t media, css_computed_style *result,
+ uint32_t pseudo_element, uint64_t media,
+ css_computed_style *result,
css_select_handler *handler, void *pw);
#endif