Reviewed by Sam.
<rdar://problem/5344848> IME is incorrectly used for key events when on non-editable regions
EditorClient::setInputMethodState stub
* WebCoreSupport/EditorClientGtk.cpp:
(WebKit::EditorClient::setInputMethodState):
* WebCoreSupport/EditorClientGtk.h:
WebCore:
Reviewed by Sam.
<rdar://problem/5344848> IME is incorrectly used for key events when on non-editable regions
Adding a new EditorClient method so it is possible to inform WebKit of focus changes.
Also added new virtual method Node::shouldUseInputMethod to allow us to trivially check
whether an input method should be used when processing input for the currently focused
Node.
* bridge/EditorClient.h:
* dom/Node.cpp:
(WebCore::Node::shouldUseInputMethod):
* dom/Node.h:
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::shouldUseInputMethod):
* html/HTMLInputElement.h:
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::shouldUseInputMethod):
* html/HTMLTextAreaElement.h:
* page/FocusController.cpp:
(WebCore::FocusController::setFocusedNode):
* platform/graphics/svg/SVGImageEmptyClients.h:
(WebCore::SVGEmptyEditorClient::setInputMethodState):
WebKit:
Reviewed by Sam.
<rdar://problem/5344848> IME is incorrectly used for key events when on non-editable regions
EditorClient::setInputMethodState stub
* WebCoreSupport/WebEditorClient.h:
* WebCoreSupport/WebEditorClient.mm:
(WebEditorClient::setInputMethodState):
WebKitQt:
Reviewed by Sam.
<rdar://problem/5344848> IME is incorrectly used for key events when on non-editable regions
EditorClient::setInputMethodState stub
* WebCoreSupport/EditorClientQt.cpp:
(WebCore::EditorClientQt::setInputMethodState):
* WebCoreSupport/EditorClientQt.h:
win:
Reviewed by Sam.
<rdar://problem/5344848> IME is incorrectly used for key events when on non-editable regions
When focusing a password field or a non-editable element we disassociate any IME that may have
been active, and reassociate should a non-password editable element is focused.
This makes password input with an IME active simpler, and brings our IME behaviour in line with
IE.
* WebEditorClient.cpp:
(WebEditorClient::setInputMethodState):
* WebEditorClient.h:
* WebView.cpp:
(IMMDict::IMMDict):
(WebView::setInputMethodState):
* WebView.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@25345
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-09-01 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Sam.
+
+ <rdar://problem/5344848> IME is incorrectly used for key events when on non-editable regions
+
+ Adding a new EditorClient method so it is possible to inform WebKit of focus changes.
+ Also added new virtual method Node::shouldUseInputMethod to allow us to trivially check
+ whether an input method should be used when processing input for the currently focused
+ Node.
+
+ * bridge/EditorClient.h:
+ * dom/Node.cpp:
+ (WebCore::Node::shouldUseInputMethod):
+ * dom/Node.h:
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::shouldUseInputMethod):
+ * html/HTMLInputElement.h:
+ * html/HTMLTextAreaElement.cpp:
+ (WebCore::HTMLTextAreaElement::shouldUseInputMethod):
+ * html/HTMLTextAreaElement.h:
+ * page/FocusController.cpp:
+ (WebCore::FocusController::setFocusedNode):
+ * platform/graphics/svg/SVGImageEmptyClients.h:
+ (WebCore::SVGEmptyEditorClient::setInputMethodState):
+
2007-09-01 Rob Buis <buis@kde.org>
Reviewed by Darin.
virtual void showSpellingUI(bool show) = 0;
virtual bool spellingUIIsShowing() = 0;
virtual void getGuessesForWord(const String&, Vector<String>& guesses) = 0;
+ virtual void setInputMethodState(bool enabled) = 0;
};
}
return parent() && parent()->isContentRichlyEditable();
}
+bool Node::shouldUseInputMethod() const
+{
+ return isContentEditable();
+}
+
IntRect Node::getRect() const
{
int _x, _y;
virtual bool isContentEditable() const;
virtual bool isContentRichlyEditable() const;
+ virtual bool shouldUseInputMethod() const;
virtual IntRect getRect() const;
enum StyleChange { NoChange, NoInherit, Inherit, Detach, Force };
document()->frame()->textFieldDidEndEditing(this);
}
+bool HTMLInputElement::shouldUseInputMethod() const
+{
+ return m_type == TEXT || m_type == SEARCH || m_type == ISINDEX;
+}
+
void HTMLInputElement::dispatchFocusEvent()
{
if (isTextField()) {
virtual void dispatchBlurEvent();
virtual void updateFocusAppearance(bool restorePreviousSelection);
virtual void aboutToUnload();
+ virtual bool shouldUseInputMethod() const;
virtual const AtomicString& name() const;
return static_cast<RenderTextControl*>(renderer())->selection(cachedSelStart, cachedSelEnd);
}
+bool HTMLTextAreaElement::shouldUseInputMethod() const
+{
+ return true;
+}
+
} // namespace
void cacheSelection(int s, int e) { cachedSelStart = s; cachedSelEnd = e; };
Selection selection() const;
+ virtual bool shouldUseInputMethod() const;
private:
void updateValue() const;
#include "Chrome.h"
#include "Document.h"
#include "Editor.h"
+#include "EditorClient.h"
#include "Element.h"
#include "Event.h"
#include "EventHandler.h"
if (!node) {
if (oldDocument)
oldDocument->setFocusedNode(0);
+ m_page->editorClient()->setInputMethodState(false);
return true;
}
RefPtr<Document> newDocument = node ? node->document() : 0;
- if (newDocument && newDocument->focusedNode() == node)
+ if (newDocument && newDocument->focusedNode() == node) {
+ m_page->editorClient()->setInputMethodState(node->shouldUseInputMethod());
return true;
+ }
if (oldDocument && oldDocument != newDocument)
oldDocument->setFocusedNode(0);
if (newDocument)
newDocument->setFocusedNode(node);
+ m_page->editorClient()->setInputMethodState(node->shouldUseInputMethod());
+
return true;
}
virtual void showSpellingUI(bool show) { }
virtual bool spellingUIIsShowing() { return false; }
virtual void getGuessesForWord(const String&, Vector<String>& guesses) { }
+ virtual void setInputMethodState(bool enabled) { }
};
+2007-09-01 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Sam.
+
+ <rdar://problem/5344848> IME is incorrectly used for key events when on non-editable regions
+
+ EditorClient::setInputMethodState stub
+
+ * WebCoreSupport/WebEditorClient.h:
+ * WebCoreSupport/WebEditorClient.mm:
+ (WebEditorClient::setInputMethodState):
+
2007-08-30 Maciej Stachowiak <mjs@apple.com>
Reviewed by Tim.
virtual void showSpellingUI(bool show);
virtual bool spellingUIIsShowing();
virtual void getGuessesForWord(const WebCore::String&, WTF::Vector<WebCore::String>& guesses);
-
+ virtual void setInputMethodState(bool enabled);
private:
void registerCommandForUndoOrRedo(PassRefPtr<WebCore::EditCommand>, bool isRedo);
WebEditorClient();
guesses.append(string);
}
}
+
+void WebEditorClient::setInputMethodState(bool)
+{
+}
+2007-09-01 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Sam.
+
+ <rdar://problem/5344848> IME is incorrectly used for key events when on non-editable regions
+
+ EditorClient::setInputMethodState stub
+
+ * WebCoreSupport/EditorClientGtk.cpp:
+ (WebKit::EditorClient::setInputMethodState):
+ * WebCoreSupport/EditorClientGtk.h:
+
2007-08-18 Holger Hans Peter Freyther <zecke@selfish.org>
Build fix. Add const to the first parameter of createPlugin
notImplemented();
}
+void EditorClient::setInputMethodState(bool)
+{
+}
+
}
// vim: ts=4 sw=4 et
virtual void showSpellingUI(bool show);
virtual bool spellingUIIsShowing();
virtual void getGuessesForWord(const WebCore::String&, WTF::Vector<WebCore::String>& guesses);
+ virtual void setInputMethodState(bool enabled);
private:
WebKitGtkPage* m_page;
+2007-09-01 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Sam.
+
+ <rdar://problem/5344848> IME is incorrectly used for key events when on non-editable regions
+
+ When focusing a password field or a non-editable element we disassociate any IME that may have
+ been active, and reassociate should a non-password editable element is focused.
+
+ This makes password input with an IME active simpler, and brings our IME behaviour in line with
+ IE.
+
+ * WebEditorClient.cpp:
+ (WebEditorClient::setInputMethodState):
+ * WebEditorClient.h:
+ * WebView.cpp:
+ (IMMDict::IMMDict):
+ (WebView::setInputMethodState):
+ * WebView.h:
+
2007-08-31 Steve Falkenburg <sfalken@apple.com>
<rdar://problem/5432594> Safari quits when hovering over mailto links on a webpage
}
}
+void WebEditorClient::setInputMethodState(bool enabled)
+{
+ m_webView->setInputMethodState(enabled);
+}
virtual bool spellingUIIsShowing();
virtual void getGuessesForWord(const WebCore::String&, Vector<WebCore::String>& guesses);
+ virtual void setInputMethodState(bool);
+
private:
WebView* m_webView;
WebEditorUndoTarget* m_undoTarget;
typedef BOOL (CALLBACK *setCandidateWindowPtr)(HIMC, LPCANDIDATEFORM);
typedef BOOL (CALLBACK *setOpenStatusPtr)(HIMC, BOOL);
typedef BOOL (CALLBACK *notifyIMEPtr)(HIMC, DWORD, DWORD, DWORD);
+ typedef BOOL (CALLBACK *associateContextExPtr)(HWND, HIMC, DWORD);
public:
getContextPtr getContext;
setCandidateWindowPtr setCandidateWindow;
setOpenStatusPtr setOpenStatus;
notifyIMEPtr notifyIME;
+ associateContextExPtr associateContextEx;
+
static const IMMDict& dict();
private:
IMMDict();
ASSERT(setOpenStatus);
notifyIME = reinterpret_cast<notifyIMEPtr>(::GetProcAddress(m_instance, "ImmNotifyIME"));
ASSERT(notifyIME);
+ associateContextEx = reinterpret_cast<associateContextExPtr>(::GetProcAddress(m_instance, "ImmAssociateContextEx"));
+ ASSERT(associateContextEx);
}
HIMC WebView::getIMMContext()
resetIME(targetFrame);
}
+void WebView::setInputMethodState(bool enabled)
+{
+ IMMDict::dict().associateContextEx(m_viewWindow, 0, enabled ? IACE_DEFAULT : 0);
+}
+
void WebView::selectionChanged()
{
updateSelectionForIME();
void selectionChanged();
void resetIME(WebCore::Frame*);
bool inIMEKeyDown() const { return m_inIMEKeyDown; }
+ void setInputMethodState(bool);
HRESULT registerDragDrop();
HRESULT revokeDragDrop();
+2007-09-01 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Sam.
+
+ <rdar://problem/5344848> IME is incorrectly used for key events when on non-editable regions
+
+ EditorClient::setInputMethodState stub
+
+ * WebCoreSupport/EditorClientQt.cpp:
+ (WebCore::EditorClientQt::setInputMethodState):
+ * WebCoreSupport/EditorClientQt.h:
+
2007-08-30 Simon Hausmann <hausmann@kde.org>
Reviewed by Zack.
{
return m_editing;
}
+
+void EditorClientQt::setInputMethodState(bool)
+{
+}
}
virtual void showSpellingUI(bool show);
virtual bool spellingUIIsShowing();
virtual void getGuessesForWord(const String&, Vector<String>& guesses);
+ virtual void setInputMethodState(bool enabled);
bool isEditing() const;