OLD | NEW |
1 /* | 1 /* |
2 * CSS Media Query Evaluator | 2 * CSS Media Query Evaluator |
3 * | 3 * |
4 * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>. | 4 * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>. |
5 * Copyright (C) 2013 Apple Inc. All rights reserved. | 5 * Copyright (C) 2013 Apple Inc. All rights reserved. |
6 * Copyright (C) 2013 Intel Corporation. All rights reserved. | 6 * Copyright (C) 2013 Intel Corporation. All rights reserved. |
7 * | 7 * |
8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
10 * are met: | 10 * are met: |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 return nullAtom; | 104 return nullAtom; |
105 } | 105 } |
106 | 106 |
107 bool MediaQueryEvaluator::mediaTypeMatch(const String& mediaTypeToMatch) const | 107 bool MediaQueryEvaluator::mediaTypeMatch(const String& mediaTypeToMatch) const |
108 { | 108 { |
109 return mediaTypeToMatch.isEmpty() | 109 return mediaTypeToMatch.isEmpty() |
110 || equalIgnoringCase(mediaTypeToMatch, MediaTypeNames::all) | 110 || equalIgnoringCase(mediaTypeToMatch, MediaTypeNames::all) |
111 || equalIgnoringCase(mediaTypeToMatch, mediaType()); | 111 || equalIgnoringCase(mediaTypeToMatch, mediaType()); |
112 } | 112 } |
113 | 113 |
114 bool MediaQueryEvaluator::mediaTypeMatchSpecific(const char* mediaTypeToMatch) c
onst | |
115 { | |
116 // Like mediaTypeMatch, but without the special cases for "" and "all". | |
117 ASSERT(mediaTypeToMatch); | |
118 ASSERT(mediaTypeToMatch[0] != '\0'); | |
119 ASSERT(!equalIgnoringCase(mediaTypeToMatch, MediaTypeNames::all)); | |
120 return equalIgnoringCase(mediaTypeToMatch, mediaType()); | |
121 } | |
122 | |
123 static bool applyRestrictor(MediaQuery::Restrictor r, bool value) | 114 static bool applyRestrictor(MediaQuery::Restrictor r, bool value) |
124 { | 115 { |
125 return r == MediaQuery::Not ? !value : value; | 116 return r == MediaQuery::Not ? !value : value; |
126 } | 117 } |
127 | 118 |
128 bool MediaQueryEvaluator::eval(const MediaQuerySet* querySet, MediaQueryResultLi
st* viewportDependentMediaQueryResults) const | 119 bool MediaQueryEvaluator::eval(const MediaQuerySet* querySet, MediaQueryResultLi
st* viewportDependentMediaQueryResults) const |
129 { | 120 { |
130 if (!querySet) | 121 if (!querySet) |
131 return true; | 122 return true; |
132 | 123 |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 // Call the media feature evaluation function. Assume no prefix and let | 598 // Call the media feature evaluation function. Assume no prefix and let |
608 // trampoline functions override the prefix if prefix is used. | 599 // trampoline functions override the prefix if prefix is used. |
609 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl()); | 600 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl()); |
610 if (func) | 601 if (func) |
611 return func(expr->expValue(), NoPrefix, *m_mediaValues); | 602 return func(expr->expValue(), NoPrefix, *m_mediaValues); |
612 | 603 |
613 return false; | 604 return false; |
614 } | 605 } |
615 | 606 |
616 } // namespace | 607 } // namespace |
OLD | NEW |