| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 } | 62 } |
| 63 | 63 |
| 64 result.append(m_expressions.at(0)->serialize()); | 64 result.append(m_expressions.at(0)->serialize()); |
| 65 for (size_t i = 1; i < m_expressions.size(); ++i) { | 65 for (size_t i = 1; i < m_expressions.size(); ++i) { |
| 66 result.appendLiteral(" and "); | 66 result.appendLiteral(" and "); |
| 67 result.append(m_expressions.at(i)->serialize()); | 67 result.append(m_expressions.at(i)->serialize()); |
| 68 } | 68 } |
| 69 return result.toString(); | 69 return result.toString(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 static bool expressionCompare(const OwnPtrWillBeMember<MediaQueryExp>& a, const
OwnPtrWillBeMember<MediaQueryExp>& b) | 72 static bool expressionCompare(const Member<MediaQueryExp>& a, const Member<Media
QueryExp>& b) |
| 73 { | 73 { |
| 74 return codePointCompare(a->serialize(), b->serialize()) < 0; | 74 return codePointCompare(a->serialize(), b->serialize()) < 0; |
| 75 } | 75 } |
| 76 | 76 |
| 77 PassOwnPtrWillBeRawPtr<MediaQuery> MediaQuery::createNotAll() | 77 RawPtr<MediaQuery> MediaQuery::createNotAll() |
| 78 { | 78 { |
| 79 return adoptPtrWillBeNoop(new MediaQuery(MediaQuery::Not, MediaTypeNames::al
l, ExpressionHeapVector())); | 79 return (new MediaQuery(MediaQuery::Not, MediaTypeNames::all, ExpressionHeapV
ector())); |
| 80 } | 80 } |
| 81 | 81 |
| 82 PassOwnPtrWillBeRawPtr<MediaQuery> MediaQuery::create(Restrictor restrictor, Str
ing mediaType, ExpressionHeapVector expressions) | 82 RawPtr<MediaQuery> MediaQuery::create(Restrictor restrictor, String mediaType, E
xpressionHeapVector expressions) |
| 83 { | 83 { |
| 84 return adoptPtrWillBeNoop(new MediaQuery(restrictor, std::move(mediaType), s
td::move(expressions))); | 84 return (new MediaQuery(restrictor, std::move(mediaType), std::move(expressio
ns))); |
| 85 } | 85 } |
| 86 | 86 |
| 87 MediaQuery::MediaQuery(Restrictor r, String mediaType, ExpressionHeapVector expr
essions) | 87 MediaQuery::MediaQuery(Restrictor r, String mediaType, ExpressionHeapVector expr
essions) |
| 88 : m_restrictor(r) | 88 : m_restrictor(r) |
| 89 , m_mediaType(attemptStaticStringCreation(mediaType.lower())) | 89 , m_mediaType(attemptStaticStringCreation(mediaType.lower())) |
| 90 , m_expressions(std::move(expressions)) | 90 , m_expressions(std::move(expressions)) |
| 91 { | 91 { |
| 92 nonCopyingSort(m_expressions.begin(), m_expressions.end(), expressionCompare
); | 92 nonCopyingSort(m_expressions.begin(), m_expressions.end(), expressionCompare
); |
| 93 | 93 |
| 94 // Remove all duplicated expressions. | 94 // Remove all duplicated expressions. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 DEFINE_TRACE(MediaQuery) | 135 DEFINE_TRACE(MediaQuery) |
| 136 { | 136 { |
| 137 // We don't support tracing of vectors of OwnPtrs (ie. OwnPtr<Vector<OwnPtr<
MediaQuery>>>). | 137 // We don't support tracing of vectors of OwnPtrs (ie. OwnPtr<Vector<OwnPtr<
MediaQuery>>>). |
| 138 // Since this is a transitional object we are just ifdef'ing it out when oil
pan is not enabled. | 138 // Since this is a transitional object we are just ifdef'ing it out when oil
pan is not enabled. |
| 139 #if ENABLE(OILPAN) | 139 #if ENABLE(OILPAN) |
| 140 visitor->trace(m_expressions); | 140 visitor->trace(m_expressions); |
| 141 #endif | 141 #endif |
| 142 } | 142 } |
| 143 | 143 |
| 144 } // namespace blink | 144 } // namespace blink |
| OLD | NEW |