diff options
Diffstat (limited to 'Source/WebKit/win/WebView.cpp')
-rw-r--r-- | Source/WebKit/win/WebView.cpp | 67 |
1 files changed, 22 insertions, 45 deletions
diff --git a/Source/WebKit/win/WebView.cpp b/Source/WebKit/win/WebView.cpp index 0fb8047..69f83de 100644 --- a/Source/WebKit/win/WebView.cpp +++ b/Source/WebKit/win/WebView.cpp @@ -128,6 +128,7 @@ #include <WebCore/SelectionController.h> #include <WebCore/Settings.h> #include <WebCore/SimpleFontData.h> +#include <WebCore/SystemInfo.h> #include <WebCore/TypingCommand.h> #include <WebCore/WindowMessageBroadcaster.h> #include <wtf/Threading.h> @@ -161,7 +162,7 @@ #include <comutil.h> #include <dimm.h> #include <oleacc.h> -#include <tchar.h> +#include <wchar.h> #include <windowsx.h> #include <wtf/HashSet.h> #include <wtf/text/CString.h> @@ -184,8 +185,7 @@ using JSC::JSLock; static HMODULE accessibilityLib; static HashSet<WebView*> pendingDeleteBackingStoreSet; -static String osVersion(); -static String webKitVersion(); +static String webKitVersionString(); WebView* kit(Page* page) { @@ -1244,9 +1244,10 @@ bool WebView::canHandleRequest(const WebCore::ResourceRequest& request) String WebView::standardUserAgentWithApplicationName(const String& applicationName) { - if (applicationName.isEmpty()) - return makeString("Mozilla/5.0 (", osVersion(), ") AppleWebKit/", webKitVersion(), " (KHTML, like Gecko)"); - return makeString("Mozilla/5.0 (", osVersion(), ") AppleWebKit/", webKitVersion(), " (KHTML, like Gecko) ", applicationName); + DEFINE_STATIC_LOCAL(String, osVersion, (windowsVersionForUAString())); + DEFINE_STATIC_LOCAL(String, webKitVersion, (webKitVersionString())); + + return makeString("Mozilla/5.0 (", osVersion, ") AppleWebKit/", webKitVersion, " (KHTML, like Gecko)", applicationName.isEmpty() ? "" : " ", applicationName); } Page* WebView::page() @@ -1675,12 +1676,12 @@ bool WebView::mouseWheel(WPARAM wParam, LPARAM lParam, bool isMouseHWheel) HWND focusedWindow = GetFocus(); if (focusedWindow && focusedWindow != m_viewWindow) { // Our focus is on a different hwnd, see if it's a PopupMenu and if so, set the focus back on us (which will hide the popup). - TCHAR className[256]; + WCHAR className[256]; // Make sure truncation won't affect the comparison. - ASSERT(WTF_ARRAY_LENGTH(className) > _tcslen(PopupMenuWin::popupClassName())); + ASSERT(WTF_ARRAY_LENGTH(className) > wcslen(PopupMenuWin::popupClassName())); - if (GetClassName(focusedWindow, className, WTF_ARRAY_LENGTH(className)) && !_tcscmp(className, PopupMenuWin::popupClassName())) { + if (GetClassNameW(focusedWindow, className, WTF_ARRAY_LENGTH(className)) && !wcscmp(className, PopupMenuWin::popupClassName())) { // We don't let the WebView scroll here for two reasons - 1) To match Firefox behavior, 2) If we do scroll, we lose the // focus ring around the select menu. SetFocus(m_viewWindow); @@ -2336,31 +2337,7 @@ bool WebView::developerExtrasEnabled() const #endif } -static String osVersion() -{ - String osVersion; - OSVERSIONINFO versionInfo = {0}; - versionInfo.dwOSVersionInfoSize = sizeof(versionInfo); - GetVersionEx(&versionInfo); - - if (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { - if (versionInfo.dwMajorVersion == 4) { - if (versionInfo.dwMinorVersion == 0) - osVersion = "Windows 95"; - else if (versionInfo.dwMinorVersion == 10) - osVersion = "Windows 98"; - else if (versionInfo.dwMinorVersion == 90) - osVersion = "Windows 98; Win 9x 4.90"; - } - } else if (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT) - osVersion = makeString("Windows NT ", String::number(versionInfo.dwMajorVersion), '.', String::number(versionInfo.dwMinorVersion)); - - if (!osVersion.length()) - osVersion = makeString("Windows ", String::number(versionInfo.dwMajorVersion), '.', String::number(versionInfo.dwMinorVersion)); - return osVersion; -} - -static String webKitVersion() +static String webKitVersionString() { LPWSTR buildNumberStringPtr; if (!::LoadStringW(gInstance, BUILD_NUMBER, reinterpret_cast<LPWSTR>(&buildNumberStringPtr), 0) || !buildNumberStringPtr) @@ -2523,15 +2500,15 @@ bool WebView::shouldInitializeTrackPointHack() return shouldCreateScrollbars; hasRunTrackPointCheck = true; - const TCHAR trackPointKeys[][50] = { TEXT("Software\\Lenovo\\TrackPoint"), - TEXT("Software\\Lenovo\\UltraNav"), - TEXT("Software\\Alps\\Apoint\\TrackPoint"), - TEXT("Software\\Synaptics\\SynTPEnh\\UltraNavUSB"), - TEXT("Software\\Synaptics\\SynTPEnh\\UltraNavPS2") }; + const WCHAR trackPointKeys[][50] = { L"Software\\Lenovo\\TrackPoint", + L"Software\\Lenovo\\UltraNav", + L"Software\\Alps\\Apoint\\TrackPoint", + L"Software\\Synaptics\\SynTPEnh\\UltraNavUSB", + L"Software\\Synaptics\\SynTPEnh\\UltraNavPS2" }; for (int i = 0; i < 5; ++i) { HKEY trackPointKey; - int readKeyResult = ::RegOpenKeyEx(HKEY_CURRENT_USER, trackPointKeys[i], 0, KEY_READ, &trackPointKey); + int readKeyResult = ::RegOpenKeyExW(HKEY_CURRENT_USER, trackPointKeys[i], 0, KEY_READ, &trackPointKey); ::RegCloseKey(trackPointKey); if (readKeyResult == ERROR_SUCCESS) { shouldCreateScrollbars = true; @@ -2562,8 +2539,8 @@ HRESULT STDMETHODCALLTYPE WebView::initWithFrame( // If we detected a registry key belonging to a TrackPoint driver, then create fake trackpoint // scrollbars, so the WebView will receive WM_VSCROLL and WM_HSCROLL messages. We create one // vertical scrollbar and one horizontal to allow for receiving both types of messages. - ::CreateWindow(TEXT("SCROLLBAR"), TEXT("FAKETRACKPOINTHSCROLLBAR"), WS_CHILD | WS_VISIBLE | SBS_HORZ, 0, 0, 0, 0, m_viewWindow, 0, gInstance, 0); - ::CreateWindow(TEXT("SCROLLBAR"), TEXT("FAKETRACKPOINTVSCROLLBAR"), WS_CHILD | WS_VISIBLE | SBS_VERT, 0, 0, 0, 0, m_viewWindow, 0, gInstance, 0); + ::CreateWindowW(L"SCROLLBAR", L"FAKETRACKPOINTHSCROLLBAR", WS_CHILD | WS_VISIBLE | SBS_HORZ, 0, 0, 0, 0, m_viewWindow, 0, gInstance, 0); + ::CreateWindowW(L"SCROLLBAR", L"FAKETRACKPOINTVSCROLLBAR", WS_CHILD | WS_VISIBLE | SBS_VERT, 0, 0, 0, 0, m_viewWindow, 0, gInstance, 0); } hr = registerDragDrop(); @@ -3050,7 +3027,7 @@ HRESULT STDMETHODCALLTYPE WebView::setCustomTextEncodingName( if (FAILED(hr)) return hr; - if (oldEncoding != encodingName && (!oldEncoding || !encodingName || _tcscmp(oldEncoding, encodingName))) { + if (oldEncoding != encodingName && (!oldEncoding || !encodingName || wcscmp(oldEncoding, encodingName))) { if (Frame* coreFrame = core(m_mainFrame)) coreFrame->loader()->reloadWithOverrideEncoding(String(encodingName, SysStringLen(encodingName))); } @@ -5271,7 +5248,7 @@ const IMMDict& IMMDict::dict() IMMDict::IMMDict() { - m_instance = ::LoadLibrary(TEXT("IMM32.DLL")); + m_instance = ::LoadLibraryW(L"IMM32.DLL"); getContext = reinterpret_cast<getContextPtr>(::GetProcAddress(m_instance, "ImmGetContext")); ASSERT(getContext); releaseContext = reinterpret_cast<releaseContextPtr>(::GetProcAddress(m_instance, "ImmReleaseContext")); @@ -5928,7 +5905,7 @@ bool WebView::onGetObject(WPARAM wParam, LPARAM lParam, LRESULT& lResult) const return false; if (!accessibilityLib) { - if (!(accessibilityLib = ::LoadLibrary(TEXT("oleacc.dll")))) + if (!(accessibilityLib = ::LoadLibraryW(L"oleacc.dll"))) return false; } |