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

Unified Diff: third_party/WebKit/Source/core/css/MediaQueryEvaluator.cpp

Issue 2863603002: Change Monochrome media query evaluator (Closed)
Patch Set: Add test Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/MediaQueryEvaluatorTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/MediaQueryEvaluator.cpp
diff --git a/third_party/WebKit/Source/core/css/MediaQueryEvaluator.cpp b/third_party/WebKit/Source/core/css/MediaQueryEvaluator.cpp
index 5de5c47dbe03711ef477f3e10437fd0603ae84dc..99238ea20c383fbeaf1c5e31d106f8c513053c0d 100644
--- a/third_party/WebKit/Source/core/css/MediaQueryEvaluator.cpp
+++ b/third_party/WebKit/Source/core/css/MediaQueryEvaluator.cpp
@@ -235,16 +235,13 @@ static bool ColorIndexMediaFeatureEval(const MediaQueryExpValue& value,
static bool MonochromeMediaFeatureEval(const MediaQueryExpValue& value,
MediaFeaturePrefix op,
const MediaValues& media_values) {
- if (!media_values.MonochromeBitsPerComponent()) {
- if (value.IsValid()) {
- float number;
- return NumberValue(value, number) &&
- CompareValue(0, static_cast<int>(number), op);
- }
- return false;
+ float number;
rune 2017/05/04 20:52:37 Nit: I think I'd put this declaration inside the i
+ int bits_per_component = media_values.MonochromeBitsPerComponent();
+ if (value.IsValid()) {
+ return NumberValue(value, number) &&
+ CompareValue(bits_per_component, static_cast<int>(number), op);
}
-
- return ColorMediaFeatureEval(value, op, media_values);
+ return bits_per_component != 0;
}
static bool DisplayModeMediaFeatureEval(const MediaQueryExpValue& value,
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/MediaQueryEvaluatorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698