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