| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // CSS3 Module "Media Queries" (http://www.w3.org/TR/css3-mediaqueries/) | 46 // CSS3 Module "Media Queries" (http://www.w3.org/TR/css3-mediaqueries/) |
| 47 // Special constructors are needed, if simple media queries are to be | 47 // Special constructors are needed, if simple media queries are to be |
| 48 // evaluated without knowledge of the medium features. This can happen | 48 // evaluated without knowledge of the medium features. This can happen |
| 49 // for example when parsing UA stylesheets, if evaluation is done | 49 // for example when parsing UA stylesheets, if evaluation is done |
| 50 // right after parsing. | 50 // right after parsing. |
| 51 // | 51 // |
| 52 // the boolean parameter is used to approximate results of evaluation, if | 52 // the boolean parameter is used to approximate results of evaluation, if |
| 53 // the device characteristics are not known. This can be used to prune the loadi
ng | 53 // the device characteristics are not known. This can be used to prune the loadi
ng |
| 54 // of stylesheets to only those which are probable to match. | 54 // of stylesheets to only those which are probable to match. |
| 55 | 55 |
| 56 class CORE_EXPORT MediaQueryEvaluator { | 56 class CORE_EXPORT MediaQueryEvaluator final : public NoBaseWillBeGarbageCollecte
dFinalized<MediaQueryEvaluator> { |
| 57 WTF_MAKE_NONCOPYABLE(MediaQueryEvaluator); USING_FAST_MALLOC(MediaQueryEvalu
ator); | 57 WTF_MAKE_NONCOPYABLE(MediaQueryEvaluator); |
| 58 USING_FAST_MALLOC_WILL_BE_REMOVED(MediaQueryEvaluator); |
| 58 public: | 59 public: |
| 59 // Creates evaluator which evaluates only simple media queries | 60 // Creates evaluator which evaluates only simple media queries |
| 60 // Evaluator returns true for "all", and returns value of \mediaFeatureResul
t | 61 // Evaluator returns true for "all", and returns value of \mediaFeatureResul
t |
| 61 // for any media features. | 62 // for any media features. |
| 62 | 63 |
| 63 explicit MediaQueryEvaluator(bool mediaFeatureResult = false); | 64 explicit MediaQueryEvaluator(bool mediaFeatureResult = false); |
| 64 | 65 |
| 65 // Creates evaluator which evaluates only simple media queries | 66 // Creates evaluator which evaluates only simple media queries |
| 66 // Evaluator returns true for acceptedMediaType and returns value of \media
featureResult | 67 // Evaluator returns true for acceptedMediaType and returns value of \media
featureResult |
| 67 // for any media features. | 68 // for any media features. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 80 | 81 |
| 81 // Evaluates a list of media queries. | 82 // Evaluates a list of media queries. |
| 82 bool eval(const MediaQuerySet*, MediaQueryResultList* = 0) const; | 83 bool eval(const MediaQuerySet*, MediaQueryResultList* = 0) const; |
| 83 | 84 |
| 84 // Evaluates media query. | 85 // Evaluates media query. |
| 85 bool eval(const MediaQuery*, MediaQueryResultList*) const; | 86 bool eval(const MediaQuery*, MediaQueryResultList*) const; |
| 86 | 87 |
| 87 // Evaluates media query subexpression, ie "and (media-feature: value)" part
. | 88 // Evaluates media query subexpression, ie "and (media-feature: value)" part
. |
| 88 bool eval(const MediaQueryExp*) const; | 89 bool eval(const MediaQueryExp*) const; |
| 89 | 90 |
| 91 DECLARE_TRACE(); |
| 92 |
| 90 private: | 93 private: |
| 91 const String mediaType() const; | 94 const String mediaType() const; |
| 92 | 95 |
| 93 String m_mediaType; | 96 String m_mediaType; |
| 94 bool m_expectedResult; | 97 bool m_expectedResult; |
| 95 RefPtrWillBePersistent<MediaValues> m_mediaValues; | 98 RefPtrWillBeMember<MediaValues> m_mediaValues; |
| 96 }; | 99 }; |
| 97 | 100 |
| 98 } // namespace | 101 } // namespace |
| 99 #endif | 102 #endif |
| OLD | NEW |