Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(777)

Side by Side Diff: Source/core/css/MediaQueryMatcher.cpp

Issue 14408004: Fix incorrect evaluation of resolution media queries (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 OwnPtr<MediaQueryEvaluator> evaluator(prepareEvaluator()); 101 OwnPtr<MediaQueryEvaluator> evaluator(prepareEvaluator());
102 return evaluator && evaluator->eval(media); 102 return evaluator && evaluator->eval(media);
103 } 103 }
104 104
105 PassRefPtr<MediaQueryList> MediaQueryMatcher::matchMedia(const String& query) 105 PassRefPtr<MediaQueryList> MediaQueryMatcher::matchMedia(const String& query)
106 { 106 {
107 if (!m_document) 107 if (!m_document)
108 return 0; 108 return 0;
109 109
110 RefPtr<MediaQuerySet> media = MediaQuerySet::create(query); 110 RefPtr<MediaQuerySet> media = MediaQuerySet::create(query);
111 #if ENABLE(RESOLUTION_MEDIA_QUERY)
112 // Add warning message to inspector whenever dpi/dpcm values are used for "s creen" media. 111 // Add warning message to inspector whenever dpi/dpcm values are used for "s creen" media.
113 reportMediaQueryWarningIfNeeded(m_document, media.get()); 112 reportMediaQueryWarningIfNeeded(m_document, media.get());
114 #endif
115 return MediaQueryList::create(this, media, evaluate(media.get())); 113 return MediaQueryList::create(this, media, evaluate(media.get()));
116 } 114 }
117 115
118 void MediaQueryMatcher::addListener(PassRefPtr<MediaQueryListListener> listener, PassRefPtr<MediaQueryList> query) 116 void MediaQueryMatcher::addListener(PassRefPtr<MediaQueryListListener> listener, PassRefPtr<MediaQueryList> query)
119 { 117 {
120 if (!m_document) 118 if (!m_document)
121 return; 119 return;
122 120
123 for (size_t i = 0; i < m_listeners.size(); ++i) { 121 for (size_t i = 0; i < m_listeners.size(); ++i) {
124 if (*m_listeners[i]->listener() == *listener && m_listeners[i]->query() == query) 122 if (*m_listeners[i]->listener() == *listener && m_listeners[i]->query() == query)
(...skipping 27 matching lines...) Expand all
152 ++m_evaluationRound; 150 ++m_evaluationRound;
153 OwnPtr<MediaQueryEvaluator> evaluator = prepareEvaluator(); 151 OwnPtr<MediaQueryEvaluator> evaluator = prepareEvaluator();
154 if (!evaluator) 152 if (!evaluator)
155 return; 153 return;
156 154
157 for (size_t i = 0; i < m_listeners.size(); ++i) 155 for (size_t i = 0; i < m_listeners.size(); ++i)
158 m_listeners[i]->evaluate(scriptState, evaluator.get()); 156 m_listeners[i]->evaluate(scriptState, evaluator.get());
159 } 157 }
160 158
161 } 159 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698