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

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

Issue 1395543005: matchMedia('(display-mode: <notValid>)').matches should not evaluate true (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comments Created 5 years, 2 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
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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 return numberValue(value, number) && compareValue(0, static_cast<int >(number), op); 214 return numberValue(value, number) && compareValue(0, static_cast<int >(number), op);
215 } 215 }
216 return false; 216 return false;
217 } 217 }
218 218
219 return colorMediaFeatureEval(value, op, mediaValues); 219 return colorMediaFeatureEval(value, op, mediaValues);
220 } 220 }
221 221
222 static bool displayModeMediaFeatureEval(const MediaQueryExpValue& value, MediaFe aturePrefix, const MediaValues& mediaValues) 222 static bool displayModeMediaFeatureEval(const MediaQueryExpValue& value, MediaFe aturePrefix, const MediaValues& mediaValues)
223 { 223 {
224 // isValid() is false if there is no parameter. Without parameter we should return true to indicate that
225 // displayModeMediaFeature is enabled in the browser.
226 if (!value.isValid())
227 return true;
228
224 if (!value.isID) 229 if (!value.isID)
225 return true; 230 return false;
226 231
227 WebDisplayMode mode = mediaValues.displayMode(); 232 WebDisplayMode mode = mediaValues.displayMode();
228 switch (value.id) { 233 switch (value.id) {
229 case CSSValueFullscreen: 234 case CSSValueFullscreen:
230 return mode == WebDisplayModeFullscreen; 235 return mode == WebDisplayModeFullscreen;
231 case CSSValueStandalone: 236 case CSSValueStandalone:
232 return mode == WebDisplayModeStandalone; 237 return mode == WebDisplayModeStandalone;
233 case CSSValueMinimalUi: 238 case CSSValueMinimalUi:
234 return mode == WebDisplayModeMinimalUi; 239 return mode == WebDisplayModeMinimalUi;
235 case CSSValueBrowser: 240 case CSSValueBrowser:
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 // Call the media feature evaluation function. Assume no prefix and let 659 // Call the media feature evaluation function. Assume no prefix and let
655 // trampoline functions override the prefix if prefix is used. 660 // trampoline functions override the prefix if prefix is used.
656 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl()); 661 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl());
657 if (func) 662 if (func)
658 return func(expr->expValue(), NoPrefix, *m_mediaValues); 663 return func(expr->expValue(), NoPrefix, *m_mediaValues);
659 664
660 return false; 665 return false;
661 } 666 }
662 667
663 } // namespace 668 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698