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

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

Issue 870933002: Make it possible to set the display mode from the WebView API (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Using enum now Created 5 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/DisplayModeProperties.h ('k') | Source/core/css/MediaQueryEvaluatorTest.cpp » ('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 19 matching lines...) Expand all
30 #include "config.h" 30 #include "config.h"
31 #include "core/css/MediaQueryEvaluator.h" 31 #include "core/css/MediaQueryEvaluator.h"
32 32
33 #include "core/CSSValueKeywords.h" 33 #include "core/CSSValueKeywords.h"
34 #include "core/MediaFeatureNames.h" 34 #include "core/MediaFeatureNames.h"
35 #include "core/MediaFeatures.h" 35 #include "core/MediaFeatures.h"
36 #include "core/MediaTypeNames.h" 36 #include "core/MediaTypeNames.h"
37 #include "core/css/CSSHelper.h" 37 #include "core/css/CSSHelper.h"
38 #include "core/css/CSSPrimitiveValue.h" 38 #include "core/css/CSSPrimitiveValue.h"
39 #include "core/css/CSSToLengthConversionData.h" 39 #include "core/css/CSSToLengthConversionData.h"
40 #include "core/css/DisplayModeProperties.h"
41 #include "core/css/MediaList.h" 40 #include "core/css/MediaList.h"
42 #include "core/css/MediaQuery.h" 41 #include "core/css/MediaQuery.h"
43 #include "core/css/MediaValuesDynamic.h" 42 #include "core/css/MediaValuesDynamic.h"
44 #include "core/css/PointerProperties.h" 43 #include "core/css/PointerProperties.h"
45 #include "core/css/resolver/MediaQueryResult.h" 44 #include "core/css/resolver/MediaQueryResult.h"
46 #include "core/dom/NodeRenderStyle.h" 45 #include "core/dom/NodeRenderStyle.h"
47 #include "core/frame/FrameHost.h" 46 #include "core/frame/FrameHost.h"
48 #include "core/frame/FrameView.h" 47 #include "core/frame/FrameView.h"
49 #include "core/frame/LocalFrame.h" 48 #include "core/frame/LocalFrame.h"
50 #include "core/frame/Settings.h" 49 #include "core/frame/Settings.h"
51 #include "core/frame/UseCounter.h" 50 #include "core/frame/UseCounter.h"
52 #include "core/inspector/InspectorInstrumentation.h" 51 #include "core/inspector/InspectorInstrumentation.h"
53 #include "core/rendering/RenderView.h" 52 #include "core/rendering/RenderView.h"
54 #include "core/rendering/compositing/RenderLayerCompositor.h" 53 #include "core/rendering/compositing/RenderLayerCompositor.h"
55 #include "core/rendering/style/RenderStyle.h" 54 #include "core/rendering/style/RenderStyle.h"
56 #include "platform/PlatformScreen.h" 55 #include "platform/PlatformScreen.h"
57 #include "platform/RuntimeEnabledFeatures.h" 56 #include "platform/RuntimeEnabledFeatures.h"
58 #include "platform/geometry/FloatRect.h" 57 #include "platform/geometry/FloatRect.h"
58 #include "public/platform/WebDisplayMode.h"
59 #include "wtf/HashMap.h" 59 #include "wtf/HashMap.h"
60 60
61 namespace blink { 61 namespace blink {
62 62
63 using namespace MediaFeatureNames; 63 using namespace MediaFeatureNames;
64 64
65 enum MediaFeaturePrefix { MinPrefix, MaxPrefix, NoPrefix }; 65 enum MediaFeaturePrefix { MinPrefix, MaxPrefix, NoPrefix };
66 66
67 typedef bool (*EvalFunc)(const MediaQueryExpValue&, MediaFeaturePrefix, const Me diaValues&); 67 typedef bool (*EvalFunc)(const MediaQueryExpValue&, MediaFeaturePrefix, const Me diaValues&);
68 typedef HashMap<StringImpl*, EvalFunc> FunctionMap; 68 typedef HashMap<StringImpl*, EvalFunc> FunctionMap;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 } 219 }
220 220
221 return colorMediaFeatureEval(value, op, mediaValues); 221 return colorMediaFeatureEval(value, op, mediaValues);
222 } 222 }
223 223
224 static bool displayModeMediaFeatureEval(const MediaQueryExpValue& value, MediaFe aturePrefix, const MediaValues& mediaValues) 224 static bool displayModeMediaFeatureEval(const MediaQueryExpValue& value, MediaFe aturePrefix, const MediaValues& mediaValues)
225 { 225 {
226 if (!value.isID) 226 if (!value.isID)
227 return false; 227 return false;
228 228
229 DisplayMode mode = mediaValues.displayMode(); 229 WebDisplayMode mode = mediaValues.displayMode();
230 switch (value.id) { 230 switch (value.id) {
231 case CSSValueFullscreen: 231 case CSSValueFullscreen:
232 return mode == DisplayModeFullscreen; 232 return mode == WebDisplayModeFullscreen;
233 case CSSValueStandalone: 233 case CSSValueStandalone:
234 return mode == DisplayModeStandalone; 234 return mode == WebDisplayModeStandalone;
235 case CSSValueMinimalUi: 235 case CSSValueMinimalUi:
236 return mode == DisplayModeMinimalUi; 236 return mode == WebDisplayModeMinimalUi;
237 case CSSValueBrowser: 237 case CSSValueBrowser:
238 return mode == DisplayModeBrowser; 238 return mode == WebDisplayModeBrowser;
239 default: 239 default:
240 ASSERT_NOT_REACHED(); 240 ASSERT_NOT_REACHED();
241 return false; 241 return false;
242 } 242 }
243 } 243 }
244 244
245 static bool orientationMediaFeatureEval(const MediaQueryExpValue& value, MediaFe aturePrefix, const MediaValues& mediaValues) 245 static bool orientationMediaFeatureEval(const MediaQueryExpValue& value, MediaFe aturePrefix, const MediaValues& mediaValues)
246 { 246 {
247 int width = mediaValues.viewportWidth(); 247 int width = mediaValues.viewportWidth();
248 int height = mediaValues.viewportHeight(); 248 int height = mediaValues.viewportHeight();
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 // Call the media feature evaluation function. Assume no prefix and let 662 // Call the media feature evaluation function. Assume no prefix and let
663 // trampoline functions override the prefix if prefix is used. 663 // trampoline functions override the prefix if prefix is used.
664 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl()); 664 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl());
665 if (func) 665 if (func)
666 return func(expr->expValue(), NoPrefix, *m_mediaValues); 666 return func(expr->expValue(), NoPrefix, *m_mediaValues);
667 667
668 return false; 668 return false;
669 } 669 }
670 670
671 } // namespace 671 } // namespace
OLDNEW
« no previous file with comments | « Source/core/css/DisplayModeProperties.h ('k') | Source/core/css/MediaQueryEvaluatorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698