9#ifndef css_select_mq_h_
10#define css_select_mq_h_
16static inline bool mq_match_feature_range_length_op1(
24 if (value->
type != CSS_MQ_VALUE_TYPE_DIM) {
48static inline bool mq_match_feature_range_length_op2(
59 if (value->
type != CSS_MQ_VALUE_TYPE_DIM) {
82static inline bool mq_match_feature_eq_ident_op1(
89 if (value->
type != CSS_MQ_VALUE_TYPE_IDENT) {
115static inline bool mq_match_feature(
127 if (!mq_match_feature_range_length_op1(feat->
op, &feat->
value,
128 media->
width, unit_ctx)) {
131 return mq_match_feature_range_length_op2(feat->
op2,
137 if (!mq_match_feature_range_length_op1(feat->
op, &feat->
value,
138 media->
height, unit_ctx)) {
142 return mq_match_feature_range_length_op2(feat->
op2,
148 if (mq_match_feature_eq_ident_op1(feat->
op, &feat->
value,
170static inline bool mq_match_condition(
176 bool matched = !cond->
op;
180 if (cond->
parts[i]->
type == CSS_MQ_FEATURE) {
181 part_matched = mq_match_feature(
183 unit_ctx, media, str);
186 part_matched = mq_match_condition(
188 unit_ctx, media, str);
193 matched |= part_matched;
199 matched &= part_matched;
206 return matched != cond->
negate;
220static inline bool mq__list_match(
230 mq_match_condition(m->
cond,
231 unit_ctx, media, str)) {
249static inline bool mq_rule_good_for_media(
258 while (ancestor !=
NULL) {
262 applies = mq__list_match(m->
media,
263 unit_ctx, media, str);
264 if (applies ==
false) {
270 ancestor = ancestor->
parent;
#define assert(expr)
Definition assert.h:32
unsigned int uint32_t
Definition acefiex.h:163
#define NULL
Definition actypes.h:561
@ UNIT_PX
Definition bytecode.h:40
int32_t css_fixed
Definition fpmath.h:23
#define lwc_string_isequal(str1, str2, ret)
Definition libwapcaplet.h:186
@ lwc_error_ok
Definition libwapcaplet.h:62
css_mq_feature_op
Definition mq.h:38
@ CSS_MQ_FEATURE_OP_EQ
Definition mq.h:44
@ CSS_MQ_FEATURE_OP_GTE
Definition mq.h:45
@ CSS_MQ_FEATURE_OP_BOOL
Definition mq.h:39
@ CSS_MQ_FEATURE_OP_UNUSED
Definition mq.h:40
@ CSS_MQ_FEATURE_OP_LT
Definition mq.h:42
@ CSS_MQ_FEATURE_OP_GT
Definition mq.h:46
@ CSS_MQ_FEATURE_OP_LTE
Definition mq.h:43
@ CSS_RULE_MEDIA
Definition stylesheet.h:103
@ CSS_RULE_PARENT_STYLESHEET
Definition stylesheet.h:109
enum css_mq_cond_or_feature::@846 type
css_mq_feature * feat
Definition mq.h:73
css_mq_cond * cond
Definition mq.h:72
union css_mq_cond_or_feature::@847 data
css_mq_cond_or_feature ** parts
Definition mq.h:63
uint32_t op
Definition mq.h:61
uint32_t negate
Definition mq.h:60
uint32_t nparts
Definition mq.h:62
css_mq_value value2
Definition mq.h:54
css_mq_feature_op op2
Definition mq.h:52
css_mq_feature_op op
Definition mq.h:51
lwc_string * name
Definition mq.h:50
css_mq_value value
Definition mq.h:53
uint64_t type
Definition mq.h:81
struct css_mq_query * next
Definition mq.h:78
css_mq_cond * cond
Definition mq.h:83
uint32_t negate_type
Definition mq.h:80
uint32_t unit
Definition mq.h:25
lwc_string * ident
Definition mq.h:27
struct css_mq_value::@844::@845 dim
union css_mq_value::@844 data
css_fixed len
Definition mq.h:24
enum css_mq_value::@843 type
Definition stylesheet.h:113
uint8_t ptype
Definition stylesheet.h:123
void * parent
Definition stylesheet.h:114
uint8_t type
Definition stylesheet.h:122
lwc_string * height
Definition strings.h:44
lwc_string * width
Definition strings.h:43
lwc_string * prefers_color_scheme
Definition strings.h:45
Definition libwapcaplet.h:41
css_fixed css_unit_len2px_mq(const css_unit_ctx *ctx, const css_fixed length, const css_unit unit)
Definition unit.c:281