[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

dbates at webkit.org dbates at webkit.org
Wed Apr 7 23:08:06 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit c6b0081f256724ecff1d67db4c65cea42112ac6e
Author: dbates at webkit.org <dbates at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 27 07:12:10 2009 +0000

    2009-10-26  Daniel Bates  <dbates at webkit.org>
    
            Reviewed by Darin Adler.
    
            https://bugs.webkit.org/show_bug.cgi?id=30491
    
            Fixes an issue where pressing return/enter on the keyboard
            in <isindex> does not submit it if is not within a <form>.
    
            According to the HTML 2.0 thru HTML 4.01 spec
            (http://www.w3.org/MarkUp/html-spec/html-spec_7.html#SEC7.5), the
            <isindex> element does not need to be within a <form> element in
            order to submit it. It can submitted on its own. Also, if present,
            the href property of the <base> element will dictate where to submit
            the value of the <isindex> element (this is analogous to the action
            property of the <form> element).
    
            Tests: http/tests/misc/isindex-with-no-form-base-href.html
                   http/tests/misc/isindex-with-no-form.html
    
            * html/HTMLInputElement.cpp:
            (WebCore::HTMLInputElement::defaultEventHandler): Calls createTemporaryFormForIsIndex()
            to create a <form> if none is present and we are an <isindex> element.
            (WebCore::HTMLInputElement::createTemporaryFormForIsIndex): Added.
            * html/HTMLInputElement.h:
    2009-10-26  Daniel Bates  <dbates at webkit.org>
    
            Reviewed by Darin Adler.
    
            https://bugs.webkit.org/show_bug.cgi?id=30491
    
            Test that the <isindex> element can be submitted without being enclosed
            within a <form> element. Also tests that the href property of the <base>
            element can be used to direct where the submission is sent.
    
            * http/tests/misc/isindex-with-no-form-base-href-expected.txt: Added.
            * http/tests/misc/isindex-with-no-form-base-href.html: Added.
            * http/tests/misc/isindex-with-no-form-expected.txt: Added.
            * http/tests/misc/isindex-with-no-form.html: Added.
            * http/tests/misc/resources/isindex-with-no-form-base-href-submit.html: Added.
            * http/tests/misc/resources/isindex-with-no-form-base-href.html: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50132 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 6d1b9b4..7d3cd2b 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,20 @@
+2009-10-26  Daniel Bates  <dbates at webkit.org>
+
+        Reviewed by Darin Adler.
+
+        https://bugs.webkit.org/show_bug.cgi?id=30491
+
+        Test that the <isindex> element can be submitted without being enclosed
+        within a <form> element. Also tests that the href property of the <base>
+        element can be used to direct where the submission is sent.
+
+        * http/tests/misc/isindex-with-no-form-base-href-expected.txt: Added.
+        * http/tests/misc/isindex-with-no-form-base-href.html: Added.
+        * http/tests/misc/isindex-with-no-form-expected.txt: Added.
+        * http/tests/misc/isindex-with-no-form.html: Added.
+        * http/tests/misc/resources/isindex-with-no-form-base-href-submit.html: Added.
+        * http/tests/misc/resources/isindex-with-no-form-base-href.html: Added.
+
 2009-10-26  Brian Weinstein  <bweinstein at apple.com>
 
         Unreviewed - Updating getComputedStyle results for Windows.
diff --git a/LayoutTests/http/tests/misc/isindex-with-no-form-base-href-expected.txt b/LayoutTests/http/tests/misc/isindex-with-no-form-base-href-expected.txt
new file mode 100644
index 0000000..c8dcf53
--- /dev/null
+++ b/LayoutTests/http/tests/misc/isindex-with-no-form-base-href-expected.txt
@@ -0,0 +1,7 @@
+
+
+--------
+Frame: '<!--framePath //<!--frame0-->-->'
+--------
+PASS
+
diff --git a/LayoutTests/http/tests/misc/isindex-with-no-form-base-href.html b/LayoutTests/http/tests/misc/isindex-with-no-form-base-href.html
new file mode 100644
index 0000000..1414db9
--- /dev/null
+++ b/LayoutTests/http/tests/misc/isindex-with-no-form-base-href.html
@@ -0,0 +1,14 @@
+<html>
+<head>
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.dumpChildFramesAsText();
+    layoutTestController.waitUntilDone();
+}
+</script>
+</head>
+<body>
+<iframe src="resources/isindex-with-no-form-base-href.html"></iframe>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/misc/isindex-with-no-form-expected.txt b/LayoutTests/http/tests/misc/isindex-with-no-form-expected.txt
new file mode 100644
index 0000000..e3774db
--- /dev/null
+++ b/LayoutTests/http/tests/misc/isindex-with-no-form-expected.txt
@@ -0,0 +1,7 @@
+This page tests that we correctly put the value of an <isindex> element into the form data.
+
+If you are running this test by hand, press the enter/return key on your keyboard to submit.
+
+This is a searchable index. Enter search keywords: 
+PASS
+
diff --git a/LayoutTests/http/tests/misc/isindex-with-no-form.html b/LayoutTests/http/tests/misc/isindex-with-no-form.html
new file mode 100644
index 0000000..4af1795
--- /dev/null
+++ b/LayoutTests/http/tests/misc/isindex-with-no-form.html
@@ -0,0 +1,44 @@
+<html>
+<head>
+<script>
+function test()
+{
+    var isindexElm = document.getElementById("isindex");
+    if (!location.search.length) {
+        if (window.layoutTestController) {
+            layoutTestController.dumpAsText();
+            layoutTestController.waitUntilDone();
+        }
+
+        isindexElm.value = "This is a test";
+        isindexElm.focus();
+
+        if (window.eventSender)
+            eventSender.keyDown(String.fromCharCode(0x0d));
+    } else {
+        var expected = "?This+is+a+test";
+        if (location.search != expected)
+            log("FAIL: Expected \"" + expected + "\" but got \"" + location.search + "\"");
+        else
+            log("PASS");
+
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
+    }
+}
+
+function log(msg)
+{
+    document.getElementById("log").appendChild(document.createTextNode(msg + "\n"));
+}
+
+window.onload = test;
+</script>
+</head>
+<body>
+<p>This page tests that we correctly put the value of an <tt>&lt;isindex&gt;</tt> element into the form data.</p>
+<p>If you are running this test by hand, press the enter/return key on your keyboard to submit.</p>
+<isindex id="isindex"></isindex>
+<pre id="log"></pre>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/misc/resources/isindex-with-no-form-base-href-submit.html b/LayoutTests/http/tests/misc/resources/isindex-with-no-form-base-href-submit.html
new file mode 100644
index 0000000..1d4714a
--- /dev/null
+++ b/LayoutTests/http/tests/misc/resources/isindex-with-no-form-base-href-submit.html
@@ -0,0 +1,28 @@
+<html>
+<head>
+<script>
+function test()
+{
+    var expected = "?This+is+a+test";
+    if (location.search != expected)
+        log("FAIL: Expected \"" + expected + "\" but got \"" + location.search + "\"");
+    else
+        log("PASS");
+}
+
+function log(msg)
+{
+    document.getElementById("log").appendChild(document.createTextNode(msg + "\n"));
+}
+
+window.onload = test;
+</script>
+</head>
+<body>
+<pre id="log"></pre>
+<script>
+if (window.layoutTestController)
+    layoutTestController.notifyDone();
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/misc/resources/isindex-with-no-form-base-href.html b/LayoutTests/http/tests/misc/resources/isindex-with-no-form-base-href.html
new file mode 100644
index 0000000..06bede8
--- /dev/null
+++ b/LayoutTests/http/tests/misc/resources/isindex-with-no-form-base-href.html
@@ -0,0 +1,23 @@
+<html>
+<head>
+<base href="http://localhost:8000/misc/resources/isindex-with-no-form-base-href-submit.html">
+<script>
+function test()
+{
+    var isindexElm = document.getElementById("isindex");
+    isindexElm.value = "This is a test";
+    isindexElm.focus();
+
+    if (window.eventSender)
+        eventSender.keyDown(String.fromCharCode(0x0d));
+}
+
+window.onload = test;
+</script>
+</head>
+<body>
+<p>This page tests that we correctly put the value of an <tt>&lt;isindex&gt;</tt> element into the form data.</p>
+<p>If you are running this test by hand, press the enter/return key on your keyboard to submit.</p>
+<isindex id="isindex"></isindex>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e0310b6..65df547 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,29 @@
+2009-10-26  Daniel Bates  <dbates at webkit.org>
+
+        Reviewed by Darin Adler.
+
+        https://bugs.webkit.org/show_bug.cgi?id=30491
+
+        Fixes an issue where pressing return/enter on the keyboard 
+        in <isindex> does not submit it if is not within a <form>.
+
+        According to the HTML 2.0 thru HTML 4.01 spec 
+        (http://www.w3.org/MarkUp/html-spec/html-spec_7.html#SEC7.5), the 
+        <isindex> element does not need to be within a <form> element in 
+        order to submit it. It can submitted on its own. Also, if present,
+        the href property of the <base> element will dictate where to submit
+        the value of the <isindex> element (this is analogous to the action 
+        property of the <form> element).
+
+        Tests: http/tests/misc/isindex-with-no-form-base-href.html
+               http/tests/misc/isindex-with-no-form.html
+
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::defaultEventHandler): Calls createTemporaryFormForIsIndex()
+        to create a <form> if none is present and we are an <isindex> element.
+        (WebCore::HTMLInputElement::createTemporaryFormForIsIndex): Added.
+        * html/HTMLInputElement.h:
+
 2009-10-26  Oliver Hunt  <oliver at apple.com>
 
         Reviewed by Maciej Stachowiak.
diff --git a/WebCore/html/HTMLInputElement.cpp b/WebCore/html/HTMLInputElement.cpp
index ed3405a..f25c908 100644
--- a/WebCore/html/HTMLInputElement.cpp
+++ b/WebCore/html/HTMLInputElement.cpp
@@ -1549,9 +1549,16 @@ void HTMLInputElement::defaultEventHandler(Event* evt)
             if (r && r->isTextField())
                 toRenderTextControl(r)->setEdited(false);
         }
-        // Form may never have been present, or may have been destroyed by the change event.
-        if (form())
-            form()->submitClick(evt);
+
+        RefPtr<HTMLFormElement> formForSubmission = form();
+        // If there is no form and the element is an <isindex>, then create a temporary form just to be used for submission.
+        if (!formForSubmission && inputType() == ISINDEX)
+            formForSubmission = createTemporaryFormForIsIndex();
+
+        // Form may never have been present, or may have been destroyed by code responding to the change event.
+        if (formForSubmission)
+            formForSubmission->submitClick(evt);
+
         evt->setDefaultHandled();
         return;
     }
@@ -1569,6 +1576,19 @@ void HTMLInputElement::defaultEventHandler(Event* evt)
         HTMLFormControlElementWithState::defaultEventHandler(evt);
 }
 
+PassRefPtr<HTMLFormElement> HTMLInputElement::createTemporaryFormForIsIndex()
+{
+    RefPtr<HTMLFormElement> form = new HTMLFormElement(formTag, document());
+    form->registerFormElement(this);
+    form->setMethod("GET");
+    if (!document()->baseURL().isEmpty()) {
+        // We treat the href property of the <base> element as the form action, as per section 7.5 
+        // "Queries and Indexes" of the HTML 2.0 spec. <http://www.w3.org/MarkUp/html-spec/html-spec_7.html#SEC7.5>.
+        form->setAction(document()->baseURL().string());
+    }
+    return form.release();
+}
+
 bool HTMLInputElement::isURLAttribute(Attribute *attr) const
 {
     return (attr->name() == srcAttr);
diff --git a/WebCore/html/HTMLInputElement.h b/WebCore/html/HTMLInputElement.h
index 799d92c..0e2da32 100644
--- a/WebCore/html/HTMLInputElement.h
+++ b/WebCore/html/HTMLInputElement.h
@@ -256,6 +256,8 @@ private:
     virtual bool isOptionalFormControl() const { return !isRequiredFormControl(); }
     virtual bool isRequiredFormControl() const;
 
+    PassRefPtr<HTMLFormElement> createTemporaryFormForIsIndex();
+
 #if ENABLE(DATALIST)
     HTMLDataListElement* dataList() const;
 #endif

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list