Update LiteHTML sources
[claws.git] / src / plugins / litehtml_viewer / litehtml / media_query.h
blob4cb21fc2f680f8edf31a2b219f42a6d404cd15c0
1 #ifndef LH_MEDIA_QUERY_H
2 #define LH_MEDIA_QUERY_H
4 namespace litehtml
6 struct media_query_expression
8 typedef std::vector<media_query_expression> vector;
9 media_feature feature;
10 int val;
11 int val2;
12 bool check_as_bool;
14 media_query_expression()
16 check_as_bool = false;
17 feature = media_feature_none;
18 val = 0;
19 val2 = 0;
22 bool check(const media_features& features) const;
25 class media_query
27 public:
28 typedef std::shared_ptr<media_query> ptr;
29 typedef std::vector<media_query::ptr> vector;
30 private:
31 media_query_expression::vector m_expressions;
32 bool m_not;
33 media_type m_media_type;
34 public:
35 media_query();
36 media_query(const media_query& val);
38 static media_query::ptr create_from_string(const string& str, const std::shared_ptr<document>& doc);
39 bool check(const media_features& features) const;
42 class media_query_list
44 public:
45 typedef std::shared_ptr<media_query_list> ptr;
46 typedef std::vector<media_query_list::ptr> vector;
47 private:
48 media_query::vector m_queries;
49 bool m_is_used;
50 public:
51 media_query_list();
52 media_query_list(const media_query_list& val);
54 static media_query_list::ptr create_from_string(const string& str, const std::shared_ptr<document>& doc);
55 bool is_used() const;
56 bool apply_media_features(const media_features& features); // returns true if the m_is_used changed
59 inline media_query_list::media_query_list(const media_query_list& val)
61 m_is_used = val.m_is_used;
62 m_queries = val.m_queries;
65 inline media_query_list::media_query_list()
67 m_is_used = false;
70 inline bool media_query_list::is_used() const
72 return m_is_used;
77 #endif // LH_MEDIA_QUERY_H