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

Unified Diff: Source/core/css/MediaQueryExp.cpp

Issue 427683002: Bug fix - rem & ch in MQs/sizes treated as unknown units (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix ch as well Created 6 years, 5 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 | « Source/core/css/CSSPrimitiveValue.cpp ('k') | Source/core/css/MediaQuerySetTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/MediaQueryExp.cpp
diff --git a/Source/core/css/MediaQueryExp.cpp b/Source/core/css/MediaQueryExp.cpp
index 253350d1da9e82a17d88230d3e71f61a8302ebcb..798fafe20d6a0bdb3cf385b78169e4c0c92c1e1f 100644
--- a/Source/core/css/MediaQueryExp.cpp
+++ b/Source/core/css/MediaQueryExp.cpp
@@ -67,9 +67,15 @@ static inline bool featureWithValidIdent(const String& mediaFeature, CSSValueID
return false;
}
+static bool positiveLengthUnit(const int unit)
+{
+ return ((unit >= CSSPrimitiveValue::CSS_EMS && unit <= CSSPrimitiveValue::CSS_PC)
+ || unit == CSSPrimitiveValue::CSS_REMS || unit == CSSPrimitiveValue::CSS_CHS);
alancutter (OOO until 2018) 2014/07/29 03:25:15 A switch would be more explicit and readable here.
+}
+
static inline bool featureWithValidPositiveLength(const String& mediaFeature, const CSSParserValue* value)
{
- if (!(((value->unit >= CSSPrimitiveValue::CSS_EMS && value->unit <= CSSPrimitiveValue::CSS_PC) || value->unit == CSSPrimitiveValue::CSS_REMS) || (value->unit == CSSPrimitiveValue::CSS_NUMBER && !(value->fValue))) || value->fValue < 0)
+ if (!(positiveLengthUnit(value->unit) || (value->unit == CSSPrimitiveValue::CSS_NUMBER && !(value->fValue))) || value->fValue < 0)
alancutter (OOO until 2018) 2014/07/29 03:25:15 It's within the style guide to make comparisons wi
return false;
« no previous file with comments | « Source/core/css/CSSPrimitiveValue.cpp ('k') | Source/core/css/MediaQuerySetTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698