[EFL][DRT] Implement LayoutTestController::execCommand
[WebKit-https.git] / Source / WebKit / efl / WebCoreSupport / DumpRenderTreeSupportEfl.cpp
index 74958fba8edec89fa6a1efedb414a57832b03a4e..9b28046f8cbda0c237f253db5457661432ce9880 100644 (file)
@@ -32,6 +32,7 @@
 #include <Evas.h>
 #include <FindOptions.h>
 #include <FloatSize.h>
+#include <FocusController.h>
 #include <FrameView.h>
 #include <HTMLInputElement.h>
 #include <InspectorController.h>
@@ -392,6 +393,15 @@ void DumpRenderTreeSupportEfl::addUserStyleSheet(const Evas_Object* ewkView, con
     page->group().addUserStyleSheetToWorld(WebCore::mainThreadNormalWorld(), sourceCode, WebCore::KURL(), nullptr, nullptr, allFrames ? WebCore::InjectInAllFrames : WebCore::InjectInTopFrameOnly);
 }
 
+void DumpRenderTreeSupportEfl::executeCoreCommandByName(const Evas_Object* ewkView, const char* name, const char* value)
+{
+    WebCore::Page* page = EWKPrivate::corePage(ewkView);
+    if (!page)
+        return;
+
+    page->focusController()->focusedOrMainFrame()->editor()->command(name).execute(value);
+}
+
 bool DumpRenderTreeSupportEfl::findString(const Evas_Object* ewkView, const char* text, WebCore::FindOptions options)
 {
     WebCore::Page* page = EWKPrivate::corePage(ewkView);
@@ -420,6 +430,15 @@ void DumpRenderTreeSupportEfl::setJavaScriptProfilingEnabled(const Evas_Object*
 #endif
 }
 
+bool DumpRenderTreeSupportEfl::isCommandEnabled(const Evas_Object* ewkView, const char* name)
+{
+    WebCore::Page* page = EWKPrivate::corePage(ewkView);
+    if (!page)
+        return false;
+
+    return page->focusController()->focusedOrMainFrame()->editor()->command(name).isEnabled();
+}
+
 void DumpRenderTreeSupportEfl::setSmartInsertDeleteEnabled(Evas_Object* ewkView, bool enabled)
 {
     WebCore::Page* page = EWKPrivate::corePage(ewkView);