コード例 #1
0
bool DumpRenderTreeSupportEfl::selectedRange(Evas_Object* ewkView, int* start, int* length)
{
    if (!(start && length))
        return false;

    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page, false);

    if (!page->focusController() || !page->focusController()->focusedOrMainFrame())
        return false;

    WebCore::Frame* frame = page->focusController()->focusedOrMainFrame();
    RefPtr<WebCore::Range> range = frame->selection()->toNormalizedRange().get();
    if (!range)
        return false;

    WebCore::Element* selectionRoot = frame->selection()->rootEditableElement();
    WebCore::Element* scope = selectionRoot ? selectionRoot : frame->document()->documentElement();

    RefPtr<WebCore::Range> testRange = WebCore::Range::create(scope->document(), scope, 0, range->startContainer(), range->startOffset());
    *start = WebCore::TextIterator::rangeLength(testRange.get());

    WebCore::ExceptionCode ec;
    testRange->setEnd(range->endContainer(), range->endOffset(), ec);
    *length = WebCore::TextIterator::rangeLength(testRange.get());

    return true;
}
コード例 #2
0
void DumpRenderTreeSupportEfl::addUserScript(const Evas_Object* ewkView, const String& sourceCode, bool runAtStart, bool allFrames)
{
    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);

    page->group().addUserScriptToWorld(WebCore::mainThreadNormalWorld(), sourceCode, WebCore::KURL(),
                                       nullptr, nullptr, runAtStart ? WebCore::InjectAtDocumentStart : WebCore::InjectAtDocumentEnd,
                                       allFrames ? WebCore::InjectInAllFrames : WebCore::InjectInTopFrameOnly);
}
コード例 #3
0
bool DumpRenderTreeSupportEfl::hasComposition(const Evas_Object* ewkView)
{
    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page, false);

    if (!page->focusController() || !page->focusController()->focusedOrMainFrame())
        return false;

    return page->focusController()->focusedOrMainFrame()->editor().hasComposition();
}
コード例 #4
0
void DumpRenderTreeSupportEfl::evaluateInWebInspector(const Evas_Object* ewkView, long callId, const String& script)
{
#if ENABLE(INSPECTOR)
    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);

    if (page->inspectorController())
        page->inspectorController()->evaluateForTestInFrontend(callId, script);
#endif
}
コード例 #5
0
void DumpRenderTreeSupportEfl::setSelectTrailingWhitespaceEnabled(Evas_Object* ewkView, bool enabled)
{
    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);

    WebCore::EditorClientEfl* editorClient = static_cast<WebCore::EditorClientEfl*>(page->editorClient());
    if (!editorClient)
        return;

    editorClient->setSelectTrailingWhitespaceEnabled(enabled);
}
コード例 #6
0
void DumpRenderTreeSupportEfl::setWebAudioEnabled(Evas_Object* ewkView, bool enabled)
{
#if ENABLE(WEB_AUDIO)
    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);

    page->settings().setWebAudioEnabled(enabled);
#else
    UNUSED_PARAM(ewkView);
    UNUSED_PARAM(enabled);
#endif
}
コード例 #7
0
void DumpRenderTreeSupportEfl::resetGeolocationClientMock(const Evas_Object* ewkView)
{
#if ENABLE(GEOLOCATION)
    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);

    WebCore::GeolocationClientMock* mock = static_cast<WebCore::GeolocationClientMock*>(WebCore::GeolocationController::from(page)->client());
    mock->reset();
#else
    UNUSED_PARAM(ewkView);
#endif
}
コード例 #8
0
int DumpRenderTreeSupportEfl::numberOfPendingGeolocationPermissionRequests(const Evas_Object* ewkView)
{
#if ENABLE(GEOLOCATION)
    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page, -1);

    WebCore::GeolocationClientMock* mock = static_cast<WebCore::GeolocationClientMock*>(WebCore::GeolocationController::from(page)->client());
    return mock->numberOfPendingPermissionRequests();
#else
    UNUSED_PARAM(ewkView);
    return 0;
#endif
}
コード例 #9
0
void DumpRenderTreeSupportEfl::setMockGeolocationPositionUnavailableError(const Evas_Object* ewkView, const char* errorMessage)
{
#if ENABLE(GEOLOCATION)
    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);

    WebCore::GeolocationClientMock* mock = static_cast<WebCore::GeolocationClientMock*>(WebCore::GeolocationController::from(page)->client());
    mock->setPositionUnavailableError(errorMessage);
#else
    UNUSED_PARAM(ewkView);
    UNUSED_PARAM(errorMessage);
#endif
}
コード例 #10
0
void DumpRenderTreeSupportEfl::setComposition(Evas_Object* ewkView, const char* text, int start, int length)
{
    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);

    WebCore::Editor& editor = page->focusController().focusedOrMainFrame().editor();
    if (!editor.canEdit() && !editor.hasComposition())
        return;

    const String compositionString = String::fromUTF8(text);
    Vector<WebCore::CompositionUnderline> underlines;
    underlines.append(WebCore::CompositionUnderline(0, compositionString.length(), WebCore::Color(0, 0, 0), false));
    editor.setComposition(compositionString, underlines, start, start + length);
}
コード例 #11
0
bool DumpRenderTreeSupportEfl::compositionRange(Evas_Object* ewkView, int* start, int* length)
{
    *start = *length = 0;

    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page, false);

    WebCore::Editor& editor = page->focusController().focusedOrMainFrame().editor();
    if (!editor.hasComposition())
        return false;

    *start = editor.compositionStart();
    *length = editor.compositionEnd() - *start;
    return true;
}
コード例 #12
0
WebCore::IntRect DumpRenderTreeSupportEfl::firstRectForCharacterRange(Evas_Object* ewkView, int location, int length)
{
    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page, WebCore::IntRect());

    if ((location + length < location) && (location + length))
        length = 0;

    WebCore::Frame& frame = page->focusController().focusedOrMainFrame();

    RefPtr<WebCore::Range> range = WebCore::TextIterator::rangeFromLocationAndLength(frame.selection().rootEditableElementOrDocumentElement(), location, length);
    if (!range)
        return WebCore::IntRect();

    return frame.editor().firstRectForRange(range.get());
}
コード例 #13
0
void DumpRenderTreeSupportEfl::confirmComposition(Evas_Object* ewkView, const char* text)
{
    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);

    WebCore::Editor& editor = page->focusController().focusedOrMainFrame().editor();

    if (!editor.hasComposition()) {
        editor.insertText(String::fromUTF8(text), 0);
        return;
    }

    if (text) {
        editor.confirmComposition(String::fromUTF8(text));
        return;
    }
    editor.confirmComposition();
}
コード例 #14
0
void DumpRenderTreeSupportEfl::setMockGeolocationPosition(const Evas_Object* ewkView, double latitude, double longitude, double accuracy, bool canProvideAltitude, double altitude, bool canProvideAltitudeAccuracy, double altitudeAccuracy, bool canProvideHeading, double heading, bool canProvideSpeed, double speed)
{
#if ENABLE(GEOLOCATION)
    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);

    WebCore::GeolocationClientMock* mock = static_cast<WebCore::GeolocationClientMock*>(WebCore::GeolocationController::from(page)->client());
    mock->setPosition(WebCore::GeolocationPosition::create(currentTime(), latitude, longitude, accuracy, canProvideAltitude, altitude, canProvideAltitudeAccuracy, altitudeAccuracy, canProvideHeading, heading, canProvideSpeed, speed));
#else
    UNUSED_PARAM(ewkView);
    UNUSED_PARAM(latitude);
    UNUSED_PARAM(longitude);
    UNUSED_PARAM(accuracy);
    UNUSED_PARAM(canProvideAltitude);
    UNUSED_PARAM(altitude);
    UNUSED_PARAM(canProvideAltitudeAccuracy);
    UNUSED_PARAM(altitudeAccuracy);
    UNUSED_PARAM(canProvideHeading);
    UNUSED_PARAM(heading);
    UNUSED_PARAM(canProvideSpeed);
    UNUSED_PARAM(speed);
#endif
}
コード例 #15
0
bool DumpRenderTreeSupportEfl::isCommandEnabled(const Evas_Object* ewkView, const char* name)
{
    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page, false);

    return page->focusController()->focusedOrMainFrame()->editor()->command(name).isEnabled();
}
コード例 #16
0
void DumpRenderTreeSupportEfl::setCSSRegionsEnabled(const Evas_Object* ewkView, bool enabled)
{
    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);

    page->settings()->setCSSRegionsEnabled(enabled);
}
コード例 #17
0
bool DumpRenderTreeSupportEfl::findString(const Evas_Object* ewkView, const String& text, WebCore::FindOptions options)
{
    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page, false);

    return page->findString(text, options);
}
コード例 #18
0
void DumpRenderTreeSupportEfl::executeCoreCommandByName(const Evas_Object* ewkView, const char* name, const char* value)
{
    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);

    page->focusController()->focusedOrMainFrame()->editor()->command(name).execute(value);
}
コード例 #19
0
void DumpRenderTreeSupportEfl::clearUserStyleSheets(const Evas_Object* ewkView)
{
    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);

    page->group().removeUserStyleSheetsFromWorld(WebCore::mainThreadNormalWorld());
}
コード例 #20
0
void DumpRenderTreeSupportEfl::setInteractiveFormValidationEnabled(Evas_Object* ewkView, bool enabled)
{
    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);

    page->settings()->setInteractiveFormValidationEnabled(enabled);
}
コード例 #21
0
void DumpRenderTreeSupportEfl::setDefersLoading(Evas_Object* ewkView, bool defers)
{
    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);

    page->setDefersLoading(defers);
}
コード例 #22
0
void DumpRenderTreeSupportEfl::addUserStyleSheet(const Evas_Object* ewkView, const String& sourceCode, bool allFrames)
{
    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);

    page->group().addUserStyleSheetToWorld(WebCore::mainThreadNormalWorld(), sourceCode, WebCore::URL(), Vector<String>(), Vector<String>(), allFrames ? WebCore::InjectInAllFrames : WebCore::InjectInTopFrameOnly);
}
コード例 #23
0
void DumpRenderTreeSupportEfl::setAuthorAndUserStylesEnabled(Evas_Object* ewkView, bool enabled)
{
    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);

    page->settings()->setAuthorAndUserStylesEnabled(enabled);
}
コード例 #24
0
void DumpRenderTreeSupportEfl::setValidationMessageTimerMagnification(Evas_Object* ewkView, int value)
{
    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);

    page->settings()->setValidationMessageTimerMagnification(value);
}
コード例 #25
0
void DumpRenderTreeSupportEfl::setMinimumLogicalFontSize(Evas_Object* ewkView, int size)
{
    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);

    page->settings()->setMinimumLogicalFontSize(size);
}
コード例 #26
0
void DumpRenderTreeSupportEfl::setLoadsSiteIconsIgnoringImageLoadingSetting(Evas_Object* ewkView, bool loadsSiteIconsIgnoringImageLoadingPreferences)
{
    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);

    page->settings()->setLoadsSiteIconsIgnoringImageLoadingSetting(loadsSiteIconsIgnoringImageLoadingPreferences);
}
コード例 #27
0
void DumpRenderTreeSupportEfl::setCSSRegionsEnabled(const Evas_Object* ewkView, bool enabled)
{
    DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page);

    WebCore::RuntimeEnabledFeatures::sharedFeatures().setCSSRegionsEnabled(enabled);
}