2006-07-27 Alexander Kellett <lypanov@kde.org>
authorlypanov <lypanov@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Jul 2006 21:06:13 +0000 (21:06 +0000)
committerlypanov <lypanov@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Jul 2006 21:06:13 +0000 (21:06 +0000)
        Reviewed by Darin.

        - fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=9867
          REGRESSION: code that modifies form element in Firefox modifies form attribute in WebKit

        * bindings/scripts/CodeGeneratorJS.pm: add new attribute - HasOverridingNameGetter
        * html/HTMLFormElement.idl:

2006-07-27  Alexander Kellett  <lypanov@kde.org>

        Reviewed by Darin.

        Test for: http://bugzilla.opendarwin.org/show_bug.cgi?id=9867
        REGRESSION: code that modifies form element in Firefox modifies form attribute in WebKit

        * fast/forms/input-named-action-overrides-action-attribute-expected.txt: Added.
        * fast/forms/input-named-action-overrides-action-attribute.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/forms/input-named-action-overrides-action-attribute-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/input-named-action-overrides-action-attribute.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/bindings/scripts/CodeGeneratorJS.pm
WebCore/html/HTMLFormElement.idl

index b44e9d14f025caae964b472d98e2715e77794b0a..4bdda204b0037a9ccd1e19c3938eb0573e8140fd 100644 (file)
@@ -1,3 +1,13 @@
+2006-07-27  Alexander Kellett  <lypanov@kde.org>
+
+        Reviewed by Darin.
+
+        Test for: http://bugzilla.opendarwin.org/show_bug.cgi?id=9867
+        REGRESSION: code that modifies form element in Firefox modifies form attribute in WebKit
+
+        * fast/forms/input-named-action-overrides-action-attribute-expected.txt: Added.
+        * fast/forms/input-named-action-overrides-action-attribute.html: Added.
+
 2006-07-27  Rob Buis  <buis@kde.org>
 
         Reviewed by Anders.
diff --git a/LayoutTests/fast/forms/input-named-action-overrides-action-attribute-expected.txt b/LayoutTests/fast/forms/input-named-action-overrides-action-attribute-expected.txt
new file mode 100644 (file)
index 0000000..750bbb1
--- /dev/null
@@ -0,0 +1,10 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {FORM} at (0,0) size 784x0
+      RenderBlock (anonymous) at (0,0) size 784x18
+        RenderInline {SPAN} at (0,0) size 74x18
+          RenderText {#text} at (0,0) size 74x18
+            text run at (0,0) width 74: "Test Passed"
diff --git a/LayoutTests/fast/forms/input-named-action-overrides-action-attribute.html b/LayoutTests/fast/forms/input-named-action-overrides-action-attribute.html
new file mode 100644 (file)
index 0000000..245a4ae
--- /dev/null
@@ -0,0 +1,11 @@
+<body onload="foo()"/>
+<form action="/">
+   <input type=hidden name="action" value="">
+</form>
+<span id="result"/>
+<script>
+   function foo() {
+      document.forms[0].action.value = "Passed";
+      document.getElementById("result").innerText = "Test " + (document.forms[0].action.value ? document.forms[0].action.value : "Failed");
+   }
+</script>
index 4a8df995cd410aa04eda09518931acf1edd4d5fe..11945bd93cf40cdbde868f8539e54b6376edc745 100644 (file)
@@ -1,3 +1,13 @@
+2006-07-27  Alexander Kellett  <lypanov@kde.org>
+
+        Reviewed by Darin.
+
+        - fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=9867
+          REGRESSION: code that modifies form element in Firefox modifies form attribute in WebKit
+
+        * bindings/scripts/CodeGeneratorJS.pm: add new attribute - HasOverridingNameGetter
+        * html/HTMLFormElement.idl:
+
 2006-07-27  Rob Buis  <buis@kde.org>
 
         Reviewed by Anders.
index 50123fdebf31bda96e43d2f2a0301a88265cb9b0..15bb35a33e6c9d2ec1c6bbf1de216298c4b606dc 100644 (file)
@@ -368,7 +368,7 @@ sub GenerateHeader
         push(@headerContent, "    static KJS::JSValue* indexGetter(KJS::ExecState*, KJS::JSObject*, const KJS::Identifier&, const KJS::PropertySlot&);\n");
     }
     # Name getter
-    if ($dataNode->extendedAttributes->{"HasNameGetter"}) {
+    if ($dataNode->extendedAttributes->{"HasNameGetter"} || $dataNode->extendedAttributes->{"HasOverridingNameGetter"}) {
         push(@headerContent, "private:\n");
         push(@headerContent, "    static KJS::JSValue* nameGetter(KJS::ExecState*, KJS::JSObject*, const KJS::Identifier&, const KJS::PropertySlot&);\n");
         push(@headerContent, "    static bool canGetItemsForName(KJS::ExecState*, $implClassName*, const AtomicString&);\n")
@@ -657,6 +657,17 @@ sub GenerateImplementation
         push(@implContent, "        return true;\n");
     }
     
+    my $hasNameGetterGeneration = sub {
+        push(@implContent, "    if (canGetItemsForName(exec, static_cast<$implClassName*>(impl()), propertyName)) {\n");
+        push(@implContent, "        slot.setCustom(this, nameGetter);\n");
+        push(@implContent, "        return true;\n");
+        push(@implContent, "    }\n");
+    };
+    
+    if ($dataNode->extendedAttributes->{"HasOverridingNameGetter"}) {
+        &$hasNameGetterGeneration();
+    }
+
     my $requiresManualLookup = $dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasNameGetter"};
     if ($requiresManualLookup) {
         push(@implContent, "    const HashEntry* entry = Lookup::findEntry(&${className}Table, propertyName);\n");
@@ -666,7 +677,7 @@ sub GenerateImplementation
         push(@implContent, "    }\n");
     }
     
-    if ($dataNode->extendedAttributes->{"HasNameGetter"}) {
+    if ($dataNode->extendedAttributes->{"HasNameGetter"} || $dataNode->extendedAttributes->{"HasOverridingNameGetter"}) {
         # if it has a prototype, we need to check that first too
         push(@implContent, "    if (prototype()->isObject() && static_cast<JSObject*>(prototype())->hasProperty(exec, propertyName))\n");
         push(@implContent, "        return false;\n");
@@ -679,13 +690,10 @@ sub GenerateImplementation
         push(@implContent, "        slot.setCustomIndex(this, u, indexGetter);\n");
         push(@implContent, "        return true;\n");
         push(@implContent, "    }\n");
-    }
-    
+    }    
+       
     if ($dataNode->extendedAttributes->{"HasNameGetter"}) {
-        push(@implContent, "    if (canGetItemsForName(exec, static_cast<$implClassName*>(impl()), propertyName)) {\n");
-        push(@implContent, "        slot.setCustom(this, nameGetter);\n");
-        push(@implContent, "        return true;\n");
-        push(@implContent, "    }\n");
+        &$hasNameGetterGeneration();
     }
     
     if ($requiresManualLookup) {
index b996709dedc7b3114c3514de373e3893ff52391b..a8855ffb22c08af6f2dc34563ad181b0fef447f5 100644 (file)
@@ -19,7 +19,7 @@
 
 module html {
 
-    interface [LegacyParent=KJS::JSHTMLElement, HasIndexGetter, HasNameGetter] HTMLFormElement : HTMLElement {
+    interface [LegacyParent=KJS::JSHTMLElement, HasIndexGetter, HasOverridingNameGetter] HTMLFormElement : HTMLElement {
         readonly attribute HTMLCollection  elements;
         readonly attribute long            length;
                  attribute DOMString       name;