diff options
author | Michael Drake <michael.drake@codethink.co.uk> | 2019-05-04 14:10:41 +0100 |
---|---|---|
committer | Michael Drake <michael.drake@codethink.co.uk> | 2019-05-04 14:10:41 +0100 |
commit | 5d1a706bfc5d25ea0fc2060772e44222ea711df5 (patch) | |
tree | 548af2617882f5be239ea188d1c964245cfc06b3 /src/select/mq.h | |
parent | d6126aa77eb442f446d28b6dfb15a884f209a341 (diff) | |
download | libcss-5d1a706bfc5d25ea0fc2060772e44222ea711df5.tar.gz libcss-5d1a706bfc5d25ea0fc2060772e44222ea711df5.tar.bz2 |
Media queries: Update selection API to support media queries.
The API changes are:
1. When building a selection context, stylesheets added with
`css_select_ctx_{append|insert}_sheet()` now have to have
media strings associcated with them. Previously they took
a simple bitfield for CSS media type.
2. When selecting for an element, the client needs to specify
the current media requirements. Previously it only had to
provide the bitfield for CSS media type.
3. Same for the css_select_font_faces API.
The selection handling has been updated to handle the new
API, however it is currently only looking at the media type
when performing selection.
Signed-off-by: Michael Drake <michael.drake@codethink.co.uk>
Diffstat (limited to 'src/select/mq.h')
-rw-r--r-- | src/select/mq.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/select/mq.h b/src/select/mq.h index 4fe67b0..290505c 100644 --- a/src/select/mq.h +++ b/src/select/mq.h @@ -32,11 +32,11 @@ static inline bool mq_match_condition(css_mq_cond *cond) * \meaid media Current media spec, to check against m. * \return true if media query list matches media */ -static inline bool mq__list_match(const css_mq_query *m, uint64_t media) +static inline bool mq__list_match(const css_mq_query *m, const css_media *media) { for (; m != NULL; m = m->next) { /* Check type */ - if (!!(m->type & media) != m->negate_type) { + if (!!(m->type & media->type) != m->negate_type) { if (mq_match_condition(m->cond)) { /* We have a match, no need to look further. */ return true; @@ -54,7 +54,7 @@ static inline bool mq__list_match(const css_mq_query *m, uint64_t media) * \param media Current media type(s) * \return true iff chain's rule applies for media */ -static inline bool mq_rule_good_for_media(const css_rule *rule, uint64_t media) +static inline bool mq_rule_good_for_media(const css_rule *rule, const css_media *media) { bool applies = true; const css_rule *ancestor = rule; |