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 13 matching lines...) Expand all Loading... |
24 #include "CSSParser.h" | 24 #include "CSSParser.h" |
25 #include "CSSStyleSheet.h" | 25 #include "CSSStyleSheet.h" |
26 #include "Console.h" | 26 #include "Console.h" |
27 #include "DOMWindow.h" | 27 #include "DOMWindow.h" |
28 #include "Document.h" | 28 #include "Document.h" |
29 #include "ExceptionCode.h" | 29 #include "ExceptionCode.h" |
30 #include "MediaFeatureNames.h" | 30 #include "MediaFeatureNames.h" |
31 #include "MediaQuery.h" | 31 #include "MediaQuery.h" |
32 #include "MediaQueryExp.h" | 32 #include "MediaQueryExp.h" |
33 #include "ScriptableDocumentParser.h" | 33 #include "ScriptableDocumentParser.h" |
34 #include "WebCoreMemoryInstrumentation.h" | |
35 #include <wtf/MemoryInstrumentationVector.h> | |
36 #include <wtf/text/StringBuilder.h> | 34 #include <wtf/text/StringBuilder.h> |
37 | 35 |
38 namespace WebCore { | 36 namespace WebCore { |
39 | 37 |
40 /* MediaList is used to store 3 types of media related entities which mean the s
ame: | 38 /* MediaList is used to store 3 types of media related entities which mean the s
ame: |
41 * Media Queries, Media Types and Media Descriptors. | 39 * Media Queries, Media Types and Media Descriptors. |
42 * Currently MediaList always tries to parse media queries and if parsing fails, | 40 * Currently MediaList always tries to parse media queries and if parsing fails, |
43 * tries to fallback to Media Descriptors if m_fallbackToDescriptor flag is set. | 41 * tries to fallback to Media Descriptors if m_fallbackToDescriptor flag is set. |
44 * Slight problem with syntax error handling: | 42 * Slight problem with syntax error handling: |
45 * CSS 2.1 Spec (http://www.w3.org/TR/CSS21/media.html) | 43 * CSS 2.1 Spec (http://www.w3.org/TR/CSS21/media.html) |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 for (size_t i = 0; i < m_queries.size(); ++i) { | 209 for (size_t i = 0; i < m_queries.size(); ++i) { |
212 if (!first) | 210 if (!first) |
213 text.appendLiteral(", "); | 211 text.appendLiteral(", "); |
214 else | 212 else |
215 first = false; | 213 first = false; |
216 text.append(m_queries[i]->cssText()); | 214 text.append(m_queries[i]->cssText()); |
217 } | 215 } |
218 return text.toString(); | 216 return text.toString(); |
219 } | 217 } |
220 | 218 |
221 void MediaQuerySet::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const | |
222 { | |
223 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); | |
224 info.addMember(m_queries, "queries"); | |
225 } | |
226 | |
227 MediaList::MediaList(MediaQuerySet* mediaQueries, CSSStyleSheet* parentSheet) | 219 MediaList::MediaList(MediaQuerySet* mediaQueries, CSSStyleSheet* parentSheet) |
228 : m_mediaQueries(mediaQueries) | 220 : m_mediaQueries(mediaQueries) |
229 , m_parentStyleSheet(parentSheet) | 221 , m_parentStyleSheet(parentSheet) |
230 , m_parentRule(0) | 222 , m_parentRule(0) |
231 { | 223 { |
232 } | 224 } |
233 | 225 |
234 MediaList::MediaList(MediaQuerySet* mediaQueries, CSSRule* parentRule) | 226 MediaList::MediaList(MediaQuerySet* mediaQueries, CSSRule* parentRule) |
235 : m_mediaQueries(mediaQueries) | 227 : m_mediaQueries(mediaQueries) |
236 , m_parentStyleSheet(0) | 228 , m_parentStyleSheet(0) |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 if (m_parentStyleSheet) | 281 if (m_parentStyleSheet) |
290 m_parentStyleSheet->didMutate(); | 282 m_parentStyleSheet->didMutate(); |
291 } | 283 } |
292 | 284 |
293 void MediaList::reattach(MediaQuerySet* mediaQueries) | 285 void MediaList::reattach(MediaQuerySet* mediaQueries) |
294 { | 286 { |
295 ASSERT(mediaQueries); | 287 ASSERT(mediaQueries); |
296 m_mediaQueries = mediaQueries; | 288 m_mediaQueries = mediaQueries; |
297 } | 289 } |
298 | 290 |
299 void MediaList::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const | |
300 { | |
301 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); | |
302 info.addMember(m_mediaQueries, "mediaQueries"); | |
303 info.addMember(m_parentStyleSheet, "parentStyleSheet"); | |
304 info.addMember(m_parentRule, "parentRule"); | |
305 } | |
306 | |
307 #if ENABLE(RESOLUTION_MEDIA_QUERY) | 291 #if ENABLE(RESOLUTION_MEDIA_QUERY) |
308 static void addResolutionWarningMessageToConsole(Document* document, const Strin
g& serializedExpression, const CSSPrimitiveValue* value) | 292 static void addResolutionWarningMessageToConsole(Document* document, const Strin
g& serializedExpression, const CSSPrimitiveValue* value) |
309 { | 293 { |
310 ASSERT(document); | 294 ASSERT(document); |
311 ASSERT(value); | 295 ASSERT(value); |
312 | 296 |
313 DEFINE_STATIC_LOCAL(String, mediaQueryMessage, (ASCIILiteral("Consider using
'dppx' units instead of '%replacementUnits%', as in CSS '%replacementUnits%' me
ans dots-per-CSS-%lengthUnit%, not dots-per-physical-%lengthUnit%, so does not c
orrespond to the actual '%replacementUnits%' of a screen. In media query express
ion: "))); | 297 DEFINE_STATIC_LOCAL(String, mediaQueryMessage, (ASCIILiteral("Consider using
'dppx' units instead of '%replacementUnits%', as in CSS '%replacementUnits%' me
ans dots-per-CSS-%lengthUnit%, not dots-per-physical-%lengthUnit%, so does not c
orrespond to the actual '%replacementUnits%' of a screen. In media query express
ion: "))); |
314 DEFINE_STATIC_LOCAL(String, mediaValueDPI, (ASCIILiteral("dpi"))); | 298 DEFINE_STATIC_LOCAL(String, mediaValueDPI, (ASCIILiteral("dpi"))); |
315 DEFINE_STATIC_LOCAL(String, mediaValueDPCM, (ASCIILiteral("dpcm"))); | 299 DEFINE_STATIC_LOCAL(String, mediaValueDPCM, (ASCIILiteral("dpcm"))); |
316 DEFINE_STATIC_LOCAL(String, lengthUnitInch, (ASCIILiteral("inch"))); | 300 DEFINE_STATIC_LOCAL(String, lengthUnitInch, (ASCIILiteral("inch"))); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 addResolutionWarningMessageToConsole(document, media
QuerySet->mediaText(), primitiveValue); | 339 addResolutionWarningMessageToConsole(document, media
QuerySet->mediaText(), primitiveValue); |
356 } | 340 } |
357 } | 341 } |
358 } | 342 } |
359 } | 343 } |
360 } | 344 } |
361 } | 345 } |
362 #endif | 346 #endif |
363 | 347 |
364 } | 348 } |
OLD | NEW |