OLD | NEW |
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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 190 |
191 didMutate(); | 191 didMutate(); |
192 } | 192 } |
193 | 193 |
194 void CSSStyleSheet::setMediaQueries(MediaQuerySet* mediaQueries) { | 194 void CSSStyleSheet::setMediaQueries(MediaQuerySet* mediaQueries) { |
195 m_mediaQueries = mediaQueries; | 195 m_mediaQueries = mediaQueries; |
196 if (m_mediaCSSOMWrapper && m_mediaQueries) | 196 if (m_mediaCSSOMWrapper && m_mediaQueries) |
197 m_mediaCSSOMWrapper->reattach(m_mediaQueries.get()); | 197 m_mediaCSSOMWrapper->reattach(m_mediaQueries.get()); |
198 } | 198 } |
199 | 199 |
| 200 bool CSSStyleSheet::matchesMediaQueries(const MediaQueryEvaluator& evaluator) { |
| 201 m_viewportDependentMediaQueryResults.clear(); |
| 202 m_deviceDependentMediaQueryResults.clear(); |
| 203 |
| 204 if (!m_mediaQueries) |
| 205 return true; |
| 206 return evaluator.eval(m_mediaQueries, &m_viewportDependentMediaQueryResults, |
| 207 &m_deviceDependentMediaQueryResults); |
| 208 } |
| 209 |
200 unsigned CSSStyleSheet::length() const { | 210 unsigned CSSStyleSheet::length() const { |
201 return m_contents->ruleCount(); | 211 return m_contents->ruleCount(); |
202 } | 212 } |
203 | 213 |
204 CSSRule* CSSStyleSheet::item(unsigned index) { | 214 CSSRule* CSSStyleSheet::item(unsigned index) { |
205 unsigned ruleCount = length(); | 215 unsigned ruleCount = length(); |
206 if (index >= ruleCount) | 216 if (index >= ruleCount) |
207 return nullptr; | 217 return nullptr; |
208 | 218 |
209 if (m_childRuleCSSOMWrappers.isEmpty()) | 219 if (m_childRuleCSSOMWrappers.isEmpty()) |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 m_childRuleCSSOMWrappers.clear(); | 427 m_childRuleCSSOMWrappers.clear(); |
418 | 428 |
419 CSSStyleSheet::RuleMutationScope mutationScope(this); | 429 CSSStyleSheet::RuleMutationScope mutationScope(this); |
420 m_contents->clearRules(); | 430 m_contents->clearRules(); |
421 m_contents->parseString(text); | 431 m_contents->parseString(text); |
422 } | 432 } |
423 | 433 |
424 DEFINE_TRACE(CSSStyleSheet) { | 434 DEFINE_TRACE(CSSStyleSheet) { |
425 visitor->trace(m_contents); | 435 visitor->trace(m_contents); |
426 visitor->trace(m_mediaQueries); | 436 visitor->trace(m_mediaQueries); |
| 437 visitor->trace(m_viewportDependentMediaQueryResults); |
| 438 visitor->trace(m_deviceDependentMediaQueryResults); |
427 visitor->trace(m_ownerNode); | 439 visitor->trace(m_ownerNode); |
428 visitor->trace(m_ownerRule); | 440 visitor->trace(m_ownerRule); |
429 visitor->trace(m_mediaCSSOMWrapper); | 441 visitor->trace(m_mediaCSSOMWrapper); |
430 visitor->trace(m_childRuleCSSOMWrappers); | 442 visitor->trace(m_childRuleCSSOMWrappers); |
431 visitor->trace(m_ruleListCSSOMWrapper); | 443 visitor->trace(m_ruleListCSSOMWrapper); |
432 StyleSheet::trace(visitor); | 444 StyleSheet::trace(visitor); |
433 } | 445 } |
434 | 446 |
435 } // namespace blink | 447 } // namespace blink |
OLD | NEW |