Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: Source/core/css/MediaQueryEvaluator.cpp

Issue 185533012: Auto generate MediaFeatureNames, its macros and MediaTypeNames (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed comment from RuntimeEnabled Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/css/MediaList.cpp ('k') | Source/core/css/MediaQueryExp.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 13 matching lines...) Expand all
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 "config.h"
31 #include "core/css/MediaQueryEvaluator.h" 31 #include "core/css/MediaQueryEvaluator.h"
32 32
33 #include "CSSValueKeywords.h" 33 #include "CSSValueKeywords.h"
34 #include "MediaFeatureNames.h"
35 #include "MediaFeatures.h"
34 #include "core/css/CSSAspectRatioValue.h" 36 #include "core/css/CSSAspectRatioValue.h"
35 #include "core/css/CSSHelper.h" 37 #include "core/css/CSSHelper.h"
36 #include "core/css/CSSPrimitiveValue.h" 38 #include "core/css/CSSPrimitiveValue.h"
37 #include "core/css/CSSToLengthConversionData.h" 39 #include "core/css/CSSToLengthConversionData.h"
38 #include "core/css/MediaFeatureNames.h"
39 #include "core/css/MediaList.h" 40 #include "core/css/MediaList.h"
40 #include "core/css/MediaQuery.h" 41 #include "core/css/MediaQuery.h"
41 #include "core/css/resolver/MediaQueryResult.h" 42 #include "core/css/resolver/MediaQueryResult.h"
42 #include "core/dom/NodeRenderStyle.h" 43 #include "core/dom/NodeRenderStyle.h"
43 #include "core/frame/FrameHost.h" 44 #include "core/frame/FrameHost.h"
44 #include "core/frame/FrameView.h" 45 #include "core/frame/FrameView.h"
45 #include "core/frame/LocalFrame.h" 46 #include "core/frame/LocalFrame.h"
46 #include "core/frame/Settings.h" 47 #include "core/frame/Settings.h"
47 #include "core/inspector/InspectorInstrumentation.h" 48 #include "core/inspector/InspectorInstrumentation.h"
48 #include "core/rendering/RenderView.h" 49 #include "core/rendering/RenderView.h"
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 // If a platform interface supplies progressive/interlace info for TVs in th e 667 // If a platform interface supplies progressive/interlace info for TVs in th e
667 // future, it needs to be handled here. For now, assume a modern TV with 668 // future, it needs to be handled here. For now, assume a modern TV with
668 // progressive display. 669 // progressive display.
669 return toCSSPrimitiveValue(value)->getValueID() == CSSValueProgressive; 670 return toCSSPrimitiveValue(value)->getValueID() == CSSValueProgressive;
670 } 671 }
671 672
672 static void createFunctionMap() 673 static void createFunctionMap()
673 { 674 {
674 // Create the table. 675 // Create the table.
675 gFunctionMap = new FunctionMap; 676 gFunctionMap = new FunctionMap;
676 #define ADD_TO_FUNCTIONMAP(name, str) \ 677 #define ADD_TO_FUNCTIONMAP(name) \
677 gFunctionMap->set(name##MediaFeature.impl(), name##MediaFeatureEval); 678 gFunctionMap->set(name##MediaFeature.impl(), name##MediaFeatureEval);
678 CSS_MEDIAQUERY_NAMES_FOR_EACH_MEDIAFEATURE(ADD_TO_FUNCTIONMAP); 679 CSS_MEDIAQUERY_NAMES_FOR_EACH_MEDIAFEATURE(ADD_TO_FUNCTIONMAP);
679 #undef ADD_TO_FUNCTIONMAP 680 #undef ADD_TO_FUNCTIONMAP
680 } 681 }
681 682
682 bool MediaQueryEvaluator::eval(const MediaQueryExp* expr) const 683 bool MediaQueryEvaluator::eval(const MediaQueryExp* expr) const
683 { 684 {
684 if (!m_frame || !m_style) 685 if (!m_frame || !m_style)
685 return m_expResult; 686 return m_expResult;
686 687
687 if (!gFunctionMap) 688 if (!gFunctionMap)
688 createFunctionMap(); 689 createFunctionMap();
689 690
690 // Call the media feature evaluation function. Assume no prefix and let 691 // Call the media feature evaluation function. Assume no prefix and let
691 // trampoline functions override the prefix if prefix is used. 692 // trampoline functions override the prefix if prefix is used.
692 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl()); 693 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl());
693 if (func) 694 if (func)
694 return func(expr->value(), m_style.get(), m_frame, NoPrefix); 695 return func(expr->value(), m_style.get(), m_frame, NoPrefix);
695 696
696 return false; 697 return false;
697 } 698 }
698 699
699 } // namespace 700 } // namespace
OLDNEW
« no previous file with comments | « Source/core/css/MediaList.cpp ('k') | Source/core/css/MediaQueryExp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698