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

Side by Side Diff: Source/core/css/CSSStyleSheet.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 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 200
201 didMutate(); 201 didMutate();
202 } 202 }
203 203
204 void CSSStyleSheet::setMediaQueries(PassRefPtr<MediaQuerySet> mediaQueries) 204 void CSSStyleSheet::setMediaQueries(PassRefPtr<MediaQuerySet> mediaQueries)
205 { 205 {
206 m_mediaQueries = mediaQueries; 206 m_mediaQueries = mediaQueries;
207 if (m_mediaCSSOMWrapper && m_mediaQueries) 207 if (m_mediaCSSOMWrapper && m_mediaQueries)
208 m_mediaCSSOMWrapper->reattach(m_mediaQueries.get()); 208 m_mediaCSSOMWrapper->reattach(m_mediaQueries.get());
209 209
210 #if ENABLE(RESOLUTION_MEDIA_QUERY)
211 // Add warning message to inspector whenever dpi/dpcm values are used for "s creen" media. 210 // Add warning message to inspector whenever dpi/dpcm values are used for "s creen" media.
212 reportMediaQueryWarningIfNeeded(ownerDocument(), m_mediaQueries.get()); 211 reportMediaQueryWarningIfNeeded(ownerDocument(), m_mediaQueries.get());
213 #endif
214 } 212 }
215 213
216 unsigned CSSStyleSheet::length() const 214 unsigned CSSStyleSheet::length() const
217 { 215 {
218 return m_contents->ruleCount(); 216 return m_contents->ruleCount();
219 } 217 }
220 218
221 CSSRule* CSSStyleSheet::item(unsigned index) 219 CSSRule* CSSStyleSheet::item(unsigned index)
222 { 220 {
223 unsigned ruleCount = length(); 221 unsigned ruleCount = length();
224 if (index >= ruleCount) 222 if (index >= ruleCount)
225 return 0; 223 return 0;
226 224
227 if (m_childRuleCSSOMWrappers.isEmpty()) 225 if (m_childRuleCSSOMWrappers.isEmpty())
228 m_childRuleCSSOMWrappers.grow(ruleCount); 226 m_childRuleCSSOMWrappers.grow(ruleCount);
229 ASSERT(m_childRuleCSSOMWrappers.size() == ruleCount); 227 ASSERT(m_childRuleCSSOMWrappers.size() == ruleCount);
230 228
231 RefPtr<CSSRule>& cssRule = m_childRuleCSSOMWrappers[index]; 229 RefPtr<CSSRule>& cssRule = m_childRuleCSSOMWrappers[index];
232 if (!cssRule) { 230 if (!cssRule) {
233 if (index == 0 && m_contents->hasCharsetRule()) { 231 if (index == 0 && m_contents->hasCharsetRule()) {
234 ASSERT(!m_contents->ruleAt(0)); 232 ASSERT(!m_contents->ruleAt(0));
235 cssRule = CSSCharsetRule::create(this, m_contents->encodingFromChars etRule()); 233 cssRule = CSSCharsetRule::create(this, m_contents->encodingFromChars etRule());
236 } else 234 } else
237 cssRule = m_contents->ruleAt(index)->createCSSOMWrapper(this); 235 cssRule = m_contents->ruleAt(index)->createCSSOMWrapper(this);
238 } 236 }
239 return cssRule.get(); 237 return cssRule.get();
240 } 238 }
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 root = root->parentStyleSheet(); 384 root = root->parentStyleSheet();
387 return root->ownerNode() ? root->ownerNode()->document() : 0; 385 return root->ownerNode() ? root->ownerNode()->document() : 0;
388 } 386 }
389 387
390 void CSSStyleSheet::clearChildRuleCSSOMWrappers() 388 void CSSStyleSheet::clearChildRuleCSSOMWrappers()
391 { 389 {
392 m_childRuleCSSOMWrappers.clear(); 390 m_childRuleCSSOMWrappers.clear();
393 } 391 }
394 392
395 } 393 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698