| 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: |
| 11 * 1. Redistributions of source code must retain the above copyright | 11 * 1. Redistributions of source code must retain the above copyright |
| 12 * notice, this list of conditions and the following disclaimer. | 12 * notice, this list of conditions and the following disclaimer. |
| 13 * 2. Redistributions in binary form must reproduce the above copyright | 13 * 2. Redistributions in binary form must reproduce the above copyright |
| 14 * notice, this list of conditions and the following disclaimer in the | 14 * notice, this list of conditions and the following disclaimer in the |
| 15 * documentation and/or other materials provided with the distribution. | 15 * documentation and/or other materials provided with the distribution. |
| 16 * | 16 * |
| 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY | 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY |
| 18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
| 21 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 21 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 25 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 #include "config.h" | 30 #include "sky/engine/config.h" |
| 31 #include "core/css/MediaQueryEvaluator.h" | 31 #include "sky/engine/core/css/MediaQueryEvaluator.h" |
| 32 | 32 |
| 33 #include "gen/sky/core/CSSValueKeywords.h" | 33 #include "gen/sky/core/CSSValueKeywords.h" |
| 34 #include "gen/sky/core/MediaFeatureNames.h" | 34 #include "gen/sky/core/MediaFeatureNames.h" |
| 35 #include "gen/sky/core/MediaFeatures.h" | 35 #include "gen/sky/core/MediaFeatures.h" |
| 36 #include "gen/sky/core/MediaTypeNames.h" | 36 #include "gen/sky/core/MediaTypeNames.h" |
| 37 #include "core/css/CSSAspectRatioValue.h" | |
| 38 #include "core/css/CSSHelper.h" | |
| 39 #include "core/css/CSSPrimitiveValue.h" | |
| 40 #include "core/css/CSSToLengthConversionData.h" | |
| 41 #include "core/css/MediaList.h" | |
| 42 #include "core/css/MediaQuery.h" | |
| 43 #include "core/css/MediaValuesDynamic.h" | |
| 44 #include "core/css/PointerProperties.h" | |
| 45 #include "core/css/resolver/MediaQueryResult.h" | |
| 46 #include "core/dom/NodeRenderStyle.h" | |
| 47 #include "core/frame/FrameHost.h" | |
| 48 #include "core/frame/FrameView.h" | |
| 49 #include "core/frame/LocalFrame.h" | |
| 50 #include "core/frame/Settings.h" | |
| 51 #include "core/frame/UseCounter.h" | |
| 52 #include "core/rendering/RenderView.h" | |
| 53 #include "core/rendering/compositing/RenderLayerCompositor.h" | |
| 54 #include "core/rendering/style/RenderStyle.h" | |
| 55 #include "platform/PlatformScreen.h" | |
| 56 #include "gen/sky/platform/RuntimeEnabledFeatures.h" | 37 #include "gen/sky/platform/RuntimeEnabledFeatures.h" |
| 57 #include "platform/geometry/FloatRect.h" | 38 #include "sky/engine/core/css/CSSAspectRatioValue.h" |
| 58 #include "wtf/HashMap.h" | 39 #include "sky/engine/core/css/CSSHelper.h" |
| 40 #include "sky/engine/core/css/CSSPrimitiveValue.h" |
| 41 #include "sky/engine/core/css/CSSToLengthConversionData.h" |
| 42 #include "sky/engine/core/css/MediaList.h" |
| 43 #include "sky/engine/core/css/MediaQuery.h" |
| 44 #include "sky/engine/core/css/MediaValuesDynamic.h" |
| 45 #include "sky/engine/core/css/PointerProperties.h" |
| 46 #include "sky/engine/core/css/resolver/MediaQueryResult.h" |
| 47 #include "sky/engine/core/dom/NodeRenderStyle.h" |
| 48 #include "sky/engine/core/frame/FrameHost.h" |
| 49 #include "sky/engine/core/frame/FrameView.h" |
| 50 #include "sky/engine/core/frame/LocalFrame.h" |
| 51 #include "sky/engine/core/frame/Settings.h" |
| 52 #include "sky/engine/core/frame/UseCounter.h" |
| 53 #include "sky/engine/core/rendering/RenderView.h" |
| 54 #include "sky/engine/core/rendering/compositing/RenderLayerCompositor.h" |
| 55 #include "sky/engine/core/rendering/style/RenderStyle.h" |
| 56 #include "sky/engine/platform/PlatformScreen.h" |
| 57 #include "sky/engine/platform/geometry/FloatRect.h" |
| 58 #include "sky/engine/wtf/HashMap.h" |
| 59 | 59 |
| 60 namespace blink { | 60 namespace blink { |
| 61 | 61 |
| 62 using namespace MediaFeatureNames; | 62 using namespace MediaFeatureNames; |
| 63 | 63 |
| 64 enum MediaFeaturePrefix { MinPrefix, MaxPrefix, NoPrefix }; | 64 enum MediaFeaturePrefix { MinPrefix, MaxPrefix, NoPrefix }; |
| 65 | 65 |
| 66 typedef bool (*EvalFunc)(const MediaQueryExpValue&, MediaFeaturePrefix, const Me
diaValues&); | 66 typedef bool (*EvalFunc)(const MediaQueryExpValue&, MediaFeaturePrefix, const Me
diaValues&); |
| 67 typedef HashMap<StringImpl*, EvalFunc> FunctionMap; | 67 typedef HashMap<StringImpl*, EvalFunc> FunctionMap; |
| 68 static FunctionMap* gFunctionMap; | 68 static FunctionMap* gFunctionMap; |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 // Call the media feature evaluation function. Assume no prefix and let | 642 // Call the media feature evaluation function. Assume no prefix and let |
| 643 // trampoline functions override the prefix if prefix is used. | 643 // trampoline functions override the prefix if prefix is used. |
| 644 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl()); | 644 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl()); |
| 645 if (func) | 645 if (func) |
| 646 return func(expr->expValue(), NoPrefix, *m_mediaValues); | 646 return func(expr->expValue(), NoPrefix, *m_mediaValues); |
| 647 | 647 |
| 648 return false; | 648 return false; |
| 649 } | 649 } |
| 650 | 650 |
| 651 } // namespace | 651 } // namespace |
| OLD | NEW |