fix bug 110726. Add carbon event handler for Text Input event to handle input methods r=ccarlen sr=sfraser a=asa
git-svn-id: svn://10.0.0.236/trunk@119025 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -60,6 +60,7 @@
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsIWebBrowserPrint.h"
|
||||
#include "nsIMacTextInputEventSink.h"
|
||||
|
||||
// Local
|
||||
#include "ApplIDs.h"
|
||||
@@ -1490,3 +1491,86 @@ CBrowserShell::DoDragReceive( DragReference inDragRef )
|
||||
sDragHelper->Drop ( inDragRef, mEventSink, &dragAccepted );
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
OSStatus CBrowserShell::HandleUpdateActiveInputArea(
|
||||
const nsAString& text,
|
||||
PRInt16 script,
|
||||
PRInt16 language,
|
||||
PRInt32 fixLen,
|
||||
const TextRangeArray * hiliteRng
|
||||
)
|
||||
{
|
||||
nsCOMPtr<nsIMacTextInputEventSink> tieSink;
|
||||
tieSink = do_QueryInterface(mEventSink);
|
||||
if (!tieSink)
|
||||
return eventNotHandledErr;
|
||||
|
||||
OSStatus err = noErr;
|
||||
nsresult res = tieSink->HandleUpdateActiveInputArea( text,
|
||||
script, language,
|
||||
fixLen, (void*)hiliteRng,
|
||||
&err);
|
||||
if (noErr != err)
|
||||
return err;
|
||||
return NS_FAILED(res) ? eventNotHandledErr : noErr;
|
||||
}
|
||||
|
||||
OSStatus CBrowserShell::HandleUnicodeForKeyEvent(
|
||||
const nsAString& text,
|
||||
PRInt16 script,
|
||||
PRInt16 language,
|
||||
const EventRecord * keyboardEvent)
|
||||
{
|
||||
nsCOMPtr<nsIMacTextInputEventSink> tieSink;
|
||||
tieSink = do_QueryInterface(mEventSink);
|
||||
if (!tieSink)
|
||||
return eventNotHandledErr;
|
||||
|
||||
OSStatus err = noErr;
|
||||
nsresult res = tieSink->HandleUnicodeForKeyEvent( text,
|
||||
script, language,
|
||||
(void*)keyboardEvent,
|
||||
&err);
|
||||
if (noErr != err)
|
||||
return err;
|
||||
return NS_FAILED(res) ? eventNotHandledErr : noErr;
|
||||
}
|
||||
|
||||
OSStatus CBrowserShell::HandleOffsetToPos(
|
||||
PRInt32 offset,
|
||||
PRInt16 *pointX,
|
||||
PRInt16 *pointY)
|
||||
{
|
||||
nsCOMPtr<nsIMacTextInputEventSink> tieSink;
|
||||
tieSink = do_QueryInterface(mEventSink);
|
||||
if (!tieSink)
|
||||
return eventNotHandledErr;
|
||||
|
||||
OSStatus err = noErr;
|
||||
nsresult res = tieSink->HandleOffsetToPos( offset, pointX, pointY, &err);
|
||||
if (noErr != err)
|
||||
return err;
|
||||
return NS_FAILED(res) ? eventNotHandledErr : noErr;
|
||||
}
|
||||
|
||||
OSStatus CBrowserShell::HandlePosToOffset(
|
||||
PRInt16 currentPointX,
|
||||
PRInt16 currentPointY,
|
||||
PRInt32 *offset,
|
||||
PRInt16 *regionClass
|
||||
)
|
||||
{
|
||||
nsCOMPtr<nsIMacTextInputEventSink> tieSink;
|
||||
tieSink = do_QueryInterface(mEventSink);
|
||||
if (!tieSink)
|
||||
return eventNotHandledErr;
|
||||
|
||||
OSStatus err = noErr;
|
||||
nsresult res = tieSink->HandlePosToOffset( currentPointX, currentPointY,
|
||||
offset, regionClass, &err);
|
||||
if (noErr != err)
|
||||
return err;
|
||||
return NS_FAILED(res) ? eventNotHandledErr : noErr;
|
||||
}
|
||||
|
||||
@@ -107,6 +107,19 @@ public:
|
||||
// LPeriodical
|
||||
virtual void SpendTime(const EventRecord& inMacEvent);
|
||||
|
||||
// Handle Text Input Event
|
||||
// hiliteRng should be a
|
||||
virtual OSStatus HandleUpdateActiveInputArea(const nsAString& text,
|
||||
PRInt16 script, PRInt16 language,
|
||||
PRInt32 fixLen, const TextRangeArray * hiliteRng);
|
||||
virtual OSStatus HandleUnicodeForKeyEvent(const nsAString& text,
|
||||
PRInt16 script, PRInt16 language,
|
||||
const EventRecord* keyboardEvent);
|
||||
virtual OSStatus HandleOffsetToPos(PRInt32 offset, PRInt16 *pointX, PRInt16 *pointY);
|
||||
virtual OSStatus HandlePosToOffset(PRInt16 currentPointX, PRInt16 currentPointY,
|
||||
PRInt32 *offset, PRInt16 *regionClass);
|
||||
|
||||
|
||||
|
||||
// CBrowserShell
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
#include "EmbedEventHandling.h"
|
||||
#include "CTextInputEventHandler.h"
|
||||
|
||||
#include "nsRepeater.h"
|
||||
#include "prthread.h"
|
||||
@@ -271,5 +272,6 @@ void InitializeEmbedEventHandling(LApplication* theApplication)
|
||||
CEmbedRepeater *embedRepeater = new CEmbedRepeater;
|
||||
ThrowIfNil_(embedRepeater);
|
||||
embedRepeater->StartRepeating();
|
||||
InitializeTextInputEventHandling();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user