| 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 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 return false; | 795 return false; |
| 796 } | 796 } |
| 797 | 797 |
| 798 // This is for some compilers that do not understand that it can't be reached. | 798 // This is for some compilers that do not understand that it can't be reached. |
| 799 NOTREACHED(); | 799 NOTREACHED(); |
| 800 return false; | 800 return false; |
| 801 } | 801 } |
| 802 | 802 |
| 803 void MediaQueryEvaluator::init() { | 803 void MediaQueryEvaluator::init() { |
| 804 // Create the table. | 804 // Create the table. |
| 805 gFunctionMap = new FunctionMap; | 805 g_function_map = new FunctionMap; |
| 806 #define ADD_TO_FUNCTIONMAP(name) \ | 806 #define ADD_TO_FUNCTIONMAP(constantPrefix, methodPrefix) \ |
| 807 gFunctionMap->set(name##MediaFeature.impl(), name##MediaFeatureEval); | 807 g_function_map->Set(constantPrefix##MediaFeature.Impl(), \ |
| 808 methodPrefix##MediaFeatureEval); |
| 808 CSS_MEDIAQUERY_NAMES_FOR_EACH_MEDIAFEATURE(ADD_TO_FUNCTIONMAP); | 809 CSS_MEDIAQUERY_NAMES_FOR_EACH_MEDIAFEATURE(ADD_TO_FUNCTIONMAP); |
| 809 #undef ADD_TO_FUNCTIONMAP | 810 #undef ADD_TO_FUNCTIONMAP |
| 810 } | 811 } |
| 811 | 812 |
| 812 bool MediaQueryEvaluator::eval(const MediaQueryExp* expr) const { | 813 bool MediaQueryEvaluator::eval(const MediaQueryExp* expr) const { |
| 813 if (!m_mediaValues || !m_mediaValues->hasValues()) | 814 if (!m_mediaValues || !m_mediaValues->hasValues()) |
| 814 return true; | 815 return true; |
| 815 | 816 |
| 816 DCHECK(gFunctionMap); | 817 DCHECK(gFunctionMap); |
| 817 | 818 |
| 818 // Call the media feature evaluation function. Assume no prefix and let | 819 // Call the media feature evaluation function. Assume no prefix and let |
| 819 // trampoline functions override the prefix if prefix is used. | 820 // trampoline functions override the prefix if prefix is used. |
| 820 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl()); | 821 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl()); |
| 821 if (func) | 822 if (func) |
| 822 return func(expr->expValue(), NoPrefix, *m_mediaValues); | 823 return func(expr->expValue(), NoPrefix, *m_mediaValues); |
| 823 | 824 |
| 824 return false; | 825 return false; |
| 825 } | 826 } |
| 826 | 827 |
| 827 } // namespace blink | 828 } // namespace blink |
| OLD | NEW |