Reviewed by Andreas Kling.
Replace FLT_MAX with std::numeric_limits
https://bugs.webkit.org/show_bug.cgi?id=53861
Also move EFL's userIdleTime from TemporaryLinkStubs into SystemTimeEfl.
* html/NumberInputType.cpp:
* html/parser/HTMLParserIdioms.cpp:
(WebCore::parseToDoubleForNumberType):
* platform/brew/SystemTimeBrew.cpp:
(WebCore::userIdleTime):
* platform/efl/SystemTimeEfl.cpp:
(WebCore::userIdleTime):
* platform/efl/TemporaryLinkStubs.cpp:
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::setupAnimation):
* platform/win/SystemTimeWin.cpp:
(WebCore::userIdleTime):
* platform/wx/SystemTimeWx.cpp:
(WebCore::userIdleTime):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77774
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-02-06 Patrick Gansterer <paroga@webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ Replace FLT_MAX with std::numeric_limits
+ https://bugs.webkit.org/show_bug.cgi?id=53861
+
+ Also move EFL's userIdleTime from TemporaryLinkStubs into SystemTimeEfl.
+
+ * html/NumberInputType.cpp:
+ * html/parser/HTMLParserIdioms.cpp:
+ (WebCore::parseToDoubleForNumberType):
+ * platform/brew/SystemTimeBrew.cpp:
+ (WebCore::userIdleTime):
+ * platform/efl/SystemTimeEfl.cpp:
+ (WebCore::userIdleTime):
+ * platform/efl/TemporaryLinkStubs.cpp:
+ * platform/graphics/ca/GraphicsLayerCA.cpp:
+ (WebCore::GraphicsLayerCA::setupAnimation):
+ * platform/win/SystemTimeWin.cpp:
+ (WebCore::userIdleTime):
+ * platform/wx/SystemTimeWx.cpp:
+ (WebCore::userIdleTime):
+
2011-02-06 Patrick Gansterer <paroga@webkit.org>
Reviewed by Andreas Kling.
using namespace HTMLNames;
using namespace std;
-static const double numberDefaultMinimum = -FLT_MAX;
-static const double numberDefaultMaximum = FLT_MAX;
-
static const double numberDefaultStep = 1.0;
static const double numberStepScaleFactor = 1.0;
void NumberInputType::setValueAsNumber(double newValue, ExceptionCode& ec) const
{
- if (newValue < numberDefaultMinimum) {
+ if (newValue < -numeric_limits<float>::max()) {
ec = INVALID_STATE_ERR;
return;
}
- if (newValue > numberDefaultMaximum) {
+ if (newValue > numeric_limits<float>::max()) {
ec = INVALID_STATE_ERR;
return;
}
double NumberInputType::minimum() const
{
- return parseToDouble(element()->fastGetAttribute(minAttr), numberDefaultMinimum);
+ return parseToDouble(element()->fastGetAttribute(minAttr), -numeric_limits<float>::max());
}
double NumberInputType::maximum() const
{
- return parseToDouble(element()->fastGetAttribute(maxAttr), numberDefaultMaximum);
+ return parseToDouble(element()->fastGetAttribute(maxAttr), numeric_limits<float>::max());
}
bool NumberInputType::stepMismatch(const String& value, double step) const
#include "config.h"
#include "HTMLParserIdioms.h"
+#include <limits>
#include <wtf/MathExtras.h>
#include <wtf/dtoa.h>
#include <wtf/text/AtomicString.h>
// Numbers are considered finite IEEE 754 single-precision floating point values.
// See HTML5 2.4.4.3 `Real numbers.'
- if (-FLT_MAX > value || value > FLT_MAX)
+ if (-std::numeric_limits<float>::max() > value || value > std::numeric_limits<float>::max())
return false;
if (result) {
#include "config.h"
#include "SystemTime.h"
-#include <float.h>
+#include "NotImplemented.h"
+#include <limits>
namespace WebCore {
float userIdleTime()
{
- // return an arbitrarily high userIdleTime so that releasing pages from the page cache isn't postponed
- return FLT_MAX;
-}
-
+ notImplemented();
+ // Return an arbitrarily high userIdleTime so that releasing pages from the page cache isn't postponed.
+ return std::numeric_limits<float>::max();
}
+} // namespace WebCore
#include "config.h"
#include "SystemTime.h"
+#include "NotImplemented.h"
#include <Ecore.h>
+#include <limits>
namespace WebCore {
return ecore_time_get();
}
+float userIdleTime()
+{
+ notImplemented();
+ // Return an arbitrarily high userIdleTime so that releasing pages from the page cache isn't postponed.
+ return std::numeric_limits<float>::max();
}
+
+} // namespace WebCore
return String();
}
-float userIdleTime()
-{
- notImplemented();
- return FLT_MAX;
-}
-
void setCookieStoragePrivateBrowsingEnabled(bool)
{
notImplemented();
float repeatCount = anim->iterationCount();
if (repeatCount == Animation::IterationCountInfinite)
- repeatCount = FLT_MAX;
+ repeatCount = numeric_limits<float>::max();
else if (anim->direction() == Animation::AnimationDirectionAlternate)
repeatCount /= 2;
#include "config.h"
#include "SystemTime.h"
+#include <limits>
#include <windows.h>
-#if COMPILER(MINGW) || (PLATFORM(QT) && COMPILER(MSVC))
-#include <float.h>
-#define FLOAT_MAX FLT_MAX
-#endif
-
namespace WebCore {
float userIdleTime()
if (::GetLastInputInfo(&lastInputInfo))
return (GetTickCount() - lastInputInfo.dwTime) * 0.001; // ::GetTickCount returns ms of uptime valid for up to 49.7 days.
#endif
- return FLT_MAX; // return an arbitrarily high userIdleTime so that releasing pages from the page cache isn't postponed.
+ // Return an arbitrarily high userIdleTime so that releasing pages from the page cache isn't postponed.
+ return std::numeric_limits<float>::max();
}
-}
+} // namespace WebCore
#include "config.h"
#include "SystemTime.h"
-#include <float.h>
-
#include "NotImplemented.h"
+#include <limits>
namespace WebCore {
float userIdleTime()
{
notImplemented();
- // return an arbitrarily high userIdleTime so that releasing pages from the page cache isn't postponed
- return FLT_MAX;
-}
-
+ // Return an arbitrarily high userIdleTime so that releasing pages from the page cache isn't postponed.
+ return std::numeric_limits<float>::max();
}
+} // namespace WebCore