diff options
Diffstat (limited to 'WebCore/platform/brew')
-rw-r--r-- | WebCore/platform/brew/ClipboardBrew.cpp | 2 | ||||
-rw-r--r-- | WebCore/platform/brew/FileSystemBrew.cpp | 21 | ||||
-rw-r--r-- | WebCore/platform/brew/PlatformKeyboardEventBrew.cpp | 95 | ||||
-rw-r--r-- | WebCore/platform/brew/ScreenBrew.cpp | 8 |
4 files changed, 99 insertions, 27 deletions
diff --git a/WebCore/platform/brew/ClipboardBrew.cpp b/WebCore/platform/brew/ClipboardBrew.cpp index 10025d6..c0504bc 100644 --- a/WebCore/platform/brew/ClipboardBrew.cpp +++ b/WebCore/platform/brew/ClipboardBrew.cpp @@ -42,7 +42,7 @@ PassRefPtr<Clipboard> Clipboard::create(ClipboardAccessPolicy, DragData*, Frame* } ClipboardBrew::ClipboardBrew(ClipboardAccessPolicy policy, ClipboardType clipboardType) - : Clipboard(clipboardType, isForDragging) + : Clipboard(policy, clipboardType) { } diff --git a/WebCore/platform/brew/FileSystemBrew.cpp b/WebCore/platform/brew/FileSystemBrew.cpp index a723e63..e207b55 100644 --- a/WebCore/platform/brew/FileSystemBrew.cpp +++ b/WebCore/platform/brew/FileSystemBrew.cpp @@ -30,24 +30,23 @@ #include "FileSystem.h" #include "NotImplemented.h" -#include "PlatformString.h" -#include "StringBuilder.h" #include <AEEAppGen.h> #include <AEEFile.h> #include <AEEStdLib.h> -#include <wtf/OwnPtr.h> -#include <wtf/PassOwnPtr.h> #include <wtf/RandomNumber.h> +#include <wtf/brew/RefPtrBrew.h> #include <wtf/brew/ShellBrew.h> #include <wtf/text/CString.h> +#include <wtf/text/StringBuilder.h> +#include <wtf/text/WTFString.h> namespace WebCore { bool getFileSize(const String& path, long long& result) { - OwnPtr<IFileMgr> fileMgr = createInstance<IFileMgr>(AEECLSID_FILEMGR); + PlatformRefPtr<IFileMgr> fileMgr = createRefPtrInstance<IFileMgr>(AEECLSID_FILEMGR); FileInfo info; if (IFILEMGR_GetInfo(fileMgr.get(), path.utf8().data(), &info) == SUCCESS) { @@ -67,21 +66,21 @@ bool getFileModificationTime(const String& path, time_t& result) bool fileExists(const String& path) { - OwnPtr<IFileMgr> fileMgr = createInstance<IFileMgr>(AEECLSID_FILEMGR); + PlatformRefPtr<IFileMgr> fileMgr = createRefPtrInstance<IFileMgr>(AEECLSID_FILEMGR); return (IFILEMGR_Test(fileMgr.get(), path.utf8().data()) == SUCCESS); } bool deleteFile(const String& path) { - OwnPtr<IFileMgr> fileMgr = createInstance<IFileMgr>(AEECLSID_FILEMGR); + PlatformRefPtr<IFileMgr> fileMgr = createRefPtrInstance<IFileMgr>(AEECLSID_FILEMGR); return (IFILEMGR_Remove(fileMgr.get(), path.utf8().data()) == SUCCESS); } bool deleteEmptyDirectory(const String& path) { - OwnPtr<IFileMgr> fileMgr = createInstance<IFileMgr>(AEECLSID_FILEMGR); + PlatformRefPtr<IFileMgr> fileMgr = createRefPtrInstance<IFileMgr>(AEECLSID_FILEMGR); return (IFILEMGR_RmDir(fileMgr.get(), path.utf8().data()) == SUCCESS); } @@ -110,7 +109,7 @@ CString fileSystemRepresentation(const String& path) static String canonicalPath(const String& path) { - OwnPtr<IFileMgr> fileMgr = createInstance<IFileMgr>(AEECLSID_FILEMGR); + PlatformRefPtr<IFileMgr> fileMgr = createRefPtrInstance<IFileMgr>(AEECLSID_FILEMGR); // Get the buffer size required to resolve the path. int canonPathLen; @@ -163,7 +162,7 @@ static bool makeAllDirectories(IFileMgr* fileManager, const String& path) bool makeAllDirectories(const String& path) { - OwnPtr<IFileMgr> fileMgr = createInstance<IFileMgr>(AEECLSID_FILEMGR); + PlatformRefPtr<IFileMgr> fileMgr = createRefPtrInstance<IFileMgr>(AEECLSID_FILEMGR); return makeAllDirectories(fileMgr.get(), canonicalPath(path)); } @@ -193,7 +192,7 @@ CString openTemporaryFile(const char* prefix, PlatformFileHandle& handle) // use "fs:/~/tmp" as our temporary directory. String tempPath("fs:/~/tmp"); - OwnPtr<IFileMgr> fileMgr = createInstance<IFileMgr>(AEECLSID_FILEMGR); + PlatformRefPtr<IFileMgr> fileMgr = createRefPtrInstance<IFileMgr>(AEECLSID_FILEMGR); // Create the temporary directory if it does not exist. IFILEMGR_MkDir(fileMgr.get(), tempPath.utf8().data()); diff --git a/WebCore/platform/brew/PlatformKeyboardEventBrew.cpp b/WebCore/platform/brew/PlatformKeyboardEventBrew.cpp index 3384a4f..fc6a753 100644 --- a/WebCore/platform/brew/PlatformKeyboardEventBrew.cpp +++ b/WebCore/platform/brew/PlatformKeyboardEventBrew.cpp @@ -30,9 +30,14 @@ #include "WindowsKeyboardCodes.h" #include <AEEEvent.h> +#include <AEEIKeysMapping.h> +#include <AEEKeysMapping.bid> #include <AEEStdDef.h> #include <AEEVCodes.h> +#include <wtf/brew/RefPtrBrew.h> +#include <wtf/brew/ShellBrew.h> + namespace WebCore { static String keyIdentifierForBrewKeyCode(uint16 keyCode) @@ -143,23 +148,93 @@ static int windowsKeyCodeForKeyEvent(uint16 code) static inline String singleCharacterString(UChar c) { - return String(&c, 1); + UChar text; + + // Some key codes are not mapped to Unicode characters. Convert them to Unicode characters here. + switch (c) { + case AVK_0: + text = VK_0; + break; + case AVK_1: + text = VK_1; + break; + case AVK_2: + text = VK_2; + break; + case AVK_3: + text = VK_3; + break; + case AVK_4: + text = VK_4; + break; + case AVK_5: + text = VK_5; + break; + case AVK_6: + text = VK_6; + break; + case AVK_7: + text = VK_7; + break; + case AVK_8: + text = VK_8; + break; + case AVK_9: + text = VK_9; + break; + case AVK_STAR: + text = '*'; + break; + case AVK_POUND: + text = '#'; + break; + case AVK_FUNCTION1: + text = '='; + break; + case AVK_FUNCTION2: + text = '/'; + break; + case AVK_FUNCTION3: + text = '_'; + break; + case AVK_PUNC1: + text = ','; + break; + case AVK_PUNC2: + text = '.'; + break; + case AVK_SPACE: + text = VK_SPACE; + break; + default: + text = c; + break; + } + + return String(&text, 1); } PlatformKeyboardEvent::PlatformKeyboardEvent(AEEEvent event, uint16 code, uint32 modifiers, Type type) : m_type(type) - , m_text((type == Char) ? singleCharacterString(code) : String()) - , m_unmodifiedText((type == Char) ? singleCharacterString(code) : String()) - , m_keyIdentifier((type == Char) ? String() : keyIdentifierForBrewKeyCode(code)) - , m_autoRepeat(modifiers & KB_AUTOREPEAT) - , m_windowsVirtualKeyCode((type == RawKeyDown || type == KeyUp) ? windowsKeyCodeForKeyEvent(code) : 0) - , m_nativeVirtualKeyCode(code) , m_isKeypad(false) - , m_shiftKey(modifiers & (KB_LSHIFT | KB_RSHIFT)) - , m_ctrlKey(modifiers & (KB_LCTRL | KB_RCTRL)) - , m_altKey(modifiers & (KB_LALT | KB_RALT)) , m_metaKey(false) + , m_windowsVirtualKeyCode((type == RawKeyDown || type == KeyUp) ? windowsKeyCodeForKeyEvent(code) : 0) { + if ((m_type == Char) && modifiers) { + PlatformRefPtr<IKeysMapping> keysMapping = createRefPtrInstance<IKeysMapping>(AEECLSID_KeysMapping); + int result = IKeysMapping_GetMapping(keysMapping.get(), code, modifiers, reinterpret_cast<AECHAR*>(&code)); + if (result == AEE_SUCCESS) // Reset the modifier when key code is successfully mapped. + modifiers = 0; + } + + m_text = (type == Char) ? singleCharacterString(code) : String(); + m_unmodifiedText = (type == Char) ? singleCharacterString(code) : String(); + m_keyIdentifier = (type == Char) ? String() : keyIdentifierForBrewKeyCode(code); + m_nativeVirtualKeyCode = code; + m_autoRepeat = modifiers & KB_AUTOREPEAT; + m_shiftKey = modifiers & (KB_LSHIFT | KB_RSHIFT); + m_ctrlKey = modifiers & (KB_LCTRL | KB_RCTRL); + m_altKey = modifiers & (KB_LALT | KB_RALT); } void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool) diff --git a/WebCore/platform/brew/ScreenBrew.cpp b/WebCore/platform/brew/ScreenBrew.cpp index b141b34..53e53d0 100644 --- a/WebCore/platform/brew/ScreenBrew.cpp +++ b/WebCore/platform/brew/ScreenBrew.cpp @@ -36,6 +36,7 @@ #include <AEEAppGen.h> #include <AEEStdLib.h> +#include <wtf/brew/RefPtrBrew.h> namespace WebCore { @@ -48,17 +49,14 @@ struct DisplayInfo { static void getDisplayInfo(DisplayInfo& info) { IDisplay* display = reinterpret_cast<AEEApplet*>(GETAPPINSTANCE())->m_pIDisplay; - IBitmap* bitmap = IDisplay_GetDestination(display); - ASSERT(bitmap); + PlatformRefPtr<IBitmap> bitmap = adoptPlatformRef(IDisplay_GetDestination(display)); AEEBitmapInfo bitmapInfo; - IBitmap_GetInfo(bitmap, &bitmapInfo, sizeof(AEEBitmapInfo)); + IBitmap_GetInfo(bitmap.get(), &bitmapInfo, sizeof(AEEBitmapInfo)); info.width = bitmapInfo.cx; info.height = bitmapInfo.cy; info.depth = bitmapInfo.nDepth; - - IBitmap_Release(bitmap); } FloatRect screenRect(Widget*) |