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; }
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); }
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(); }
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 }
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); }
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 }
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 }
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 }
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 }
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); }
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; }
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()); }
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(); }
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 }
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(); }
void DumpRenderTreeSupportEfl::setCSSRegionsEnabled(const Evas_Object* ewkView, bool enabled) { DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page); page->settings()->setCSSRegionsEnabled(enabled); }
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); }
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); }
void DumpRenderTreeSupportEfl::clearUserStyleSheets(const Evas_Object* ewkView) { DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page); page->group().removeUserStyleSheetsFromWorld(WebCore::mainThreadNormalWorld()); }
void DumpRenderTreeSupportEfl::setInteractiveFormValidationEnabled(Evas_Object* ewkView, bool enabled) { DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page); page->settings()->setInteractiveFormValidationEnabled(enabled); }
void DumpRenderTreeSupportEfl::setDefersLoading(Evas_Object* ewkView, bool defers) { DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page); page->setDefersLoading(defers); }
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); }
void DumpRenderTreeSupportEfl::setAuthorAndUserStylesEnabled(Evas_Object* ewkView, bool enabled) { DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page); page->settings()->setAuthorAndUserStylesEnabled(enabled); }
void DumpRenderTreeSupportEfl::setValidationMessageTimerMagnification(Evas_Object* ewkView, int value) { DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page); page->settings()->setValidationMessageTimerMagnification(value); }
void DumpRenderTreeSupportEfl::setMinimumLogicalFontSize(Evas_Object* ewkView, int size) { DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page); page->settings()->setMinimumLogicalFontSize(size); }
void DumpRenderTreeSupportEfl::setLoadsSiteIconsIgnoringImageLoadingSetting(Evas_Object* ewkView, bool loadsSiteIconsIgnoringImageLoadingPreferences) { DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page); page->settings()->setLoadsSiteIconsIgnoringImageLoadingSetting(loadsSiteIconsIgnoringImageLoadingPreferences); }
void DumpRenderTreeSupportEfl::setCSSRegionsEnabled(const Evas_Object* ewkView, bool enabled) { DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page); WebCore::RuntimeEnabledFeatures::sharedFeatures().setCSSRegionsEnabled(enabled); }