[EFL][WK2] Implement the inspector for WebKitTestRunner
https://bugs.webkit.org/show_bug.cgi?id=92213
Patch by Seokju Kwon <seokju.kwon@samsung.com> on 2012-07-25
Reviewed by Ryosuke Niwa.
Partial Implementation of WebInspectorProxyEfl for WebkitTestRunner.
And Web Inspector resources installation.
* PlatformEfl.cmake:
* UIProcess/WebInspectorProxy.cpp:
(WebKit::WebInspectorProxy::WebInspectorProxy):
* UIProcess/WebInspectorProxy.h:
(WebInspectorProxy):
* UIProcess/efl/WebInspectorProxyEfl.cpp:
(WebKit::WebInspectorProxy::platformCreateInspectorPage):
(WebKit::WebInspectorProxy::platformDidClose):
(WebKit::WebInspectorProxy::inspectorPageURL):
(WebKit::WebInspectorProxy::inspectorBaseURL):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@123703 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index 672aeec..c93c5ee 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,3 +1,24 @@
+2012-07-25 Seokju Kwon <seokju.kwon@samsung.com>
+
+ [EFL][WK2] Implement the inspector for WebKitTestRunner
+ https://bugs.webkit.org/show_bug.cgi?id=92213
+
+ Reviewed by Ryosuke Niwa.
+
+ Partial Implementation of WebInspectorProxyEfl for WebkitTestRunner.
+ And Web Inspector resources installation.
+
+ * PlatformEfl.cmake:
+ * UIProcess/WebInspectorProxy.cpp:
+ (WebKit::WebInspectorProxy::WebInspectorProxy):
+ * UIProcess/WebInspectorProxy.h:
+ (WebInspectorProxy):
+ * UIProcess/efl/WebInspectorProxyEfl.cpp:
+ (WebKit::WebInspectorProxy::platformCreateInspectorPage):
+ (WebKit::WebInspectorProxy::platformDidClose):
+ (WebKit::WebInspectorProxy::inspectorPageURL):
+ (WebKit::WebInspectorProxy::inspectorBaseURL):
+
2012-07-25 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Create a specialized struct for use in HashMap iterators
diff --git a/Source/WebKit2/PlatformEfl.cmake b/Source/WebKit2/PlatformEfl.cmake
index 66ad037..1939b63 100644
--- a/Source/WebKit2/PlatformEfl.cmake
+++ b/Source/WebKit2/PlatformEfl.cmake
@@ -252,3 +252,24 @@
TARGET_LINK_LIBRARIES(${testName} ${EWK2UnitTests_LIBRARIES} ewk2UnitTestUtils)
ENDFOREACH ()
ENDIF ()
+
+IF (ENABLE_INSPECTOR)
+ SET(WK2_WEB_INSPECTOR_DIR ${CMAKE_BINARY_DIR}/WebKit2/efl/webinspector)
+ SET(WK2_WEB_INSPECTOR_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/${WebKit2_LIBRARY_NAME}-${PROJECT_VERSION_MAJOR})
+ ADD_DEFINITIONS(-DWK2_WEB_INSPECTOR_DIR="${WK2_WEB_INSPECTOR_DIR}")
+ ADD_DEFINITIONS(-DWK2_WEB_INSPECTOR_INSTALL_DIR="${WK2_WEB_INSPECTOR_INSTALL_DIR}/webinspector")
+ ADD_CUSTOM_TARGET(
+ wk2-web-inspector-resources ALL
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${WEBCORE_DIR}/inspector/front-end ${WK2_WEB_INSPECTOR_DIR}
+ COMMAND ${CMAKE_COMMAND} -E copy ${WEBCORE_DIR}/English.lproj/localizedStrings.js ${WK2_WEB_INSPECTOR_DIR}
+ COMMAND ${CMAKE_COMMAND} -E copy ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorBackendCommands.js ${WK2_WEB_INSPECTOR_DIR}/InspectorBackendCommands.js
+ DEPENDS ${WebCore_LIBRARY_NAME}
+ )
+ INSTALL(DIRECTORY ${WK2_WEB_INSPECTOR_DIR}
+ DESTINATION ${WK2_WEB_INSPECTOR_INSTALL_DIR}
+ FILES_MATCHING PATTERN "*.js"
+ PATTERN "*.html"
+ PATTERN "*.css"
+ PATTERN "*.gif"
+ PATTERN "*.png")
+ENDIF ()
diff --git a/Source/WebKit2/UIProcess/WebInspectorProxy.cpp b/Source/WebKit2/UIProcess/WebInspectorProxy.cpp
index ab19d5d..3c5c380 100644
--- a/Source/WebKit2/UIProcess/WebInspectorProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebInspectorProxy.cpp
@@ -80,7 +80,7 @@
, m_isProfilingPage(false)
#if PLATFORM(WIN)
, m_inspectorWindow(0)
-#elif PLATFORM(GTK)
+#elif PLATFORM(GTK) || PLATFORM(EFL)
, m_inspectorView(0)
, m_inspectorWindow(0)
#endif
diff --git a/Source/WebKit2/UIProcess/WebInspectorProxy.h b/Source/WebKit2/UIProcess/WebInspectorProxy.h
index 0958472..5a73a5e 100644
--- a/Source/WebKit2/UIProcess/WebInspectorProxy.h
+++ b/Source/WebKit2/UIProcess/WebInspectorProxy.h
@@ -52,6 +52,11 @@
#include "WebInspectorClientGtk.h"
#endif
+#if PLATFORM(EFL)
+#include <Ecore_Evas.h>
+#include <Evas.h>
+#endif
+
namespace WebKit {
class WebFrameProxy;
@@ -217,6 +222,9 @@
WebInspectorClientGtk m_client;
GtkWidget* m_inspectorView;
GtkWidget* m_inspectorWindow;
+#elif PLATFORM(EFL)
+ Evas_Object* m_inspectorView;
+ Ecore_Evas* m_inspectorWindow;
#endif
#if ENABLE(INSPECTOR_SERVER)
int m_remoteInspectionPageId;
diff --git a/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp b/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp
index b2b68bc..2b1537e 100644
--- a/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp
+++ b/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp
@@ -28,15 +28,25 @@
#if ENABLE(INSPECTOR)
+#include "WebProcessProxy.h"
+#include "ewk_view_private.h"
#include <WebCore/NotImplemented.h>
+#include <unistd.h>
+#include <wtf/text/CString.h>
#include <wtf/text/WTFString.h>
namespace WebKit {
WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
{
- notImplemented();
- return 0;
+ ASSERT(m_page);
+
+ m_inspectorWindow = ecore_evas_buffer_new(initialWindowWidth, initialWindowHeight);
+ if (!m_inspectorWindow)
+ return 0;
+
+ m_inspectorView = ewk_view_base_add(ecore_evas_get(m_inspectorWindow), toAPI(page()->process()->context()), toAPI(inspectorPageGroup()));
+ return ewk_view_page_get(m_inspectorView);
}
void WebInspectorProxy::platformOpen()
@@ -46,7 +56,15 @@
void WebInspectorProxy::platformDidClose()
{
- notImplemented();
+ if (m_inspectorView) {
+ evas_object_del(m_inspectorView);
+ m_inspectorView = 0;
+ }
+
+ if (m_inspectorWindow) {
+ ecore_evas_free(m_inspectorWindow);
+ m_inspectorWindow = 0;
+ }
}
void WebInspectorProxy::platformBringToFront()
@@ -67,14 +85,16 @@
String WebInspectorProxy::inspectorPageURL() const
{
- notImplemented();
- return String();
+ return makeString(inspectorBaseURL(), "/inspector.html");
}
String WebInspectorProxy::inspectorBaseURL() const
{
- notImplemented();
- return String();
+ String inspectorFilesPath = makeString("file://", WK2_WEB_INSPECTOR_INSTALL_DIR);
+ if (access(inspectorFilesPath.utf8().data(), R_OK))
+ inspectorFilesPath = makeString("file://", WK2_WEB_INSPECTOR_DIR);
+
+ return inspectorFilesPath;
}
unsigned WebInspectorProxy::platformInspectedWindowHeight()