Changeset 83633 in webkit
- Timestamp:
- Apr 12, 2011 1:44:17 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r83628 r83633 1 2011-04-12 Jeff Miller <jeffm@apple.com> 2 3 Reviewed by Adam Roben. 4 5 WebKit2: Pressing Tab in Web Inspector's console does not cycle through completion options 6 https://bugs.webkit.org/show_bug.cgi?id=56020 7 8 Safari was always calling TranslateMessage() on key events since it has no way to know whether 9 WebKit handled the event without a PageUIClient (which Safari only installs on pages inside 10 a Safari window), which was generating a WM_CHAR message containing the tab in this case. The fix 11 is for Safari to never call TranslateMessage() on key events outside of a Safari window, but this 12 means the WebPageProxy needs to do this for unhandled key events if there is no didNotHandleKeyEvent 13 callback in the PageUIClient. 14 15 * UIProcess/WebPageProxy.cpp: 16 (WebKit::WebPageProxy::didReceiveEvent): Call TranslateMessage() on Windows for unhandled key events that can't be handled by the PageUIClient. 17 * UIProcess/WebUIClient.cpp: 18 (WebKit::WebUIClient::canNotHandleKeyEvent): Added. 19 * UIProcess/WebUIClient.h: Added canNotHandleKeyEvent(). 20 1 21 2011-04-12 Alice Liu <alice.liu@apple.com> 2 22 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r83627 r83633 2564 2564 break; 2565 2565 2566 m_uiClient.didNotHandleKeyEvent(this, event); 2566 if (m_uiClient.implementsDidNotHandleKeyEvent()) 2567 m_uiClient.didNotHandleKeyEvent(this, event); 2568 #if PLATFORM(WIN) 2569 else 2570 ::TranslateMessage(event.nativeEvent()); 2571 #endif 2567 2572 break; 2568 2573 } -
trunk/Source/WebKit2/UIProcess/WebUIClient.cpp
r83531 r83633 156 156 } 157 157 158 bool WebUIClient::implementsDidNotHandleKeyEvent() const 159 { 160 return m_client.didNotHandleKeyEvent; 161 } 162 158 163 void WebUIClient::didNotHandleKeyEvent(WebPageProxy* page, const NativeWebKeyboardEvent& event) 159 164 { -
trunk/Source/WebKit2/UIProcess/WebUIClient.h
r83531 r83633 67 67 void mouseDidMoveOverElement(WebPageProxy*, WebEvent::Modifiers, APIObject*); 68 68 void missingPluginButtonClicked(WebPageProxy*, const String& mimeType, const String& url, const String& pluginsPageURL); 69 70 bool implementsDidNotHandleKeyEvent() const; 69 71 void didNotHandleKeyEvent(WebPageProxy*, const NativeWebKeyboardEvent&); 70 72 -
trunk/Tools/ChangeLog
r83631 r83633 1 2011-04-12 Jeff Miller <jeffm@apple.com> 2 3 Reviewed by Adam Roben. 4 5 WebKit2: Pressing Tab in Web Inspector's console does not cycle through completion options 6 https://bugs.webkit.org/show_bug.cgi?id=56020 7 8 Don't call TranslateMessage() in the MiniBrowser or TestWebKitAPI for key messages destined for a WebKit2 view, 9 since WebKit will do this for us. If we didn't do this, TranslateMessage() would be called twice, 10 which would generate two characters for every keypress (for example). I didn't bother doing this for 11 WebKitTestRunner, since it doesn't get any WM_KEYDOWN events. 12 13 Add new WebKit2/TranslateMessageGeneratesWMChar test to test expected TranslateMessage() behavior. 14 15 * MiniBrowser/win/main.cpp: 16 (shouldTranslateMessage): Added. 17 (_tWinMain): Don't call TranslateMessage() unless shouldTranslateMessage() says to. 18 * TestWebKitAPI/PlatformUtilities.h: Added shouldTranslateMessage() on Windows. 19 * TestWebKitAPI/PlatformWebView.h: Added simulateAKeyDown(). 20 * TestWebKitAPI/Tests/WebKit2/win/TranslateMessageGeneratesWMChar.cpp: Added. 21 (TestWebKitAPI::didNotHandleKeyEventCallback): Added. 22 (TestWebKitAPI::runAndWatchForWMChar): Added. 23 (TestWebKitAPI::TEST): Added. 24 * TestWebKitAPI/win/PlatformUtilitiesWin.cpp: 25 (TestWebKitAPI::Util::run): Don't call TranslateMessage() unless shouldTranslateMessage() says to. 26 (TestWebKitAPI::Util::shouldTranslateMessage): Added. 27 * TestWebKitAPI/win/PlatformWebViewWin.cpp: 28 (TestWebKitAPI::PlatformWebView::simulateAKeyDown): Added. 29 * TestWebKitAPI/win/TestWebKitAPI.vcproj: Added TranslateMessageGeneratesWMChar.cpp. 30 1 31 2011-04-12 Dirk Pranke <dpranke@chromium.org> 2 32 -
trunk/Tools/MiniBrowser/win/main.cpp
r57849 r83633 42 42 #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='" PROCESSORARCHITECTURE "' publicKeyToken='6595b64144ccf1df' language='*'\"") 43 43 44 static bool shouldTranslateMessage(const MSG& msg) 45 { 46 // Only these four messages are actually translated by ::TranslateMessage or ::TranslateAccelerator. 47 // It's useless (though harmless) to call those functions for other messages, so we always allow other messages to be translated. 48 if (msg.message != WM_KEYDOWN && msg.message != WM_SYSKEYDOWN && msg.message != WM_KEYUP && msg.message != WM_SYSKEYUP) 49 return true; 50 51 wchar_t className[256]; 52 if (!::GetClassNameW(msg.hwnd, className, ARRAYSIZE(className))) 53 return true; 54 55 // Don't call TranslateMessage() on key events destined for a WebKit2 view, WebKit will do this if it doesn't handle the message. 56 // It would be nice to use some API here instead of hard-coding the window class name. 57 return wcscmp(className, L"WebKit2WebViewWindowClass"); 58 } 59 44 60 int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpstrCmdLine, int nCmdShow) 45 61 { … … 53 69 if (result == -1) 54 70 break; 55 ::TranslateMessage(&message); 71 72 if (shouldTranslateMessage(message)) 73 ::TranslateMessage(&message); 56 74 57 75 if (!MiniBrowser::shared().handleMessage(&message)) -
trunk/Tools/TestWebKitAPI/PlatformUtilities.h
r82730 r83633 29 29 #include <WebKit2/WebKit2.h> 30 30 #include <WebKit2/WKRetainPtr.h> 31 #include <wtf/Platform.h> 31 32 #include <string> 32 33 … … 36 37 // Runs a platform runloop until the 'done' is true. 37 38 void run(bool* done); 39 40 #if PLATFORM(WIN) 41 bool shouldTranslateMessage(const MSG&); 42 #endif 38 43 39 44 void sleep(double seconds); -
trunk/Tools/TestWebKitAPI/PlatformWebView.h
r79966 r83633 66 66 67 67 #if PLATFORM(WIN) 68 void simulateAKeyDown(); 68 69 void setParentWindowMessageObserver(WindowMessageObserver* observer) { m_parentWindowMessageObserver = observer; } 69 70 #endif -
trunk/Tools/TestWebKitAPI/win/PlatformUtilitiesWin.cpp
r81116 r83633 50 50 if (!result || result == -1) 51 51 break; 52 ::TranslateMessage(&msg); 52 53 if (shouldTranslateMessage(msg)) 54 ::TranslateMessage(&msg); 53 55 ::DispatchMessage(&msg); 54 56 } 57 } 58 59 bool shouldTranslateMessage(const MSG& msg) 60 { 61 // Only these four messages are actually translated by ::TranslateMessage or ::TranslateAccelerator. 62 // It's useless (though harmless) to call those functions for other messages, so we always allow other messages to be translated. 63 if (msg.message != WM_KEYDOWN && msg.message != WM_SYSKEYDOWN && msg.message != WM_KEYUP && msg.message != WM_SYSKEYUP) 64 return true; 65 66 wchar_t className[256]; 67 if (!::GetClassNameW(msg.hwnd, className, ARRAYSIZE(className))) 68 return true; 69 70 // Don't call TranslateMessage() on key events destined for a WebKit2 view, WebKit will do this if it doesn't handle the message. 71 // It would be nice to use some API here instead of hard-coding the window class name. 72 return wcscmp(className, L"WebKit2WebViewWindowClass"); 55 73 } 56 74 -
trunk/Tools/TestWebKitAPI/win/PlatformWebViewWin.cpp
r79966 r83633 93 93 } 94 94 95 void PlatformWebView::simulateAKeyDown() 96 { 97 HWND window = WKViewGetWindow(m_view); 98 99 // These values match what happens when you press the 'A' key in Notepad, as observed by Spy++. 100 ::SendMessageW(window, WM_KEYDOWN, 'A', (1 << repeatCountBitOffset) | (30 << scanCodeBitOffset)); 101 } 102 95 103 void PlatformWebView::simulateAltKeyPress() 96 104 { -
trunk/Tools/TestWebKitAPI/win/TestWebKitAPI.vcproj
r82906 r83633 560 560 </File> 561 561 <File 562 RelativePath="..\Tests\WebKit2\win\TranslateMessageGeneratesWMChar.cpp" 563 > 564 </File> 565 <File 562 566 RelativePath="..\Tests\WebKit2\win\WMCloseCallsUIClientClose.cpp" 563 567 >
Note: See TracChangeset
for help on using the changeset viewer.