summaryrefslogtreecommitdiffstats
path: root/webkit/glue
diff options
context:
space:
mode:
authorpinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-09 19:41:42 +0000
committerpinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-09 19:41:42 +0000
commit35406dbfc537f51b2e6fe97c2fb000576262f206 (patch)
tree4cddf16ef7459742c66d9308fffc433e8b0fb152 /webkit/glue
parent5956848cf26bd275c8d03db6c92990c4022e57c2 (diff)
downloadchromium_src-35406dbfc537f51b2e6fe97c2fb000576262f206.zip
chromium_src-35406dbfc537f51b2e6fe97c2fb000576262f206.tar.gz
chromium_src-35406dbfc537f51b2e6fe97c2fb000576262f206.tar.bz2
fix platform differences in editor client, make compile on non-windows
Review URL: http://codereview.chromium.org/1852 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1916 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r--webkit/glue/editor_client_impl.cc40
-rw-r--r--webkit/glue/editor_client_impl.h10
2 files changed, 41 insertions, 9 deletions
diff --git a/webkit/glue/editor_client_impl.cc b/webkit/glue/editor_client_impl.cc
index b996370..c81921d 100644
--- a/webkit/glue/editor_client_impl.cc
+++ b/webkit/glue/editor_client_impl.cc
@@ -397,6 +397,7 @@ struct KeyPressEntry {
};
static const KeyDownEntry keyDownEntries[] = {
+#if defined(OS_WIN)
{ VK_LEFT, 0, "MoveLeft" },
{ VK_LEFT, ShiftKey, "MoveLeftAndModifySelection" },
{ VK_LEFT, CtrlKey, "MoveWordLeft" },
@@ -428,11 +429,13 @@ static const KeyDownEntry keyDownEntries[] = {
{ VK_DELETE, 0, "DeleteForward" },
{ VK_BACK, CtrlKey, "DeleteWordBackward" },
{ VK_DELETE, CtrlKey, "DeleteWordForward" },
+#endif
{ 'B', CtrlKey, "ToggleBold" },
{ 'I', CtrlKey, "ToggleItalic" },
{ 'U', CtrlKey, "ToggleUnderline" },
+#if defined(OS_WIN)
{ VK_ESCAPE, 0, "Cancel" },
{ VK_OEM_PERIOD, CtrlKey, "Cancel" },
{ VK_TAB, 0, "InsertTab" },
@@ -443,13 +446,14 @@ static const KeyDownEntry keyDownEntries[] = {
{ VK_RETURN, AltKey | ShiftKey, "InsertNewline" },
{ VK_RETURN, ShiftKey, "InsertLineBreak" },
- { 'C', CtrlKey, "Copy" },
{ VK_INSERT, CtrlKey, "Copy" },
- { 'V', CtrlKey, "Paste" },
{ VK_INSERT, ShiftKey, "Paste" },
+ { VK_DELETE, ShiftKey, "Cut" },
+#endif
+ { 'C', CtrlKey, "Copy" },
+ { 'V', CtrlKey, "Paste" },
{ 'V', CtrlKey | ShiftKey, "PasteAndMatchStyle" },
{ 'X', CtrlKey, "Cut" },
- { VK_DELETE, ShiftKey, "Cut" },
{ 'A', CtrlKey, "SelectAll" },
{ 'Z', CtrlKey, "Undo" },
{ 'Z', CtrlKey | ShiftKey, "Redo" },
@@ -479,13 +483,13 @@ const char* EditorClientImpl::interpretKeyEvent(
keyDownCommandsMap = new HashMap<int, const char*>;
keyPressCommandsMap = new HashMap<int, const char*>;
- for (unsigned i = 0; i < _countof(keyDownEntries); i++) {
+ for (unsigned i = 0; i < arraysize(keyDownEntries); i++) {
keyDownCommandsMap->set(
keyDownEntries[i].modifiers << 16 | keyDownEntries[i].virtualKey,
keyDownEntries[i].name);
}
- for (unsigned i = 0; i < _countof(keyPressEntries); i++) {
+ for (unsigned i = 0; i < arraysize(keyPressEntries); i++) {
keyPressCommandsMap->set(
keyPressEntries[i].modifiers << 16 | keyPressEntries[i].charCode,
keyPressEntries[i].name);
@@ -512,9 +516,11 @@ const char* EditorClientImpl::interpretKeyEvent(
bool EditorClientImpl::handleEditingKeyboardEvent(
WebCore::KeyboardEvent* evt) {
const WebCore::PlatformKeyboardEvent* keyEvent = evt->keyEvent();
+#if defined(OS_WIN)
// do not treat this as text input if it's a system key event
if (!keyEvent || keyEvent->isSystemKey())
return false;
+#endif
WebCore::Frame* frame = evt->target()->toNode()->document()->frame();
if (!frame)
@@ -603,6 +609,23 @@ void EditorClientImpl::textDidChangeInTextArea(WebCore::Element*) {
notImplemented();
}
+#if defined(OS_MACOSX)
+// TODO(pinkerton): implement these when we get to copy/paste
+NSData* EditorClientImpl::dataForArchivedSelection(WebCore::Frame*) {
+ notImplemented();
+}
+
+NSString* EditorClientImpl::userVisibleString(NSURL*) {
+ notImplemented();
+}
+
+#ifdef BUILDING_ON_TIGER
+NSArray* EditorClientImpl::pasteboardTypesForSelection(WebCore::Frame*) {
+ notImplemented();
+}
+#endif
+#endif
+
void EditorClientImpl::ignoreWordInSpellDocument(const WebCore::String&) {
notImplemented();
}
@@ -620,7 +643,8 @@ void EditorClientImpl::checkSpellingOfString(const UChar* str, int length,
int spell_length = 0;
WebViewDelegate* d = web_view_->delegate();
if (web_view_->FocusedFrameNeedsSpellchecking() && d) {
- std::wstring word(str, length);
+ std::wstring word =
+ webkit_glue::StringToStdWString(WebCore::String(str, length));
d->SpellCheck(word, spell_location, spell_length);
} else {
spell_location = 0;
@@ -681,9 +705,7 @@ std::wstring EditorClientImpl::DescribeOrError(int number,
if (ec)
return L"ERROR";
- wchar_t buffer[128];
- _itow_s(number, buffer, arraysize(buffer), 10);
- return std::wstring(buffer);
+ return IntToWString(number);
}
std::wstring EditorClientImpl::DescribeOrError(WebCore::Node* node,
diff --git a/webkit/glue/editor_client_impl.h b/webkit/glue/editor_client_impl.h
index 6602426..a9878e2 100644
--- a/webkit/glue/editor_client_impl.h
+++ b/webkit/glue/editor_client_impl.h
@@ -5,6 +5,8 @@
#ifndef WEBKIT_GLUE_EDITOR_CLIENT_IMPL_H__
#define WEBKIT_GLUE_EDITOR_CLIENT_IMPL_H__
+#include "build/build_config.h"
+
#include <deque>
#pragma warning(push, 0)
@@ -80,6 +82,14 @@ class EditorClientImpl : public WebCore::EditorClient {
virtual void textWillBeDeletedInTextField(WebCore::Element*);
virtual void textDidChangeInTextArea(WebCore::Element*);
+#if defined(OS_MACOSX)
+ virtual NSData* dataForArchivedSelection(WebCore::Frame*);
+ virtual NSString* userVisibleString(NSURL*);
+#ifdef BUILDING_ON_TIGER
+ virtual NSArray* pasteboardTypesForSelection(WebCore::Frame*);
+#endif
+#endif
+
virtual void ignoreWordInSpellDocument(const WebCore::String&);
virtual void learnWord(const WebCore::String&);
virtual void checkSpellingOfString(const UChar*, int length,