Changeset 94771 in webkit


Ignore:
Timestamp:
Sep 8, 2011 11:28:42 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Kentaro Hara <haraken@google.com> on 2011-09-08
Reviewed by Sam Weinig.

Source/WebCore:

The spec for the ProgressEvent constructor is here:
http://www.w3.org/TR/progress-events/#interface-progressevent

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

  • bindings/generic/EventConstructors.h: Added a definition for the ProgressEvent constructor.
  • bindings/js/JSDictionary.cpp:

(WebCore::JSDictionary::convertValue): Converts an ECMA-262 Number into an IDL unsigned long long value. Spec: http://www.w3.org/TR/WebIDL/#es-unsigned-long-long

  • bindings/js/JSEventConstructors.cpp: Added #includes for ProgressEvent.
  • dom/ProgressEvent.cpp:

(WebCore::ProgressEventInit::ProgressEventInit):
(WebCore::ProgressEvent::ProgressEvent):

  • dom/ProgressEvent.h: Added a definition for ProgressEventInit.

(WebCore::ProgressEvent::create):

  • dom/ProgressEvent.idl: Makes ProgressEvent constructible.

LayoutTests:

  • fast/events/constructors/progress-event-constructor-expected.txt: Added.
  • fast/events/constructors/progress-event-constructor.html: Added. Checks the behavior of the ProgressEvent constructor.
  • platform/chromium/test_expectations.txt: Skipped progress-event-constructor.html, since V8 does not yet have the ProgressEvent constructor.
Location:
trunk
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r94770 r94771  
     12011-09-08  Kentaro Hara  <haraken@google.com>
     2
     3        Implement a ProgressEvent constructor for JSC
     4        https://bugs.webkit.org/show_bug.cgi?id=67537
     5
     6        Reviewed by Sam Weinig.
     7
     8        * fast/events/constructors/progress-event-constructor-expected.txt: Added.
     9        * fast/events/constructors/progress-event-constructor.html: Added. Checks the behavior of the ProgressEvent constructor.
     10        * platform/chromium/test_expectations.txt: Skipped progress-event-constructor.html, since V8 does not yet have the ProgressEvent constructor.
     11
    1122011-09-08  Nate Chapin  <japhet@chromium.org>
    213
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r94763 r94771  
    504504// There's a missing glyph box in "full-time".
    505505BUGCR20547 WIN : fast/text/capitalize-boundaries.html = FAIL
     506
     507// This will soon be fixed after implementing a ProgressEvent constructor for V8.
     508BUGWK67537 : fast/events/constructors/progress-event-constructor.html = FAIL
    506509
    507510// Different button line-heights, our behavior looks wrong.
  • trunk/Source/WebCore/ChangeLog

    r94766 r94771  
     12011-09-08  Kentaro Hara  <haraken@google.com>
     2
     3        Implement a ProgressEvent constructor for JSC
     4        https://bugs.webkit.org/show_bug.cgi?id=67537
     5
     6        Reviewed by Sam Weinig.
     7
     8        The spec for the ProgressEvent constructor is here:
     9        http://www.w3.org/TR/progress-events/#interface-progressevent
     10
     11        Test: fast/events/constructors/progress-event-constructor.html
     12
     13        * bindings/generic/EventConstructors.h: Added a definition for the ProgressEvent constructor.
     14        * bindings/js/JSDictionary.cpp:
     15        (WebCore::JSDictionary::convertValue): Converts an ECMA-262 Number into an IDL unsigned long long value. Spec: http://www.w3.org/TR/WebIDL/#es-unsigned-long-long
     16        * bindings/js/JSEventConstructors.cpp: Added #includes for ProgressEvent.
     17        * dom/ProgressEvent.cpp:
     18        (WebCore::ProgressEventInit::ProgressEventInit):
     19        (WebCore::ProgressEvent::ProgressEvent):
     20        * dom/ProgressEvent.h: Added a definition for ProgressEventInit.
     21        (WebCore::ProgressEvent::create):
     22        * dom/ProgressEvent.idl: Makes ProgressEvent constructible.
     23
    1242011-09-08  Ryosuke Niwa  <rniwa@webkit.org>
    225
  • trunk/Source/WebCore/bindings/generic/EventConstructors.h

    r94147 r94771  
    4343    DICTIONARY_END(CustomEvent)
    4444
     45#define INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_PROGRESS_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
     46    \
     47    DICTIONARY_START(ProgressEvent) \
     48        FILL_PARENT_PROPERTIES(Event) \
     49        FILL_PROPERTY(lengthComputable) \
     50        FILL_PROPERTY(loaded) \
     51        FILL_PROPERTY(total) \
     52    DICTIONARY_END(ProgressEvent)
     53
    4554
    4655#define INSTANTIATE_ALL_EVENT_INITIALIZING_CONSTRUCTORS(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
    4756    INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
    4857    INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_CUSTOM_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
     58    INSTANTIATE_INITIALIZING_CONSTRUCTOR_FOR_PROGRESS_EVENT(DICTIONARY_START, DICTIONARY_END, FILL_PARENT_PROPERTIES, FILL_PROPERTY) \
    4959
    5060} // namespace WebCore
  • trunk/Source/WebCore/bindings/js/JSDictionary.cpp

    r94123 r94771  
    3737
    3838namespace WebCore {
     39
     40static const double UnsignedLongLongMax = 18446744073709551616.0; // 2^64
    3941
    4042JSDictionary::GetPropertyResult JSDictionary::tryGetProperty(const char* propertyName, JSValue& finalResult)
     
    7880void JSDictionary::convertValue(ExecState* exec, JSValue value, unsigned long long& result)
    7981{
    80     result = static_cast<unsigned long long>(value.toInteger(exec));
     82    double d = value.toNumber(exec);
     83    if (isnan(d) || isinf(d))
     84        result = 0;
     85    else
     86        result = static_cast<unsigned long long>(fmod(trunc(d), UnsignedLongLongMax));
    8187}
    8288
  • trunk/Source/WebCore/bindings/js/JSEventConstructors.cpp

    r94147 r94771  
    3232#include "JSDictionary.h"
    3333#include "JSEvent.h"
     34#include "JSProgressEvent.h"
     35#include "ProgressEvent.h"
    3436#include <runtime/Error.h>
    3537
  • trunk/Source/WebCore/dom/ProgressEvent.cpp

    r72985 r94771  
    2828
    2929namespace WebCore {
    30    
     30
     31ProgressEventInit::ProgressEventInit()
     32    : lengthComputable(false)
     33    , loaded(0)
     34    , total(0)
     35{
     36}
     37
    3138ProgressEvent::ProgressEvent()
    3239    : m_lengthComputable(false)
    3340    , m_loaded(0)
    3441    , m_total(0)
     42{
     43}
     44
     45ProgressEvent::ProgressEvent(const AtomicString& type, const ProgressEventInit& initializer)
     46    : Event(type, initializer)
     47    , m_lengthComputable(initializer.lengthComputable)
     48    , m_loaded(initializer.loaded)
     49    , m_total(initializer.total)
    3550{
    3651}
  • trunk/Source/WebCore/dom/ProgressEvent.h

    r72985 r94771  
    3030
    3131namespace WebCore {
    32    
     32
     33struct ProgressEventInit : public EventInit {
     34    ProgressEventInit();
     35
     36    bool lengthComputable;
     37    unsigned long long loaded;
     38    unsigned long long total;
     39};
     40
    3341class ProgressEvent : public Event {
    3442public:
     
    4048    {
    4149        return adoptRef(new ProgressEvent(type, lengthComputable, loaded, total));
     50    }
     51    static PassRefPtr<ProgressEvent> create(const AtomicString& type, const ProgressEventInit& initializer)
     52    {
     53        return adoptRef(new ProgressEvent(type, initializer));
    4254    }
    4355
     
    5264    ProgressEvent();
    5365    ProgressEvent(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total);
     66    ProgressEvent(const AtomicString&, const ProgressEventInit&);
    5467
    5568private:
  • trunk/Source/WebCore/dom/ProgressEvent.idl

    r91617 r94771  
    2626module events {
    2727
    28     interface ProgressEvent : Event {
     28    interface [
     29        CanBeConstructed,
     30        CustomConstructFunction
     31    ] ProgressEvent : Event {
    2932        readonly attribute boolean lengthComputable;
    3033        readonly attribute unsigned long long loaded;
Note: See TracChangeset for help on using the changeset viewer.