Add a [V8CustomToJSObject] IDL attribute
authorharaken@chromium.org <haraken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Feb 2012 05:35:55 +0000 (05:35 +0000)
committerharaken@chromium.org <haraken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Feb 2012 05:35:55 +0000 (05:35 +0000)
https://bugs.webkit.org/show_bug.cgi?id=78450

Reviewed by Adam Barth.

This is the first step to remove hard-coding in HasCustomToV8Implementation()
in CodeGeneratorV8.pm. This patch adds [V8CustomToJSObject]
to interfaces which have custom toV8() but do not have custom toJS().

No tests. No change in behavior.

* bindings/scripts/CodeGeneratorV8.pm: Replaced hard-coding with [V8CustomToJSObject].
(HasCustomToV8Implementation):

* css/CSSStyleSheet.idl: Added [V8CustomToJSObject].
* dom/DOMStringMap.idl:
* dom/Element.idl:
* dom/NamedNodeMap.idl:
* html/DOMTokenList.idl:
* html/HTMLDocument.idl:
* html/HTMLElement.idl:
* html/canvas/CanvasPixelArray.idl:
* inspector/ScriptProfile.idl:
* inspector/ScriptProfileNode.idl:
* page/DOMWindow.idl:
* page/Location.idl:
* svg/SVGDocument.idl:
* svg/SVGElement.idl:
* workers/WorkerContext.idl:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107530 268f45cc-cd09-0410-ab3c-d52691b4dbfc

17 files changed:
Source/WebCore/ChangeLog
Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
Source/WebCore/css/CSSStyleSheet.idl
Source/WebCore/dom/DOMStringMap.idl
Source/WebCore/dom/Element.idl
Source/WebCore/dom/NamedNodeMap.idl
Source/WebCore/html/DOMTokenList.idl
Source/WebCore/html/HTMLDocument.idl
Source/WebCore/html/HTMLElement.idl
Source/WebCore/html/canvas/CanvasPixelArray.idl
Source/WebCore/inspector/ScriptProfile.idl
Source/WebCore/inspector/ScriptProfileNode.idl
Source/WebCore/page/DOMWindow.idl
Source/WebCore/page/Location.idl
Source/WebCore/svg/SVGDocument.idl
Source/WebCore/svg/SVGElement.idl
Source/WebCore/workers/WorkerContext.idl

index 0e17fd9..37d95b6 100644 (file)
@@ -1,3 +1,35 @@
+2012-02-12  Kentaro Hara  <haraken@chromium.org>
+
+        Add a [V8CustomToJSObject] IDL attribute
+        https://bugs.webkit.org/show_bug.cgi?id=78450
+
+        Reviewed by Adam Barth.
+
+        This is the first step to remove hard-coding in HasCustomToV8Implementation()
+        in CodeGeneratorV8.pm. This patch adds [V8CustomToJSObject]
+        to interfaces which have custom toV8() but do not have custom toJS().
+
+        No tests. No change in behavior.
+
+        * bindings/scripts/CodeGeneratorV8.pm: Replaced hard-coding with [V8CustomToJSObject].
+        (HasCustomToV8Implementation):
+
+        * css/CSSStyleSheet.idl: Added [V8CustomToJSObject].
+        * dom/DOMStringMap.idl:
+        * dom/Element.idl:
+        * dom/NamedNodeMap.idl:
+        * html/DOMTokenList.idl:
+        * html/HTMLDocument.idl:
+        * html/HTMLElement.idl:
+        * html/canvas/CanvasPixelArray.idl:
+        * inspector/ScriptProfile.idl:
+        * inspector/ScriptProfileNode.idl:
+        * page/DOMWindow.idl:
+        * page/Location.idl:
+        * svg/SVGDocument.idl:
+        * svg/SVGElement.idl:
+        * workers/WorkerContext.idl:
+
 2012-02-12  David Barr  <davidbarr@chromium.org>
 
         CSS3 currentColor on outline-color gets treated as inherit
index 06a1b6a..c6d8586 100644 (file)
@@ -3106,22 +3106,8 @@ sub HasCustomToV8Implementation {
     my $dataNode = shift;
     my $interfaceName = shift;
 
-    # We generate a custom converter (but JSC doesn't) for the following:
-    return 1 if $interfaceName eq "CSSStyleSheet";
-    return 1 if $interfaceName eq "CanvasPixelArray";
-    return 1 if $interfaceName eq "DOMStringMap";
-    return 1 if $interfaceName eq "DOMWindow";
-    return 1 if $interfaceName eq "DOMTokenList";
-    return 1 if $interfaceName eq "Element";
-    return 1 if $interfaceName eq "HTMLDocument";
-    return 1 if $interfaceName eq "HTMLElement";
-    return 1 if $interfaceName eq "Location";
-    return 1 if $interfaceName eq "NamedNodeMap";
-    return 1 if $interfaceName eq "SVGDocument";
-    return 1 if $interfaceName eq "SVGElement";
-    return 1 if $interfaceName eq "ScriptProfile";
-    return 1 if $interfaceName eq "ScriptProfileNode";
-    return 1 if $interfaceName eq "WorkerContext";
+    return 1 if $dataNode->extendedAttributes->{"V8CustomToJSObject"};
+
     # We don't generate a custom converter (but JSC does) for the following:
     return 0 if $interfaceName eq "AbstractWorker";
     return 0 if $interfaceName eq "CanvasRenderingContext";
index 71d4c66..962c9db 100644 (file)
@@ -21,7 +21,9 @@
 module css {
 
     // Introduced in DOM Level 2:
-    interface CSSStyleSheet : StyleSheet {
+    interface [
+        V8CustomToJSObject
+    ] CSSStyleSheet : StyleSheet {
         readonly attribute CSSRule          ownerRule;
         readonly attribute CSSRuleList      cssRules;
 
index 823626a..980d044 100644 (file)
@@ -31,6 +31,7 @@ module core {
         CustomDeleteProperty,
         CustomEnumerateProperty,
         CustomNamedSetter,
+        V8CustomToJSObject
     ] DOMStringMap {
     };
 
index a147c92..b1ce6f1 100644 (file)
@@ -22,7 +22,8 @@ module core {
 
     interface [
         JSGenerateToNativeObject,
-        JSInlineGetOwnPropertySlot
+        JSInlineGetOwnPropertySlot,
+        V8CustomToJSObject
     ] Element : Node {
 
         // DOM Level 1 Core
index 333789d..88820c0 100644 (file)
@@ -24,7 +24,8 @@ module core {
         JSGenerateIsReachable=ImplElementRoot,
         JSCustomMarkFunction,
         IndexedGetter,
-        NamedGetter
+        NamedGetter,
+        V8CustomToJSObject
     ] NamedNodeMap {
 
         Node getNamedItem(in [Optional=DefaultIsUndefined] DOMString name);
index 06a331b..55b636f 100644 (file)
@@ -26,7 +26,8 @@ module core {
 
     interface [
         JSGenerateIsReachable=ImplElementRoot,
-        IndexedGetter
+        IndexedGetter,
+        V8CustomToJSObject
     ] DOMTokenList {
         readonly attribute unsigned long length;
         [TreatReturnedNullStringAs=Null] DOMString item(in unsigned long index);
index 670c73b..19420ee 100644 (file)
@@ -21,7 +21,8 @@
 module html {
 
     interface [
-        CustomNamedGetter
+        CustomNamedGetter,
+        V8CustomToJSObject
     ] HTMLDocument : Document {
         [JSCustom, V8Custom] void open();
         void close();
index 4d266b7..b73b4d0 100644 (file)
@@ -22,7 +22,8 @@ module html {
 
     interface [
         JSGenerateToNativeObject,
-        JSCustomPushEventHandlerScope
+        JSCustomPushEventHandlerScope,
+        V8CustomToJSObject
     ] HTMLElement : Element {
                  // iht.com relies on id returning the empty string when no id is present. 
                  // Other browsers do this as well. So we don't convert null to JS null.
index a12c8ce..8c0836b 100644 (file)
@@ -31,7 +31,8 @@ module html {
     interface [
         OmitConstructor,
         NumericIndexedGetter,
-        CustomIndexedSetter
+        CustomIndexedSetter,
+        V8CustomToJSObject
     ] CanvasPixelArray {
 #if !defined(V8_BINDING) || !V8_BINDING
         readonly attribute long length;
index 00b62a3..ebbee2e 100644 (file)
@@ -28,7 +28,8 @@ module core {
 
     interface [
         Conditional=JAVASCRIPT_DEBUGGER,
-        OmitConstructor
+        OmitConstructor,
+        V8CustomToJSObject
     ] ScriptProfile {
         readonly attribute DOMString title;
         readonly attribute unsigned long uid;
index 93908b5..008d3b3 100644 (file)
@@ -28,7 +28,8 @@ module core {
 
     interface [
         Conditional=JAVASCRIPT_DEBUGGER,
-        OmitConstructor
+        OmitConstructor,
+        V8CustomToJSObject
     ] ScriptProfileNode {
         readonly attribute DOMString functionName;
         readonly attribute DOMString url;
index d0767b5..331e62c 100644 (file)
@@ -39,7 +39,8 @@ module window {
         ExtendsDOMGlobalObject,
         JSGenerateToNativeObject,
         ReplaceableConstructor,
-        JSLegacyParent=JSDOMWindowBase
+        JSLegacyParent=JSDOMWindowBase,
+        V8CustomToJSObject
     ] DOMWindow {
         // DOM Level 0
         attribute [Replaceable] Screen screen;
index 9b8bbb7..a543f21 100644 (file)
@@ -40,7 +40,8 @@ module window {
         JSCustomDefineOwnProperty,
         JSCustomNamedGetterOnPrototype,
         JSCustomDefineOwnPropertyOnPrototype,
-        OmitConstructor
+        OmitConstructor,
+        V8CustomToJSObject
     ] Location {
 #if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP
                  attribute [DoNotCheckDomainSecurityOnSetter, CustomSetter, V8Unforgeable] DOMString href;
index 4726fc5..2f9abfc 100644 (file)
@@ -22,7 +22,8 @@
 module svg {
 
     interface [
-        Conditional=SVG
+        Conditional=SVG,
+        V8CustomToJSObject
     ] SVGDocument : Document {
         readonly attribute SVGSVGElement        rootElement;
 
index 5e9b831..41ae9c2 100644 (file)
@@ -24,7 +24,8 @@ module svg {
 
     interface [
         JSGenerateToNativeObject,
-        Conditional=SVG
+        Conditional=SVG,
+        V8CustomToJSObject
     ] SVGElement : Element {
         attribute [Reflect] DOMString id;
         attribute [TreatNullAs=NullString] DOMString xmlbase setter raises(DOMException);
index f669ceb..a5408d7 100644 (file)
@@ -35,7 +35,8 @@ module threads {
         IsWorkerContext,
         JSLegacyParent=JSWorkerContextBase,
         JSNoStaticTables,
-        OmitConstructor
+        OmitConstructor,
+        V8CustomToJSObject
     ] WorkerContext {
 
         // WorkerGlobalScope