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

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

Issue 644813005: Floating point MQs should not match. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/css/MediaQueryEvaluator.cpp
diff --git a/Source/core/css/MediaQueryEvaluator.cpp b/Source/core/css/MediaQueryEvaluator.cpp
index 7a3b245983d1403c1591a3c0bace57dad15ab948..f10123c27ef0fdb93c6e0d44c9a3bdbf8c1ef4d1 100644
--- a/Source/core/css/MediaQueryEvaluator.cpp
+++ b/Source/core/css/MediaQueryEvaluator.cpp
@@ -326,7 +326,7 @@ static bool gridMediaFeatureEval(const MediaQueryExpValue& value, MediaFeaturePr
return false;
}
-static bool computeLength(const MediaQueryExpValue& value, const MediaValues& mediaValues, int& result)
+static bool computeLength(const MediaQueryExpValue& value, const MediaValues& mediaValues, float& result)
{
if (!value.isValue)
return false;
@@ -344,8 +344,8 @@ static bool computeLength(const MediaQueryExpValue& value, const MediaValues& me
static bool deviceHeightMediaFeatureEval(const MediaQueryExpValue& value, MediaFeaturePrefix op, const MediaValues& mediaValues)
{
if (value.isValid()) {
- int length;
- return computeLength(value, mediaValues, length) && compareValue(static_cast<int>(mediaValues.deviceHeight()), length, op);
+ float length;
+ return computeLength(value, mediaValues, length) && compareValue(static_cast<float>(mediaValues.deviceHeight()), length, op);
}
// ({,min-,max-}device-height)
// assume if we have a device, assume non-zero
@@ -355,8 +355,8 @@ static bool deviceHeightMediaFeatureEval(const MediaQueryExpValue& value, MediaF
static bool deviceWidthMediaFeatureEval(const MediaQueryExpValue& value, MediaFeaturePrefix op, const MediaValues& mediaValues)
{
if (value.isValid()) {
- int length;
- return computeLength(value, mediaValues, length) && compareValue(static_cast<int>(mediaValues.deviceWidth()), length, op);
+ float length;
+ return computeLength(value, mediaValues, length) && compareValue(static_cast<float>(mediaValues.deviceWidth()), length, op);
}
// ({,min-,max-}device-width)
// assume if we have a device, assume non-zero
@@ -365,9 +365,9 @@ static bool deviceWidthMediaFeatureEval(const MediaQueryExpValue& value, MediaFe
static bool heightMediaFeatureEval(const MediaQueryExpValue& value, MediaFeaturePrefix op, const MediaValues& mediaValues)
{
- int height = mediaValues.viewportHeight();
+ float height = mediaValues.viewportHeight();
if (value.isValid()) {
- int length;
+ float length;
return computeLength(value, mediaValues, length) && compareValue(height, length, op);
}
@@ -376,9 +376,9 @@ static bool heightMediaFeatureEval(const MediaQueryExpValue& value, MediaFeature
static bool widthMediaFeatureEval(const MediaQueryExpValue& value, MediaFeaturePrefix op, const MediaValues& mediaValues)
{
- int width = mediaValues.viewportWidth();
+ float width = mediaValues.viewportWidth();
if (value.isValid()) {
- int length;
+ float length;
return computeLength(value, mediaValues, length) && compareValue(width, length, op);
}
« no previous file with comments | « no previous file | Source/core/css/MediaQueryEvaluatorTest.cpp » ('j') | Source/core/css/MediaQueryEvaluatorTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698