Changeset 94946 in webkit


Ignore:
Timestamp:
Sep 11, 2011 10:46:44 PM (13 years ago)
Author:
hayato@chromium.org
Message:

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

Patch by Kentaro Hara <haraken@google.com> 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:
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r94945 r94946  
     12011-09-11  Kentaro Hara  <haraken@google.com>
     2
     3        Implement a ProgressEvent constructor for V8
     4        https://bugs.webkit.org/show_bug.cgi?id=67800
     5
     6        Reviewed by Sam Weinig.
     7
     8        Enabled fast/events/constructors/progress-event-constructor.html
     9
     10        * platform/chromium/test_expectations.txt:
     11
    1122011-09-11  Fumitoshi Ukai  <ukai@chromium.org>
    213
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r94945 r94946  
    514514// There's a missing glyph box in "full-time".
    515515BUGCR20547 WIN : fast/text/capitalize-boundaries.html = FAIL
    516 
    517 // This will soon be fixed after implementing a ProgressEvent constructor for V8.
    518 BUGWK67537 : fast/events/constructors/progress-event-constructor.html = FAIL
    519516
    520517// Different button line-heights, our behavior looks wrong.
  • trunk/Source/WebCore/ChangeLog

    r94938 r94946  
     12011-09-11  Kentaro Hara  <haraken@google.com>
     2
     3        Implement a ProgressEvent constructor for V8
     4        https://bugs.webkit.org/show_bug.cgi?id=67800
     5
     6        Reviewed by Sam Weinig.
     7
     8        Test: fast/events/constructors/progress-event-constructor.html
     9
     10        * bindings/js/JSDictionary.cpp:
     11        (WebCore::JSDictionary::convertValue): Replaced UnsignedLongLongMax with std::numeric_limits<unsigned long long>::max().
     12        * bindings/v8/OptionsObject.cpp:
     13        (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
     14        * bindings/v8/OptionsObject.h:
     15        * bindings/v8/custom/V8EventConstructors.cpp: Added the ProgressEvent constructor.
     16        * dom/ProgressEvent.idl: Added a 'V8CustomConstructor' attribute.
     17
    1182011-09-11  Dimitri Glazkov  <dglazkov@chromium.org>
    219
  • trunk/Source/WebCore/bindings/js/JSDictionary.cpp

    r94771 r94946  
    3737
    3838namespace WebCore {
    39 
    40 static const double UnsignedLongLongMax = 18446744073709551616.0; // 2^64
    4139
    4240JSDictionary::GetPropertyResult JSDictionary::tryGetProperty(const char* propertyName, JSValue& finalResult)
     
    8482        result = 0;
    8583    else
    86         result = static_cast<unsigned long long>(fmod(trunc(d), UnsignedLongLongMax));
     84        result = static_cast<unsigned long long>(fmod(trunc(d), std::numeric_limits<unsigned long long>::max() + 1.0));
    8785}
    8886
  • trunk/Source/WebCore/bindings/v8/OptionsObject.cpp

    r94424 r94946  
    181181}
    182182
     183bool OptionsObject::getKeyValue(const String& key, unsigned long long& value) const
     184{
     185    v8::Local<v8::Value> v8Value;
     186    if (!getKey(key, v8Value))
     187        return false;
     188
     189    v8::Local<v8::Number> v8Number = v8Value->ToNumber();
     190    if (v8Number.IsEmpty())
     191        return false;
     192    double d = v8Number->Value();
     193    if (isnan(d) || isinf(d))
     194        value = 0;
     195    else
     196        value = static_cast<unsigned long long>(fmod(trunc(d), std::numeric_limits<unsigned long long>::max() + 1.0));
     197    return true;
     198}
     199
    183200} // namespace WebCore
  • trunk/Source/WebCore/bindings/v8/OptionsObject.h

    r94480 r94946  
    7878        return true;
    7979    }
     80    bool getKeyValue(const String& key, unsigned long long& value) const;
    8081
    8182private:
  • trunk/Source/WebCore/bindings/v8/custom/V8EventConstructors.cpp

    r94480 r94946  
    3636#include "DocumentFragment.h"
    3737#include "Node.h"
     38#include "ProgressEvent.h"
    3839
    3940#include "OptionsObject.h"
     
    4445#include "V8Event.h"
    4546#include "V8Node.h"
     47#include "V8ProgressEvent.h"
    4648#include "V8Proxy.h"
    4749
     
    100102INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY)
    101103INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_CUSTOM_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY)
     104INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_PROGRESS_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY)
    102105
    103106
  • trunk/Source/WebCore/dom/ProgressEvent.idl

    r94771 r94946  
    2828    interface [
    2929        CanBeConstructed,
    30         CustomConstructFunction
     30        CustomConstructFunction,
     31        V8CustomConstructor
    3132    ] ProgressEvent : Event {
    3233        readonly attribute boolean lengthComputable;
Note: See TracChangeset for help on using the changeset viewer.