OLD | NEW |
1 /* | 1 /* |
2 * CSS Media Query | 2 * CSS Media Query |
3 * | 3 * |
4 * Copyright (C) 2005, 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>. | 4 * Copyright (C) 2005, 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>. |
5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | 5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
6 * | 6 * |
7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
9 * are met: | 9 * are met: |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 result.append(m_expressions->at(i)->serialize()); | 66 result.append(m_expressions->at(i)->serialize()); |
67 } | 67 } |
68 return result.toString(); | 68 return result.toString(); |
69 } | 69 } |
70 | 70 |
71 static bool expressionCompare(const OwnPtr<MediaQueryExp>& a, const OwnPtr<Media
QueryExp>& b) | 71 static bool expressionCompare(const OwnPtr<MediaQueryExp>& a, const OwnPtr<Media
QueryExp>& b) |
72 { | 72 { |
73 return codePointCompare(a->serialize(), b->serialize()) < 0; | 73 return codePointCompare(a->serialize(), b->serialize()) < 0; |
74 } | 74 } |
75 | 75 |
76 MediaQuery::MediaQuery(Restrictor r, const String& mediaType, PassOwnPtr<Express
ionVector> expressions) | 76 MediaQuery::MediaQuery(Restrictor r, const AtomicString& mediaType, PassOwnPtr<E
xpressionVector> expressions) |
77 : m_restrictor(r) | 77 : m_restrictor(r) |
78 , m_mediaType(mediaType.lower()) | 78 , m_mediaType(mediaType.lower()) |
79 , m_expressions(expressions) | 79 , m_expressions(expressions) |
80 { | 80 { |
81 if (!m_expressions) { | 81 if (!m_expressions) { |
82 m_expressions = adoptPtr(new ExpressionVector); | 82 m_expressions = adoptPtr(new ExpressionVector); |
83 return; | 83 return; |
84 } | 84 } |
85 | 85 |
86 nonCopyingSort(m_expressions->begin(), m_expressions->end(), expressionCompa
re); | 86 nonCopyingSort(m_expressions->begin(), m_expressions->end(), expressionCompa
re); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // http://dev.w3.org/csswg/cssom/#serialize-a-list-of-media-queries | 120 // http://dev.w3.org/csswg/cssom/#serialize-a-list-of-media-queries |
121 String MediaQuery::cssText() const | 121 String MediaQuery::cssText() const |
122 { | 122 { |
123 if (m_serializationCache.isNull()) | 123 if (m_serializationCache.isNull()) |
124 const_cast<MediaQuery*>(this)->m_serializationCache = serialize(); | 124 const_cast<MediaQuery*>(this)->m_serializationCache = serialize(); |
125 | 125 |
126 return m_serializationCache; | 126 return m_serializationCache; |
127 } | 127 } |
128 | 128 |
129 } | 129 } |
OLD | NEW |