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

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

Issue 252743004: A thread safe CSS calc parser for sizes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed CSSCalc tests that assert Created 6 years, 8 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/core.gypi ('k') | Source/core/css/MediaValues.cpp » ('j') | 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 c163bb682bd524dcf5ae07770b6c61bebc5bfd16..a4f8d737e8312daefd84df64059499225c9f27e5 100644
--- a/Source/core/css/MediaValues.h
+++ b/Source/core/css/MediaValues.h
@@ -35,8 +35,19 @@ public:
static PassRefPtr<MediaValues> createDynamicIfFrameExists(LocalFrame*);
virtual PassRefPtr<MediaValues> copy() const = 0;
virtual bool isSafeToSendToAnotherThread() const = 0;
- static bool computeLength(double value, CSSPrimitiveValue::UnitTypes, unsigned defaultFontSize, unsigned viewportWidth, unsigned viewportHeight, int& result);
+
+ static bool computeLengthImpl(double value, CSSPrimitiveValue::UnitTypes, unsigned defaultFontSize, unsigned viewportWidth, unsigned viewportHeight, double& result);
+ template<typename T>
+ static bool computeLength(double value, CSSPrimitiveValue::UnitTypes type, unsigned defaultFontSize, unsigned viewportWidth, unsigned viewportHeight, T& result)
+ {
+ double tempResult;
+ if (!computeLengthImpl(value, type, defaultFontSize, viewportWidth, viewportHeight, tempResult))
+ return false;
+ result = roundForImpreciseConversion<T>(tempResult);
+ return true;
+ }
virtual bool computeLength(double value, CSSPrimitiveValue::UnitTypes, int& result) const = 0;
+ virtual bool computeLength(double value, CSSPrimitiveValue::UnitTypes, double& result) const = 0;
virtual int viewportWidth() const = 0;
virtual int viewportHeight() const = 0;
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/css/MediaValues.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698