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

Unified Diff: Source/core/css/MediaValues.h

Issue 639783002: Media query values should not be 0 when overflowed (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
« no previous file with comments | « LayoutTests/fast/media/media-query-overflow-value-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/MediaValues.h
diff --git a/Source/core/css/MediaValues.h b/Source/core/css/MediaValues.h
index d306ac43029692f7d6a8f4cab5a4abb09f1f26d8..0ab4a9a97c3a75d09950f3cf06f9f1ccf8d8a9fd 100644
--- a/Source/core/css/MediaValues.h
+++ b/Source/core/css/MediaValues.h
@@ -37,7 +37,14 @@ public:
double tempResult;
if (!computeLengthImpl(value, type, defaultFontSize, viewportWidth, viewportHeight, tempResult))
return false;
- result = roundForImpreciseConversion<T>(tempResult);
+
+ if (tempResult > std::numeric_limits<T>::max())
+ result = std::numeric_limits<T>::max();
+ else if (tempResult < std::numeric_limits<T>::min())
+ result = std::numeric_limits<T>::min();
+ else
+ result = static_cast<T>(tempResult);
rune 2014/10/08 12:26:39 There is a clampTo templated method you could use.
+
return true;
}
virtual bool computeLength(double value, CSSPrimitiveValue::UnitType, int& result) const = 0;
« no previous file with comments | « LayoutTests/fast/media/media-query-overflow-value-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698