[EFL][WK2] Remove some C'ism from EwkView
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Oct 2012 16:55:04 +0000 (16:55 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Oct 2012 16:55:04 +0000 (16:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=100370

Patch by Christophe Dumez <christophe.dumez@intel.com> on 2012-10-25
Reviewed by Kenneth Rohde Christiansen.

Source/WebKit2:

Remove a lot of C'ism from EwkView:
- Make more members private and add C++ methods to
EwkViewImpl for the public C API to use
- Use smart pointers when possible instead of raw
ones
- Use C++ naming conventions for callback functions
and define them as static methods in EwkViewImpl.

* UIProcess/API/efl/EwkViewImpl.cpp:
(EwkViewImpl::onIMFInputSequenceComplete):
(EwkViewImpl::onIMFPreeditSequenceChanged):
(EwkViewImpl::createIMFContext):
(EwkViewImpl::EwkViewImpl):
(EwkViewImpl::~EwkViewImpl):
(EwkViewImpl::setCursor):
(EwkViewImpl::setColorPickerColor):
(EwkViewImpl::isFocused):
(EwkViewImpl::isVisible):
(EwkViewImpl::title):
(EwkViewImpl::inputMethodContext):
(EwkViewImpl::themePath):
(EwkViewImpl::setThemePath):
(EwkViewImpl::customTextEncodingName):
(EwkViewImpl::setCustomTextEncodingName):
(EwkViewImpl::setMouseEventsEnabled):
(EwkViewImpl::setTouchEventsEnabled):
(EwkViewImpl::informIconChange):
(EwkViewImpl::requestColorPicker):
(EwkViewImpl::dismissColorPicker):
(EwkViewImpl::updateTextInputState):
(EwkViewImpl::informURLChange):
(EwkViewImpl::onMouseDown):
(EwkViewImpl::onMouseUp):
(EwkViewImpl::onMouseMove):
(EwkViewImpl::feedTouchEvents):
(EwkViewImpl::onTouchDown):
(EwkViewImpl::onTouchUp):
(EwkViewImpl::onTouchMove):
* UIProcess/API/efl/EwkViewImpl.h:
(WebCore):
(EwkViewImpl::ewkContext):
(EwkViewImpl::settings):
(EwkViewImpl):
(EwkViewImpl::url):
(EwkViewImpl::faviconURL):
(EwkViewImpl::mouseEventsEnabled):
(EwkViewImpl::touchEventsEnabled):
* UIProcess/API/efl/PageClientImpl.cpp:
(WebKit::PageClientImpl::isViewFocused):
(WebKit::PageClientImpl::isViewVisible):
(WebKit::PageClientImpl::didRelaunchProcess):
(WebKit::PageClientImpl::handleDownloadRequest):
* UIProcess/API/efl/ewk_settings_private.h:
(Ewk_Settings::create):
(Ewk_Settings::Ewk_Settings):
(Ewk_Settings):
* UIProcess/API/efl/ewk_view.cpp:
(_ewk_view_smart_mouse_up):
(_ewk_view_smart_key_down):
(_ewk_view_smart_add):
(ewk_view_context_get):
(ewk_view_url_get):
(ewk_view_icon_url_get):
(ewk_view_settings_get):
(ewk_view_title_get):
(ewk_view_theme_set):
(ewk_view_theme_get):
(ewk_view_setting_encoding_custom_get):
(ewk_view_setting_encoding_custom_set):
(ewk_view_mouse_events_enabled_set):
(ewk_view_mouse_events_enabled_get):
(ewk_view_color_picker_color_set):
(ewk_view_touch_events_enabled_set):
(ewk_view_touch_events_enabled_get):
* UIProcess/efl/WebInspectorProxyEfl.cpp:
(WebKit::WebInspectorProxy::platformCreateInspectorPage):

Source/WTF:

Make OwnPtr useable for Ecore_IMF_Context to avoid
using raw pointers in EFL port.

* wtf/OwnPtrCommon.h:
(WTF):
* wtf/PlatformEfl.cmake:
* wtf/efl/OwnPtrEfl.cpp:
(WTF::deleteOwnedPtr):
(WTF):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@132498 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WTF/ChangeLog
Source/WTF/wtf/OwnPtrCommon.h
Source/WTF/wtf/PlatformEfl.cmake
Source/WTF/wtf/efl/OwnPtrEfl.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp
Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h
Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp
Source/WebKit2/UIProcess/API/efl/ewk_settings_private.h
Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp

index 3f0b868..983f07d 100644 (file)
@@ -1,3 +1,20 @@
+2012-10-25  Christophe Dumez  <christophe.dumez@intel.com>
+
+        [EFL][WK2] Remove some C'ism from EwkView
+        https://bugs.webkit.org/show_bug.cgi?id=100370
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Make OwnPtr useable for Ecore_IMF_Context to avoid
+        using raw pointers in EFL port.
+
+        * wtf/OwnPtrCommon.h:
+        (WTF):
+        * wtf/PlatformEfl.cmake:
+        * wtf/efl/OwnPtrEfl.cpp:
+        (WTF::deleteOwnedPtr):
+        (WTF):
+
 2012-09-27  Yury Semikhatsky  <yurys@chromium.org>
 
         Web Inspector: provide memory instrumentation for ListHashSet
index 43a3cb7..fe2500e 100644 (file)
@@ -40,6 +40,7 @@ typedef struct HRGN__* HRGN;
 
 #if PLATFORM(EFL)
 typedef struct _Ecore_Evas Ecore_Evas;
+typedef struct _Ecore_IMF_Context Ecore_IMF_Context;
 typedef struct _Ecore_Pipe Ecore_Pipe;
 typedef struct _Ecore_Timer Ecore_Timer;
 typedef struct _Eina_Hash Eina_Hash;
@@ -68,6 +69,7 @@ namespace WTF {
 
 #if PLATFORM(EFL)
     WTF_EXPORT_PRIVATE void deleteOwnedPtr(Ecore_Evas*);
+    WTF_EXPORT_PRIVATE void deleteOwnedPtr(Ecore_IMF_Context*);
     WTF_EXPORT_PRIVATE void deleteOwnedPtr(Ecore_Pipe*);
     WTF_EXPORT_PRIVATE void deleteOwnedPtr(Ecore_Timer*);
     WTF_EXPORT_PRIVATE void deleteOwnedPtr(Eina_Hash*);
index 2d663fa..73d57e5 100644 (file)
@@ -21,6 +21,7 @@ LIST(APPEND WTF_LIBRARIES
     ${ICU_I18N_LIBRARIES}
     ${ECORE_LIBRARIES}
     ${ECORE_EVAS_LIBRARIES}
+    ${ECORE_IMF_LIBRARIES}
     ${EINA_LIBRARIES}
     ${EVAS_LIBRARIES}
     ${CMAKE_DL_LIBS}
index c6ca5e2..b764239 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <Ecore.h>
 #include <Ecore_Evas.h>
+#include <Ecore_IMF.h>
 #include <Eina.h>
 #include <Evas.h>
 
@@ -64,4 +65,10 @@ void deleteOwnedPtr(Ecore_Timer* ptr)
         ecore_timer_del(ptr);
 }
 
+void deleteOwnedPtr(Ecore_IMF_Context* ptr)
+{
+    if (ptr)
+        ecore_imf_context_del(ptr);
+}
+
 }
index 64e3bd6..2625a39 100644 (file)
@@ -1,3 +1,87 @@
+2012-10-25  Christophe Dumez  <christophe.dumez@intel.com>
+
+        [EFL][WK2] Remove some C'ism from EwkView
+        https://bugs.webkit.org/show_bug.cgi?id=100370
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Remove a lot of C'ism from EwkView:
+        - Make more members private and add C++ methods to
+        EwkViewImpl for the public C API to use
+        - Use smart pointers when possible instead of raw
+        ones
+        - Use C++ naming conventions for callback functions
+        and define them as static methods in EwkViewImpl.
+
+        * UIProcess/API/efl/EwkViewImpl.cpp:
+        (EwkViewImpl::onIMFInputSequenceComplete):
+        (EwkViewImpl::onIMFPreeditSequenceChanged):
+        (EwkViewImpl::createIMFContext):
+        (EwkViewImpl::EwkViewImpl):
+        (EwkViewImpl::~EwkViewImpl):
+        (EwkViewImpl::setCursor):
+        (EwkViewImpl::setColorPickerColor):
+        (EwkViewImpl::isFocused):
+        (EwkViewImpl::isVisible):
+        (EwkViewImpl::title):
+        (EwkViewImpl::inputMethodContext):
+        (EwkViewImpl::themePath):
+        (EwkViewImpl::setThemePath):
+        (EwkViewImpl::customTextEncodingName):
+        (EwkViewImpl::setCustomTextEncodingName):
+        (EwkViewImpl::setMouseEventsEnabled):
+        (EwkViewImpl::setTouchEventsEnabled):
+        (EwkViewImpl::informIconChange):
+        (EwkViewImpl::requestColorPicker):
+        (EwkViewImpl::dismissColorPicker):
+        (EwkViewImpl::updateTextInputState):
+        (EwkViewImpl::informURLChange):
+        (EwkViewImpl::onMouseDown):
+        (EwkViewImpl::onMouseUp):
+        (EwkViewImpl::onMouseMove):
+        (EwkViewImpl::feedTouchEvents):
+        (EwkViewImpl::onTouchDown):
+        (EwkViewImpl::onTouchUp):
+        (EwkViewImpl::onTouchMove):
+        * UIProcess/API/efl/EwkViewImpl.h:
+        (WebCore):
+        (EwkViewImpl::ewkContext):
+        (EwkViewImpl::settings):
+        (EwkViewImpl):
+        (EwkViewImpl::url):
+        (EwkViewImpl::faviconURL):
+        (EwkViewImpl::mouseEventsEnabled):
+        (EwkViewImpl::touchEventsEnabled):
+        * UIProcess/API/efl/PageClientImpl.cpp:
+        (WebKit::PageClientImpl::isViewFocused):
+        (WebKit::PageClientImpl::isViewVisible):
+        (WebKit::PageClientImpl::didRelaunchProcess):
+        (WebKit::PageClientImpl::handleDownloadRequest):
+        * UIProcess/API/efl/ewk_settings_private.h:
+        (Ewk_Settings::create):
+        (Ewk_Settings::Ewk_Settings):
+        (Ewk_Settings):
+        * UIProcess/API/efl/ewk_view.cpp:
+        (_ewk_view_smart_mouse_up):
+        (_ewk_view_smart_key_down):
+        (_ewk_view_smart_add):
+        (ewk_view_context_get):
+        (ewk_view_url_get):
+        (ewk_view_icon_url_get):
+        (ewk_view_settings_get):
+        (ewk_view_title_get):
+        (ewk_view_theme_set):
+        (ewk_view_theme_get):
+        (ewk_view_setting_encoding_custom_get):
+        (ewk_view_setting_encoding_custom_set):
+        (ewk_view_mouse_events_enabled_set):
+        (ewk_view_mouse_events_enabled_get):
+        (ewk_view_color_picker_color_set):
+        (ewk_view_touch_events_enabled_set):
+        (ewk_view_touch_events_enabled_get):
+        * UIProcess/efl/WebInspectorProxyEfl.cpp:
+        (WebKit::WebInspectorProxy::platformCreateInspectorPage):
+
 2012-10-25  Anders Carlsson  <andersca@apple.com>
 
         Assertion failure trying to dispatch notification messages
index 27295c0..6bb361d 100644 (file)
@@ -31,6 +31,8 @@
 #include "PageViewportController.h"
 #include "PageViewportControllerClientEfl.h"
 #include "ResourceLoadClientEfl.h"
+#include "WKColorPickerResultListener.h"
+#include "WKString.h"
 #include "WebPageProxy.h"
 #include "WebPopupMenuProxyEfl.h"
 #include "ewk_back_forward_list_private.h"
@@ -77,22 +79,22 @@ const Evas_Object* EwkViewImpl::viewFromPageViewMap(const WKPageRef page)
     return pageViewMap.get(page);
 }
 
-static void _ewk_view_commit(void* data, Ecore_IMF_Context*, void* eventInfo)
+void EwkViewImpl::onIMFInputSequenceComplete(void* data, Ecore_IMF_Context*, void* eventInfo)
 {
     Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
     EWK_VIEW_IMPL_GET_OR_RETURN(smartData, viewImpl);
-    if (!eventInfo || !viewImpl->isImfFocused)
+    if (!eventInfo || !viewImpl->m_inputMethodContextFocused)
         return;
 
     viewImpl->pageProxy->confirmComposition(String::fromUTF8(static_cast<char*>(eventInfo)));
 }
 
-static void _ewk_view_preedit_changed(void* data, Ecore_IMF_Context* context, void*)
+void EwkViewImpl::onIMFPreeditSequenceChanged(void* data, Ecore_IMF_Context* context, void*)
 {
     Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
     EWK_VIEW_IMPL_GET_OR_RETURN(smartData, viewImpl);
 
-    if (!viewImpl->pageProxy->focusedFrame() || !viewImpl->isImfFocused)
+    if (!viewImpl->pageProxy->focusedFrame() || !viewImpl->m_inputMethodContextFocused)
         return;
 
     char* buffer = 0;
@@ -107,72 +109,52 @@ static void _ewk_view_preedit_changed(void* data, Ecore_IMF_Context* context, vo
     viewImpl->pageProxy->setComposition(preeditString, underlines, 0);
 }
 
-static void _ewk_view_imf_context_destroy(Ecore_IMF_Context* imfContext)
-{
-    if (!imfContext)
-        return;
-
-    ecore_imf_context_event_callback_del(imfContext, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, _ewk_view_preedit_changed);
-    ecore_imf_context_event_callback_del(imfContext, ECORE_IMF_CALLBACK_COMMIT, _ewk_view_commit);
-    ecore_imf_context_del(imfContext);
-}
-
-static Ecore_IMF_Context* _ewk_view_imf_context_create(Ewk_View_Smart_Data* smartData)
+PassOwnPtr<Ecore_IMF_Context> EwkViewImpl::createIMFContext(Ewk_View_Smart_Data* sd)
 {
     const char* defaultContextID = ecore_imf_context_default_id_get();
     if (!defaultContextID)
-        return 0;
+        return nullptr;
 
-    Ecore_IMF_Context* imfContext = ecore_imf_context_add(defaultContextID);
+    OwnPtr<Ecore_IMF_Context> imfContext = adoptPtr(ecore_imf_context_add(defaultContextID));
     if (!imfContext)
-        return 0;
+        return nullptr;
 
-    ecore_imf_context_event_callback_add(imfContext, ECORE_IMF_CALLBACK_PREEDIT_CHANGED, _ewk_view_preedit_changed, smartData);
-    ecore_imf_context_event_callback_add(imfContext, ECORE_IMF_CALLBACK_COMMIT, _ewk_view_commit, smartData);
+    ecore_imf_context_event_callback_add(imfContext.get(), ECORE_IMF_CALLBACK_PREEDIT_CHANGED, onIMFPreeditSequenceChanged, sd);
+    ecore_imf_context_event_callback_add(imfContext.get(), ECORE_IMF_CALLBACK_COMMIT, onIMFInputSequenceComplete, sd);
 
-    Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(smartData->base.evas);
-    ecore_imf_context_client_window_set(imfContext, (void*)ecore_evas_window_get(ecoreEvas));
-    ecore_imf_context_client_canvas_set(imfContext, smartData->base.evas);
+    Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(sd->base.evas);
+    ecore_imf_context_client_window_set(imfContext.get(), reinterpret_cast<void*>(ecore_evas_window_get(ecoreEvas)));
+    ecore_imf_context_client_canvas_set(imfContext.get(), sd->base.evas);
 
-    return imfContext;
+    return imfContext.release();
 }
 
 EwkViewImpl::EwkViewImpl(Evas_Object* view)
-    : settings(adoptPtr(new Ewk_Settings(this)))
-    , areMouseEventsEnabled(false)
-#if ENABLE(TOUCH_EVENTS)
-    , areTouchEventsEnabled(false)
-#endif
-    , popupMenuProxy(0)
+    : popupMenuProxy(0)
     , popupMenuItems(0)
-    , imfContext(0)
-    , isImfFocused(false)
-#ifdef HAVE_ECORE_X
-    , isUsingEcoreX(false)
-#endif
 #if USE(ACCELERATED_COMPOSITING)
     , evasGl(0)
     , evasGlContext(0)
     , evasGlSurface(0)
 #endif
     , m_view(view)
+    , m_settings(Ewk_Settings::create(this))
+    , m_inputMethodContext(createIMFContext(smartData()))
+    , m_inputMethodContextFocused(false)
+    , m_mouseEventsEnabled(false)
+#if ENABLE(TOUCH_EVENTS)
+    , m_touchEventsEnabled(false)
+#endif
     , m_displayTimer(this, &EwkViewImpl::displayTimerFired)
 {
     ASSERT(view);
-    Ewk_View_Smart_Data* sd = smartData();
-    ASSERT(sd);
-
-    imfContext = _ewk_view_imf_context_create(sd);
 
-#ifdef HAVE_ECORE_X
-    isUsingEcoreX = WebCore::isUsingEcoreX(sd->base.evas);
-#endif
+    // Enable mouse events by default
+    setMouseEventsEnabled(true);
 }
 
 EwkViewImpl::~EwkViewImpl()
 {
-    _ewk_view_imf_context_destroy(imfContext);
-
     void* item;
     EINA_LIST_FREE(popupMenuItems, item)
         delete static_cast<Ewk_Popup_Menu_Item*>(item);
@@ -206,46 +188,46 @@ void EwkViewImpl::setCursor(const Cursor& cursor)
     Ewk_View_Smart_Data* sd = smartData();
 
     const char* group = cursor.platformCursor();
-    if (!group || group == cursorGroup)
+    if (!group || group == m_cursorGroup)
         return;
 
-    cursorGroup = group;
-    cursorObject = adoptRef(edje_object_add(sd->base.evas));
+    m_cursorGroup = group;
+    m_cursorObject = adoptRef(edje_object_add(sd->base.evas));
 
     Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(sd->base.evas);
-    if (!theme || !edje_object_file_set(cursorObject.get(), theme, group)) {
-        cursorObject.clear();
+    if (!m_theme || !edje_object_file_set(m_cursorObject.get(), m_theme, group)) {
+        m_cursorObject.clear();
 
         ecore_evas_object_cursor_set(ecoreEvas, 0, 0, 0, 0);
 #ifdef HAVE_ECORE_X
-        if (isUsingEcoreX)
+        if (WebCore::isUsingEcoreX(sd->base.evas))
             WebCore::applyFallbackCursor(ecoreEvas, group);
 #endif
         return;
     }
 
     Evas_Coord width, height;
-    edje_object_size_min_get(cursorObject.get(), &width, &height);
+    edje_object_size_min_get(m_cursorObject.get(), &width, &height);
     if (width <= 0 || height <= 0)
-        edje_object_size_min_calc(cursorObject.get(), &width, &height);
+        edje_object_size_min_calc(m_cursorObject.get(), &width, &height);
     if (width <= 0 || height <= 0) {
         width = defaultCursorSize;
         height = defaultCursorSize;
     }
-    evas_object_resize(cursorObject.get(), width, height);
+    evas_object_resize(m_cursorObject.get(), width, height);
 
     const char* data;
     int hotspotX = 0;
-    data = edje_object_data_get(cursorObject.get(), "hot.x");
+    data = edje_object_data_get(m_cursorObject.get(), "hot.x");
     if (data)
         hotspotX = atoi(data);
 
     int hotspotY = 0;
-    data = edje_object_data_get(cursorObject.get(), "hot.y");
+    data = edje_object_data_get(m_cursorObject.get(), "hot.y");
     if (data)
         hotspotY = atoi(data);
 
-    ecore_evas_object_cursor_set(ecoreEvas, cursorObject.get(), EVAS_LAYER_MAX, hotspotX, hotspotY);
+    ecore_evas_object_cursor_set(ecoreEvas, m_cursorObject.get(), EVAS_LAYER_MAX, hotspotX, hotspotY);
 }
 
 void EwkViewImpl::displayTimerFired(WebCore::Timer<EwkViewImpl>*)
@@ -383,6 +365,20 @@ void EwkViewImpl::setImageData(void* imageData, const IntSize& size)
     evas_object_image_data_copy_set(sd->image, imageData);
 }
 
+#if ENABLE(INPUT_TYPE_COLOR)
+bool EwkViewImpl::setColorPickerColor(const WebCore::Color& color)
+{
+    if (!m_colorPickerResultListener)
+        return false;
+
+    WKRetainPtr<WKStringRef> colorString(AdoptWK, WKStringCreateWithUTF8CString(color.serialized().utf8().data()));
+    WKColorPickerResultListenerSetColor(m_colorPickerResultListener.get(), colorString.get());
+    m_colorPickerResultListener.clear();
+
+    return true;
+}
+#endif
+
 /**
  * @internal
  * informs load failed with error information.
@@ -582,6 +578,108 @@ IntSize EwkViewImpl::size() const
     return IntSize(width, height);
 }
 
+bool EwkViewImpl::isFocused() const
+{
+    return evas_object_focus_get(m_view);
+}
+
+bool EwkViewImpl::isVisible() const
+{
+    return evas_object_visible_get(m_view);
+}
+
+const char* EwkViewImpl::title() const
+{
+    m_title = pageProxy->pageTitle().utf8().data();
+
+    return m_title;
+}
+
+Ecore_IMF_Context* EwkViewImpl::inputMethodContext()
+{
+    return m_inputMethodContext.get();
+}
+
+const char* EwkViewImpl::themePath() const
+{
+    return m_theme;
+}
+
+void EwkViewImpl::setThemePath(const char* theme)
+{
+    if (m_theme != theme) {
+        m_theme = theme;
+        pageProxy->setThemePath(theme);
+    }
+}
+
+const char* EwkViewImpl::customTextEncodingName() const
+{
+    String customEncoding = pageProxy->customTextEncodingName();
+    if (customEncoding.isEmpty())
+        return 0;
+
+    m_customEncoding = customEncoding.utf8().data();
+
+    return m_customEncoding;
+}
+
+void EwkViewImpl::setCustomTextEncodingName(const char* encoding)
+{
+    m_customEncoding = encoding;
+    pageProxy->setCustomTextEncodingName(encoding ? encoding : String());
+}
+
+void EwkViewImpl::setMouseEventsEnabled(bool enabled)
+{
+    if (m_mouseEventsEnabled == enabled)
+        return;
+
+    m_mouseEventsEnabled = enabled;
+    if (enabled) {
+        Ewk_View_Smart_Data* sd = smartData();
+        evas_object_event_callback_add(m_view, EVAS_CALLBACK_MOUSE_DOWN, onMouseDown, sd);
+        evas_object_event_callback_add(m_view, EVAS_CALLBACK_MOUSE_UP, onMouseUp, sd);
+        evas_object_event_callback_add(m_view, EVAS_CALLBACK_MOUSE_MOVE, onMouseMove, sd);
+    } else {
+        evas_object_event_callback_del(m_view, EVAS_CALLBACK_MOUSE_DOWN, onMouseDown);
+        evas_object_event_callback_del(m_view, EVAS_CALLBACK_MOUSE_UP, onMouseUp);
+        evas_object_event_callback_del(m_view, EVAS_CALLBACK_MOUSE_MOVE, onMouseMove);
+    }
+}
+
+#if ENABLE(TOUCH_EVENTS)
+void EwkViewImpl::setTouchEventsEnabled(bool enabled)
+{
+    if (m_touchEventsEnabled == enabled)
+        return;
+
+    m_touchEventsEnabled = enabled;
+
+    if (enabled) {
+        // FIXME: We have to connect touch callbacks with mouse and multi events
+        // because the Evas creates mouse events for first touch and multi events
+        // for second and third touches. Below codes should be fixed when the Evas
+        // supports the touch events.
+        // See https://bugs.webkit.org/show_bug.cgi?id=97785 for details.
+        Ewk_View_Smart_Data* sd = smartData();
+        evas_object_event_callback_add(m_view, EVAS_CALLBACK_MOUSE_DOWN, onTouchDown, sd);
+        evas_object_event_callback_add(m_view, EVAS_CALLBACK_MOUSE_UP, onTouchUp, sd);
+        evas_object_event_callback_add(m_view, EVAS_CALLBACK_MOUSE_MOVE, onTouchMove, sd);
+        evas_object_event_callback_add(m_view, EVAS_CALLBACK_MULTI_DOWN, onTouchDown, sd);
+        evas_object_event_callback_add(m_view, EVAS_CALLBACK_MULTI_UP, onTouchUp, sd);
+        evas_object_event_callback_add(m_view, EVAS_CALLBACK_MULTI_MOVE, onTouchMove, sd);
+    } else {
+        evas_object_event_callback_del(m_view, EVAS_CALLBACK_MOUSE_DOWN, onTouchDown);
+        evas_object_event_callback_del(m_view, EVAS_CALLBACK_MOUSE_UP, onTouchUp);
+        evas_object_event_callback_del(m_view, EVAS_CALLBACK_MOUSE_MOVE, onTouchMove);
+        evas_object_event_callback_del(m_view, EVAS_CALLBACK_MULTI_DOWN, onTouchDown);
+        evas_object_event_callback_del(m_view, EVAS_CALLBACK_MULTI_UP, onTouchUp);
+        evas_object_event_callback_del(m_view, EVAS_CALLBACK_MULTI_MOVE, onTouchMove);
+    }
+}
+#endif
+
 /**
  * @internal
  * Update the view's favicon and emits a "icon,changed" signal if it has
@@ -595,7 +693,7 @@ void EwkViewImpl::informIconChange()
     Ewk_Favicon_Database* iconDatabase = context->faviconDatabase();
     ASSERT(iconDatabase);
 
-    faviconURL = ewk_favicon_database_icon_url_get(iconDatabase, url);
+    m_faviconURL = ewk_favicon_database_icon_url_get(iconDatabase, m_url);
     evas_object_smart_callback_call(m_view, "icon,changed", 0);
 }
 
@@ -713,7 +811,7 @@ void EwkViewImpl::requestColorPicker(int r, int g, int b, int a, WKColorPickerRe
     Ewk_View_Smart_Data* sd = smartData();
     EINA_SAFETY_ON_NULL_RETURN(sd->api->input_picker_color_request);
 
-    colorPickerResultListener = listener;
+    m_colorPickerResultListener = listener;
 
     sd->api->input_picker_color_request(sd, r, g, b, a);
 }
@@ -727,7 +825,7 @@ void EwkViewImpl::dismissColorPicker()
     Ewk_View_Smart_Data* sd = smartData();
     EINA_SAFETY_ON_NULL_RETURN(sd->api->input_picker_color_dismiss);
 
-    colorPickerResultListener.clear();
+    m_colorPickerResultListener.clear();
 
     sd->api->input_picker_color_dismiss(sd);
 }
@@ -868,28 +966,28 @@ unsigned long long EwkViewImpl::informDatabaseQuotaReached(const String& databas
  */
 void EwkViewImpl::updateTextInputState()
 {
-    if (!imfContext)
+    if (!m_inputMethodContext)
         return;
 
     const EditorState& editor = pageProxy->editorState();
 
     if (editor.isContentEditable) {
-        if (isImfFocused)
+        if (m_inputMethodContextFocused)
             return;
 
-        ecore_imf_context_reset(imfContext);
-        ecore_imf_context_focus_in(imfContext);
-        isImfFocused = true;
+        ecore_imf_context_reset(m_inputMethodContext.get());
+        ecore_imf_context_focus_in(m_inputMethodContext.get());
+        m_inputMethodContextFocused = true;
     } else {
-        if (!isImfFocused)
+        if (!m_inputMethodContextFocused)
             return;
 
         if (editor.hasComposition)
             pageProxy->cancelComposition();
 
-        isImfFocused = false;
-        ecore_imf_context_reset(imfContext);
-        ecore_imf_context_focus_out(imfContext);
+        m_inputMethodContextFocused = false;
+        ecore_imf_context_reset(m_inputMethodContext.get());
+        ecore_imf_context_focus_out(m_inputMethodContext.get());
     }
 }
 
@@ -906,11 +1004,11 @@ void EwkViewImpl::informURLChange()
         return;
 
     CString rawActiveURL = activeURL.utf8();
-    if (url == rawActiveURL.data())
+    if (m_url == rawActiveURL.data())
         return;
 
-    url = rawActiveURL.data();
-    const char* callbackArgument = static_cast<const char*>(url);
+    m_url = rawActiveURL.data();
+    const char* callbackArgument = static_cast<const char*>(m_url);
     evas_object_smart_callback_call(m_view, "url,changed", const_cast<char*>(callbackArgument));
 
     // Update the view's favicon.
@@ -935,3 +1033,74 @@ void EwkViewImpl::closePage()
 {
     evas_object_smart_callback_call(m_view, "close,window", 0);
 }
+
+void EwkViewImpl::onMouseDown(void* data, Evas*, Evas_Object*, void* eventInfo)
+{
+    Evas_Event_Mouse_Down* downEvent = static_cast<Evas_Event_Mouse_Down*>(eventInfo);
+    Ewk_View_Smart_Data* sd = static_cast<Ewk_View_Smart_Data*>(data);
+    EINA_SAFETY_ON_NULL_RETURN(sd->api);
+    EINA_SAFETY_ON_NULL_RETURN(sd->api->mouse_down);
+    sd->api->mouse_down(sd, downEvent);
+}
+
+void EwkViewImpl::onMouseUp(void* data, Evas*, Evas_Object*, void* eventInfo)
+{
+    Evas_Event_Mouse_Up* upEvent = static_cast<Evas_Event_Mouse_Up*>(eventInfo);
+    Ewk_View_Smart_Data* sd = static_cast<Ewk_View_Smart_Data*>(data);
+    EINA_SAFETY_ON_NULL_RETURN(sd->api);
+    EINA_SAFETY_ON_NULL_RETURN(sd->api->mouse_up);
+    sd->api->mouse_up(sd, upEvent);
+}
+
+void EwkViewImpl::onMouseMove(void* data, Evas*, Evas_Object*, void* eventInfo)
+{
+    Evas_Event_Mouse_Move* moveEvent = static_cast<Evas_Event_Mouse_Move*>(eventInfo);
+    Ewk_View_Smart_Data* sd = static_cast<Ewk_View_Smart_Data*>(data);
+    EINA_SAFETY_ON_NULL_RETURN(sd->api);
+    EINA_SAFETY_ON_NULL_RETURN(sd->api->mouse_move);
+    sd->api->mouse_move(sd, moveEvent);
+}
+
+#if ENABLE(TOUCH_EVENTS)
+void EwkViewImpl::feedTouchEvents(Ewk_Touch_Event_Type type)
+{
+    Ewk_View_Smart_Data* sd = smartData();
+
+    unsigned count = evas_touch_point_list_count(sd->base.evas);
+    if (!count)
+        return;
+
+    Eina_List* points = 0;
+    for (unsigned i = 0; i < count; ++i) {
+        Ewk_Touch_Point* point = new Ewk_Touch_Point;
+        point->id = evas_touch_point_list_nth_id_get(sd->base.evas, i);
+        evas_touch_point_list_nth_xy_get(sd->base.evas, i, &point->x, &point->y);
+        point->state = evas_touch_point_list_nth_state_get(sd->base.evas, i);
+        points = eina_list_append(points, point);
+    }
+
+    ewk_view_feed_touch_event(m_view, type, points, evas_key_modifier_get(sd->base.evas));
+
+    void* data;
+    EINA_LIST_FREE(points, data)
+        delete static_cast<Ewk_Touch_Point*>(data);
+}
+
+void EwkViewImpl::onTouchDown(void* /* data */, Evas* /* canvas */, Evas_Object* ewkView, void* /* eventInfo */)
+{
+    EwkViewImpl* viewImpl = EwkViewImpl::fromEvasObject(ewkView);
+    viewImpl->feedTouchEvents(EWK_TOUCH_START);
+}
+
+void EwkViewImpl::onTouchUp(void* /* data */, Evas* /* canvas */, Evas_Object* ewkView, void* /* eventInfo */)
+{
+    EwkViewImpl* viewImpl = EwkViewImpl::fromEvasObject(ewkView);
+    viewImpl->feedTouchEvents(EWK_TOUCH_END);
+}
+
+void EwkViewImpl::onTouchMove(void* /* data */, Evas* /* canvas */, Evas_Object* ewkView, void* /* eventInfo */)
+{
+    EwkViewImpl* viewImpl = EwkViewImpl::fromEvasObject(ewkView);
+    viewImpl->feedTouchEvents(EWK_TOUCH_MOVE);
+}
+#endif
index e747a2b..7228f45 100644 (file)
 #include <wtf/RefPtr.h>
 #include <wtf/text/WTFString.h>
 
+#if ENABLE(TOUCH_EVENTS)
+#include "ewk_touch.h"
+#endif
+
 #if USE(ACCELERATED_COMPOSITING)
 #include <Evas_GL.h>
 #endif
@@ -72,6 +76,7 @@ class WebPopupMenuProxyEfl;
 }
 
 namespace WebCore {
+class Color;
 class Cursor;
 class IntRect;
 class IntSize;
@@ -102,13 +107,38 @@ public:
     inline Evas_Object* view() { return m_view; }
     WKPageRef wkPage();
     inline WebKit::WebPageProxy* page() { return pageProxy.get(); }
+    Ewk_Context* ewkContext() { return context.get(); }
+    Ewk_Settings* settings() { return m_settings.get(); }
 
     WebCore::IntSize size() const;
+    bool isFocused() const;
+    bool isVisible() const;
+
+    const char* url() const { return m_url; }
+    const char* faviconURL() const { return m_faviconURL; }
+    const char* title() const;
+    Ecore_IMF_Context* inputMethodContext();
+
+    const char* themePath() const;
+    void setThemePath(const char* theme);
+    const char* customTextEncodingName() const;
+    void setCustomTextEncodingName(const char* encoding);
+
+    bool mouseEventsEnabled() const { return m_mouseEventsEnabled; }
+    void setMouseEventsEnabled(bool enabled);
+#if ENABLE(TOUCH_EVENTS)
+    bool touchEventsEnabled() const { return m_touchEventsEnabled; }
+    void setTouchEventsEnabled(bool enabled);
+#endif
 
     void setCursor(const WebCore::Cursor& cursor);
     void redrawRegion(const WebCore::IntRect& rect);
     void setImageData(void* imageData, const WebCore::IntSize& size);
 
+#if ENABLE(INPUT_TYPE_COLOR)
+    bool setColorPickerColor(const WebCore::Color& color);
+#endif
+
     static void addToPageViewMap(const Evas_Object* ewkView);
     static void removeFromPageViewMap(const Evas_Object* ewkView);
     static const Evas_Object* viewFromPageViewMap(const WKPageRef);
@@ -195,32 +225,12 @@ public:
     OwnPtr<WebKit::FindClientEfl> findClient;
     OwnPtr<WebKit::FormClientEfl> formClient;
 
-    WKEinaSharedString url;
-    WKEinaSharedString title;
-    WKEinaSharedString theme;
-    WKEinaSharedString customEncoding;
-    WKEinaSharedString cursorGroup;
-    WKEinaSharedString faviconURL;
-    RefPtr<Evas_Object> cursorObject;
     OwnPtr<Ewk_Back_Forward_List> backForwardList;
-    OwnPtr<Ewk_Settings> settings;
-    bool areMouseEventsEnabled;
-    WKRetainPtr<WKColorPickerResultListenerRef> colorPickerResultListener;
     RefPtr<Ewk_Context> context;
-#if ENABLE(TOUCH_EVENTS)
-    bool areTouchEventsEnabled;
-#endif
 
     WebKit::WebPopupMenuProxyEfl* popupMenuProxy;
     Eina_List* popupMenuItems;
 
-    Ecore_IMF_Context* imfContext;
-    bool isImfFocused;
-
-#ifdef HAVE_ECORE_X
-    bool isUsingEcoreX;
-#endif
-
 #if USE(ACCELERATED_COMPOSITING)
     Evas_GL* evasGl;
     Evas_GL_Context* evasGlContext;
@@ -228,14 +238,44 @@ public:
 #endif
 
 private:
-    Ewk_View_Smart_Data* smartData();
+    inline Ewk_View_Smart_Data* smartData();
     void displayTimerFired(WebCore::Timer<EwkViewImpl>*);
 
+    static PassOwnPtr<Ecore_IMF_Context> createIMFContext(Ewk_View_Smart_Data*);
+    static void onIMFInputSequenceComplete(void* data, Ecore_IMF_Context*, void* eventInfo);
+    static void onIMFPreeditSequenceChanged(void* data, Ecore_IMF_Context*, void* eventInfo);
+
+    static void onMouseDown(void* data, Evas*, Evas_Object*, void* eventInfo);
+    static void onMouseUp(void* data, Evas*, Evas_Object*, void* eventInfo);
+    static void onMouseMove(void* data, Evas*, Evas_Object*, void* eventInfo);
+#if ENABLE(TOUCH_EVENTS)
+    void feedTouchEvents(Ewk_Touch_Event_Type type);
+    static void onTouchDown(void* /* data */, Evas* /* canvas */, Evas_Object* ewkView, void* /* eventInfo */);
+    static void onTouchUp(void* /* data */, Evas* /* canvas */, Evas_Object* ewkView, void* /* eventInfo */);
+    static void onTouchMove(void* /* data */, Evas* /* canvas */, Evas_Object* ewkView, void* /* eventInfo */);
+#endif
+
     Evas_Object* m_view;
-    typedef HashMap<WKPageRef, const Evas_Object*> PageViewMap;
-    static PageViewMap pageViewMap;
+    OwnPtr<Ewk_Settings> m_settings;
+    OwnPtr<Ecore_IMF_Context> m_inputMethodContext;
+    bool m_inputMethodContextFocused;
+    RefPtr<Evas_Object> m_cursorObject;
+    WKEinaSharedString m_cursorGroup;
+    WKEinaSharedString m_faviconURL;
+    WKEinaSharedString m_url;
+    mutable WKEinaSharedString m_title;
+    WKEinaSharedString m_theme;
+    mutable WKEinaSharedString m_customEncoding;
+    bool m_mouseEventsEnabled;
+#if ENABLE(TOUCH_EVENTS)
+    bool m_touchEventsEnabled;
+#endif
+    WKRetainPtr<WKColorPickerResultListenerRef> m_colorPickerResultListener;
     WebCore::Timer<EwkViewImpl> m_displayTimer;
     WTF::Vector <WebCore::IntRect> m_dirtyRects;
+
+    typedef HashMap<WKPageRef, const Evas_Object*> PageViewMap;
+    static PageViewMap pageViewMap;
 };
 
 #endif // EwkViewImpl_h
index 537f4e0..e3565eb 100644 (file)
@@ -98,12 +98,12 @@ bool PageClientImpl::isViewWindowActive()
 
 bool PageClientImpl::isViewFocused()
 {
-    return evas_object_focus_get(m_viewImpl->view());
+    return m_viewImpl->isFocused();
 }
 
 bool PageClientImpl::isViewVisible()
 {
-    return evas_object_visible_get(m_viewImpl->view());
+    return m_viewImpl->isVisible();
 }
 
 bool PageClientImpl::isViewInWindow()
@@ -124,7 +124,7 @@ void PageClientImpl::processDidCrash()
 
 void PageClientImpl::didRelaunchProcess()
 {
-    const char* themePath = ewk_view_theme_get(m_viewImpl->view());
+    const char* themePath = m_viewImpl->themePath();
     if (themePath)
         m_viewImpl->page()->setThemePath(themePath);
 }
@@ -303,7 +303,7 @@ void PageClientImpl::updateTextInputState()
 
 void PageClientImpl::handleDownloadRequest(DownloadProxy* download)
 {
-    Ewk_Context* context = ewk_view_context_get(m_viewImpl->view());
+    Ewk_Context* context = m_viewImpl->ewkContext();
     context->downloadManager()->registerDownload(download, m_viewImpl);
 }
 
index 244f957..ea29a85 100644 (file)
@@ -27,7 +27,7 @@
 #ifndef ewk_settings_private_h
 #define ewk_settings_private_h
 
-#include <wtf/RefPtr.h>
+#include <wtf/PassOwnPtr.h>
 
 namespace WebKit {
 class WebPreferences;
@@ -39,16 +39,21 @@ class EwkViewImpl;
  */
 class Ewk_Settings {
 public:
-    explicit Ewk_Settings(EwkViewImpl* viewImpl)
-        : m_viewImpl(viewImpl)
+    static PassOwnPtr<Ewk_Settings> create(EwkViewImpl* viewImpl)
     {
-        ASSERT(m_viewImpl);
+        return adoptPtr(new Ewk_Settings(viewImpl));
     }
 
     const WebKit::WebPreferences* preferences() const;
     WebKit::WebPreferences* preferences();
 
 private:
+    explicit Ewk_Settings(EwkViewImpl* viewImpl)
+        : m_viewImpl(viewImpl)
+    {
+        ASSERT(m_viewImpl);
+    }
+
     EwkViewImpl* m_viewImpl;
 };
 
index 3445c42..9dff90c 100644 (file)
@@ -33,7 +33,6 @@
 #include "PageUIClientEfl.h"
 #include "ResourceLoadClientEfl.h"
 #include "WKAPICast.h"
-#include "WKColorPickerResultListener.h"
 #include "WKEinaSharedString.h"
 #include "WKFindOptions.h"
 #include "WKRetainPtr.h"
@@ -217,8 +216,9 @@ static Eina_Bool _ewk_view_smart_mouse_up(Ewk_View_Smart_Data* smartData, const
     impl->pageProxy->handleMouseEvent(NativeWebMouseEvent(upEvent, &position));
 #endif
 
-    if (impl->imfContext)
-        ecore_imf_context_reset(impl->imfContext);
+    Ecore_IMF_Context* inputMethodContext = impl->inputMethodContext();
+    if (inputMethodContext)
+        ecore_imf_context_reset(inputMethodContext);
 
     return true;
 }
@@ -243,11 +243,12 @@ static Eina_Bool _ewk_view_smart_key_down(Ewk_View_Smart_Data* smartData, const
     EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
 
     bool isFiltered = false;
-    if (impl->imfContext) {
-        Ecore_IMF_Event imfEvent;
-        ecore_imf_evas_event_key_down_wrap(const_cast<Evas_Event_Key_Down*>(downEvent), &imfEvent.key_down);
+    Ecore_IMF_Context* inputMethodContext = impl->inputMethodContext();
+    if (inputMethodContext) {
+        Ecore_IMF_Event inputMethodEvent;
+        ecore_imf_evas_event_key_down_wrap(const_cast<Evas_Event_Key_Down*>(downEvent), &inputMethodEvent.key_down);
 
-        isFiltered = ecore_imf_context_filter_event(impl->imfContext, ECORE_IMF_EVENT_KEY_DOWN, &imfEvent);
+        isFiltered = ecore_imf_context_filter_event(inputMethodContext, ECORE_IMF_EVENT_KEY_DOWN, &inputMethodEvent);
     }
 
     impl->pageProxy->handleKeyboardEvent(NativeWebKeyboardEvent(downEvent, isFiltered));
@@ -288,33 +289,6 @@ static void _ewk_view_on_mouse_wheel(void* data, Evas*, Evas_Object*, void* even
     smartData->api->mouse_wheel(smartData, wheelEvent);
 }
 
-static void _ewk_view_on_mouse_down(void* data, Evas*, Evas_Object*, void* eventInfo)
-{
-    Evas_Event_Mouse_Down* downEvent = static_cast<Evas_Event_Mouse_Down*>(eventInfo);
-    Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
-    EINA_SAFETY_ON_NULL_RETURN(smartData->api);
-    EINA_SAFETY_ON_NULL_RETURN(smartData->api->mouse_down);
-    smartData->api->mouse_down(smartData, downEvent);
-}
-
-static void _ewk_view_on_mouse_up(void* data, Evas*, Evas_Object*, void* eventInfo)
-{
-    Evas_Event_Mouse_Up* upEvent = static_cast<Evas_Event_Mouse_Up*>(eventInfo);
-    Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
-    EINA_SAFETY_ON_NULL_RETURN(smartData->api);
-    EINA_SAFETY_ON_NULL_RETURN(smartData->api->mouse_up);
-    smartData->api->mouse_up(smartData, upEvent);
-}
-
-static void _ewk_view_on_mouse_move(void* data, Evas*, Evas_Object*, void* eventInfo)
-{
-    Evas_Event_Mouse_Move* moveEvent = static_cast<Evas_Event_Mouse_Move*>(eventInfo);
-    Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data);
-    EINA_SAFETY_ON_NULL_RETURN(smartData->api);
-    EINA_SAFETY_ON_NULL_RETURN(smartData->api->mouse_move);
-    smartData->api->mouse_move(smartData, moveEvent);
-}
-
 static void _ewk_view_on_key_down(void* data, Evas*, Evas_Object*, void* eventInfo)
 {
     Evas_Event_Key_Down* downEvent = static_cast<Evas_Event_Key_Down*>(eventInfo);
@@ -351,47 +325,6 @@ static void _ewk_view_on_hide(void* data, Evas*, Evas_Object*, void* /*eventInfo
     impl->pageProxy->viewStateDidChange(WebPageProxy::ViewIsVisible);
 }
 
-#if ENABLE(TOUCH_EVENTS)
-static inline void _ewk_view_feed_touch_event_using_touch_point_list_of_evas(Evas_Object* ewkView, Ewk_Touch_Event_Type type)
-{
-    EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
-
-    unsigned count = evas_touch_point_list_count(smartData->base.evas);
-    if (!count)
-        return;
-
-    Eina_List* points = 0;
-    for (unsigned i = 0; i < count; ++i) {
-        Ewk_Touch_Point* point = new Ewk_Touch_Point;
-        point->id = evas_touch_point_list_nth_id_get(smartData->base.evas, i);
-        evas_touch_point_list_nth_xy_get(smartData->base.evas, i, &point->x, &point->y);
-        point->state = evas_touch_point_list_nth_state_get(smartData->base.evas, i);
-        points = eina_list_append(points, point);
-    }
-
-    ewk_view_feed_touch_event(ewkView, type, points, evas_key_modifier_get(smartData->base.evas));
-
-    void* data;
-    EINA_LIST_FREE(points, data)
-        delete static_cast<Ewk_Touch_Point*>(data);
-}
-
-static void _ewk_view_on_touch_down(void* /* data */, Evas* /* canvas */, Evas_Object* ewkView, void* /* eventInfo */)
-{
-    _ewk_view_feed_touch_event_using_touch_point_list_of_evas(ewkView, EWK_TOUCH_START);
-}
-
-static void _ewk_view_on_touch_up(void* /* data */, Evas* /* canvas */, Evas_Object* ewkView, void* /* eventInfo */)
-{
-    _ewk_view_feed_touch_event_using_touch_point_list_of_evas(ewkView, EWK_TOUCH_END);
-}
-
-static void _ewk_view_on_touch_move(void* /* data */, Evas* /* canvas */, Evas_Object* ewkView, void* /* eventInfo */)
-{
-    _ewk_view_feed_touch_event_using_touch_point_list_of_evas(ewkView, EWK_TOUCH_MOVE);
-}
-#endif
-
 static Evas_Smart_Class g_parentSmartClass = EVAS_SMART_CLASS_INIT_NULL;
 
 static void _ewk_view_impl_del(EwkViewImpl* impl)
@@ -439,8 +372,6 @@ static void _ewk_view_smart_add(Evas_Object* ewkView)
     evas_object_smart_member_add(smartData->image, ewkView);
     evas_object_show(smartData->image);
 
-    ewk_view_mouse_events_enabled_set(ewkView, true);
-
 #define CONNECT(s, c) evas_object_event_callback_add(ewkView, s, c, smartData)
     CONNECT(EVAS_CALLBACK_FOCUS_IN, _ewk_view_on_focus_in);
     CONNECT(EVAS_CALLBACK_FOCUS_OUT, _ewk_view_on_focus_out);
@@ -750,7 +681,7 @@ Ewk_Context* ewk_view_context_get(const Evas_Object* ewkView)
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
     EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
 
-    return impl->context.get();
+    return impl->ewkContext();
 }
 
 Eina_Bool ewk_view_url_set(Evas_Object* ewkView, const char* url)
@@ -770,7 +701,7 @@ const char* ewk_view_url_get(const Evas_Object* ewkView)
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
     EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
 
-    return impl->url;
+    return impl->url();
 }
 
 const char *ewk_view_icon_url_get(const Evas_Object *ewkView)
@@ -778,7 +709,7 @@ const char *ewk_view_icon_url_get(const Evas_Object *ewkView)
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
     EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
 
-    return impl->faviconURL;
+    return impl->faviconURL();
 }
 
 Eina_Bool ewk_view_reload(Evas_Object* ewkView)
@@ -818,7 +749,7 @@ Ewk_Settings* ewk_view_settings_get(const Evas_Object* ewkView)
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
     EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
 
-    return impl->settings.get();
+    return impl->settings();
 }
 
 const char* ewk_view_title_get(const Evas_Object* ewkView)
@@ -826,10 +757,7 @@ const char* ewk_view_title_get(const Evas_Object* ewkView)
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
     EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
 
-    CString title = impl->pageProxy->pageTitle().utf8();
-    impl->title = title.data();
-
-    return impl->title;
+    return impl->title();
 }
 
 /**
@@ -891,10 +819,7 @@ void ewk_view_theme_set(Evas_Object* ewkView, const char* path)
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
     EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl);
 
-    if (impl->theme != path) {
-        impl->theme = path;
-        impl->pageProxy->setThemePath(path);
-    }
+    impl->setThemePath(path);
 }
 
 const char* ewk_view_theme_get(const Evas_Object* ewkView)
@@ -902,7 +827,7 @@ const char* ewk_view_theme_get(const Evas_Object* ewkView)
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
     EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
 
-    return impl->theme;
+    return impl->themePath();
 }
 
 Eina_Bool ewk_view_back(Evas_Object* ewkView)
@@ -994,13 +919,7 @@ const char* ewk_view_setting_encoding_custom_get(const Evas_Object* ewkView)
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
     EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, 0);
 
-    String customEncoding = impl->pageProxy->customTextEncodingName();
-    if (customEncoding.isEmpty())
-        return 0;
-
-    impl->customEncoding = customEncoding.utf8().data();
-
-    return impl->customEncoding;
+    return impl->customTextEncodingName();
 }
 
 Eina_Bool ewk_view_setting_encoding_custom_set(Evas_Object* ewkView, const char* encoding)
@@ -1008,8 +927,7 @@ Eina_Bool ewk_view_setting_encoding_custom_set(Evas_Object* ewkView, const char*
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
     EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
 
-    impl->customEncoding = encoding;
-    impl->pageProxy->setCustomTextEncodingName(encoding ? encoding : String());
+    impl->setCustomTextEncodingName(encoding);
 
     return true;
 }
@@ -1096,20 +1014,7 @@ Eina_Bool ewk_view_mouse_events_enabled_set(Evas_Object* ewkView, Eina_Bool enab
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
     EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
 
-    enabled = !!enabled;
-    if (impl->areMouseEventsEnabled == enabled)
-        return true;
-
-    impl->areMouseEventsEnabled = enabled;
-    if (enabled) {
-        evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MOUSE_DOWN, _ewk_view_on_mouse_down, smartData);
-        evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MOUSE_UP, _ewk_view_on_mouse_up, smartData);
-        evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MOUSE_MOVE, _ewk_view_on_mouse_move, smartData);
-    } else {
-        evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MOUSE_DOWN, _ewk_view_on_mouse_down);
-        evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MOUSE_UP, _ewk_view_on_mouse_up);
-        evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MOUSE_MOVE, _ewk_view_on_mouse_move);
-    }
+    impl->setMouseEventsEnabled(!!enabled);
 
     return true;
 }
@@ -1119,7 +1024,7 @@ Eina_Bool ewk_view_mouse_events_enabled_get(const Evas_Object* ewkView)
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
     EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
 
-    return impl->areMouseEventsEnabled;
+    return impl->mouseEventsEnabled();
 }
 
 Eina_Bool ewk_view_color_picker_color_set(Evas_Object* ewkView, int r, int g, int b, int a)
@@ -1127,14 +1032,8 @@ Eina_Bool ewk_view_color_picker_color_set(Evas_Object* ewkView, int r, int g, in
 #if ENABLE(INPUT_TYPE_COLOR)
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
     EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
-    EINA_SAFETY_ON_NULL_RETURN_VAL(impl->colorPickerResultListener, false);
-
-    WebCore::Color color = WebCore::Color(r, g, b, a);
-    WKRetainPtr<WKStringRef> colorString(AdoptWK, WKStringCreateWithUTF8CString(color.serialized().utf8().data()));
-    WKColorPickerResultListenerSetColor(impl->colorPickerResultListener.get(), colorString.get());
-    impl->colorPickerResultListener.clear();
 
-    return true;
+    return impl->setColorPickerColor(WebCore::Color(r, g, b, a));
 #else
     return false;
 #endif
@@ -1164,31 +1063,7 @@ Eina_Bool ewk_view_touch_events_enabled_set(Evas_Object* ewkView, Eina_Bool enab
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
     EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
 
-    enabled = !!enabled;
-    if (impl->areTouchEventsEnabled == enabled)
-        return true;
-
-    impl->areTouchEventsEnabled = enabled;
-    if (enabled) {
-        // FIXME: We have to connect touch callbacks with mouse and multi events
-        // because the Evas creates mouse events for first touch and multi events
-        // for second and third touches. Below codes should be fixed when the Evas
-        // supports the touch events.
-        // See https://bugs.webkit.org/show_bug.cgi?id=97785 for details.
-        evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MOUSE_DOWN, _ewk_view_on_touch_down, smartData);
-        evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MOUSE_UP, _ewk_view_on_touch_up, smartData);
-        evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MOUSE_MOVE, _ewk_view_on_touch_move, smartData);
-        evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MULTI_DOWN, _ewk_view_on_touch_down, smartData);
-        evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MULTI_UP, _ewk_view_on_touch_up, smartData);
-        evas_object_event_callback_add(ewkView, EVAS_CALLBACK_MULTI_MOVE, _ewk_view_on_touch_move, smartData);
-    } else {
-        evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MOUSE_DOWN, _ewk_view_on_touch_down);
-        evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MOUSE_UP, _ewk_view_on_touch_up);
-        evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MOUSE_MOVE, _ewk_view_on_touch_move);
-        evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MULTI_DOWN, _ewk_view_on_touch_down);
-        evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MULTI_UP, _ewk_view_on_touch_up);
-        evas_object_event_callback_del(ewkView, EVAS_CALLBACK_MULTI_MOVE, _ewk_view_on_touch_move);
-    }
+    impl->setTouchEventsEnabled(!!enabled);
 
     return true;
 #else
@@ -1202,7 +1077,7 @@ Eina_Bool ewk_view_touch_events_enabled_get(const Evas_Object* ewkView)
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
     EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
 
-    return impl->areTouchEventsEnabled;
+    return impl->touchEventsEnabled();
 #else
     return false;
 #endif
index 84ba2b3..82f83c8 100644 (file)
@@ -97,12 +97,13 @@ WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
         return 0;
 
     m_inspectorView = ewk_view_base_add(ecore_evas_get(m_inspectorWindow), toAPI(page()->process()->context()), toAPI(inspectorPageGroup()));
-    ewk_view_theme_set(m_inspectorView, TEST_THEME_DIR"/default.edj");
+    EwkViewImpl* inspectorViewImpl = EwkViewImpl::fromEvasObject(m_inspectorView);
+    inspectorViewImpl->setThemePath(TEST_THEME_DIR "/default.edj");
 
-    Ewk_Settings* settings = ewk_view_settings_get(m_inspectorView);
+    Ewk_Settings* settings = inspectorViewImpl->settings();
     ewk_settings_file_access_from_file_urls_allowed_set(settings, true);
 
-    return EwkViewImpl::fromEvasObject(m_inspectorView)->page();
+    return inspectorViewImpl->page();
 }
 
 void WebInspectorProxy::platformOpen()