2006-03-30 Eric Seidel <eseidel@apple.com>
authoreseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Mar 2006 21:55:26 +0000 (21:55 +0000)
committereseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Mar 2006 21:55:26 +0000 (21:55 +0000)
        Reviewed by hyatt.

        Fix html editing input & basic form submission.

        * Spinneret/Spinneret/WebFrame.cpp:
        (WebKit::WebFrame::submitForm):
        (WebKit::WebFrame::loadURL):
        * Spinneret/Spinneret/WebFrame.h:
        * Spinneret/Spinneret/WebView.cpp:
        (WebKit::WebView::keyPress):
        (WebKit::WebViewWndProc):

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

WebKitTools/ChangeLog
WebKitTools/Spinneret/Spinneret/WebFrame.cpp
WebKitTools/Spinneret/Spinneret/WebFrame.h
WebKitTools/Spinneret/Spinneret/WebView.cpp

index f51dc0b..5a6e077 100644 (file)
@@ -1,3 +1,17 @@
+2006-03-30  Eric Seidel  <eseidel@apple.com>
+
+        Reviewed by hyatt.
+
+        Fix html editing input & basic form submission.
+
+        * Spinneret/Spinneret/WebFrame.cpp:
+        (WebKit::WebFrame::submitForm):
+        (WebKit::WebFrame::loadURL):
+        * Spinneret/Spinneret/WebFrame.h:
+        * Spinneret/Spinneret/WebView.cpp:
+        (WebKit::WebView::keyPress):
+        (WebKit::WebViewWndProc):
+
 2006-03-28  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by darin
index aef771a..b2f93d5 100755 (executable)
@@ -30,6 +30,7 @@
 #include "WebView.h"
 #include "Spinneret.h"
 
+#include "Document.h"
 #include "FrameView.h"
 #include "FrameWin.h"
 #include "GraphicsContext.h"
@@ -108,12 +109,25 @@ void WebFrame::openURL(const DeprecatedString& str)
    loadURL(str.ascii());
 }
 
+void WebFrame::submitForm(const String& method, const KURL& url, const FormData* submitFormData)
+{
+    // FIXME: This is a dumb implementation, doesn't handle subframes, etc.
+    d->frame->didOpenURL(url);
+    d->frame->begin(url);
+    TransferJob* job;
+    if (method == "GET" || !submitFormData)
+        job = new TransferJob(this, method, url);
+    else
+        job = new TransferJob(this, method, url, *submitFormData);
+    job->start(d->frame->document()->docLoader());
+}
+
 void WebFrame::loadURL(const char* URL)
 {
     d->frame->didOpenURL(URL);
     d->frame->begin(URL);
     WebCore::TransferJob* job = new TransferJob(this, "GET", URL);
-    job->start(0);
+    job->start(d->frame->document()->docLoader());
 }
     
 void WebFrame::receivedData(WebCore::TransferJob*, const char* data, int length)
index de97647..4945419 100755 (executable)
 #include "TransferJobClient.h"
 #include "FrameWin.h"
 
+class KURL;
+
 namespace WebCore {
+    class FormData;
     class Frame;
     class FrameView;
+    class String;
     class TransferJob;
 }
 
@@ -45,6 +49,7 @@ namespace WebKit {
     void loadHTMLString(char* html, char* baseURL = 0);
 
     virtual void openURL(const DeprecatedString&);
+    virtual void submitForm(const WebCore::String& method, const KURL&, const WebCore::FormData*);
 
     void loadURL(const char*);
     
index 5b3a09c..902a9ea 100755 (executable)
@@ -55,6 +55,7 @@ public:
 };
 
 const LPCWSTR kWebViewWindowClassName = L"WebViewWindowClass";
+static bool nextCharIsInputText = false;
 
 LRESULT CALLBACK WebViewWndProc(HWND, UINT, WPARAM, LPARAM);
 
@@ -178,7 +179,7 @@ bool WebView::keyPress(WPARAM wParam, LPARAM lParam)
                 frame->selection().modify(SelectionController::MOVE, SelectionController::FORWARD, ParagraphGranularity);
                 break;
             default:
-                TypingCommand::insertText(frame->document(), keyEvent.text(), false);
+                nextCharIsInputText = true;
             }
             handled = true;
         }
@@ -280,10 +281,18 @@ LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
         // through to the top level webview and do things like scrolling
         if (webview->keyPress(wParam, lParam))
             break;
-
         WORD wScrollNotify = scrollMessageForKey(wParam);
         if (wScrollNotify != -1)
             SendMessage(hWnd, WM_VSCROLL, MAKELONG(wScrollNotify, 0), 0L);
+        break;
+    }
+    case WM_CHAR: {
+        // FIXME: We need to use WM_UNICHAR to support international text.
+        if (nextCharIsInputText) {
+            TypingCommand::insertText(webview->mainFrame()->impl()->document(), QChar(wParam), false);
+            nextCharIsInputText = false;
+        }
+        break;
     }
     case WM_KEYUP: {
         webview->keyPress(wParam, lParam);