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

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: 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 if (!value.isValid())
Mikhail 2015/10/13 14:01:16 would be nice to have a short comment here explain
225 return true;
226
224 if (!value.isID) 227 if (!value.isID)
225 return true; 228 return false;
226 229
227 WebDisplayMode mode = mediaValues.displayMode(); 230 WebDisplayMode mode = mediaValues.displayMode();
228 switch (value.id) { 231 switch (value.id) {
229 case CSSValueFullscreen: 232 case CSSValueFullscreen:
230 return mode == WebDisplayModeFullscreen; 233 return mode == WebDisplayModeFullscreen;
231 case CSSValueStandalone: 234 case CSSValueStandalone:
232 return mode == WebDisplayModeStandalone; 235 return mode == WebDisplayModeStandalone;
233 case CSSValueMinimalUi: 236 case CSSValueMinimalUi:
234 return mode == WebDisplayModeMinimalUi; 237 return mode == WebDisplayModeMinimalUi;
235 case CSSValueBrowser: 238 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 657 // Call the media feature evaluation function. Assume no prefix and let
655 // trampoline functions override the prefix if prefix is used. 658 // trampoline functions override the prefix if prefix is used.
656 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl()); 659 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl());
657 if (func) 660 if (func)
658 return func(expr->expValue(), NoPrefix, *m_mediaValues); 661 return func(expr->expValue(), NoPrefix, *m_mediaValues);
659 662
660 return false; 663 return false;
661 } 664 }
662 665
663 } // namespace 666 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698