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

Unified Diff: Source/core/style/ComputedStyle.h

Issue 1193203003: Keep effectiveZoom finite (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Reduced clamp range; Remove clamp in CSSToLength... Created 5 years, 6 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/CSSToLengthConversionData.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/style/ComputedStyle.h
diff --git a/Source/core/style/ComputedStyle.h b/Source/core/style/ComputedStyle.h
index 84bca97d0b11b3746168b62dba3e15167982b0ef..4099c5d08cd2cce6ec766e0924838a74652b6ed3 100644
--- a/Source/core/style/ComputedStyle.h
+++ b/Source/core/style/ComputedStyle.h
@@ -1887,9 +1887,12 @@ inline bool ComputedStyle::setZoom(float f)
inline bool ComputedStyle::setEffectiveZoom(float f)
{
- if (compareEqual(rareInheritedData->m_effectiveZoom, f))
+ // Clamp the effective zoom value to a smaller (but hopeful still large
+ // enough) range, to avoid overflow in derived computations.
+ float clampedEffectiveZoom = clampTo<float>(f, 1e-6, 1e6);
+ if (compareEqual(rareInheritedData->m_effectiveZoom, clampedEffectiveZoom))
return false;
- rareInheritedData.access()->m_effectiveZoom = f;
+ rareInheritedData.access()->m_effectiveZoom = clampedEffectiveZoom;
return true;
}
« no previous file with comments | « Source/core/css/CSSToLengthConversionData.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698