Пример #1
0
void TextInputController::unmarkText(const CppArgumentList&, CppVariant* result)
{
    result->setNull();

    WebFrame* mainFrame = getMainFrame();
    if (!mainFrame)
        return;

    mainFrame->unmarkText();
}
Пример #2
0
void TextInputController::insertText(const CppArgumentList& arguments, CppVariant* result)
{
    result->setNull();

    WebFrame* mainFrame = getMainFrame();
    if (!mainFrame)
        return;
    if (arguments.size() < 1 || !arguments[0].isString())
        return;

    if (mainFrame->hasMarkedText()) {
        mainFrame->unmarkText();
        mainFrame->replaceSelection(WebString());
    }
    mainFrame->insertText(WebString::fromUTF8(arguments[0].toString()));
}