| 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 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 #include "Frame.h" | 40 #include "Frame.h" |
| 41 #include "FrameView.h" | 41 #include "FrameView.h" |
| 42 #include "IntRect.h" | 42 #include "IntRect.h" |
| 43 #include "MediaFeatureNames.h" | 43 #include "MediaFeatureNames.h" |
| 44 #include "MediaList.h" | 44 #include "MediaList.h" |
| 45 #include "MediaQuery.h" | 45 #include "MediaQuery.h" |
| 46 #include "MediaQueryExp.h" | 46 #include "MediaQueryExp.h" |
| 47 #include "NodeRenderStyle.h" | 47 #include "NodeRenderStyle.h" |
| 48 #include "Page.h" | 48 #include "Page.h" |
| 49 #include "PlatformScreen.h" | 49 #include "PlatformScreen.h" |
| 50 #include "RenderLayerCompositor.h" |
| 50 #include "RenderStyle.h" | 51 #include "RenderStyle.h" |
| 51 #include "RenderView.h" | 52 #include "RenderView.h" |
| 52 #include "Screen.h" | 53 #include "Screen.h" |
| 53 #include "Settings.h" | 54 #include "Settings.h" |
| 54 #include "StyleResolver.h" | 55 #include "StyleResolver.h" |
| 55 #include <wtf/HashMap.h> | 56 #include <wtf/HashMap.h> |
| 56 | 57 |
| 57 #if ENABLE(3D_RENDERING) | |
| 58 #include "RenderLayerCompositor.h" | |
| 59 #endif | |
| 60 | |
| 61 namespace WebCore { | 58 namespace WebCore { |
| 62 | 59 |
| 63 using namespace MediaFeatureNames; | 60 using namespace MediaFeatureNames; |
| 64 | 61 |
| 65 enum MediaFeaturePrefix { MinPrefix, MaxPrefix, NoPrefix }; | 62 enum MediaFeaturePrefix { MinPrefix, MaxPrefix, NoPrefix }; |
| 66 | 63 |
| 67 typedef bool (*EvalFunc)(CSSValue*, RenderStyle*, Frame*, MediaFeaturePrefix); | 64 typedef bool (*EvalFunc)(CSSValue*, RenderStyle*, Frame*, MediaFeaturePrefix); |
| 68 typedef HashMap<AtomicStringImpl*, EvalFunc> FunctionMap; | 65 typedef HashMap<AtomicStringImpl*, EvalFunc> FunctionMap; |
| 69 static FunctionMap* gFunctionMap; | 66 static FunctionMap* gFunctionMap; |
| 70 | 67 |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 return numberValue(value, number) && compareValue(1, static_cast<int>(nu
mber), op); | 630 return numberValue(value, number) && compareValue(1, static_cast<int>(nu
mber), op); |
| 634 } | 631 } |
| 635 return true; | 632 return true; |
| 636 } | 633 } |
| 637 | 634 |
| 638 static bool transform_3dMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* f
rame, MediaFeaturePrefix op) | 635 static bool transform_3dMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* f
rame, MediaFeaturePrefix op) |
| 639 { | 636 { |
| 640 bool returnValueIfNoParameter; | 637 bool returnValueIfNoParameter; |
| 641 int have3dRendering; | 638 int have3dRendering; |
| 642 | 639 |
| 643 #if ENABLE(3D_RENDERING) | |
| 644 bool threeDEnabled = false; | 640 bool threeDEnabled = false; |
| 645 if (RenderView* view = frame->contentRenderer()) | 641 if (RenderView* view = frame->contentRenderer()) |
| 646 threeDEnabled = view->compositor()->canRender3DTransforms(); | 642 threeDEnabled = view->compositor()->canRender3DTransforms(); |
| 647 | 643 |
| 648 returnValueIfNoParameter = threeDEnabled; | 644 returnValueIfNoParameter = threeDEnabled; |
| 649 have3dRendering = threeDEnabled ? 1 : 0; | 645 have3dRendering = threeDEnabled ? 1 : 0; |
| 650 #else | |
| 651 UNUSED_PARAM(frame); | |
| 652 returnValueIfNoParameter = false; | |
| 653 have3dRendering = 0; | |
| 654 #endif | |
| 655 | 646 |
| 656 if (value) { | 647 if (value) { |
| 657 float number; | 648 float number; |
| 658 return numberValue(value, number) && compareValue(have3dRendering, stati
c_cast<int>(number), op); | 649 return numberValue(value, number) && compareValue(have3dRendering, stati
c_cast<int>(number), op); |
| 659 } | 650 } |
| 660 return returnValueIfNoParameter; | 651 return returnValueIfNoParameter; |
| 661 } | 652 } |
| 662 | 653 |
| 663 #if ENABLE(VIEW_MODE_CSS_MEDIA) | 654 #if ENABLE(VIEW_MODE_CSS_MEDIA) |
| 664 static bool view_modeMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* fram
e, MediaFeaturePrefix op) | 655 static bool view_modeMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* fram
e, MediaFeaturePrefix op) |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 // and let trampoline functions override the prefix if prefix is | 771 // and let trampoline functions override the prefix if prefix is |
| 781 // used | 772 // used |
| 782 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl()); | 773 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl()); |
| 783 if (func) | 774 if (func) |
| 784 return func(expr->value(), m_style.get(), m_frame, NoPrefix); | 775 return func(expr->value(), m_style.get(), m_frame, NoPrefix); |
| 785 | 776 |
| 786 return false; | 777 return false; |
| 787 } | 778 } |
| 788 | 779 |
| 789 } // namespace | 780 } // namespace |
| OLD | NEW |