OLD | NEW |
1 /* | 1 /* |
2 * CSS Media Query Evaluator | 2 * CSS Media Query Evaluator |
3 * | 3 * |
4 * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>. | 4 * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 /** Creates evaluator which evaluates only simple media queries | 58 /** Creates evaluator which evaluates only simple media queries |
59 * Evaluator returns true for "all", and returns value of \mediaFeatureResu
lt | 59 * Evaluator returns true for "all", and returns value of \mediaFeatureResu
lt |
60 * for any media features | 60 * for any media features |
61 */ | 61 */ |
62 explicit MediaQueryEvaluator(bool mediaFeatureResult = false); | 62 explicit MediaQueryEvaluator(bool mediaFeatureResult = false); |
63 | 63 |
64 /** Creates evaluator which evaluates only simple media queries | 64 /** Creates evaluator which evaluates only simple media queries |
65 * Evaluator returns true for acceptedMediaType and returns value of \medi
afeatureResult | 65 * Evaluator returns true for acceptedMediaType and returns value of \medi
afeatureResult |
66 * for any media features | 66 * for any media features |
67 */ | 67 */ |
68 MediaQueryEvaluator(const AtomicString& acceptedMediaType, bool mediaFeature
Result = false); | 68 MediaQueryEvaluator(const String& acceptedMediaType, bool mediaFeatureResult
= false); |
69 MediaQueryEvaluator(const char* acceptedMediaType, bool mediaFeatureResult =
false); | 69 MediaQueryEvaluator(const char* acceptedMediaType, bool mediaFeatureResult =
false); |
70 | 70 |
71 /** Creates evaluator which evaluates full media queries */ | 71 /** Creates evaluator which evaluates full media queries */ |
72 MediaQueryEvaluator(const AtomicString& acceptedMediaType, LocalFrame*, Rend
erStyle*); | 72 MediaQueryEvaluator(const String& acceptedMediaType, LocalFrame*, RenderStyl
e*); |
73 | 73 |
74 ~MediaQueryEvaluator(); | 74 ~MediaQueryEvaluator(); |
75 | 75 |
76 bool mediaTypeMatch(const AtomicString& mediaTypeToMatch) const; | 76 bool mediaTypeMatch(const String& mediaTypeToMatch) const; |
77 bool mediaTypeMatchSpecific(const char* mediaTypeToMatch) const; | 77 bool mediaTypeMatchSpecific(const char* mediaTypeToMatch) const; |
78 | 78 |
79 /** Evaluates a list of media queries */ | 79 /** Evaluates a list of media queries */ |
80 bool eval(const MediaQuerySet*, MediaQueryResultList* = 0) const; | 80 bool eval(const MediaQuerySet*, MediaQueryResultList* = 0) const; |
81 | 81 |
82 /** Evaluates media query subexpression, ie "and (media-feature: value)" par
t */ | 82 /** Evaluates media query subexpression, ie "and (media-feature: value)" par
t */ |
83 bool eval(const MediaQueryExp*) const; | 83 bool eval(const MediaQueryExp*) const; |
84 | 84 |
85 private: | 85 private: |
86 AtomicString m_mediaType; | 86 String m_mediaType; |
87 LocalFrame* m_frame; // Not owned. | 87 LocalFrame* m_frame; // Not owned. |
88 RefPtr<RenderStyle> m_style; | 88 RefPtr<RenderStyle> m_style; |
89 bool m_expResult; | 89 bool m_expResult; |
90 }; | 90 }; |
91 | 91 |
92 } // namespace | 92 } // namespace |
93 #endif | 93 #endif |
OLD | NEW |