From 391c6b110b77b5fc5a6c05800a7a6f850f15017b Mon Sep 17 00:00:00 2001 From: "cdumez@apple.com" Date: Tue, 26 Jul 2016 02:24:20 +0000 Subject: [PATCH] Touch properties should be on the prototype https://bugs.webkit.org/show_bug.cgi?id=160174 Reviewed by Ryosuke Niwa. Source/WebCore: Touch properties should be on the prototype: - https://w3c.github.io/touch-events/#idl-def-touch Chrome agrees with the specification. Test: platform/ios-simulator/ios/touch/Touch-attributes-prototype.html * bindings/scripts/CodeGeneratorJS.pm: (InterfaceRequiresAttributesOnInstanceForCompatibility): Deleted. LayoutTests: Add layout test coverage. * platform/ios-simulator/ios/touch/Touch-attributes-prototype-expected.txt: Added. * platform/ios-simulator/ios/touch/Touch-attributes-prototype.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@203707 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- LayoutTests/ChangeLog | 12 +++ .../touch/Touch-attributes-prototype-expected.txt | 101 +++++++++++++++++++++ .../ios/touch/Touch-attributes-prototype.html | 32 +++++++ Source/WebCore/ChangeLog | 17 ++++ Source/WebCore/bindings/scripts/CodeGeneratorJS.pm | 34 ------- 5 files changed, 162 insertions(+), 34 deletions(-) create mode 100644 LayoutTests/platform/ios-simulator/ios/touch/Touch-attributes-prototype-expected.txt create mode 100644 LayoutTests/platform/ios-simulator/ios/touch/Touch-attributes-prototype.html diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index 651720d..0d5cae56 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,5 +1,17 @@ 2016-07-25 Chris Dumez + Touch properties should be on the prototype + https://bugs.webkit.org/show_bug.cgi?id=160174 + + Reviewed by Ryosuke Niwa. + + Add layout test coverage. + + * platform/ios-simulator/ios/touch/Touch-attributes-prototype-expected.txt: Added. + * platform/ios-simulator/ios/touch/Touch-attributes-prototype.html: Added. + +2016-07-25 Chris Dumez + ClientRect properties should be on the prototype https://bugs.webkit.org/show_bug.cgi?id=160165 diff --git a/LayoutTests/platform/ios-simulator/ios/touch/Touch-attributes-prototype-expected.txt b/LayoutTests/platform/ios-simulator/ios/touch/Touch-attributes-prototype-expected.txt new file mode 100644 index 0000000..8e8af96 --- /dev/null +++ b/LayoutTests/platform/ios-simulator/ios/touch/Touch-attributes-prototype-expected.txt @@ -0,0 +1,101 @@ +Checks that Touch attributes are on the prototype. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS touch.__proto__ is Touch.prototype +PASS Object.getOwnPropertyNames(touch).length is 0 + +* touch.__proto__.identifier +PASS descriptor.get is an instance of Function +PASS descriptor.enumerable is true +PASS descriptor.configurable is true + +* Touch.prototype.identifier +PASS descriptor.get is an instance of Function +PASS descriptor.enumerable is true +PASS descriptor.configurable is true + +* touch.__proto__.target +PASS descriptor.get is an instance of Function +PASS descriptor.enumerable is true +PASS descriptor.configurable is true + +* Touch.prototype.target +PASS descriptor.get is an instance of Function +PASS descriptor.enumerable is true +PASS descriptor.configurable is true + +* touch.__proto__.screenX +PASS descriptor.get is an instance of Function +PASS descriptor.enumerable is true +PASS descriptor.configurable is true + +* Touch.prototype.screenX +PASS descriptor.get is an instance of Function +PASS descriptor.enumerable is true +PASS descriptor.configurable is true + +* touch.__proto__.screenY +PASS descriptor.get is an instance of Function +PASS descriptor.enumerable is true +PASS descriptor.configurable is true + +* Touch.prototype.screenY +PASS descriptor.get is an instance of Function +PASS descriptor.enumerable is true +PASS descriptor.configurable is true + +* touch.__proto__.clientX +PASS descriptor.get is an instance of Function +PASS descriptor.enumerable is true +PASS descriptor.configurable is true + +* Touch.prototype.clientX +PASS descriptor.get is an instance of Function +PASS descriptor.enumerable is true +PASS descriptor.configurable is true + +* touch.__proto__.clientY +PASS descriptor.get is an instance of Function +PASS descriptor.enumerable is true +PASS descriptor.configurable is true + +* Touch.prototype.clientY +PASS descriptor.get is an instance of Function +PASS descriptor.enumerable is true +PASS descriptor.configurable is true + +* touch.__proto__.pageX +PASS descriptor.get is an instance of Function +PASS descriptor.enumerable is true +PASS descriptor.configurable is true + +* Touch.prototype.pageX +PASS descriptor.get is an instance of Function +PASS descriptor.enumerable is true +PASS descriptor.configurable is true + +* touch.__proto__.pageY +PASS descriptor.get is an instance of Function +PASS descriptor.enumerable is true +PASS descriptor.configurable is true + +* Touch.prototype.pageY +PASS descriptor.get is an instance of Function +PASS descriptor.enumerable is true +PASS descriptor.configurable is true + +* touch.__proto__.force +PASS descriptor.get is an instance of Function +PASS descriptor.enumerable is true +PASS descriptor.configurable is true + +* Touch.prototype.force +PASS descriptor.get is an instance of Function +PASS descriptor.enumerable is true +PASS descriptor.configurable is true +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/platform/ios-simulator/ios/touch/Touch-attributes-prototype.html b/LayoutTests/platform/ios-simulator/ios/touch/Touch-attributes-prototype.html new file mode 100644 index 0000000..bb0b458 --- /dev/null +++ b/LayoutTests/platform/ios-simulator/ios/touch/Touch-attributes-prototype.html @@ -0,0 +1,32 @@ + + + + + + + + diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index b70b552..3a75ca1 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,20 @@ +2016-07-25 Chris Dumez + + Touch properties should be on the prototype + https://bugs.webkit.org/show_bug.cgi?id=160174 + + Reviewed by Ryosuke Niwa. + + Touch properties should be on the prototype: + - https://w3c.github.io/touch-events/#idl-def-touch + + Chrome agrees with the specification. + + Test: platform/ios-simulator/ios/touch/Touch-attributes-prototype.html + + * bindings/scripts/CodeGeneratorJS.pm: + (InterfaceRequiresAttributesOnInstanceForCompatibility): Deleted. + 2016-07-25 Jeremy Jones Set MediaRemote playback state based on MediaSession playback state. diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm index a00ae95..25beddc 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -533,18 +533,6 @@ sub HasComplexGetOwnProperty return 0; } - -sub InterfaceRequiresAttributesOnInstanceForCompatibility -{ - my $interface = shift; - my $interfaceName = $interface->name; - - # Needed for compatibility with existing content - return 1 if $interfaceName =~ "Touch"; - - return 0; -} - sub InterfaceRequiresAttributesOnInstance { my $interface = shift; @@ -560,8 +548,6 @@ sub InterfaceRequiresAttributesOnInstance # FIXME: Add support for [PrimaryGlobal] / [Global]. return 1 if IsDOMGlobalObject($interface) && $interface->name ne "WorkerGlobalScope"; - return 1 if InterfaceRequiresAttributesOnInstanceForCompatibility($interface); - return 0; } @@ -2573,16 +2559,6 @@ sub GenerateImplementation push(@implContent, " if (UNLIKELY(!castedThis)) {\n"); if ($attribute->signature->extendedAttributes->{"LenientThis"}) { push(@implContent, " return JSValue::encode(jsUndefined());\n"); - } elsif (InterfaceRequiresAttributesOnInstanceForCompatibility($interface)) { - # Fallback to trying to searching the prototype chain for compatibility reasons. - push(@implContent, " JSObject* thisObject = JSValue::decode(thisValue).getObject();\n"); - push(@implContent, " for (thisObject = thisObject ? thisObject->getPrototypeDirect().getObject() : nullptr; thisObject; thisObject = thisObject->getPrototypeDirect().getObject()) {\n"); - push(@implContent, " if ((castedThis = " . GetCastingHelperForThisObject($interface) . "(thisObject)))\n"); - push(@implContent, " break;\n"); - push(@implContent, " }\n"); - push(@implContent, " if (!castedThis)\n"); - push(@implContent, " return throwGetterTypeError(*state, \"$interfaceName\", \"$name\");\n"); - push(@implContent, " reportDeprecatedGetterError(*state, \"$interfaceName\", \"$name\");\n"); } else { push(@implContent, " return throwGetterTypeError(*state, \"$interfaceName\", \"$name\");\n"); } @@ -2874,16 +2850,6 @@ sub GenerateImplementation push(@implContent, " if (UNLIKELY(!castedThis)) {\n"); if ($attribute->signature->extendedAttributes->{"LenientThis"}) { push(@implContent, " return false;\n"); - } elsif (InterfaceRequiresAttributesOnInstanceForCompatibility($interface)) { - # Fallback to trying to searching the prototype chain for compatibility reasons. - push(@implContent, " JSObject* thisObject = JSValue::decode(thisValue).getObject();\n"); - push(@implContent, " for (thisObject = thisObject ? thisObject->getPrototypeDirect().getObject() : nullptr; thisObject; thisObject = thisObject->getPrototypeDirect().getObject()) {\n"); - push(@implContent, " if ((castedThis = " . GetCastingHelperForThisObject($interface) . "(thisObject)))\n"); - push(@implContent, " break;\n"); - push(@implContent, " }\n"); - push(@implContent, " if (!castedThis)\n"); - push(@implContent, " return throwSetterTypeError(*state, \"$interfaceName\", \"$name\");\n"); - push(@implContent, " reportDeprecatedSetterError(*state, \"$interfaceName\", \"$name\");\n"); } else { push(@implContent, " return throwSetterTypeError(*state, \"$interfaceName\", \"$name\");\n"); } -- 1.8.3.1