From b740ed09f1f1a9319a6ffa1d99d0dc8849f75173 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sat, 14 Feb 2009 09:35:32 +0000 Subject: 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 --- include/libcss/select.h | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'include/libcss/select.h') 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 #include -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 -- cgit v1.2.3