WebKit/win:
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Nov 2007 19:10:50 +0000 (19:10 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Nov 2007 19:10:50 +0000 (19:10 +0000)
        Reviewed by Adam.

        Get the new focus window from the wParam instead of calling GetFocus().
        Also, send blur even if there is no focused frame.

        * WebView.cpp:
        (WebViewWndProc):

WebKitTools:

        Reviewed by Adam.

        <rdar://problem/5141186>
        window.layoutTestController.setWindowIsKey is not implemented in DRT.

        Implement setWindowIsKey.

        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
        (LayoutTestController::setWindowIsKey):

LayoutTests:

        Reviewed by Adam.

        * platform/win/Skipped:
        Remove fast/dom/Window/window-onFocus.html since it succeeds now.

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

LayoutTests/ChangeLog
LayoutTests/platform/win/Skipped
WebKit/win/ChangeLog
WebKit/win/WebView.cpp
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp

index 89e3cfee78678f162cc9cee8b9a89b9d9025ab51..25882371085210ae63f657d20b08c15db955a573 100644 (file)
@@ -1,3 +1,10 @@
+2007-11-14  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Adam.
+
+        * platform/win/Skipped:
+        Remove fast/dom/Window/window-onFocus.html since it succeeds now.
+
 2007-11-13  Brady Eidson  <beidson@apple.com>
 
         Reviewed by Adam
index 7040063574128c6143d0827952d6b9aaef3f58f2..6dbd410193de70357a997e694d2e3a49ccbc45bb 100644 (file)
@@ -582,7 +582,6 @@ http/tests/xmlhttprequest/basic-auth.html
 http/tests/multipart/invalid-image-data.html
 
 # Random sizing issues (Renderblock, RenderTableCells)
-fast/dom/Window/window-onFocus.html
 fast/forms/searchfield-heights.html
 fast/table/frame-and-rules.html
 fast/table/giantCellspacing.html
index 4138e2f0b46278fd24794e717d18f5ead6625868..69d0989e8b7e415089caedf6f0c5a01bc4178327 100644 (file)
@@ -1,3 +1,13 @@
+2007-11-14  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Adam.
+
+        Get the new focus window from the wParam instead of calling GetFocus().
+        Also, send blur even if there is no focused frame.
+               
+        * WebView.cpp:
+        (WebViewWndProc):
+
 2007-11-14  Adam Roben  <aroben@apple.com>
 
         Another build fix for systems without Cygwin in their PATH
index 4dc58a34789a37f1a9d57c7ece624e1ca2e8d06d..93b1b5eda7e100e354a7a559535c48fd00d2a8d0 100644 (file)
@@ -1621,9 +1621,10 @@ static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, L
         case WM_KILLFOCUS: {
             COMPtr<IWebUIDelegate> uiDelegate;
             COMPtr<IWebUIDelegatePrivate> uiDelegatePrivate;
+            HWND newFocusWnd = reinterpret_cast<HWND>(wParam);
             if (SUCCEEDED(webView->uiDelegate(&uiDelegate)) && uiDelegate &&
                 SUCCEEDED(uiDelegate->QueryInterface(IID_IWebUIDelegatePrivate, (void**) &uiDelegatePrivate)) && uiDelegatePrivate)
-                uiDelegatePrivate->webViewLostFocus(webView, (OLE_HANDLE)(ULONG64)wParam);
+                uiDelegatePrivate->webViewLostFocus(webView, (OLE_HANDLE)(ULONG64)newFocusWnd);
             // FIXME: Merge this logic with updateActiveState, and switch this over to use updateActiveState
 
             // However here we have to be careful.  If we are losing focus because of a deactivate,
@@ -1632,12 +1633,12 @@ static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, L
             // and we need to clear out the focused target.
             FocusController* focusController = webView->page()->focusController();
             webView->resetIME(focusController->focusedOrMainFrame());
-            if (GetAncestor(hWnd, GA_ROOT) != GetFocus()) {
-                if (Frame* frame = focusController->focusedFrame()) {
+            if (GetAncestor(hWnd, GA_ROOT) != newFocusWnd) {
+                if (Frame* frame = focusController->focusedOrMainFrame()) {
                     frame->setIsActive(false);
 
                     // If we're losing focus to a child of ours, don't send blur events.
-                    if (!IsChild(hWnd, reinterpret_cast<HWND>(wParam)))
+                    if (!IsChild(hWnd, newFocusWnd))
                         frame->setWindowHasFocus(false);
                 }
             } else
index a69a7047688bdb3cd60bc08962e74136a23f545c..ce42efd2c49af5cbc6646216f294ed011f4c1e5b 100644 (file)
@@ -1,3 +1,15 @@
+2007-11-14  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Adam.
+
+        <rdar://problem/5141186>
+        window.layoutTestController.setWindowIsKey is not implemented in DRT.
+        
+        Implement setWindowIsKey.
+        
+        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
+        (LayoutTestController::setWindowIsKey):
+
 2007-11-13  Sam Weinig  <sam@webkit.org>
 
         Reviewed by Adam Roben.
index cf059775af6dedd0c64a25b3c06eaf67f248ba85..8b1fc3d7a163600d82bc029a305af1ffbcd486e3 100644 (file)
@@ -279,7 +279,19 @@ void LayoutTestController::setUserStyleSheetLocation(JSStringRef path)
 
 void LayoutTestController::setWindowIsKey(bool flag)
 {
-    // FIXME: Implement!
+    COMPtr<IWebView> webView;
+    if (FAILED(frame->webView(&webView)))
+        return;
+
+    COMPtr<IWebViewPrivate> viewPrivate;
+    if (FAILED(webView->QueryInterface(&viewPrivate)))
+        return;
+
+    HWND webViewWindow;
+    if (FAILED(viewPrivate->viewWindow((OLE_HANDLE*)&webViewWindow)))
+        return;
+
+    ::SendMessage(webViewWindow, flag ? WM_SETFOCUS : WM_KILLFOCUS, (WPARAM)::GetDesktopWindow(), 0);
 }
 
 static const CFTimeInterval waitToDumpWatchdogInterval = 10.0;