2006-03-16 Eric Seidel <eseidel@apple.com>
authoreseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Mar 2006 23:05:49 +0000 (23:05 +0000)
committereseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Mar 2006 23:05:49 +0000 (23:05 +0000)
        Reviewed by darin.

        Add resize, scroll event support.

        * Spinneret/Spinneret/WebView.cpp:
        (WebKit::WebView::mouseMoved):
        (WebKit::WebView::mouseDown):
        (WebKit::WebView::mouseUp):
        (WebKit::WebView::mouseDoubleClick):
        (WebKit::WebView::keyPress):
        (WebKit::WebViewWndProc):
        * Spinneret/Spinneret/WebView.h:

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

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

index c6950483d984642b3b2395d91ace5716a9d83a05..74056356f6dd8dd29f6c1d9063a010d91c7d80ee 100644 (file)
@@ -1,3 +1,18 @@
+2006-03-16  Eric Seidel  <eseidel@apple.com>
+
+        Reviewed by darin.
+
+        Add resize, scroll event support.
+
+        * Spinneret/Spinneret/WebView.cpp:
+        (WebKit::WebView::mouseMoved):
+        (WebKit::WebView::mouseDown):
+        (WebKit::WebView::mouseUp):
+        (WebKit::WebView::mouseDoubleClick):
+        (WebKit::WebView::keyPress):
+        (WebKit::WebViewWndProc):
+        * Spinneret/Spinneret/WebView.h:
+
 2006-03-16  Eric Seidel  <eseidel@apple.com>
 
         Reviewed by darin.
index ca87e29240993b551970997c8290606fe83ca5c7..f7764a4495f7b7c3efcc4979b41649b1b0554534 100755 (executable)
@@ -29,6 +29,7 @@
 #include "WebFrame.h"
 
 #include "WebView.h"
+#include "KeyEvent.h"
 #include "Resource.h"
 #include "FrameView.h"
 #include "MouseEvent.h"
@@ -121,30 +122,36 @@ WebFrame* WebView::mainFrame()
     return d->mainFrame;
 }
 
-void WebView::mouseMoved(HWND hWnd, WPARAM wParam, LPARAM lParam)
+void WebView::mouseMoved(WPARAM wParam, LPARAM lParam)
 {
-    MouseEvent mouseEvent(hWnd, wParam, lParam, 0);
+    MouseEvent mouseEvent(windowHandle(), wParam, lParam, 0);
     d->mainFrame->viewImpl()->viewportMouseMoveEvent(&mouseEvent);
 }
 
-void WebView::mouseDown(HWND hWnd, WPARAM wParam, LPARAM lParam)
+void WebView::mouseDown(WPARAM wParam, LPARAM lParam)
 {
-    MouseEvent mouseEvent(hWnd, wParam, lParam, 1);
+    MouseEvent mouseEvent(windowHandle(), wParam, lParam, 1);
     d->mainFrame->viewImpl()->viewportMousePressEvent(&mouseEvent);
 }
 
-void WebView::mouseUp(HWND hWnd, WPARAM wParam, LPARAM lParam)
+void WebView::mouseUp(WPARAM wParam, LPARAM lParam)
 {
-    MouseEvent mouseEvent(hWnd, wParam, lParam, 1);
+    MouseEvent mouseEvent(windowHandle(), wParam, lParam, 1);
     d->mainFrame->viewImpl()->viewportMouseReleaseEvent(&mouseEvent);
 }
 
-void WebView::mouseDoubleClick(HWND hWnd, WPARAM wParam, LPARAM lParam)
+void WebView::mouseDoubleClick(WPARAM wParam, LPARAM lParam)
 {
-    MouseEvent mouseEvent(hWnd, wParam, lParam, 2);
+    MouseEvent mouseEvent(windowHandle(), wParam, lParam, 2);
     d->mainFrame->viewImpl()->viewportMouseReleaseEvent(&mouseEvent);
 }
 
+bool WebView::keyPress(WPARAM wParam, LPARAM lParam)
+{
+    KeyEvent keyEvent(windowHandle(), wParam, lParam);
+    return static_cast<FrameWin*>(d->mainFrame->impl())->keyPress(&keyEvent);
+}
+
 #define LINE_SCROLL_SIZE 30
 
 static int calculateScrollDelta(WPARAM wParam, int oldPosition, int pageSize)
@@ -198,7 +205,7 @@ LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
         // Do nothing?
         break;
     case WM_MOUSEMOVE:
-        webview->mouseMoved(hWnd, wParam, lParam);
+        webview->mouseMoved(wParam, lParam);
         break;
     case WM_LBUTTONDOWN:
         // Make ourselves the focused window before doing anything else
@@ -208,38 +215,58 @@ LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
         SetFocus(hWnd);
     case WM_MBUTTONDOWN:
     case WM_RBUTTONDOWN:
-        webview->mouseDown(hWnd, wParam, lParam);
+        webview->mouseDown(wParam, lParam);
         break;
     case WM_LBUTTONUP:
     case WM_MBUTTONUP:
     case WM_RBUTTONUP:
-        webview->mouseUp(hWnd, wParam, lParam);
+        webview->mouseUp(wParam, lParam);
         break;
     case WM_LBUTTONDBLCLK:
     case WM_MBUTTONDBLCLK:
     case WM_RBUTTONDBLCLK:
-        webview->mouseDoubleClick(hWnd, wParam, lParam);
+        webview->mouseDoubleClick(wParam, lParam);
         break;
     case WM_HSCROLL: {
         ScrollView* view = webview->mainFrame()->impl()->view();
         view->scrollBy(calculateScrollDelta(wParam, view->contentsX(), view->visibleWidth()), 0);
+        webview->mainFrame()->impl()->sendScrollEvent();
         break;
     }
     case WM_VSCROLL: {
         ScrollView* view = webview->mainFrame()->impl()->view();
         view->scrollBy(0, calculateScrollDelta(wParam, view->contentsY(), view->visibleHeight()));
+        webview->mainFrame()->impl()->sendScrollEvent();
         break;
     }
     case WM_KEYDOWN: {
         // FIXME: First we should send key events up through the DOM
         // to form controls, etc.  If they are not handled, we fall
         // 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);
+    }
+    case WM_KEYUP: {
+        webview->keyPress(wParam, lParam);
         break;
     }
+    case WM_SIZE:
+        if (!webview)
+            break;
+        webview->mainFrame()->impl()->sendResizeEvent();
+        break;
+    case WM_SETFOCUS:
+        webview->mainFrame()->impl()->setWindowHasFocus(true);
+        webview->mainFrame()->impl()->setDisplaysWithFocusAttributes(true);
+        break;
+    case WM_KILLFOCUS:
+        webview->mainFrame()->impl()->setWindowHasFocus(false);
+        webview->mainFrame()->impl()->setDisplaysWithFocusAttributes(false);
+        break;
     default:
         return DefWindowProc(hWnd, message, wParam, lParam);
     }
index d28db5d57e24dccb9aefcf754964907cc27b3185..8a583a0613e3b115b7e64775cfd1f99af1f55293 100755 (executable)
@@ -40,10 +40,11 @@ namespace WebKit {
 
         void drawRect(const PAINTSTRUCT&);
 
-        void mouseMoved(HWND, WPARAM, LPARAM);
-        void mouseDown(HWND, WPARAM, LPARAM);
-        void mouseUp(HWND, WPARAM, LPARAM);
-        void mouseDoubleClick(HWND, WPARAM, LPARAM);
+        void mouseMoved(WPARAM, LPARAM);
+        void mouseDown(WPARAM, LPARAM);
+        void mouseUp(WPARAM, LPARAM);
+        void mouseDoubleClick(WPARAM, LPARAM);
+        bool keyPress(WPARAM, LPARAM);
 
         WebFrame* mainFrame();