The position of candidate characters' box is wrong on OSR mode on Mac.

Issue #1730 wontfix
Alex Che created an issue

Please refer to the image attached below: 1.jpg 2.jpg

The position of the candidate characters' box is displayed according to the mouse position rather than the focused input.

We use OSR mode to show HTML contents. The view which show the contents is in the host application process, while the CEF is running in another process.

The view which is shown by the host application process handles all the mouse and keyboard events, and implements NSTextInputClient protocol. In the method stage, we pass all the parameters to the process running CEF and call the same function by IPC. And the process running CEF also implements NSTextInputClient protocol. For example: In the host application process:

- (NSRect)firstRectForCharacterRange:(NSRange)aRange actualRange (NSRangePointer)actualRange
{
    NSRect result = NSMakeRect(0, 0, 0, 0);
    TRY_CATCH_DISTANT(result = [**m_cefProcess** firstRectForCharacterRange:aRange
                                                              actualRange:actualRange])
    return result;
}

In the process running CEF:

- (NSRect)firstRectForCharacterRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange
{
    // getInnerTextInputClient will return the input context from CefBrowserHost::GetNSTextInputContext.
    id<NSTextInputClient> inputClient = [self getInnerTextInputClient];
    if (!inputClient)
        return NSMakeRect(0, 0, 0, 0);

    // The position from this function returns the one according to the mouse position rather than the focused input.
    return [inputClient firstRectForCharacterRange:aRange actualRange:actualRange];
}

Please take a look, thanks!

Comments (2)

  1. Alex Che reporter

    BTW, we integrate CEF build 2272. And we implement and call every method of NSTextInputClient from host application process to the process running CEF, and call the context's method accordingly.

  2. Log in to comment