Changeset 140657 in webkit


Ignore:
Timestamp:
Jan 23, 2013 11:42:07 PM (11 years ago)
Author:
haraken@chromium.org
Message:

Implement MouseEvent constructor
https://bugs.webkit.org/show_bug.cgi?id=107630

Reviewed by Adam Barth.

Spec: https://dvcs.w3.org/hg/d4e/raw-file/tip/source_respec.htm

Source/WebCore:

The MouseEvent constructor should be implemented under a DOM4_EVENTS_CONSTRUCTOR flag.
This significantly simplifies JavaScript code to construct a MouseEvent.

Before:

event = document.createEvent("MouseEvents");
event.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);

After:

event = new MouseEvent("click");

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

  • bindings/scripts/CodeGenerator.pm:

(IsSubType):
(IsInheritExtendedAttribute):

  • bindings/scripts/CodeGeneratorV8.pm:

(GenerateHeader):
(GenerateNamedConstructorCallback):
(GenerateImplementation):

  • bindings/scripts/test/V8/V8Float64Array.cpp:

(WebCore):
(WebCore::V8Float64Array::createWrapper):

  • bindings/scripts/test/V8/V8TestActiveDOMObject.cpp:

(WebCore):
(WebCore::V8TestActiveDOMObject::createWrapper):

  • bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp:

(WebCore):
(WebCore::V8TestCustomNamedGetter::createWrapper):

  • bindings/scripts/test/V8/V8TestEventConstructor.cpp:

(WebCore):
(WebCore::V8TestEventConstructor::createWrapper):

  • bindings/scripts/test/V8/V8TestEventTarget.cpp:

(WebCore):
(WebCore::V8TestEventTarget::toEventTarget):
(WebCore::V8TestEventTarget::createWrapper):

  • bindings/scripts/test/V8/V8TestEventTarget.h:

(V8TestEventTarget):

  • bindings/scripts/test/V8/V8TestException.cpp:

(WebCore):
(WebCore::V8TestException::createWrapper):

  • bindings/scripts/test/V8/V8TestInterface.cpp:

(WebCore):
(WebCore::V8TestInterface::toActiveDOMObject):
(WebCore::V8TestInterface::createWrapper):

  • bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp:

(WebCore):
(WebCore::V8TestMediaQueryListListener::createWrapper):

  • bindings/scripts/test/V8/V8TestNamedConstructor.cpp:

(WebCore):
(WebCore::V8TestNamedConstructor::toActiveDOMObject):
(WebCore::V8TestNamedConstructor::createWrapper):

  • bindings/scripts/test/V8/V8TestNode.cpp:

(WebCore):
(WebCore::V8TestNode::toEventTarget):
(WebCore::V8TestNode::createWrapper):

  • bindings/scripts/test/V8/V8TestNode.h:

(V8TestNode):

  • bindings/scripts/test/V8/V8TestObj.cpp:

(WebCore):
(WebCore::V8TestObj::createWrapper):

  • bindings/scripts/test/V8/V8TestOverloadedConstructors.cpp:

(WebCore):
(WebCore::V8TestOverloadedConstructors::createWrapper):

  • bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp:

(WebCore):
(WebCore::V8TestSerializedScriptValueInterface::createWrapper):

  • bindings/v8/Dictionary.cpp:

(WebCore::Dictionary::get):
(WebCore):

  • bindings/v8/Dictionary.h:

(Dictionary):

  • bindings/v8/NPV8Object.cpp:

(WebCore::npObjectTypeInfo):

  • bindings/v8/V8DOMWrapper.cpp:

(WebCore::V8DOMWrapper::isDOMWrapper):
(WebCore):

  • bindings/v8/V8DOMWrapper.h:

(V8DOMWrapper):

  • bindings/v8/WrapperTypeInfo.h:

(WebCore):
(WebCore::WrapperTypeInfo::toEventTarget):
(WrapperTypeInfo):

  • bindings/v8/custom/V8HTMLImageElementConstructor.cpp:

(WebCore):

  • dom/MouseEvent.cpp:

(WebCore::MouseEventInit::MouseEventInit):
(WebCore):
(WebCore::MouseEvent::create):
(WebCore::MouseEvent::MouseEvent):

  • dom/MouseEvent.h:

(MouseEventInit):
(WebCore):
(MouseEvent):
(WebCore::MouseEvent::create):
(WebCore::MouseEvent::button):
(WebCore::MouseEvent::buttonDown):
(WebCore::MouseEvent::relatedTarget):
(WebCore::MouseEvent::setRelatedTarget):
(WebCore::MouseEvent::clipboard):
(WebCore::MouseEvent::dataTransfer):

  • dom/MouseEvent.idl:

LayoutTests:

The MouseEvent constructor should be implemented under a DOM4_EVENTS_CONSTRUCTOR flag.

  • fast/dom/constructed-objects-prototypes-expected.txt:
  • fast/dom/dom-constructors-expected.txt:
  • fast/dom/dom-constructors.html:
  • fast/events/constructors/mouse-event-constructor-expected.txt: Added.
  • fast/events/constructors/mouse-event-constructor.html: Added.
  • platform/efl/TestExpectations:
  • platform/gtk/TestExpectations:
  • platform/qt/TestExpectations:
  • platform/win/TestExpectations:
  • platform/wincairo/TestExpectations:
Location:
trunk
Files:
2 added
37 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r140654 r140657  
     12013-01-23  Kentaro Hara  <haraken@chromium.org>
     2
     3        Implement MouseEvent constructor
     4        https://bugs.webkit.org/show_bug.cgi?id=107630
     5
     6        Reviewed by Adam Barth.
     7
     8        Spec: https://dvcs.w3.org/hg/d4e/raw-file/tip/source_respec.htm
     9
     10        The MouseEvent constructor should be implemented under a DOM4_EVENTS_CONSTRUCTOR flag.
     11
     12        * fast/dom/constructed-objects-prototypes-expected.txt:
     13        * fast/dom/dom-constructors-expected.txt:
     14        * fast/dom/dom-constructors.html:
     15        * fast/events/constructors/mouse-event-constructor-expected.txt: Added.
     16        * fast/events/constructors/mouse-event-constructor.html: Added.
     17        * platform/efl/TestExpectations:
     18        * platform/gtk/TestExpectations:
     19        * platform/qt/TestExpectations:
     20        * platform/win/TestExpectations:
     21        * platform/wincairo/TestExpectations:
     22
    1232013-01-23  Yoshifumi Inoue  <yosin@chromium.org>
    224
  • trunk/LayoutTests/fast/dom/constructed-objects-prototypes-expected.txt

    r140493 r140657  
    3232PASS (new inner.MessageEvent()).isInner is true
    3333PASS (new inner.MessageEvent()).constructor.isInner is true
     34PASS (new inner.MouseEvent()).isInner is true
     35PASS (new inner.MouseEvent()).constructor.isInner is true
    3436PASS (new inner.Option()).isInner is true
    3537PASS (new inner.Option()).constructor.isInner is true
  • trunk/LayoutTests/fast/dom/dom-constructors-expected.txt

    r140493 r140657  
    9797PASS TryAllocate('MimeType') is 'exception'
    9898PASS TryAllocate('MimeTypeArray') is 'exception'
    99 PASS TryAllocate('MouseEvent') is 'exception'
    10099PASS TryAllocate('MutationEvent') is 'exception'
    101100PASS TryAllocate('NamedNodeMap') is 'exception'
  • trunk/LayoutTests/fast/dom/dom-constructors.html

    r140493 r140657  
    4444    'CSSValue', 'CSSValueList', 'DOMImplementation',
    4545    'HTMLCollection', 'KeyboardEvent', 'MediaList', 'MimeType',
    46     'MimeTypeArray', 'MouseEvent', 'MutationEvent', 'NamedNodeMap',
     46    'MimeTypeArray', 'MutationEvent', 'NamedNodeMap',
    4747    'NodeFilter', 'NodeList', 'Plugin',
    4848    'PluginArray', 'Range', 'Rect', 'StyleSheet', 'StyleSheetList',
  • trunk/LayoutTests/platform/efl/TestExpectations

    r140517 r140657  
    12301230# DOM4_EVENTS_CONSTRUCTOR is not yet enabled.
    12311231webkit.org/b/107428 fast/events/constructors/ui-event-constructor.html [ Skip ]
     1232webkit.org/b/107428 fast/events/constructors/mouse-event-constructor.html [ Skip ]
    12321233
    12331234# Requires support for Web notifications
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r140631 r140657  
    374374# DOM4_EVENTS_CONSTRUCTOR is not yet enabled.
    375375webkit.org/b/107428 fast/events/constructors/ui-event-constructor.html [ Skip ]
     376webkit.org/b/107428 fast/events/constructors/mouse-event-constructor.html [ Skip ]
    376377
    377378# No CORS support for media elements is implemented yet.
  • trunk/LayoutTests/platform/qt/TestExpectations

    r140631 r140657  
    107107# ENABLE(DOM4_EVENTS_CONSTRUCTOR) is disabled.
    108108fast/events/constructors/ui-event-constructor.html
     109fast/events/constructors/mouse-event-constructor.html
    109110
    110111# ENABLE(INDEXED_DATABASE) is disabled.
  • trunk/LayoutTests/platform/win/TestExpectations

    r140631 r140657  
    12131213# DOM4_EVENTS_CONSTRUCTOR is not yet enabled.
    12141214fast/events/constructors/ui-event-constructor.html
     1215fast/events/constructors/mouse-event-constructor.html
    12151216
    12161217# Disable until the windows WebKit API supports injecting in the top frame only.
  • trunk/LayoutTests/platform/wincairo/TestExpectations

    r140631 r140657  
    17401740# DOM4_EVENTS_CONSTRUCTOR is not yet enabled.
    17411741fast/events/constructors/ui-event-constructor.html
     1742fast/events/constructors/mouse-event-constructor.html
    17421743
    17431744# Disable until the windows WebKit API supports injecting in the top frame only.
  • trunk/Source/WebCore/ChangeLog

    r140655 r140657  
     12013-01-23  Kentaro Hara  <haraken@chromium.org>
     2
     3        Implement MouseEvent constructor
     4        https://bugs.webkit.org/show_bug.cgi?id=107630
     5
     6        Reviewed by Adam Barth.
     7
     8        Spec: https://dvcs.w3.org/hg/d4e/raw-file/tip/source_respec.htm
     9
     10        The MouseEvent constructor should be implemented under a DOM4_EVENTS_CONSTRUCTOR flag.
     11        This significantly simplifies JavaScript code to construct a MouseEvent.
     12
     13        Before:
     14          event = document.createEvent("MouseEvents");
     15          event.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
     16
     17        After:
     18          event = new MouseEvent("click");
     19
     20        Test: fast/events/constructors/mouse-event-constructor.html
     21
     22        * bindings/scripts/CodeGenerator.pm:
     23        (IsSubType):
     24        (IsInheritExtendedAttribute):
     25        * bindings/scripts/CodeGeneratorV8.pm:
     26        (GenerateHeader):
     27        (GenerateNamedConstructorCallback):
     28        (GenerateImplementation):
     29        * bindings/scripts/test/V8/V8Float64Array.cpp:
     30        (WebCore):
     31        (WebCore::V8Float64Array::createWrapper):
     32        * bindings/scripts/test/V8/V8TestActiveDOMObject.cpp:
     33        (WebCore):
     34        (WebCore::V8TestActiveDOMObject::createWrapper):
     35        * bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp:
     36        (WebCore):
     37        (WebCore::V8TestCustomNamedGetter::createWrapper):
     38        * bindings/scripts/test/V8/V8TestEventConstructor.cpp:
     39        (WebCore):
     40        (WebCore::V8TestEventConstructor::createWrapper):
     41        * bindings/scripts/test/V8/V8TestEventTarget.cpp:
     42        (WebCore):
     43        (WebCore::V8TestEventTarget::toEventTarget):
     44        (WebCore::V8TestEventTarget::createWrapper):
     45        * bindings/scripts/test/V8/V8TestEventTarget.h:
     46        (V8TestEventTarget):
     47        * bindings/scripts/test/V8/V8TestException.cpp:
     48        (WebCore):
     49        (WebCore::V8TestException::createWrapper):
     50        * bindings/scripts/test/V8/V8TestInterface.cpp:
     51        (WebCore):
     52        (WebCore::V8TestInterface::toActiveDOMObject):
     53        (WebCore::V8TestInterface::createWrapper):
     54        * bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp:
     55        (WebCore):
     56        (WebCore::V8TestMediaQueryListListener::createWrapper):
     57        * bindings/scripts/test/V8/V8TestNamedConstructor.cpp:
     58        (WebCore):
     59        (WebCore::V8TestNamedConstructor::toActiveDOMObject):
     60        (WebCore::V8TestNamedConstructor::createWrapper):
     61        * bindings/scripts/test/V8/V8TestNode.cpp:
     62        (WebCore):
     63        (WebCore::V8TestNode::toEventTarget):
     64        (WebCore::V8TestNode::createWrapper):
     65        * bindings/scripts/test/V8/V8TestNode.h:
     66        (V8TestNode):
     67        * bindings/scripts/test/V8/V8TestObj.cpp:
     68        (WebCore):
     69        (WebCore::V8TestObj::createWrapper):
     70        * bindings/scripts/test/V8/V8TestOverloadedConstructors.cpp:
     71        (WebCore):
     72        (WebCore::V8TestOverloadedConstructors::createWrapper):
     73        * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp:
     74        (WebCore):
     75        (WebCore::V8TestSerializedScriptValueInterface::createWrapper):
     76        * bindings/v8/Dictionary.cpp:
     77        (WebCore::Dictionary::get):
     78        (WebCore):
     79        * bindings/v8/Dictionary.h:
     80        (Dictionary):
     81        * bindings/v8/NPV8Object.cpp:
     82        (WebCore::npObjectTypeInfo):
     83        * bindings/v8/V8DOMWrapper.cpp:
     84        (WebCore::V8DOMWrapper::isDOMWrapper):
     85        (WebCore):
     86        * bindings/v8/V8DOMWrapper.h:
     87        (V8DOMWrapper):
     88        * bindings/v8/WrapperTypeInfo.h:
     89        (WebCore):
     90        (WebCore::WrapperTypeInfo::toEventTarget):
     91        (WrapperTypeInfo):
     92        * bindings/v8/custom/V8HTMLImageElementConstructor.cpp:
     93        (WebCore):
     94        * dom/MouseEvent.cpp:
     95        (WebCore::MouseEventInit::MouseEventInit):
     96        (WebCore):
     97        (WebCore::MouseEvent::create):
     98        (WebCore::MouseEvent::MouseEvent):
     99        * dom/MouseEvent.h:
     100        (MouseEventInit):
     101        (WebCore):
     102        (MouseEvent):
     103        (WebCore::MouseEvent::create):
     104        (WebCore::MouseEvent::button):
     105        (WebCore::MouseEvent::buttonDown):
     106        (WebCore::MouseEvent::relatedTarget):
     107        (WebCore::MouseEvent::setRelatedTarget):
     108        (WebCore::MouseEvent::clipboard):
     109        (WebCore::MouseEvent::dataTransfer):
     110        * dom/MouseEvent.idl:
     111
    11122013-01-23  Kent Tamura  <tkent@chromium.org>
    2113
  • trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm

    r140303 r140657  
    733733}
    734734
     735# FIXME: Rename to InheritsInterface
    735736sub IsSubType
    736737{
     
    746747            $found = 1;
    747748        }
    748         return "prune" if $found;
     749        return 1 if $found;
    749750    }, 0, 1);
    750751
     
    752753}
    753754
     755sub InheritsExtendedAttribute
     756{
     757    my $object = shift;
     758    my $interface = shift;
     759    my $extendedAttribute = shift;
     760    my $found = 0;
     761
     762    return 1 if $interface->extendedAttributes->{$extendedAttribute};
     763    $object->ForAllParents($interface, sub {
     764        my $currentInterface = shift;
     765        if ($currentInterface->extendedAttributes->{$extendedAttribute}) {
     766            $found = 1;
     767        }
     768        return 1 if $found;
     769    }, 0, 1);
     770
     771    return $found;
     772}
     773
    7547741;
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm

    r140624 r140657  
    372372    if ($interface->extendedAttributes->{"ActiveDOMObject"}) {
    373373        push(@headerContent, "    static ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object>);\n");
     374    }
     375
     376    if ($codeGenerator->InheritsExtendedAttribute($interface, "EventTarget")) {
     377        push(@headerContent, "    static EventTarget* toEventTarget(v8::Handle<v8::Object>);\n");
    374378    }
    375379
     
    20962100        $toActiveDOMObject = "${v8InterfaceName}::toActiveDOMObject";
    20972101    }
     2102
     2103    my $toEventTarget = "0";
     2104    if ($codeGenerator->InheritsExtendedAttribute($interface, "EventTarget")) {
     2105        $toEventTarget = "${v8InterfaceName}::toEventTarget";
     2106    }
     2107
    20982108    AddToImplIncludes("Frame.h");
    2099 
    21002109    push(@implContent, <<END);
    2101 WrapperTypeInfo ${v8InterfaceName}Constructor::info = { ${v8InterfaceName}Constructor::GetTemplate, ${v8InterfaceName}::derefObject, ${toActiveDOMObject}, 0, ${v8InterfaceName}::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
     2110WrapperTypeInfo ${v8InterfaceName}Constructor::info = { ${v8InterfaceName}Constructor::GetTemplate, ${v8InterfaceName}::derefObject, $toActiveDOMObject, $toEventTarget, 0, ${v8InterfaceName}::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
    21022111
    21032112static v8::Handle<v8::Value> ${v8InterfaceName}ConstructorCallback(const v8::Arguments& args)
     
    26192628    AddIncludesForType($interfaceName);
    26202629
    2621     my $toActive = $interface->extendedAttributes->{"ActiveDOMObject"} ? "${v8InterfaceName}::toActiveDOMObject" : "0";
     2630    my $toActiveDOMObject = $interface->extendedAttributes->{"ActiveDOMObject"} ? "${v8InterfaceName}::toActiveDOMObject" : "0";
     2631    my $toEventTarget = $codeGenerator->InheritsExtendedAttribute($interface, "EventTarget") ? "${v8InterfaceName}::toEventTarget" : "0";
    26222632    my $rootForGC = NeedsCustomOpaqueRootForGC($interface) ? "${v8InterfaceName}::opaqueRootForGC" : "0";
    26232633
     
    26372647    my $WrapperTypePrototype = $interface->isException ? "WrapperTypeErrorPrototype" : "WrapperTypeObjectPrototype";
    26382648
    2639     push(@implContentDecls, "WrapperTypeInfo ${v8InterfaceName}::info = { ${v8InterfaceName}::GetTemplate, ${v8InterfaceName}::derefObject, $toActive, $rootForGC, ${v8InterfaceName}::installPerContextPrototypeProperties, $parentClassInfo, $WrapperTypePrototype };\n\n");
     2649    push(@implContentDecls, "WrapperTypeInfo ${v8InterfaceName}::info = { ${v8InterfaceName}::GetTemplate, ${v8InterfaceName}::derefObject, $toActiveDOMObject, $toEventTarget, $rootForGC, ${v8InterfaceName}::installPerContextPrototypeProperties, $parentClassInfo, $WrapperTypePrototype };\n\n");
    26402650    push(@implContentDecls, "namespace ${interfaceName}V8Internal {\n\n");
    26412651
     
    31223132        push(@implContent, <<END);
    31233133}
     3134
    31243135END
    31253136    }
     
    31553166        push(@implContent, <<END);
    31563167}
     3168
    31573169END
    31583170    }
     
    31653177ActiveDOMObject* ${v8InterfaceName}::toActiveDOMObject(v8::Handle<v8::Object> object)
    31663178{
    3167     return ${returnValue};
    3168 }     
     3179    return $returnValue;
     3180}
     3181
     3182END
     3183    }
     3184
     3185    if ($codeGenerator->InheritsExtendedAttribute($interface, "EventTarget")) {
     3186        push(@implContent, <<END);
     3187EventTarget* ${v8InterfaceName}::toEventTarget(v8::Handle<v8::Object> object)
     3188{
     3189    return toNative(object);
     3190}
     3191
    31693192END
    31703193    }
     
    31813204    return V8DOMWindowShadowObjectCache;
    31823205}
     3206
    31833207END
    31843208    }
     
    31873211
    31883212    push(@implContent, <<END);
    3189 
    31903213void ${v8InterfaceName}::derefObject(void* object)
    31913214{
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp

    r140616 r140657  
    4343namespace WebCore {
    4444
    45 WrapperTypeInfo V8Float64Array::info = { V8Float64Array::GetTemplate, V8Float64Array::derefObject, 0, 0, V8Float64Array::installPerContextPrototypeProperties, &V8ArrayBufferView::info, WrapperTypeObjectPrototype };
     45WrapperTypeInfo V8Float64Array::info = { V8Float64Array::GetTemplate, V8Float64Array::derefObject, 0, 0, 0, V8Float64Array::installPerContextPrototypeProperties, &V8ArrayBufferView::info, WrapperTypeObjectPrototype };
    4646
    4747namespace Float64ArrayV8Internal {
     
    163163    return wrapper;
    164164}
    165 
    166165void V8Float64Array::derefObject(void* object)
    167166{
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp

    r140616 r140657  
    3434namespace WebCore {
    3535
    36 WrapperTypeInfo V8TestActiveDOMObject::info = { V8TestActiveDOMObject::GetTemplate, V8TestActiveDOMObject::derefObject, 0, 0, V8TestActiveDOMObject::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
     36WrapperTypeInfo V8TestActiveDOMObject::info = { V8TestActiveDOMObject::GetTemplate, V8TestActiveDOMObject::derefObject, 0, 0, 0, V8TestActiveDOMObject::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
    3737
    3838namespace TestActiveDOMObjectV8Internal {
     
    190190    return wrapper;
    191191}
    192 
    193192void V8TestActiveDOMObject::derefObject(void* object)
    194193{
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp

    r140616 r140657  
    3333namespace WebCore {
    3434
    35 WrapperTypeInfo V8TestCustomNamedGetter::info = { V8TestCustomNamedGetter::GetTemplate, V8TestCustomNamedGetter::derefObject, 0, 0, V8TestCustomNamedGetter::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
     35WrapperTypeInfo V8TestCustomNamedGetter::info = { V8TestCustomNamedGetter::GetTemplate, V8TestCustomNamedGetter::derefObject, 0, 0, 0, V8TestCustomNamedGetter::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
    3636
    3737namespace TestCustomNamedGetterV8Internal {
     
    128128    return wrapper;
    129129}
    130 
    131130void V8TestCustomNamedGetter::derefObject(void* object)
    132131{
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp

    r140616 r140657  
    3333namespace WebCore {
    3434
    35 WrapperTypeInfo V8TestEventConstructor::info = { V8TestEventConstructor::GetTemplate, V8TestEventConstructor::derefObject, 0, 0, V8TestEventConstructor::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
     35WrapperTypeInfo V8TestEventConstructor::info = { V8TestEventConstructor::GetTemplate, V8TestEventConstructor::derefObject, 0, 0, 0, V8TestEventConstructor::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
    3636
    3737namespace TestEventConstructorV8Internal {
     
    160160    return wrapper;
    161161}
    162 
    163162void V8TestEventConstructor::derefObject(void* object)
    164163{
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp

    r140616 r140657  
    3737namespace WebCore {
    3838
    39 WrapperTypeInfo V8TestEventTarget::info = { V8TestEventTarget::GetTemplate, V8TestEventTarget::derefObject, 0, 0, V8TestEventTarget::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
     39WrapperTypeInfo V8TestEventTarget::info = { V8TestEventTarget::GetTemplate, V8TestEventTarget::derefObject, 0, V8TestEventTarget::toEventTarget, 0, V8TestEventTarget::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
    4040
    4141namespace TestEventTargetV8Internal {
     
    173173}
    174174
     175EventTarget* V8TestEventTarget::toEventTarget(v8::Handle<v8::Object> object)
     176{
     177    return toNative(object);
     178}
     179
    175180
    176181v8::Handle<v8::Object> V8TestEventTarget::createWrapper(PassRefPtr<TestEventTarget> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
     
    189194    return wrapper;
    190195}
    191 
    192196void V8TestEventTarget::derefObject(void* object)
    193197{
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.h

    r140616 r140657  
    4444    static void derefObject(void*);
    4545    static WrapperTypeInfo info;
     46    static EventTarget* toEventTarget(v8::Handle<v8::Object>);
    4647    static v8::Handle<v8::Value> indexedPropertyGetter(uint32_t, const v8::AccessorInfo&);
    4748    static v8::Handle<v8::Value> namedPropertyGetter(v8::Local<v8::String>, const v8::AccessorInfo&);
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestException.cpp

    r140616 r140657  
    3232namespace WebCore {
    3333
    34 WrapperTypeInfo V8TestException::info = { V8TestException::GetTemplate, V8TestException::derefObject, 0, 0, V8TestException::installPerContextPrototypeProperties, 0, WrapperTypeErrorPrototype };
     34WrapperTypeInfo V8TestException::info = { V8TestException::GetTemplate, V8TestException::derefObject, 0, 0, 0, V8TestException::installPerContextPrototypeProperties, 0, WrapperTypeErrorPrototype };
    3535
    3636namespace TestExceptionV8Internal {
     
    119119    return wrapper;
    120120}
    121 
    122121void V8TestException::derefObject(void* object)
    123122{
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp

    r140616 r140657  
    4141namespace WebCore {
    4242
    43 WrapperTypeInfo V8TestInterface::info = { V8TestInterface::GetTemplate, V8TestInterface::derefObject, V8TestInterface::toActiveDOMObject, 0, V8TestInterface::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
     43WrapperTypeInfo V8TestInterface::info = { V8TestInterface::GetTemplate, V8TestInterface::derefObject, V8TestInterface::toActiveDOMObject, 0, 0, V8TestInterface::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
    4444
    4545namespace TestInterfaceV8Internal {
     
    331331{
    332332    return toNative(object);
    333 }     
     333}
     334
    334335
    335336v8::Handle<v8::Object> V8TestInterface::createWrapper(PassRefPtr<TestInterface> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
     
    348349    return wrapper;
    349350}
    350 
    351351void V8TestInterface::derefObject(void* object)
    352352{
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp

    r140616 r140657  
    3434namespace WebCore {
    3535
    36 WrapperTypeInfo V8TestMediaQueryListListener::info = { V8TestMediaQueryListListener::GetTemplate, V8TestMediaQueryListListener::derefObject, 0, 0, V8TestMediaQueryListListener::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
     36WrapperTypeInfo V8TestMediaQueryListListener::info = { V8TestMediaQueryListListener::GetTemplate, V8TestMediaQueryListListener::derefObject, 0, 0, 0, V8TestMediaQueryListListener::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
    3737
    3838namespace TestMediaQueryListListenerV8Internal {
     
    128128    return wrapper;
    129129}
    130 
    131130void V8TestMediaQueryListListener::derefObject(void* object)
    132131{
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp

    r140616 r140657  
    3333namespace WebCore {
    3434
    35 WrapperTypeInfo V8TestNamedConstructor::info = { V8TestNamedConstructor::GetTemplate, V8TestNamedConstructor::derefObject, V8TestNamedConstructor::toActiveDOMObject, 0, V8TestNamedConstructor::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
     35WrapperTypeInfo V8TestNamedConstructor::info = { V8TestNamedConstructor::GetTemplate, V8TestNamedConstructor::derefObject, V8TestNamedConstructor::toActiveDOMObject, 0, 0, V8TestNamedConstructor::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
    3636
    3737namespace TestNamedConstructorV8Internal {
     
    4141} // namespace TestNamedConstructorV8Internal
    4242
    43 WrapperTypeInfo V8TestNamedConstructorConstructor::info = { V8TestNamedConstructorConstructor::GetTemplate, V8TestNamedConstructor::derefObject, V8TestNamedConstructor::toActiveDOMObject, 0, V8TestNamedConstructor::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
     43WrapperTypeInfo V8TestNamedConstructorConstructor::info = { V8TestNamedConstructorConstructor::GetTemplate, V8TestNamedConstructor::derefObject, V8TestNamedConstructor::toActiveDOMObject, 0, 0, V8TestNamedConstructor::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
    4444
    4545static v8::Handle<v8::Value> V8TestNamedConstructorConstructorCallback(const v8::Arguments& args)
     
    151151{
    152152    return toNative(object);
    153 }     
     153}
     154
    154155
    155156v8::Handle<v8::Object> V8TestNamedConstructor::createWrapper(PassRefPtr<TestNamedConstructor> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
     
    168169    return wrapper;
    169170}
    170 
    171171void V8TestNamedConstructor::derefObject(void* object)
    172172{
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp

    r140616 r140657  
    3333namespace WebCore {
    3434
    35 WrapperTypeInfo V8TestNode::info = { V8TestNode::GetTemplate, V8TestNode::derefObject, 0, 0, V8TestNode::installPerContextPrototypeProperties, &V8Node::info, WrapperTypeObjectPrototype };
     35WrapperTypeInfo V8TestNode::info = { V8TestNode::GetTemplate, V8TestNode::derefObject, 0, V8TestNode::toEventTarget, 0, V8TestNode::installPerContextPrototypeProperties, &V8Node::info, WrapperTypeObjectPrototype };
    3636
    3737namespace TestNodeV8Internal {
     
    110110}
    111111
     112EventTarget* V8TestNode::toEventTarget(v8::Handle<v8::Object> object)
     113{
     114    return toNative(object);
     115}
     116
    112117
    113118v8::Handle<v8::Object> V8TestNode::createWrapper(PassRefPtr<TestNode> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
     
    127132    return wrapper;
    128133}
    129 
    130134void V8TestNode::derefObject(void* object)
    131135{
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNode.h

    r140616 r140657  
    4444    static void derefObject(void*);
    4545    static WrapperTypeInfo info;
     46    static EventTarget* toEventTarget(v8::Handle<v8::Object>);
    4647    static v8::Handle<v8::Value> constructorCallback(const v8::Arguments&);
    4748    static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp

    r140616 r140657  
    7575namespace WebCore {
    7676
    77 WrapperTypeInfo V8TestObj::info = { V8TestObj::GetTemplate, V8TestObj::derefObject, 0, 0, V8TestObj::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
     77WrapperTypeInfo V8TestObj::info = { V8TestObj::GetTemplate, V8TestObj::derefObject, 0, 0, 0, V8TestObj::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
    7878
    7979namespace TestObjV8Internal {
     
    22232223    }
    22242224}
     2225
    22252226void V8TestObj::installPerContextPrototypeProperties(v8::Handle<v8::Object> proto)
    22262227{
     
    22372238    }
    22382239}
     2240
    22392241
    22402242v8::Handle<v8::Object> V8TestObj::createWrapper(PassRefPtr<TestObj> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
     
    22532255    return wrapper;
    22542256}
    2255 
    22562257void V8TestObj::derefObject(void* object)
    22572258{
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestOverloadedConstructors.cpp

    r140616 r140657  
    3838namespace WebCore {
    3939
    40 WrapperTypeInfo V8TestOverloadedConstructors::info = { V8TestOverloadedConstructors::GetTemplate, V8TestOverloadedConstructors::derefObject, 0, 0, V8TestOverloadedConstructors::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
     40WrapperTypeInfo V8TestOverloadedConstructors::info = { V8TestOverloadedConstructors::GetTemplate, V8TestOverloadedConstructors::derefObject, 0, 0, 0, V8TestOverloadedConstructors::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
    4141
    4242namespace TestOverloadedConstructorsV8Internal {
     
    183183    return wrapper;
    184184}
    185 
    186185void V8TestOverloadedConstructors::derefObject(void* object)
    187186{
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp

    r140616 r140657  
    3939namespace WebCore {
    4040
    41 WrapperTypeInfo V8TestSerializedScriptValueInterface::info = { V8TestSerializedScriptValueInterface::GetTemplate, V8TestSerializedScriptValueInterface::derefObject, 0, 0, V8TestSerializedScriptValueInterface::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
     41WrapperTypeInfo V8TestSerializedScriptValueInterface::info = { V8TestSerializedScriptValueInterface::GetTemplate, V8TestSerializedScriptValueInterface::derefObject, 0, 0, 0, V8TestSerializedScriptValueInterface::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
    4242
    4343namespace TestSerializedScriptValueInterfaceV8Internal {
     
    301301    return wrapper;
    302302}
    303 
    304303void V8TestSerializedScriptValueInterface::derefObject(void* object)
    305304{
  • trunk/Source/WebCore/bindings/v8/Dictionary.cpp

    r140305 r140657  
    3131#include "V8Binding.h"
    3232#include "V8DOMWindow.h"
     33#include "V8EventTarget.h"
    3334#include "V8Storage.h"
    3435#include "V8Uint8Array.h"
     
    458459}
    459460#endif
     461
     462bool Dictionary::get(const String& key, RefPtr<EventTarget>& value) const
     463{
     464    v8::Local<v8::Value> v8Value;
     465    if (!getKey(key, v8Value))
     466        return false;
     467
     468    EventTarget* target = 0;
     469    if (V8DOMWrapper::isDOMWrapper(v8Value)) {
     470        v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(v8Value);
     471        target = toWrapperTypeInfo(wrapper)->toEventTarget(wrapper);
     472    }
     473    value = target;
     474    return true;
     475}
    460476
    461477bool Dictionary::get(const String& key, Dictionary& value) const
  • trunk/Source/WebCore/bindings/v8/Dictionary.h

    r140305 r140657  
    8989    bool get(const String&, RefPtr<MediaStream>&) const;
    9090#endif
     91    bool get(const String&, RefPtr<EventTarget>&) const;
    9192    bool get(const String&, HashSet<AtomicString>&) const;
    9293    bool get(const String&, Dictionary&) const;
  • trunk/Source/WebCore/bindings/v8/NPV8Object.cpp

    r140611 r140657  
    5252WrapperTypeInfo* npObjectTypeInfo()
    5353{
    54     static WrapperTypeInfo typeInfo = { 0, 0, 0, 0, 0, 0, WrapperTypeObjectPrototype };
     54    static WrapperTypeInfo typeInfo = { 0, 0, 0, 0, 0, 0, 0, WrapperTypeObjectPrototype };
    5555    return &typeInfo;
    5656}
  • trunk/Source/WebCore/bindings/v8/V8DOMWrapper.cpp

    r140615 r140657  
    116116#endif
    117117
     118bool V8DOMWrapper::isDOMWrapper(v8::Handle<v8::Value> value)
     119{
     120    if (value.IsEmpty() || !value->IsObject())
     121        return false;
     122
     123    v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(value);
     124    if (wrapper->InternalFieldCount() < v8DefaultWrapperInternalFieldCount)
     125        return false;
     126    ASSERT(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
     127    ASSERT(object->GetAlignedPointerFromInternalField(v8DOMWrapperTypeIndex));
     128
     129    // FIXME: Add class id checks.
     130    return true;
     131}
     132
    118133bool V8DOMWrapper::isWrapperOfType(v8::Handle<v8::Value> value, WrapperTypeInfo* type)
    119134{
  • trunk/Source/WebCore/bindings/v8/V8DOMWrapper.h

    r140615 r140657  
    6363        static inline void setWrapperClass(Node*, v8::Persistent<v8::Object>);
    6464
     65        static bool isDOMWrapper(v8::Handle<v8::Value>);
    6566        static bool isWrapperOfType(v8::Handle<v8::Value>, WrapperTypeInfo*);
    6667
  • trunk/Source/WebCore/bindings/v8/WrapperTypeInfo.h

    r140616 r140657  
    3838    class ActiveDOMObject;
    3939    class DOMDataStore;
     40    class EventTarget;
    4041
    4142    static const int v8DOMWrapperTypeIndex = 0;
     
    4950    typedef void (*DerefObjectFunction)(void*);
    5051    typedef ActiveDOMObject* (*ToActiveDOMObjectFunction)(v8::Handle<v8::Object>);
     52    typedef EventTarget* (*ToEventTargetFunction)(v8::Handle<v8::Object>);
    5153    typedef void* (*OpaqueRootForGC)(void*, v8::Persistent<v8::Object>);
    5254    typedef void (*InstallPerContextPrototypePropertiesFunction)(v8::Handle<v8::Object>);
     
    104106        }
    105107
     108        EventTarget* toEventTarget(v8::Handle<v8::Object> object)
     109        {
     110            if (!toEventTargetFunction)
     111                return 0;
     112            return toEventTargetFunction(object);
     113        }
     114
    106115        void* opaqueRootForGC(void* object, v8::Persistent<v8::Object> wrapper)
    107116        {
     
    114123        const DerefObjectFunction derefObjectFunction;
    115124        const ToActiveDOMObjectFunction toActiveDOMObjectFunction;
     125        const ToEventTargetFunction toEventTargetFunction;
    116126        const OpaqueRootForGC opaqueRootForGCFunction;
    117127        const InstallPerContextPrototypePropertiesFunction installPerContextPrototypePropertiesFunction;
  • trunk/Source/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp

    r140616 r140657  
    4444namespace WebCore {
    4545
    46 WrapperTypeInfo V8HTMLImageElementConstructor::info = { V8HTMLImageElementConstructor::GetTemplate, V8HTMLImageElement::derefObject, 0, 0, V8HTMLImageElement::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
     46WrapperTypeInfo V8HTMLImageElementConstructor::info = { V8HTMLImageElementConstructor::GetTemplate, V8HTMLImageElement::derefObject, 0, V8HTMLImageElement::toEventTarget, 0, V8HTMLImageElement::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };
    4747
    4848static v8::Handle<v8::Value> v8HTMLImageElementConstructorCallback(const v8::Arguments& args)
  • trunk/Source/WebCore/dom/MouseEvent.cpp

    r136918 r140657  
    3333namespace WebCore {
    3434
     35MouseEventInit::MouseEventInit()
     36    : screenX(0)
     37    , screenY(0)
     38    , clientX(0)
     39    , clientY(0)
     40    , ctrlKey(false)
     41    , altKey(false)
     42    , shiftKey(false)
     43    , metaKey(false)
     44    , button(0)
     45    , relatedTarget(0)
     46{
     47}
     48
     49PassRefPtr<MouseEvent> MouseEvent::create(const AtomicString& type, const MouseEventInit& initializer)
     50{
     51    return adoptRef(new MouseEvent(type, initializer));
     52}
     53
    3554PassRefPtr<MouseEvent> MouseEvent::create(const AtomicString& eventType, PassRefPtr<AbstractView> view, const PlatformMouseEvent& event, int detail, PassRefPtr<Node> relatedTarget)
    3655{
     
    7392    , m_clipboard(clipboard)
    7493{
     94}
     95
     96MouseEvent::MouseEvent(const AtomicString& eventType, const MouseEventInit& initializer)
     97    : MouseRelatedEvent(eventType, initializer.bubbles, initializer.cancelable, initializer.view, initializer.detail, IntPoint(initializer.screenX, initializer.screenY),
     98        IntPoint(0 /* pageX */, 0 /* pageY */),
     99#if ENABLE(POINTER_LOCK)
     100        IntPoint(0 /* movementX */, 0 /* movementY */),
     101#endif
     102        initializer.ctrlKey, initializer.altKey, initializer.shiftKey, initializer.metaKey, false /* isSimulated */)
     103    , m_button(initializer.button == (unsigned short)-1 ? 0 : initializer.button)
     104    , m_buttonDown(initializer.button != (unsigned short)-1)
     105    , m_relatedTarget(initializer.relatedTarget)
     106    , m_clipboard(0 /* clipboard */)
     107{
     108    initCoordinates(IntPoint(initializer.clientX, initializer.clientY));
    75109}
    76110
  • trunk/Source/WebCore/dom/MouseEvent.h

    r138674 r140657  
    3434class PlatformMouseEvent;
    3535
    36     // Introduced in DOM Level 2
    37     class MouseEvent : public MouseRelatedEvent {
    38     public:
    39         static PassRefPtr<MouseEvent> create()
    40         {
    41             return adoptRef(new MouseEvent);
    42         }
    43         static PassRefPtr<MouseEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view,
    44             int detail, int screenX, int screenY, int pageX, int pageY,
     36struct MouseEventInit : public UIEventInit {
     37    MouseEventInit();
     38
     39    int screenX;
     40    int screenY;
     41    int clientX;
     42    int clientY;
     43    bool ctrlKey;
     44    bool altKey;
     45    bool shiftKey;
     46    bool metaKey;
     47    unsigned short button;
     48    RefPtr<EventTarget> relatedTarget;
     49};
     50
     51class MouseEvent : public MouseRelatedEvent {
     52public:
     53    static PassRefPtr<MouseEvent> create()
     54    {
     55        return adoptRef(new MouseEvent);
     56    }
     57
     58    static PassRefPtr<MouseEvent> create(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView> view,
     59        int detail, int screenX, int screenY, int pageX, int pageY,
    4560#if ENABLE(POINTER_LOCK)
    46             int movementX, int movementY,
     61        int movementX, int movementY,
    4762#endif
    48             bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
    49             PassRefPtr<EventTarget> relatedTarget, PassRefPtr<Clipboard> clipboard = 0, bool isSimulated = false)
    50         {
    51             return adoptRef(new MouseEvent(type, canBubble, cancelable, view, detail, screenX, screenY, pageX, pageY,
     63        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
     64        PassRefPtr<EventTarget> relatedTarget, PassRefPtr<Clipboard> clipboard = 0, bool isSimulated = false)
     65    {
     66        return adoptRef(new MouseEvent(type, canBubble, cancelable, view, detail, screenX, screenY, pageX, pageY,
    5267#if ENABLE(POINTER_LOCK)
    53                 movementX, movementY,
     68        movementX, movementY,
    5469#endif
    55                 ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget, clipboard, isSimulated));
    56         }
    57         static PassRefPtr<MouseEvent> create(const AtomicString& eventType, PassRefPtr<AbstractView>, const PlatformMouseEvent&, int detail, PassRefPtr<Node> relatedTarget);
     70        ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget, clipboard, isSimulated));
     71    }
    5872
    59         virtual ~MouseEvent();
     73    static PassRefPtr<MouseEvent> create(const AtomicString& eventType, PassRefPtr<AbstractView>, const PlatformMouseEvent&, int detail, PassRefPtr<Node> relatedTarget);
    6074
    61         void initMouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>,
    62                             int detail, int screenX, int screenY, int clientX, int clientY,
    63                             bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
    64                             unsigned short button, PassRefPtr<EventTarget> relatedTarget);
     75    static PassRefPtr<MouseEvent> create(const AtomicString& eventType, const MouseEventInit&);
    6576
    66         // WinIE uses 1,4,2 for left/middle/right but not for click (just for mousedown/up, maybe others),
    67         // but we will match the standard DOM.
    68         unsigned short button() const { return m_button; }
    69         bool buttonDown() const { return m_buttonDown; }
    70         EventTarget* relatedTarget() const { return m_relatedTarget.get(); }
    71         void setRelatedTarget(PassRefPtr<EventTarget> relatedTarget) { m_relatedTarget = relatedTarget; }
     77    virtual ~MouseEvent();
    7278
    73         Clipboard* clipboard() const { return m_clipboard.get(); }
     79    void initMouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>,
     80        int detail, int screenX, int screenY, int clientX, int clientY,
     81        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
     82        unsigned short button, PassRefPtr<EventTarget> relatedTarget);
    7483
    75         Node* toElement() const;
    76         Node* fromElement() const;
     84    // WinIE uses 1,4,2 for left/middle/right but not for click (just for mousedown/up, maybe others),
     85    // but we will match the standard DOM.
     86    unsigned short button() const { return m_button; }
     87    bool buttonDown() const { return m_buttonDown; }
     88    EventTarget* relatedTarget() const { return m_relatedTarget.get(); }
     89    void setRelatedTarget(PassRefPtr<EventTarget> relatedTarget) { m_relatedTarget = relatedTarget; }
    7790
    78         Clipboard* dataTransfer() const { return isDragEvent() ? m_clipboard.get() : 0; }
     91    Clipboard* clipboard() const { return m_clipboard.get(); }
    7992
    80         virtual const AtomicString& interfaceName() const;
     93    Node* toElement() const;
     94    Node* fromElement() const;
    8195
    82         virtual bool isMouseEvent() const;
    83         virtual bool isDragEvent() const;
    84         virtual int which() const;
     96    Clipboard* dataTransfer() const { return isDragEvent() ? m_clipboard.get() : 0; }
    8597
    86         virtual PassRefPtr<Event> cloneFor(HTMLIFrameElement*) const OVERRIDE;
     98    virtual const AtomicString& interfaceName() const;
    8799
    88     protected:
    89         MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>,
    90                    int detail, int screenX, int screenY, int pageX, int pageY,
     100    virtual bool isMouseEvent() const;
     101    virtual bool isDragEvent() const;
     102    virtual int which() const;
     103
     104    virtual PassRefPtr<Event> cloneFor(HTMLIFrameElement*) const OVERRIDE;
     105
     106protected:
     107    MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>,
     108        int detail, int screenX, int screenY, int pageX, int pageY,
    91109#if ENABLE(POINTER_LOCK)
    92                    int movementX, int movementY,
     110        int movementX, int movementY,
    93111#endif
    94                    bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
    95                    PassRefPtr<EventTarget> relatedTarget, PassRefPtr<Clipboard> clipboard, bool isSimulated);
     112        bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button,
     113        PassRefPtr<EventTarget> relatedTarget, PassRefPtr<Clipboard>, bool isSimulated);
    96114
    97     protected:
    98         MouseEvent();
     115    MouseEvent(const AtomicString& type, const MouseEventInit&);
    99116
    100     private:
    101         unsigned short m_button;
    102         bool m_buttonDown;
    103         RefPtr<EventTarget> m_relatedTarget;
    104         RefPtr<Clipboard> m_clipboard;
    105     };
     117    MouseEvent();
     118
     119private:
     120    unsigned short m_button;
     121    bool m_buttonDown;
     122    RefPtr<EventTarget> m_relatedTarget;
     123    RefPtr<Clipboard> m_clipboard;
     124};
    106125
    107126class SimulatedMouseEvent : public MouseEvent {
  • trunk/Source/WebCore/dom/MouseEvent.idl

    r134557 r140657  
    1818 */
    1919
    20 // Introduced in DOM Level 2:
    21 interface MouseEvent : UIEvent {
    22     readonly attribute long             screenX;
    23     readonly attribute long             screenY;
    24     readonly attribute long             clientX;
    25     readonly attribute long             clientY;
    26     [Conditional=POINTER_LOCK] readonly attribute long webkitMovementX;
    27     [Conditional=POINTER_LOCK] readonly attribute long webkitMovementY;
    28     readonly attribute boolean          ctrlKey;
    29     readonly attribute boolean          shiftKey;
    30     readonly attribute boolean          altKey;
    31     readonly attribute boolean          metaKey;
    32     readonly attribute unsigned short   button;
    33     readonly attribute EventTarget      relatedTarget;
     20[
     21    ConstructorConditional=DOM4_EVENTS_CONSTRUCTOR,
     22    ConstructorTemplate=Event
     23] interface MouseEvent : UIEvent {
     24    [InitializedByEventConstructor] readonly attribute long             screenX;
     25    [InitializedByEventConstructor] readonly attribute long             screenY;
     26    [InitializedByEventConstructor] readonly attribute long             clientX;
     27    [InitializedByEventConstructor] readonly attribute long             clientY;
     28    [InitializedByEventConstructor] readonly attribute boolean          ctrlKey;
     29    [InitializedByEventConstructor] readonly attribute boolean          shiftKey;
     30    [InitializedByEventConstructor] readonly attribute boolean          altKey;
     31    [InitializedByEventConstructor] readonly attribute boolean          metaKey;
     32    [InitializedByEventConstructor] readonly attribute unsigned short   button;
     33    [InitializedByEventConstructor] readonly attribute EventTarget      relatedTarget;
     34    [Conditional=POINTER_LOCK]      readonly attribute long             webkitMovementX;
     35    [Conditional=POINTER_LOCK]      readonly attribute long             webkitMovementY;
    3436   
    3537    [ObjCLegacyUnnamedParameters] void initMouseEvent(in [Optional=DefaultIsUndefined] DOMString type,
Note: See TracChangeset for help on using the changeset viewer.