OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 if (!media) | 94 if (!media) |
95 return false; | 95 return false; |
96 | 96 |
97 OwnPtr<MediaQueryEvaluator> evaluator(prepareEvaluator()); | 97 OwnPtr<MediaQueryEvaluator> evaluator(prepareEvaluator()); |
98 return evaluator && evaluator->eval(media); | 98 return evaluator && evaluator->eval(media); |
99 } | 99 } |
100 | 100 |
101 PassRefPtr<MediaQueryList> MediaQueryMatcher::matchMedia(const String& query) | 101 PassRefPtr<MediaQueryList> MediaQueryMatcher::matchMedia(const String& query) |
102 { | 102 { |
103 if (!m_document) | 103 if (!m_document) |
104 return 0; | 104 return nullptr; |
105 | 105 |
106 RefPtr<MediaQuerySet> media = MediaQuerySet::create(query); | 106 RefPtr<MediaQuerySet> media = MediaQuerySet::create(query); |
107 // Add warning message to inspector whenever dpi/dpcm values are used for "s
creen" media. | 107 // Add warning message to inspector whenever dpi/dpcm values are used for "s
creen" media. |
108 reportMediaQueryWarningIfNeeded(m_document, media.get()); | 108 reportMediaQueryWarningIfNeeded(m_document, media.get()); |
109 return MediaQueryList::create(this, media, evaluate(media.get())); | 109 return MediaQueryList::create(this, media, evaluate(media.get())); |
110 } | 110 } |
111 | 111 |
112 void MediaQueryMatcher::addListener(PassRefPtr<MediaQueryListListener> listener,
PassRefPtr<MediaQueryList> query) | 112 void MediaQueryMatcher::addListener(PassRefPtr<MediaQueryListListener> listener,
PassRefPtr<MediaQueryList> query) |
113 { | 113 { |
114 if (!m_document) | 114 if (!m_document) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 ++m_evaluationRound; | 147 ++m_evaluationRound; |
148 OwnPtr<MediaQueryEvaluator> evaluator = prepareEvaluator(); | 148 OwnPtr<MediaQueryEvaluator> evaluator = prepareEvaluator(); |
149 if (!evaluator) | 149 if (!evaluator) |
150 return; | 150 return; |
151 | 151 |
152 for (size_t i = 0; i < m_listeners.size(); ++i) | 152 for (size_t i = 0; i < m_listeners.size(); ++i) |
153 m_listeners[i]->evaluate(scriptState, evaluator.get()); | 153 m_listeners[i]->evaluate(scriptState, evaluator.get()); |
154 } | 154 } |
155 | 155 |
156 } | 156 } |
OLD | NEW |