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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 static bool expressionCompare(const OwnPtrWillBeMember<MediaQueryExp>& a, const
OwnPtrWillBeMember<MediaQueryExp>& b) | 72 static bool expressionCompare(const OwnPtrWillBeMember<MediaQueryExp>& a, const
OwnPtrWillBeMember<MediaQueryExp>& 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 PassOwnPtrWillBeRawPtr<MediaQuery> MediaQuery::createNotAll() |
78 { | 78 { |
79 return adoptPtrWillBeNoop(new MediaQuery(MediaQuery::Not, MediaTypeNames::al
l, ExpressionHeapVector())); | 79 return adoptPtrWillBeNoop(new MediaQuery(MediaQuery::Not, MediaTypeNames::al
l, ExpressionHeapVector())); |
80 } | 80 } |
81 | 81 |
82 PassOwnPtrWillBeRawPtr<MediaQuery> MediaQuery::create(Restrictor restrictor, Str
ing mediaType, ExpressionHeapVector expressions) | 82 PassOwnPtrWillBeRawPtr<MediaQuery> MediaQuery::create(RestrictorType restrictor,
String mediaType, ExpressionHeapVector expressions) |
83 { | 83 { |
84 return adoptPtrWillBeNoop(new MediaQuery(restrictor, std::move(mediaType), s
td::move(expressions))); | 84 return adoptPtrWillBeNoop(new MediaQuery(restrictor, std::move(mediaType), s
td::move(expressions))); |
85 } | 85 } |
86 | 86 |
87 MediaQuery::MediaQuery(Restrictor r, String mediaType, ExpressionHeapVector expr
essions) | 87 MediaQuery::MediaQuery(RestrictorType restrictor, String mediaType, ExpressionHe
apVector expressions) |
88 : m_restrictor(r) | 88 : m_restrictor(restrictor) |
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. |
95 MediaQueryExp* key = 0; | 95 MediaQueryExp* key = 0; |
96 for (int i = m_expressions.size() - 1; i >= 0; --i) { | 96 for (int i = m_expressions.size() - 1; i >= 0; --i) { |
97 MediaQueryExp* exp = m_expressions.at(i).get(); | 97 MediaQueryExp* exp = m_expressions.at(i).get(); |
98 | 98 |
(...skipping 36 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 |