Changeset 140657 in webkit
- Timestamp:
- Jan 23, 2013 11:42:07 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 37 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r140654 r140657 1 2013-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 1 23 2013-01-23 Yoshifumi Inoue <yosin@chromium.org> 2 24 -
trunk/LayoutTests/fast/dom/constructed-objects-prototypes-expected.txt
r140493 r140657 32 32 PASS (new inner.MessageEvent()).isInner is true 33 33 PASS (new inner.MessageEvent()).constructor.isInner is true 34 PASS (new inner.MouseEvent()).isInner is true 35 PASS (new inner.MouseEvent()).constructor.isInner is true 34 36 PASS (new inner.Option()).isInner is true 35 37 PASS (new inner.Option()).constructor.isInner is true -
trunk/LayoutTests/fast/dom/dom-constructors-expected.txt
r140493 r140657 97 97 PASS TryAllocate('MimeType') is 'exception' 98 98 PASS TryAllocate('MimeTypeArray') is 'exception' 99 PASS TryAllocate('MouseEvent') is 'exception'100 99 PASS TryAllocate('MutationEvent') is 'exception' 101 100 PASS TryAllocate('NamedNodeMap') is 'exception' -
trunk/LayoutTests/fast/dom/dom-constructors.html
r140493 r140657 44 44 'CSSValue', 'CSSValueList', 'DOMImplementation', 45 45 'HTMLCollection', 'KeyboardEvent', 'MediaList', 'MimeType', 46 'MimeTypeArray', 'M ouseEvent', 'MutationEvent', 'NamedNodeMap',46 'MimeTypeArray', 'MutationEvent', 'NamedNodeMap', 47 47 'NodeFilter', 'NodeList', 'Plugin', 48 48 'PluginArray', 'Range', 'Rect', 'StyleSheet', 'StyleSheetList', -
trunk/LayoutTests/platform/efl/TestExpectations
r140517 r140657 1230 1230 # DOM4_EVENTS_CONSTRUCTOR is not yet enabled. 1231 1231 webkit.org/b/107428 fast/events/constructors/ui-event-constructor.html [ Skip ] 1232 webkit.org/b/107428 fast/events/constructors/mouse-event-constructor.html [ Skip ] 1232 1233 1233 1234 # Requires support for Web notifications -
trunk/LayoutTests/platform/gtk/TestExpectations
r140631 r140657 374 374 # DOM4_EVENTS_CONSTRUCTOR is not yet enabled. 375 375 webkit.org/b/107428 fast/events/constructors/ui-event-constructor.html [ Skip ] 376 webkit.org/b/107428 fast/events/constructors/mouse-event-constructor.html [ Skip ] 376 377 377 378 # No CORS support for media elements is implemented yet. -
trunk/LayoutTests/platform/qt/TestExpectations
r140631 r140657 107 107 # ENABLE(DOM4_EVENTS_CONSTRUCTOR) is disabled. 108 108 fast/events/constructors/ui-event-constructor.html 109 fast/events/constructors/mouse-event-constructor.html 109 110 110 111 # ENABLE(INDEXED_DATABASE) is disabled. -
trunk/LayoutTests/platform/win/TestExpectations
r140631 r140657 1213 1213 # DOM4_EVENTS_CONSTRUCTOR is not yet enabled. 1214 1214 fast/events/constructors/ui-event-constructor.html 1215 fast/events/constructors/mouse-event-constructor.html 1215 1216 1216 1217 # Disable until the windows WebKit API supports injecting in the top frame only. -
trunk/LayoutTests/platform/wincairo/TestExpectations
r140631 r140657 1740 1740 # DOM4_EVENTS_CONSTRUCTOR is not yet enabled. 1741 1741 fast/events/constructors/ui-event-constructor.html 1742 fast/events/constructors/mouse-event-constructor.html 1742 1743 1743 1744 # Disable until the windows WebKit API supports injecting in the top frame only. -
trunk/Source/WebCore/ChangeLog
r140655 r140657 1 2013-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 1 112 2013-01-23 Kent Tamura <tkent@chromium.org> 2 113 -
trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm
r140303 r140657 733 733 } 734 734 735 # FIXME: Rename to InheritsInterface 735 736 sub IsSubType 736 737 { … … 746 747 $found = 1; 747 748 } 748 return "prune"if $found;749 return 1 if $found; 749 750 }, 0, 1); 750 751 … … 752 753 } 753 754 755 sub 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 754 774 1; -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
r140624 r140657 372 372 if ($interface->extendedAttributes->{"ActiveDOMObject"}) { 373 373 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"); 374 378 } 375 379 … … 2096 2100 $toActiveDOMObject = "${v8InterfaceName}::toActiveDOMObject"; 2097 2101 } 2102 2103 my $toEventTarget = "0"; 2104 if ($codeGenerator->InheritsExtendedAttribute($interface, "EventTarget")) { 2105 $toEventTarget = "${v8InterfaceName}::toEventTarget"; 2106 } 2107 2098 2108 AddToImplIncludes("Frame.h"); 2099 2100 2109 push(@implContent, <<END); 2101 WrapperTypeInfo ${v8InterfaceName}Constructor::info = { ${v8InterfaceName}Constructor::GetTemplate, ${v8InterfaceName}::derefObject, $ {toActiveDOMObject}, 0, ${v8InterfaceName}::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };2110 WrapperTypeInfo ${v8InterfaceName}Constructor::info = { ${v8InterfaceName}Constructor::GetTemplate, ${v8InterfaceName}::derefObject, $toActiveDOMObject, $toEventTarget, 0, ${v8InterfaceName}::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype }; 2102 2111 2103 2112 static v8::Handle<v8::Value> ${v8InterfaceName}ConstructorCallback(const v8::Arguments& args) … … 2619 2628 AddIncludesForType($interfaceName); 2620 2629 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"; 2622 2632 my $rootForGC = NeedsCustomOpaqueRootForGC($interface) ? "${v8InterfaceName}::opaqueRootForGC" : "0"; 2623 2633 … … 2637 2647 my $WrapperTypePrototype = $interface->isException ? "WrapperTypeErrorPrototype" : "WrapperTypeObjectPrototype"; 2638 2648 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"); 2640 2650 push(@implContentDecls, "namespace ${interfaceName}V8Internal {\n\n"); 2641 2651 … … 3122 3132 push(@implContent, <<END); 3123 3133 } 3134 3124 3135 END 3125 3136 } … … 3155 3166 push(@implContent, <<END); 3156 3167 } 3168 3157 3169 END 3158 3170 } … … 3165 3177 ActiveDOMObject* ${v8InterfaceName}::toActiveDOMObject(v8::Handle<v8::Object> object) 3166 3178 { 3167 return ${returnValue}; 3168 } 3179 return $returnValue; 3180 } 3181 3182 END 3183 } 3184 3185 if ($codeGenerator->InheritsExtendedAttribute($interface, "EventTarget")) { 3186 push(@implContent, <<END); 3187 EventTarget* ${v8InterfaceName}::toEventTarget(v8::Handle<v8::Object> object) 3188 { 3189 return toNative(object); 3190 } 3191 3169 3192 END 3170 3193 } … … 3181 3204 return V8DOMWindowShadowObjectCache; 3182 3205 } 3206 3183 3207 END 3184 3208 } … … 3187 3211 3188 3212 push(@implContent, <<END); 3189 3190 3213 void ${v8InterfaceName}::derefObject(void* object) 3191 3214 { -
trunk/Source/WebCore/bindings/scripts/test/V8/V8Float64Array.cpp
r140616 r140657 43 43 namespace WebCore { 44 44 45 WrapperTypeInfo V8Float64Array::info = { V8Float64Array::GetTemplate, V8Float64Array::derefObject, 0, 0, V8Float64Array::installPerContextPrototypeProperties, &V8ArrayBufferView::info, WrapperTypeObjectPrototype };45 WrapperTypeInfo V8Float64Array::info = { V8Float64Array::GetTemplate, V8Float64Array::derefObject, 0, 0, 0, V8Float64Array::installPerContextPrototypeProperties, &V8ArrayBufferView::info, WrapperTypeObjectPrototype }; 46 46 47 47 namespace Float64ArrayV8Internal { … … 163 163 return wrapper; 164 164 } 165 166 165 void V8Float64Array::derefObject(void* object) 167 166 { -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp
r140616 r140657 34 34 namespace WebCore { 35 35 36 WrapperTypeInfo V8TestActiveDOMObject::info = { V8TestActiveDOMObject::GetTemplate, V8TestActiveDOMObject::derefObject, 0, 0, V8TestActiveDOMObject::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };36 WrapperTypeInfo V8TestActiveDOMObject::info = { V8TestActiveDOMObject::GetTemplate, V8TestActiveDOMObject::derefObject, 0, 0, 0, V8TestActiveDOMObject::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype }; 37 37 38 38 namespace TestActiveDOMObjectV8Internal { … … 190 190 return wrapper; 191 191 } 192 193 192 void V8TestActiveDOMObject::derefObject(void* object) 194 193 { -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp
r140616 r140657 33 33 namespace WebCore { 34 34 35 WrapperTypeInfo V8TestCustomNamedGetter::info = { V8TestCustomNamedGetter::GetTemplate, V8TestCustomNamedGetter::derefObject, 0, 0, V8TestCustomNamedGetter::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };35 WrapperTypeInfo V8TestCustomNamedGetter::info = { V8TestCustomNamedGetter::GetTemplate, V8TestCustomNamedGetter::derefObject, 0, 0, 0, V8TestCustomNamedGetter::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype }; 36 36 37 37 namespace TestCustomNamedGetterV8Internal { … … 128 128 return wrapper; 129 129 } 130 131 130 void V8TestCustomNamedGetter::derefObject(void* object) 132 131 { -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp
r140616 r140657 33 33 namespace WebCore { 34 34 35 WrapperTypeInfo V8TestEventConstructor::info = { V8TestEventConstructor::GetTemplate, V8TestEventConstructor::derefObject, 0, 0, V8TestEventConstructor::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };35 WrapperTypeInfo V8TestEventConstructor::info = { V8TestEventConstructor::GetTemplate, V8TestEventConstructor::derefObject, 0, 0, 0, V8TestEventConstructor::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype }; 36 36 37 37 namespace TestEventConstructorV8Internal { … … 160 160 return wrapper; 161 161 } 162 163 162 void V8TestEventConstructor::derefObject(void* object) 164 163 { -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.cpp
r140616 r140657 37 37 namespace WebCore { 38 38 39 WrapperTypeInfo V8TestEventTarget::info = { V8TestEventTarget::GetTemplate, V8TestEventTarget::derefObject, 0, 0, V8TestEventTarget::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };39 WrapperTypeInfo V8TestEventTarget::info = { V8TestEventTarget::GetTemplate, V8TestEventTarget::derefObject, 0, V8TestEventTarget::toEventTarget, 0, V8TestEventTarget::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype }; 40 40 41 41 namespace TestEventTargetV8Internal { … … 173 173 } 174 174 175 EventTarget* V8TestEventTarget::toEventTarget(v8::Handle<v8::Object> object) 176 { 177 return toNative(object); 178 } 179 175 180 176 181 v8::Handle<v8::Object> V8TestEventTarget::createWrapper(PassRefPtr<TestEventTarget> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) … … 189 194 return wrapper; 190 195 } 191 192 196 void V8TestEventTarget::derefObject(void* object) 193 197 { -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestEventTarget.h
r140616 r140657 44 44 static void derefObject(void*); 45 45 static WrapperTypeInfo info; 46 static EventTarget* toEventTarget(v8::Handle<v8::Object>); 46 47 static v8::Handle<v8::Value> indexedPropertyGetter(uint32_t, const v8::AccessorInfo&); 47 48 static v8::Handle<v8::Value> namedPropertyGetter(v8::Local<v8::String>, const v8::AccessorInfo&); -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestException.cpp
r140616 r140657 32 32 namespace WebCore { 33 33 34 WrapperTypeInfo V8TestException::info = { V8TestException::GetTemplate, V8TestException::derefObject, 0, 0, V8TestException::installPerContextPrototypeProperties, 0, WrapperTypeErrorPrototype };34 WrapperTypeInfo V8TestException::info = { V8TestException::GetTemplate, V8TestException::derefObject, 0, 0, 0, V8TestException::installPerContextPrototypeProperties, 0, WrapperTypeErrorPrototype }; 35 35 36 36 namespace TestExceptionV8Internal { … … 119 119 return wrapper; 120 120 } 121 122 121 void V8TestException::derefObject(void* object) 123 122 { -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp
r140616 r140657 41 41 namespace WebCore { 42 42 43 WrapperTypeInfo V8TestInterface::info = { V8TestInterface::GetTemplate, V8TestInterface::derefObject, V8TestInterface::toActiveDOMObject, 0, V8TestInterface::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };43 WrapperTypeInfo V8TestInterface::info = { V8TestInterface::GetTemplate, V8TestInterface::derefObject, V8TestInterface::toActiveDOMObject, 0, 0, V8TestInterface::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype }; 44 44 45 45 namespace TestInterfaceV8Internal { … … 331 331 { 332 332 return toNative(object); 333 } 333 } 334 334 335 335 336 v8::Handle<v8::Object> V8TestInterface::createWrapper(PassRefPtr<TestInterface> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) … … 348 349 return wrapper; 349 350 } 350 351 351 void V8TestInterface::derefObject(void* object) 352 352 { -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp
r140616 r140657 34 34 namespace WebCore { 35 35 36 WrapperTypeInfo V8TestMediaQueryListListener::info = { V8TestMediaQueryListListener::GetTemplate, V8TestMediaQueryListListener::derefObject, 0, 0, V8TestMediaQueryListListener::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };36 WrapperTypeInfo V8TestMediaQueryListListener::info = { V8TestMediaQueryListListener::GetTemplate, V8TestMediaQueryListListener::derefObject, 0, 0, 0, V8TestMediaQueryListListener::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype }; 37 37 38 38 namespace TestMediaQueryListListenerV8Internal { … … 128 128 return wrapper; 129 129 } 130 131 130 void V8TestMediaQueryListListener::derefObject(void* object) 132 131 { -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNamedConstructor.cpp
r140616 r140657 33 33 namespace WebCore { 34 34 35 WrapperTypeInfo V8TestNamedConstructor::info = { V8TestNamedConstructor::GetTemplate, V8TestNamedConstructor::derefObject, V8TestNamedConstructor::toActiveDOMObject, 0, V8TestNamedConstructor::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };35 WrapperTypeInfo V8TestNamedConstructor::info = { V8TestNamedConstructor::GetTemplate, V8TestNamedConstructor::derefObject, V8TestNamedConstructor::toActiveDOMObject, 0, 0, V8TestNamedConstructor::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype }; 36 36 37 37 namespace TestNamedConstructorV8Internal { … … 41 41 } // namespace TestNamedConstructorV8Internal 42 42 43 WrapperTypeInfo V8TestNamedConstructorConstructor::info = { V8TestNamedConstructorConstructor::GetTemplate, V8TestNamedConstructor::derefObject, V8TestNamedConstructor::toActiveDOMObject, 0, V8TestNamedConstructor::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };43 WrapperTypeInfo V8TestNamedConstructorConstructor::info = { V8TestNamedConstructorConstructor::GetTemplate, V8TestNamedConstructor::derefObject, V8TestNamedConstructor::toActiveDOMObject, 0, 0, V8TestNamedConstructor::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype }; 44 44 45 45 static v8::Handle<v8::Value> V8TestNamedConstructorConstructorCallback(const v8::Arguments& args) … … 151 151 { 152 152 return toNative(object); 153 } 153 } 154 154 155 155 156 v8::Handle<v8::Object> V8TestNamedConstructor::createWrapper(PassRefPtr<TestNamedConstructor> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) … … 168 169 return wrapper; 169 170 } 170 171 171 void V8TestNamedConstructor::derefObject(void* object) 172 172 { -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNode.cpp
r140616 r140657 33 33 namespace WebCore { 34 34 35 WrapperTypeInfo V8TestNode::info = { V8TestNode::GetTemplate, V8TestNode::derefObject, 0, 0, V8TestNode::installPerContextPrototypeProperties, &V8Node::info, WrapperTypeObjectPrototype };35 WrapperTypeInfo V8TestNode::info = { V8TestNode::GetTemplate, V8TestNode::derefObject, 0, V8TestNode::toEventTarget, 0, V8TestNode::installPerContextPrototypeProperties, &V8Node::info, WrapperTypeObjectPrototype }; 36 36 37 37 namespace TestNodeV8Internal { … … 110 110 } 111 111 112 EventTarget* V8TestNode::toEventTarget(v8::Handle<v8::Object> object) 113 { 114 return toNative(object); 115 } 116 112 117 113 118 v8::Handle<v8::Object> V8TestNode::createWrapper(PassRefPtr<TestNode> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) … … 127 132 return wrapper; 128 133 } 129 130 134 void V8TestNode::derefObject(void* object) 131 135 { -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestNode.h
r140616 r140657 44 44 static void derefObject(void*); 45 45 static WrapperTypeInfo info; 46 static EventTarget* toEventTarget(v8::Handle<v8::Object>); 46 47 static v8::Handle<v8::Value> constructorCallback(const v8::Arguments&); 47 48 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0; -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
r140616 r140657 75 75 namespace WebCore { 76 76 77 WrapperTypeInfo V8TestObj::info = { V8TestObj::GetTemplate, V8TestObj::derefObject, 0, 0, V8TestObj::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };77 WrapperTypeInfo V8TestObj::info = { V8TestObj::GetTemplate, V8TestObj::derefObject, 0, 0, 0, V8TestObj::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype }; 78 78 79 79 namespace TestObjV8Internal { … … 2223 2223 } 2224 2224 } 2225 2225 2226 void V8TestObj::installPerContextPrototypeProperties(v8::Handle<v8::Object> proto) 2226 2227 { … … 2237 2238 } 2238 2239 } 2240 2239 2241 2240 2242 v8::Handle<v8::Object> V8TestObj::createWrapper(PassRefPtr<TestObj> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) … … 2253 2255 return wrapper; 2254 2256 } 2255 2256 2257 void V8TestObj::derefObject(void* object) 2257 2258 { -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestOverloadedConstructors.cpp
r140616 r140657 38 38 namespace WebCore { 39 39 40 WrapperTypeInfo V8TestOverloadedConstructors::info = { V8TestOverloadedConstructors::GetTemplate, V8TestOverloadedConstructors::derefObject, 0, 0, V8TestOverloadedConstructors::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };40 WrapperTypeInfo V8TestOverloadedConstructors::info = { V8TestOverloadedConstructors::GetTemplate, V8TestOverloadedConstructors::derefObject, 0, 0, 0, V8TestOverloadedConstructors::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype }; 41 41 42 42 namespace TestOverloadedConstructorsV8Internal { … … 183 183 return wrapper; 184 184 } 185 186 185 void V8TestOverloadedConstructors::derefObject(void* object) 187 186 { -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp
r140616 r140657 39 39 namespace WebCore { 40 40 41 WrapperTypeInfo V8TestSerializedScriptValueInterface::info = { V8TestSerializedScriptValueInterface::GetTemplate, V8TestSerializedScriptValueInterface::derefObject, 0, 0, V8TestSerializedScriptValueInterface::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };41 WrapperTypeInfo V8TestSerializedScriptValueInterface::info = { V8TestSerializedScriptValueInterface::GetTemplate, V8TestSerializedScriptValueInterface::derefObject, 0, 0, 0, V8TestSerializedScriptValueInterface::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype }; 42 42 43 43 namespace TestSerializedScriptValueInterfaceV8Internal { … … 301 301 return wrapper; 302 302 } 303 304 303 void V8TestSerializedScriptValueInterface::derefObject(void* object) 305 304 { -
trunk/Source/WebCore/bindings/v8/Dictionary.cpp
r140305 r140657 31 31 #include "V8Binding.h" 32 32 #include "V8DOMWindow.h" 33 #include "V8EventTarget.h" 33 34 #include "V8Storage.h" 34 35 #include "V8Uint8Array.h" … … 458 459 } 459 460 #endif 461 462 bool 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 } 460 476 461 477 bool Dictionary::get(const String& key, Dictionary& value) const -
trunk/Source/WebCore/bindings/v8/Dictionary.h
r140305 r140657 89 89 bool get(const String&, RefPtr<MediaStream>&) const; 90 90 #endif 91 bool get(const String&, RefPtr<EventTarget>&) const; 91 92 bool get(const String&, HashSet<AtomicString>&) const; 92 93 bool get(const String&, Dictionary&) const; -
trunk/Source/WebCore/bindings/v8/NPV8Object.cpp
r140611 r140657 52 52 WrapperTypeInfo* npObjectTypeInfo() 53 53 { 54 static WrapperTypeInfo typeInfo = { 0, 0, 0, 0, 0, 0, WrapperTypeObjectPrototype };54 static WrapperTypeInfo typeInfo = { 0, 0, 0, 0, 0, 0, 0, WrapperTypeObjectPrototype }; 55 55 return &typeInfo; 56 56 } -
trunk/Source/WebCore/bindings/v8/V8DOMWrapper.cpp
r140615 r140657 116 116 #endif 117 117 118 bool 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 118 133 bool V8DOMWrapper::isWrapperOfType(v8::Handle<v8::Value> value, WrapperTypeInfo* type) 119 134 { -
trunk/Source/WebCore/bindings/v8/V8DOMWrapper.h
r140615 r140657 63 63 static inline void setWrapperClass(Node*, v8::Persistent<v8::Object>); 64 64 65 static bool isDOMWrapper(v8::Handle<v8::Value>); 65 66 static bool isWrapperOfType(v8::Handle<v8::Value>, WrapperTypeInfo*); 66 67 -
trunk/Source/WebCore/bindings/v8/WrapperTypeInfo.h
r140616 r140657 38 38 class ActiveDOMObject; 39 39 class DOMDataStore; 40 class EventTarget; 40 41 41 42 static const int v8DOMWrapperTypeIndex = 0; … … 49 50 typedef void (*DerefObjectFunction)(void*); 50 51 typedef ActiveDOMObject* (*ToActiveDOMObjectFunction)(v8::Handle<v8::Object>); 52 typedef EventTarget* (*ToEventTargetFunction)(v8::Handle<v8::Object>); 51 53 typedef void* (*OpaqueRootForGC)(void*, v8::Persistent<v8::Object>); 52 54 typedef void (*InstallPerContextPrototypePropertiesFunction)(v8::Handle<v8::Object>); … … 104 106 } 105 107 108 EventTarget* toEventTarget(v8::Handle<v8::Object> object) 109 { 110 if (!toEventTargetFunction) 111 return 0; 112 return toEventTargetFunction(object); 113 } 114 106 115 void* opaqueRootForGC(void* object, v8::Persistent<v8::Object> wrapper) 107 116 { … … 114 123 const DerefObjectFunction derefObjectFunction; 115 124 const ToActiveDOMObjectFunction toActiveDOMObjectFunction; 125 const ToEventTargetFunction toEventTargetFunction; 116 126 const OpaqueRootForGC opaqueRootForGCFunction; 117 127 const InstallPerContextPrototypePropertiesFunction installPerContextPrototypePropertiesFunction; -
trunk/Source/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
r140616 r140657 44 44 namespace WebCore { 45 45 46 WrapperTypeInfo V8HTMLImageElementConstructor::info = { V8HTMLImageElementConstructor::GetTemplate, V8HTMLImageElement::derefObject, 0, 0, V8HTMLImageElement::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype };46 WrapperTypeInfo V8HTMLImageElementConstructor::info = { V8HTMLImageElementConstructor::GetTemplate, V8HTMLImageElement::derefObject, 0, V8HTMLImageElement::toEventTarget, 0, V8HTMLImageElement::installPerContextPrototypeProperties, 0, WrapperTypeObjectPrototype }; 47 47 48 48 static v8::Handle<v8::Value> v8HTMLImageElementConstructorCallback(const v8::Arguments& args) -
trunk/Source/WebCore/dom/MouseEvent.cpp
r136918 r140657 33 33 namespace WebCore { 34 34 35 MouseEventInit::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 49 PassRefPtr<MouseEvent> MouseEvent::create(const AtomicString& type, const MouseEventInit& initializer) 50 { 51 return adoptRef(new MouseEvent(type, initializer)); 52 } 53 35 54 PassRefPtr<MouseEvent> MouseEvent::create(const AtomicString& eventType, PassRefPtr<AbstractView> view, const PlatformMouseEvent& event, int detail, PassRefPtr<Node> relatedTarget) 36 55 { … … 73 92 , m_clipboard(clipboard) 74 93 { 94 } 95 96 MouseEvent::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)); 75 109 } 76 110 -
trunk/Source/WebCore/dom/MouseEvent.h
r138674 r140657 34 34 class PlatformMouseEvent; 35 35 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, 36 struct 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 51 class MouseEvent : public MouseRelatedEvent { 52 public: 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, 45 60 #if ENABLE(POINTER_LOCK) 46 61 int movementX, int movementY, 47 62 #endif 48 49 50 51 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, 52 67 #if ENABLE(POINTER_LOCK) 53 68 movementX, movementY, 54 69 #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 } 58 72 59 virtual ~MouseEvent();73 static PassRefPtr<MouseEvent> create(const AtomicString& eventType, PassRefPtr<AbstractView>, const PlatformMouseEvent&, int detail, PassRefPtr<Node> relatedTarget); 60 74 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&); 65 76 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(); 72 78 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); 74 83 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; } 77 90 78 Clipboard* dataTransfer() const { return isDragEvent() ? m_clipboard.get() : 0; }91 Clipboard* clipboard() const { return m_clipboard.get(); } 79 92 80 virtual const AtomicString& interfaceName() const; 93 Node* toElement() const; 94 Node* fromElement() const; 81 95 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; } 85 97 86 virtual PassRefPtr<Event> cloneFor(HTMLIFrameElement*) const OVERRIDE;98 virtual const AtomicString& interfaceName() const; 87 99 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 106 protected: 107 MouseEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<AbstractView>, 108 int detail, int screenX, int screenY, int pageX, int pageY, 91 109 #if ENABLE(POINTER_LOCK) 92 110 int movementX, int movementY, 93 111 #endif 94 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); 96 114 97 protected: 98 MouseEvent(); 115 MouseEvent(const AtomicString& type, const MouseEventInit&); 99 116 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 119 private: 120 unsigned short m_button; 121 bool m_buttonDown; 122 RefPtr<EventTarget> m_relatedTarget; 123 RefPtr<Clipboard> m_clipboard; 124 }; 106 125 107 126 class SimulatedMouseEvent : public MouseEvent { -
trunk/Source/WebCore/dom/MouseEvent.idl
r134557 r140657 18 18 */ 19 19 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; 34 36 35 37 [ObjCLegacyUnnamedParameters] void initMouseEvent(in [Optional=DefaultIsUndefined] DOMString type,
Note: See TracChangeset
for help on using the changeset viewer.