| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 key = exp; | 105 key = exp; |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 | 108 |
| 109 MediaQuery::MediaQuery(const MediaQuery& o) | 109 MediaQuery::MediaQuery(const MediaQuery& o) |
| 110 : m_restrictor(o.m_restrictor), | 110 : m_restrictor(o.m_restrictor), |
| 111 m_mediaType(o.m_mediaType), | 111 m_mediaType(o.m_mediaType), |
| 112 m_serializationCache(o.m_serializationCache) { | 112 m_serializationCache(o.m_serializationCache) { |
| 113 m_expressions.reserveInitialCapacity(o.m_expressions.size()); | 113 m_expressions.reserveInitialCapacity(o.m_expressions.size()); |
| 114 for (unsigned i = 0; i < o.m_expressions.size(); ++i) | 114 for (unsigned i = 0; i < o.m_expressions.size(); ++i) |
| 115 m_expressions.append(o.m_expressions[i]->copy()); | 115 m_expressions.push_back(o.m_expressions[i]->copy()); |
| 116 } | 116 } |
| 117 | 117 |
| 118 MediaQuery::~MediaQuery() {} | 118 MediaQuery::~MediaQuery() {} |
| 119 | 119 |
| 120 // http://dev.w3.org/csswg/cssom/#compare-media-queries | 120 // http://dev.w3.org/csswg/cssom/#compare-media-queries |
| 121 bool MediaQuery::operator==(const MediaQuery& other) const { | 121 bool MediaQuery::operator==(const MediaQuery& other) const { |
| 122 return cssText() == other.cssText(); | 122 return cssText() == other.cssText(); |
| 123 } | 123 } |
| 124 | 124 |
| 125 // http://dev.w3.org/csswg/cssom/#serialize-a-list-of-media-queries | 125 // http://dev.w3.org/csswg/cssom/#serialize-a-list-of-media-queries |
| 126 String MediaQuery::cssText() const { | 126 String MediaQuery::cssText() const { |
| 127 if (m_serializationCache.isNull()) | 127 if (m_serializationCache.isNull()) |
| 128 const_cast<MediaQuery*>(this)->m_serializationCache = serialize(); | 128 const_cast<MediaQuery*>(this)->m_serializationCache = serialize(); |
| 129 | 129 |
| 130 return m_serializationCache; | 130 return m_serializationCache; |
| 131 } | 131 } |
| 132 | 132 |
| 133 DEFINE_TRACE(MediaQuery) { | 133 DEFINE_TRACE(MediaQuery) { |
| 134 visitor->trace(m_expressions); | 134 visitor->trace(m_expressions); |
| 135 } | 135 } |
| 136 | 136 |
| 137 } // namespace blink | 137 } // namespace blink |
| OLD | NEW |