Commit 8e9c2713 authored by oliver's avatar oliver

Reviewed by Maciej.

        Fix for <rdar://problem/5334818> Support IME reconversion in windows

        Also includes a small amount of IME refactoring.

        * WebView.cpp:
        (WebView::onIMERequestCharPosition):
        (WebView::onIMERequestReconvertString):
        (WebView::onIMERequest):
        * WebView.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@24352 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f4315cf2
2007-07-16 Oliver Hunt <oliver@apple.com>
Reviewed by Maciej.
Fix for <rdar://problem/5334818> Support IME reconversion in windows
Also includes a small amount of IME refactoring.
* WebView.cpp:
(WebView::onIMERequestCharPosition):
(WebView::onIMERequestReconvertString):
(WebView::onIMERequest):
* WebView.h:
2007-07-16 Brady Eidson <beidson@apple.com>
Reviewed by Adam
......
......@@ -3911,12 +3911,9 @@ bool WebView::onIMENotify(WPARAM, LPARAM, LRESULT*)
return false;
}
bool WebView::onIMERequestCharPosition(IMECHARPOSITION* charPos, LRESULT* result)
bool WebView::onIMERequestCharPosition(Frame* targetFrame, IMECHARPOSITION* charPos, LRESULT* result)
{
IntRect caret;
Frame* targetFrame = m_page->focusController()->focusedOrMainFrame();
if (!targetFrame)
return true;
if (RefPtr<Range> range = targetFrame->selectionController()->selection().toRange()) {
ExceptionCode ec = 0;
RefPtr<Range> tempRange = range->cloneRange(ec);
......@@ -3932,14 +3929,41 @@ bool WebView::onIMERequestCharPosition(IMECHARPOSITION* charPos, LRESULT* result
return true;
}
bool WebView::onIMERequestReconvertString(Frame* targetFrame, RECONVERTSTRING* reconvertString, LRESULT* result)
{
RefPtr<Range> selectedRange = targetFrame->selectionController()->toRange();
String text = selectedRange->text();
if (!reconvertString) {
*result = sizeof(RECONVERTSTRING) + text.length() * sizeof(UChar);
return true;
}
unsigned totalSize = sizeof(RECONVERTSTRING) + text.length() * sizeof(UChar);
*result = totalSize;
if (totalSize > reconvertString->dwSize) {
*result = 0;
return false;
}
reconvertString->dwCompStrLen = text.length();
reconvertString->dwStrLen = text.length();
reconvertString->dwTargetStrLen = text.length();
reconvertString->dwStrOffset = sizeof(RECONVERTSTRING);
memcpy(reconvertString + 1, text.characters(), text.length() * sizeof(UChar));
return true;
}
bool WebView::onIMERequest(WPARAM request, LPARAM data, LRESULT* result)
{
Frame* targetFrame = m_page->focusController()->focusedOrMainFrame();
if (!targetFrame || !targetFrame->editor()->canEdit())
return true;
switch (request) {
case IMR_RECONVERTSTRING:
return false;
return onIMERequestReconvertString(targetFrame, (RECONVERTSTRING*)data, result);
case IMR_QUERYCHARPOSITION:
return onIMERequestCharPosition((IMECHARPOSITION*)data, result);
return onIMERequestCharPosition(targetFrame, (IMECHARPOSITION*)data, result);
}
return false;
}
......
......@@ -675,7 +675,8 @@ protected:
void initializeToolTipWindow();
void prepareCandidateWindow(WebCore::Frame*, HIMC);
void updateSelectionForIME();
bool onIMERequestCharPosition(IMECHARPOSITION*, LRESULT*);
bool onIMERequestCharPosition(WebCore::Frame*, IMECHARPOSITION*, LRESULT*);
bool onIMERequestReconvertString(WebCore::Frame*, RECONVERTSTRING*, LRESULT*);
ULONG m_refCount;
WebCore::String m_groupName;
HWND m_hostWindow;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment