| 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, 2010, 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2006, 2010, 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 11 matching lines...) Expand all Loading... |
| 22 #include "bindings/core/v8/ExceptionState.h" | 22 #include "bindings/core/v8/ExceptionState.h" |
| 23 #include "core/css/CSSStyleSheet.h" | 23 #include "core/css/CSSStyleSheet.h" |
| 24 #include "core/css/MediaQuery.h" | 24 #include "core/css/MediaQuery.h" |
| 25 #include "core/css/MediaQueryExp.h" | 25 #include "core/css/MediaQueryExp.h" |
| 26 #include "core/css/parser/MediaQueryParser.h" | 26 #include "core/css/parser/MediaQueryParser.h" |
| 27 #include "wtf/text/StringBuilder.h" | 27 #include "wtf/text/StringBuilder.h" |
| 28 #include <memory> | 28 #include <memory> |
| 29 | 29 |
| 30 namespace blink { | 30 namespace blink { |
| 31 | 31 |
| 32 /* MediaList is used to store 3 types of media related entities which mean the s
ame: | 32 /* MediaList is used to store 3 types of media related entities which mean the |
| 33 * same: |
| 33 * | 34 * |
| 34 * Media Queries, Media Types and Media Descriptors. | 35 * Media Queries, Media Types and Media Descriptors. |
| 35 * | 36 * |
| 36 * Media queries, as described in the Media Queries Level 3 specification, build
on | 37 * Media queries, as described in the Media Queries Level 3 specification, build |
| 37 * the mechanism outlined in HTML4. The syntax of media queries fit into the med
ia | 38 * on the mechanism outlined in HTML4. The syntax of media queries fit into the |
| 38 * type syntax reserved in HTML4. The media attribute of HTML4 also exists in XH
TML | 39 * media type syntax reserved in HTML4. The media attribute of HTML4 also exists |
| 39 * and generic XML. The same syntax can also be used inside the @media and @impo
rt | 40 * in XHTML and generic XML. The same syntax can also be used inside the @media |
| 40 * rules of CSS. | 41 * and @import rules of CSS. |
| 41 * | 42 * |
| 42 * However, the parsing rules for media queries are incompatible with those of H
TML4 | 43 * However, the parsing rules for media queries are incompatible with those of |
| 43 * and are consistent with those of media queries used in CSS. | 44 * HTML4 and are consistent with those of media queries used in CSS. |
| 44 * | 45 * |
| 45 * HTML5 (at the moment of writing still work in progress) references the Media
Queries | 46 * HTML5 (at the moment of writing still work in progress) references the Media |
| 46 * specification directly and thus updates the rules for HTML. | 47 * Queries specification directly and thus updates the rules for HTML. |
| 47 * | 48 * |
| 48 * CSS 2.1 Spec (http://www.w3.org/TR/CSS21/media.html) | 49 * CSS 2.1 Spec (http://www.w3.org/TR/CSS21/media.html) |
| 49 * CSS 3 Media Queries Spec (http://www.w3.org/TR/css3-mediaqueries/) | 50 * CSS 3 Media Queries Spec (http://www.w3.org/TR/css3-mediaqueries/) |
| 50 */ | 51 */ |
| 51 | 52 |
| 52 MediaQuerySet::MediaQuerySet() {} | 53 MediaQuerySet::MediaQuerySet() {} |
| 53 | 54 |
| 54 MediaQuerySet::MediaQuerySet(const MediaQuerySet& o) | 55 MediaQuerySet::MediaQuerySet(const MediaQuerySet& o) |
| 55 : m_queries(o.m_queries.size()) { | 56 : m_queries(o.m_queries.size()) { |
| 56 for (unsigned i = 0; i < m_queries.size(); ++i) | 57 for (unsigned i = 0; i < m_queries.size(); ++i) |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 if (!first) | 143 if (!first) |
| 143 text.append(", "); | 144 text.append(", "); |
| 144 else | 145 else |
| 145 first = false; | 146 first = false; |
| 146 text.append(m_queries[i]->cssText()); | 147 text.append(m_queries[i]->cssText()); |
| 147 } | 148 } |
| 148 return text.toString(); | 149 return text.toString(); |
| 149 } | 150 } |
| 150 | 151 |
| 151 DEFINE_TRACE(MediaQuerySet) { | 152 DEFINE_TRACE(MediaQuerySet) { |
| 152 // We don't support tracing of vectors of OwnPtrs (ie. std::unique_ptr<Vector<
std::unique_ptr<MediaQuery>>>). | 153 // We don't support tracing of vectors of OwnPtrs (ie. |
| 153 // Since this is a transitional object we are just ifdef'ing it out when oilpa
n is not enabled. | 154 // std::unique_ptr<Vector<std::unique_ptr<MediaQuery>>>). |
| 155 // Since this is a transitional object we are just ifdef'ing it out when |
| 156 // oilpan is not enabled. |
| 154 visitor->trace(m_queries); | 157 visitor->trace(m_queries); |
| 155 } | 158 } |
| 156 | 159 |
| 157 MediaList::MediaList(MediaQuerySet* mediaQueries, CSSStyleSheet* parentSheet) | 160 MediaList::MediaList(MediaQuerySet* mediaQueries, CSSStyleSheet* parentSheet) |
| 158 : m_mediaQueries(mediaQueries), | 161 : m_mediaQueries(mediaQueries), |
| 159 m_parentStyleSheet(parentSheet), | 162 m_parentStyleSheet(parentSheet), |
| 160 m_parentRule(nullptr) {} | 163 m_parentRule(nullptr) {} |
| 161 | 164 |
| 162 MediaList::MediaList(MediaQuerySet* mediaQueries, CSSRule* parentRule) | 165 MediaList::MediaList(MediaQuerySet* mediaQueries, CSSRule* parentRule) |
| 163 : m_mediaQueries(mediaQueries), | 166 : m_mediaQueries(mediaQueries), |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 m_mediaQueries = mediaQueries; | 218 m_mediaQueries = mediaQueries; |
| 216 } | 219 } |
| 217 | 220 |
| 218 DEFINE_TRACE(MediaList) { | 221 DEFINE_TRACE(MediaList) { |
| 219 visitor->trace(m_mediaQueries); | 222 visitor->trace(m_mediaQueries); |
| 220 visitor->trace(m_parentStyleSheet); | 223 visitor->trace(m_parentStyleSheet); |
| 221 visitor->trace(m_parentRule); | 224 visitor->trace(m_parentRule); |
| 222 } | 225 } |
| 223 | 226 |
| 224 } // namespace blink | 227 } // namespace blink |
| OLD | NEW |