Title: [94946] trunk
Revision
94946
Author
[email protected]
Date
2011-09-11 22:46:44 -0700 (Sun, 11 Sep 2011)

Log Message

Implement a ProgressEvent constructor for V8
https://bugs.webkit.org/show_bug.cgi?id=67800

Patch by Kentaro Hara <[email protected]> on 2011-09-11
Reviewed by Sam Weinig.

Source/WebCore:

Test: fast/events/constructors/progress-event-constructor.html

* bindings/js/JSDictionary.cpp:
(WebCore::JSDictionary::convertValue): Replaced UnsignedLongLongMax with std::numeric_limits<unsigned long long>::max().
* bindings/v8/OptionsObject.cpp:
(WebCore::OptionsObject::getKeyValue): Returns an unsigned long long value corresponding to a given key. Spec: http://www.w3.org/TR/WebIDL/#es-unsigned-long-long
* bindings/v8/OptionsObject.h:
* bindings/v8/custom/V8EventConstructors.cpp: Added the ProgressEvent constructor.
* dom/ProgressEvent.idl: Added a 'V8CustomConstructor' attribute.

LayoutTests:

Enabled fast/events/constructors/progress-event-constructor.html

* platform/chromium/test_expectations.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (94945 => 94946)


--- trunk/LayoutTests/ChangeLog	2011-09-12 05:26:25 UTC (rev 94945)
+++ trunk/LayoutTests/ChangeLog	2011-09-12 05:46:44 UTC (rev 94946)
@@ -1,3 +1,14 @@
+2011-09-11  Kentaro Hara  <[email protected]>
+
+        Implement a ProgressEvent constructor for V8
+        https://bugs.webkit.org/show_bug.cgi?id=67800
+
+        Reviewed by Sam Weinig.
+
+        Enabled fast/events/constructors/progress-event-constructor.html
+
+        * platform/chromium/test_expectations.txt:
+
 2011-09-11  Fumitoshi Ukai  <[email protected]>
 
         Unreviewed, update chromium test expectations.

Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (94945 => 94946)


--- trunk/LayoutTests/platform/chromium/test_expectations.txt	2011-09-12 05:26:25 UTC (rev 94945)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt	2011-09-12 05:46:44 UTC (rev 94946)
@@ -514,9 +514,6 @@
 // There's a missing glyph box in "full-time".
 BUGCR20547 WIN : fast/text/capitalize-boundaries.html = FAIL
 
-// This will soon be fixed after implementing a ProgressEvent constructor for V8.
-BUGWK67537 : fast/events/constructors/progress-event-constructor.html = FAIL
-
 // Different button line-heights, our behavior looks wrong.
 BUGCR20551 LINUX WIN : fast/replaced/table-percent-height.html = FAIL
 BUGCR20551 LINUX WIN : fast/replaced/table-percent-height-text-controls.html = FAIL

Modified: trunk/Source/WebCore/ChangeLog (94945 => 94946)


--- trunk/Source/WebCore/ChangeLog	2011-09-12 05:26:25 UTC (rev 94945)
+++ trunk/Source/WebCore/ChangeLog	2011-09-12 05:46:44 UTC (rev 94946)
@@ -1,3 +1,20 @@
+2011-09-11  Kentaro Hara  <[email protected]>
+
+        Implement a ProgressEvent constructor for V8
+        https://bugs.webkit.org/show_bug.cgi?id=67800
+
+        Reviewed by Sam Weinig.
+
+        Test: fast/events/constructors/progress-event-constructor.html
+
+        * bindings/js/JSDictionary.cpp:
+        (WebCore::JSDictionary::convertValue): Replaced UnsignedLongLongMax with std::numeric_limits<unsigned long long>::max().
+        * bindings/v8/OptionsObject.cpp:
+        (WebCore::OptionsObject::getKeyValue): Returns an unsigned long long value corresponding to a given key. Spec: http://www.w3.org/TR/WebIDL/#es-unsigned-long-long
+        * bindings/v8/OptionsObject.h:
+        * bindings/v8/custom/V8EventConstructors.cpp: Added the ProgressEvent constructor.
+        * dom/ProgressEvent.idl: Added a 'V8CustomConstructor' attribute.
+
 2011-09-11  Dimitri Glazkov  <[email protected]>
 
         REGRESSION (r87351): toggling display of lots (thousands) of elements with display:none is very slow

Modified: trunk/Source/WebCore/bindings/js/JSDictionary.cpp (94945 => 94946)


--- trunk/Source/WebCore/bindings/js/JSDictionary.cpp	2011-09-12 05:26:25 UTC (rev 94945)
+++ trunk/Source/WebCore/bindings/js/JSDictionary.cpp	2011-09-12 05:46:44 UTC (rev 94946)
@@ -37,8 +37,6 @@
 
 namespace WebCore {
 
-static const double UnsignedLongLongMax = 18446744073709551616.0; // 2^64
-
 JSDictionary::GetPropertyResult JSDictionary::tryGetProperty(const char* propertyName, JSValue& finalResult)
 {
     Identifier identifier(m_exec, propertyName);
@@ -83,7 +81,7 @@
     if (isnan(d) || isinf(d))
         result = 0;
     else
-        result = static_cast<unsigned long long>(fmod(trunc(d), UnsignedLongLongMax));
+        result = static_cast<unsigned long long>(fmod(trunc(d), std::numeric_limits<unsigned long long>::max() + 1.0));
 }
 
 void JSDictionary::convertValue(ExecState* exec, JSValue value, double& result)

Modified: trunk/Source/WebCore/bindings/v8/OptionsObject.cpp (94945 => 94946)


--- trunk/Source/WebCore/bindings/v8/OptionsObject.cpp	2011-09-12 05:26:25 UTC (rev 94945)
+++ trunk/Source/WebCore/bindings/v8/OptionsObject.cpp	2011-09-12 05:46:44 UTC (rev 94946)
@@ -180,4 +180,21 @@
     return true;
 }
 
+bool OptionsObject::getKeyValue(const String& key, unsigned long long& value) const
+{
+    v8::Local<v8::Value> v8Value;
+    if (!getKey(key, v8Value))
+        return false;
+
+    v8::Local<v8::Number> v8Number = v8Value->ToNumber();
+    if (v8Number.IsEmpty())
+        return false;
+    double d = v8Number->Value();
+    if (isnan(d) || isinf(d))
+        value = 0;
+    else
+        value = static_cast<unsigned long long>(fmod(trunc(d), std::numeric_limits<unsigned long long>::max() + 1.0));
+    return true;
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/bindings/v8/OptionsObject.h (94945 => 94946)


--- trunk/Source/WebCore/bindings/v8/OptionsObject.h	2011-09-12 05:26:25 UTC (rev 94945)
+++ trunk/Source/WebCore/bindings/v8/OptionsObject.h	2011-09-12 05:46:44 UTC (rev 94946)
@@ -77,6 +77,7 @@
         value = ScriptValue(v8Value);
         return true;
     }
+    bool getKeyValue(const String& key, unsigned long long& value) const;
 
 private:
     bool getKey(const String& key, v8::Local<v8::Value>&) const;

Modified: trunk/Source/WebCore/bindings/v8/custom/V8EventConstructors.cpp (94945 => 94946)


--- trunk/Source/WebCore/bindings/v8/custom/V8EventConstructors.cpp	2011-09-12 05:26:25 UTC (rev 94945)
+++ trunk/Source/WebCore/bindings/v8/custom/V8EventConstructors.cpp	2011-09-12 05:46:44 UTC (rev 94946)
@@ -35,6 +35,7 @@
 #include "Document.h"
 #include "DocumentFragment.h"
 #include "Node.h"
+#include "ProgressEvent.h"
 
 #include "OptionsObject.h"
 #include "V8Binding.h"
@@ -43,6 +44,7 @@
 #include "V8Document.h"
 #include "V8Event.h"
 #include "V8Node.h"
+#include "V8ProgressEvent.h"
 #include "V8Proxy.h"
 
 #include <wtf/RefPtr.h>
@@ -99,6 +101,7 @@
 
 INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY)
 INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_CUSTOM_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY)
+INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_PROGRESS_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY)
 
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/dom/ProgressEvent.idl (94945 => 94946)


--- trunk/Source/WebCore/dom/ProgressEvent.idl	2011-09-12 05:26:25 UTC (rev 94945)
+++ trunk/Source/WebCore/dom/ProgressEvent.idl	2011-09-12 05:46:44 UTC (rev 94946)
@@ -27,7 +27,8 @@
 
     interface [
         CanBeConstructed,
-        CustomConstructFunction
+        CustomConstructFunction,
+        V8CustomConstructor
     ] ProgressEvent : Event {
         readonly attribute boolean lengthComputable;
         readonly attribute unsigned long long loaded;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to