| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 return applyRestrictor(query->restrictor(), false); | 117 return applyRestrictor(query->restrictor(), false); |
| 118 | 118 |
| 119 const ExpressionHeapVector& expressions = query->expressions(); | 119 const ExpressionHeapVector& expressions = query->expressions(); |
| 120 // Iterate through expressions, stop if any of them eval to false (AND | 120 // Iterate through expressions, stop if any of them eval to false (AND |
| 121 // semantics). | 121 // semantics). |
| 122 size_t i = 0; | 122 size_t i = 0; |
| 123 for (; i < expressions.size(); ++i) { | 123 for (; i < expressions.size(); ++i) { |
| 124 bool exprResult = eval(expressions.at(i).get()); | 124 bool exprResult = eval(expressions.at(i).get()); |
| 125 if (viewportDependentMediaQueryResults && | 125 if (viewportDependentMediaQueryResults && |
| 126 expressions.at(i)->isViewportDependent()) | 126 expressions.at(i)->isViewportDependent()) |
| 127 viewportDependentMediaQueryResults->append( | 127 viewportDependentMediaQueryResults->push_back( |
| 128 new MediaQueryResult(*expressions.at(i), exprResult)); | 128 new MediaQueryResult(*expressions.at(i), exprResult)); |
| 129 if (deviceDependentMediaQueryResults && | 129 if (deviceDependentMediaQueryResults && |
| 130 expressions.at(i)->isDeviceDependent()) | 130 expressions.at(i)->isDeviceDependent()) |
| 131 deviceDependentMediaQueryResults->append( | 131 deviceDependentMediaQueryResults->push_back( |
| 132 new MediaQueryResult(*expressions.at(i), exprResult)); | 132 new MediaQueryResult(*expressions.at(i), exprResult)); |
| 133 if (!exprResult) | 133 if (!exprResult) |
| 134 break; | 134 break; |
| 135 } | 135 } |
| 136 | 136 |
| 137 // Assume true if we are at the end of the list, otherwise assume false. | 137 // Assume true if we are at the end of the list, otherwise assume false. |
| 138 return applyRestrictor(query->restrictor(), expressions.size() == i); | 138 return applyRestrictor(query->restrictor(), expressions.size() == i); |
| 139 } | 139 } |
| 140 | 140 |
| 141 bool MediaQueryEvaluator::eval( | 141 bool MediaQueryEvaluator::eval( |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 // Call the media feature evaluation function. Assume no prefix and let | 771 // Call the media feature evaluation function. Assume no prefix and let |
| 772 // trampoline functions override the prefix if prefix is used. | 772 // trampoline functions override the prefix if prefix is used. |
| 773 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl()); | 773 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl()); |
| 774 if (func) | 774 if (func) |
| 775 return func(expr->expValue(), NoPrefix, *m_mediaValues); | 775 return func(expr->expValue(), NoPrefix, *m_mediaValues); |
| 776 | 776 |
| 777 return false; | 777 return false; |
| 778 } | 778 } |
| 779 | 779 |
| 780 } // namespace blink | 780 } // namespace blink |
| OLD | NEW |