Example #1
0
void TextInputController::selectedRange(const CppArgumentList&, CppVariant* result)
{
    result->setNull();

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

    WebRange range = mainFrame->selectionRange();
    result->set(StringPrintf("%d,%d", range.startOffset(), range.endOffset()));
}
void TextInputController::selectedRange(const CppArgumentList&, CppVariant* result)
{
    result->setNull();

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

    WebRange range = mainFrame->selectionRange();
    Vector<int> intArray(2);
    intArray[0] = range.startOffset();
    intArray[1] = range.endOffset();
    result->set(WebBindings::makeIntArray(intArray));
}
Example #3
0
static void printRangeDescription(const WebRange& range)
{
    if (range.isNull()) {
        fputs("(null)", stdout);
        return;
    }
    printf("range from %d of ", range.startOffset());
    int exception = 0;
    WebNode startNode = range.startContainer(exception);
    printNodeDescription(startNode, exception);
    printf(" to %d of ", range.endOffset());
    WebNode endNode = range.endContainer(exception);
    printNodeDescription(endNode, exception);
}
Example #4
0
void TextInputController::markedRange(const CppArgumentList&, CppVariant* result)
{
    result->setNull();

    WebFrame* mainFrame = m_webView->mainFrame();
    if (!mainFrame)
        return;

    WebRange range = mainFrame->markedRange();
    vector<int> intArray(2);
    intArray[0] = range.startOffset();
    intArray[1] = range.endOffset();

    NPObject* resultArray = WebBindings::makeIntArray(intArray);
    result->set(resultArray);
    WebBindings::releaseObject(resultArray);
}