Title: [102646] trunk/Source/WebCore
Revision
102646
Author
[email protected]
Date
2011-12-12 17:34:13 -0800 (Mon, 12 Dec 2011)

Log Message

[V8] CodeGeneratorV8.pm does not correctly work with inherited HasIndexGetter
https://bugs.webkit.org/show_bug.cgi?id=74027

Reviewed by Adam Barth.

Instead of having to write a custom indexer when the interface has an inherited indexer
we get the signature from the super interface.

Tested by existing tests.

* Target.pri: Remove V8DOMSettableTokenListCustom.cpp and V8WebKitCSSFilterValueCustom.cpp.
* UseV8.cmake: Ditto.
* WebCore.gypi: Ditto.
* bindings/scripts/CodeGenerator.pm:
(FindSuperMethod): Returns the first matching function in one of the ancestor interfaces.
* bindings/scripts/CodeGeneratorV8.pm:
(GenerateImplementationIndexer): If the current interface has no indexer try to find an
                                 indexer in one of the super interfaces.
(GenerateImplementationNamedPropertyGetter): Ditto for named property getter.
* bindings/v8/custom/V8DOMSettableTokenListCustom.cpp: Removed.
* bindings/v8/custom/V8WebKitCSSFilterValueCustom.cpp: Removed.

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (102645 => 102646)


--- trunk/Source/WebCore/ChangeLog	2011-12-13 01:14:33 UTC (rev 102645)
+++ trunk/Source/WebCore/ChangeLog	2011-12-13 01:34:13 UTC (rev 102646)
@@ -1,3 +1,27 @@
+2011-12-12  Erik Arvidsson  <[email protected]>
+
+        [V8] CodeGeneratorV8.pm does not correctly work with inherited HasIndexGetter
+        https://bugs.webkit.org/show_bug.cgi?id=74027
+
+        Reviewed by Adam Barth.
+
+        Instead of having to write a custom indexer when the interface has an inherited indexer
+        we get the signature from the super interface.
+
+        Tested by existing tests.
+
+        * Target.pri: Remove V8DOMSettableTokenListCustom.cpp and V8WebKitCSSFilterValueCustom.cpp.
+        * UseV8.cmake: Ditto.
+        * WebCore.gypi: Ditto.
+        * bindings/scripts/CodeGenerator.pm:
+        (FindSuperMethod): Returns the first matching function in one of the ancestor interfaces.
+        * bindings/scripts/CodeGeneratorV8.pm:
+        (GenerateImplementationIndexer): If the current interface has no indexer try to find an
+                                         indexer in one of the super interfaces.
+        (GenerateImplementationNamedPropertyGetter): Ditto for named property getter.
+        * bindings/v8/custom/V8DOMSettableTokenListCustom.cpp: Removed.
+        * bindings/v8/custom/V8WebKitCSSFilterValueCustom.cpp: Removed.
+
 2011-12-12  Simon Fraser  <[email protected]>
 
         Make it possible to substitute a different CALayer implementation for the main root layer

Modified: trunk/Source/WebCore/Target.pri (102645 => 102646)


--- trunk/Source/WebCore/Target.pri	2011-12-13 01:14:33 UTC (rev 102645)
+++ trunk/Source/WebCore/Target.pri	2011-12-13 01:34:13 UTC (rev 102646)
@@ -160,7 +160,6 @@
         bindings/v8/custom/V8InjectedScriptHostCustom.cpp \
         bindings/v8/custom/V8InjectedScriptManager.cpp \
         bindings/v8/custom/V8InspectorFrontendHostCustom.cpp \
-        bindings/v8/custom/V8DOMSettableTokenListCustom.cpp \
         bindings/v8/custom/V8DOMStringMapCustom.cpp \
         bindings/v8/custom/V8DOMTokenListCustom.cpp
 

Modified: trunk/Source/WebCore/UseV8.cmake (102645 => 102646)


--- trunk/Source/WebCore/UseV8.cmake	2011-12-13 01:14:33 UTC (rev 102645)
+++ trunk/Source/WebCore/UseV8.cmake	2011-12-13 01:34:13 UTC (rev 102646)
@@ -81,7 +81,6 @@
     bindings/v8/custom/V8CustomVoidCallback.cpp
     bindings/v8/custom/V8CustomXPathNSResolver.cpp
     bindings/v8/custom/V8DOMFormDataCustom.cpp
-    bindings/v8/custom/V8DOMSettableTokenListCustom.cpp
     bindings/v8/custom/V8DOMStringMapCustom.cpp
     bindings/v8/custom/V8DOMTokenListCustom.cpp
     bindings/v8/custom/V8DOMWindowCustom.cpp

Modified: trunk/Source/WebCore/WebCore.gypi (102645 => 102646)


--- trunk/Source/WebCore/WebCore.gypi	2011-12-13 01:14:33 UTC (rev 102645)
+++ trunk/Source/WebCore/WebCore.gypi	2011-12-13 01:34:13 UTC (rev 102646)
@@ -2187,7 +2187,6 @@
             'bindings/v8/custom/V8CustomXPathNSResolver.cpp',
             'bindings/v8/custom/V8CustomXPathNSResolver.h',
             'bindings/v8/custom/V8DOMFormDataCustom.cpp',
-            'bindings/v8/custom/V8DOMSettableTokenListCustom.cpp',
             'bindings/v8/custom/V8DOMStringMapCustom.cpp',
             'bindings/v8/custom/V8DOMTokenListCustom.cpp',
             'bindings/v8/custom/V8DOMWindowCustom.cpp',
@@ -2268,7 +2267,6 @@
             'bindings/v8/custom/V8Uint8ArrayCustom.cpp',
             'bindings/v8/custom/V8WebGLRenderingContextCustom.cpp',
             'bindings/v8/custom/V8WebKitAnimationCustom.cpp',
-            'bindings/v8/custom/V8WebKitCSSFilterValueCustom.cpp',
             'bindings/v8/custom/V8WebKitMutationObserverCustom.cpp',
             'bindings/v8/custom/V8WebKitPointConstructor.cpp',
             'bindings/v8/custom/V8WebSocketCustom.cpp',

Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (102645 => 102646)


--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm	2011-12-13 01:14:33 UTC (rev 102645)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm	2011-12-13 01:34:13 UTC (rev 102646)
@@ -255,6 +255,22 @@
     return @parentList;
 }
 
+sub FindSuperMethod
+{
+    my ($object, $dataNode, $functionName) = @_;
+    my $indexer;
+    $object->ForAllParents($dataNode, undef, sub {
+        my $interface = shift;
+        foreach my $function (@{$interface->functions}) {
+            if ($function->signature->name eq $functionName) {
+                $indexer = $function->signature;
+                return 'prune';
+            }
+        }
+    });
+    return $indexer;
+}
+
 sub IDLFileForInterface
 {
     my $object = shift;

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (102645 => 102646)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2011-12-13 01:14:33 UTC (rev 102645)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2011-12-13 01:34:13 UTC (rev 102646)
@@ -2016,6 +2016,10 @@
 
     AddToImplIncludes("V8Collection.h");
 
+    if (!$indexer) {
+        $indexer = $codeGenerator->FindSuperMethod($dataNode, "item");
+    }
+
     my $indexerType = $indexer ? $indexer->type : 0;
 
     # FIXME: Remove this once toV8 helper methods are implemented (see https://bugs.webkit.org/show_bug.cgi?id=32563).
@@ -2023,13 +2027,6 @@
         $indexerType = "WebKitCSSKeyframeRule";
     }
 
-    # FIXME: The item() getter is not inherited from CSSValueList, seemingly due to the way
-    # the CodeGenerator->AddMethodsConstantsAndAttributesFromParentClasses() method works,
-    # so we need to set the indexerType manually in this case.
-    if ($interfaceName eq "WebKitCSSTransformValue") {
-        $indexerType = "CSSValue";
-    }
-
     if ($indexerType && !$hasCustomSetter) {
         if ($indexerType eq "DOMString") {
             my $conversion = $indexer->extendedAttributes->{"ConvertNullStringTo"};
@@ -2101,6 +2098,10 @@
         return;
     }
 
+    if (!$namedPropertyGetter) {
+        $namedPropertyGetter = $codeGenerator->FindSuperMethod($dataNode, "namedItem");
+    }
+
     if ($namedPropertyGetter && $namedPropertyGetter->type ne "Node" && !$namedPropertyGetter->extendedAttributes->{"Custom"} && !$hasCustomGetter) {
         AddToImplIncludes("V8Collection.h");
         my $type = $namedPropertyGetter->type;

Deleted: trunk/Source/WebCore/bindings/v8/custom/V8DOMSettableTokenListCustom.cpp (102645 => 102646)


--- trunk/Source/WebCore/bindings/v8/custom/V8DOMSettableTokenListCustom.cpp	2011-12-13 01:14:33 UTC (rev 102645)
+++ trunk/Source/WebCore/bindings/v8/custom/V8DOMSettableTokenListCustom.cpp	2011-12-13 01:34:13 UTC (rev 102646)
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "V8DOMSettableTokenList.h"
-
-#include "DOMSettableTokenList.h"
-
-#include "V8Binding.h"
-#include "V8Proxy.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8DOMSettableTokenList::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
-{
-    INC_STATS("DOM.DOMSettableTokenList.IndexedPropertyGetter");
-    DOMSettableTokenList* list = V8DOMSettableTokenList::toNative(info.Holder());
-    return v8StringOrNull(list->item(index));
-}
-
-} // namespace WebCore

Deleted: trunk/Source/WebCore/bindings/v8/custom/V8WebKitCSSFilterValueCustom.cpp (102645 => 102646)


--- trunk/Source/WebCore/bindings/v8/custom/V8WebKitCSSFilterValueCustom.cpp	2011-12-13 01:14:33 UTC (rev 102645)
+++ trunk/Source/WebCore/bindings/v8/custom/V8WebKitCSSFilterValueCustom.cpp	2011-12-13 01:34:13 UTC (rev 102646)
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(CSS_FILTERS)
-
-#include "V8WebKitCSSFilterValue.h"
-
-#include "V8Binding.h"
-#include "WebKitCSSFilterValue.h"
-
-namespace WebCore {
-
-v8::Handle<v8::Value> V8WebKitCSSFilterValue::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info)
-{
-    INC_STATS("DOM.WebKitCSSFilterValue.IndexedPropertyGetter");
-    WebKitCSSFilterValue* list = V8WebKitCSSFilterValue::toNative(info.Holder());
-    return toV8(list->item(index));
-}
-
-} // namespace WebCore
-
-#endif
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to