2011-02-06 Patrick Gansterer <paroga@webkit.org>
authorparoga@webkit.org <paroga@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 6 Feb 2011 18:44:24 +0000 (18:44 +0000)
committerparoga@webkit.org <paroga@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 6 Feb 2011 18:44:24 +0000 (18:44 +0000)
        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

Source/WebCore/ChangeLog
Source/WebCore/html/NumberInputType.cpp
Source/WebCore/html/parser/HTMLParserIdioms.cpp
Source/WebCore/platform/brew/SystemTimeBrew.cpp
Source/WebCore/platform/efl/SystemTimeEfl.cpp
Source/WebCore/platform/efl/TemporaryLinkStubs.cpp
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
Source/WebCore/platform/win/SystemTimeWin.cpp
Source/WebCore/platform/wx/SystemTimeWx.cpp

index 95c8c4ee3752583683862ad0c1c30b9bd6e33ef0..2d43eb043d66f52089f1f51b771170f6c1c694db 100644 (file)
@@ -1,3 +1,27 @@
+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.
index f09677643f59bf9da98c9bc53488977a28538fca..0011115b016688f146a03c0eaf615e418b290e64 100644 (file)
@@ -50,9 +50,6 @@ namespace WebCore {
 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;
 
@@ -85,11 +82,11 @@ double NumberInputType::valueAsNumber() const
 
 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;
     }
@@ -128,12 +125,12 @@ bool NumberInputType::supportsRangeLimitation() const
 
 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
index 91ff8d3ca2a77ffdacf87f2205e087e397f62a77..2be6af904278b9197cdba20debbbf5be2bef4473 100644 (file)
@@ -25,6 +25,7 @@
 #include "config.h"
 #include "HTMLParserIdioms.h"
 
+#include <limits>
 #include <wtf/MathExtras.h>
 #include <wtf/dtoa.h>
 #include <wtf/text/AtomicString.h>
@@ -85,7 +86,7 @@ bool parseToDoubleForNumberType(const String& string, double* result)
 
     // 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) {
index c1e39fb1c2b4ae9126103ec4f268b64033d74577..6e2fe7e1d5375b7edf48270868738c60ca152f8d 100644 (file)
 #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
index de8c87c877e582eeaa9257f65cadab7c7c115cf4..ec6d662554d4a2f591a2ee382cf501369f177e63 100644 (file)
@@ -28,7 +28,9 @@
 #include "config.h"
 #include "SystemTime.h"
 
+#include "NotImplemented.h"
 #include <Ecore.h>
+#include <limits>
 
 namespace WebCore {
 
@@ -37,4 +39,11 @@ double currentTime()
     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
index ef6e6f7916acaaa0e4691cc8035bd41f87f44ae9..07ea2e69ef450fade0312a2f4c0380d40a81ae91 100644 (file)
@@ -56,12 +56,6 @@ String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String &ch
     return String();
 }
 
-float userIdleTime()
-{
-    notImplemented();
-    return FLT_MAX;
-}
-
 void setCookieStoragePrivateBrowsingEnabled(bool)
 {
     notImplemented();
index 01e25e96f970ecab1a9b9a3a2a57607b01b8e7f5..13ea923a4e877c00c7cbe7466230564c569d4190 100644 (file)
@@ -1646,7 +1646,7 @@ void GraphicsLayerCA::setupAnimation(PlatformCAAnimation* propertyAnim, const An
 
     float repeatCount = anim->iterationCount();
     if (repeatCount == Animation::IterationCountInfinite)
-        repeatCount = FLT_MAX;
+        repeatCount = numeric_limits<float>::max();
     else if (anim->direction() == Animation::AnimationDirectionAlternate)
         repeatCount /= 2;
 
index 451262d812dc362f17aef6f2a74ac30562e167bf..547decc46a4f1ce5fe1a04d476bc0787e89d843e 100644 (file)
 #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()
@@ -43,7 +39,8 @@ 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
index f607cba277b34283a425fc99bf3314ad952108a3..668ec000e89a1f12b36692795247086533272be5 100644 (file)
 #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