Implement Focus UI
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / WebPageProxy.cpp
index 2a78b55..1b39b9c 100755 (executable)
 #include "InputMethodContextEfl.h"
 #endif
 
+#if ENABLE(TIZEN_VIEWPORT_META_TAG)
+#include <WebCore/EflScreenUtilities.h>
+#endif
+
 // This controls what strategy we use for mouse wheel coalescing.
 #define MERGE_WHEEL_EVENTS 1
 
@@ -190,7 +194,7 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> p
     , m_textZoomFactor(1)
     , m_pageZoomFactor(1)
     , m_pageScaleFactor(1)
-    , m_intrinsicDeviceScaleFactor(1)
+    , m_intrinsicDeviceScaleFactor(getMobileDPI() / 160)
     , m_customDeviceScaleFactor(0)
 #if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
     , m_layerHostingMode(LayerHostingModeInWindowServer)
@@ -253,6 +257,12 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> p
 #if ENABLE(TIZEN_ISF_PORT)
     , m_didCancelCompositionFromWebProcess(false)
 #endif
+#if ENABLE(TIZEN_WEBKIT2_NOTIFY_SUSPEND_BY_REMOTE_WEB_INSPECTOR)
+    , m_contentSuspendedByInspector(false)
+#endif
+#if ENABLE(TIZEN_FOCUS_UI)
+    , m_spatialNavigationEnabled(false)
+#endif
 {
 #ifndef NDEBUG
     webPageProxyCounter.increment();
@@ -1252,11 +1262,21 @@ void WebPageProxy::handleGestureEvent(const WebGestureEvent& event)
     if (!isValid())
         return;
 
-#if ENABLE(TIZEN_ISF_PORT)
+#if ENABLE(TIZEN_ISF_PORT) || ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
     if (event.type() == WebEvent::GestureSingleTap) {
+#if ENABLE(TIZEN_WEBKIT2_FOCUS_RING)
+        FocusRing* focusRing = ewkViewGetFocusRing(viewWidget());
+        if (focusRing) {
+            IntPoint tapPosition = EwkViewImpl::fromEvasObject(viewWidget())->transformToScene().mapPoint(event.position());
+            focusRing->requestToShow(tapPosition, true);
+        }
+#endif
+
+#if ENABLE(TIZEN_ISF_PORT)
         InputMethodContextEfl* inputMethodContext = static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->inputMethodContext();
         if (inputMethodContext)
             inputMethodContext->resetIMFContext();
+#endif
     }
 #endif
 
@@ -1294,7 +1314,11 @@ void WebPageProxy::handlePotentialActivation(const IntPoint& touchPoint, const I
 
 void WebPageProxy::handleTouchEvent(const NativeWebTouchEvent& event)
 {
+#if ENABLE(TIZEN_WEBKIT2_NOTIFY_SUSPEND_BY_REMOTE_WEB_INSPECTOR)
+    if (!isValid() || isContentSuspendedByInspector())
+#else
     if (!isValid())
+#endif
         return;
 
     // If the page is suspended, which should be the case during panning, pinching
@@ -2653,6 +2677,9 @@ void WebPageProxy::runJavaScriptAlert(uint64_t frameID, const String& message, P
     process()->responsivenessTimer()->stop();
 
     m_alertReply = reply;
+#if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
+    m_uiClient.notifyPopupReplyWaitingState(this, true);
+#endif
 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
     process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
 #endif
@@ -2669,6 +2696,9 @@ void WebPageProxy::runJavaScriptConfirm(uint64_t frameID, const String& message,
     process()->responsivenessTimer()->stop();
 
     m_confirmReply = reply;
+#if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
+    m_uiClient.notifyPopupReplyWaitingState(this, true);
+#endif
 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
     process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
 #endif
@@ -2685,6 +2715,9 @@ void WebPageProxy::runJavaScriptPrompt(uint64_t frameID, const String& message,
     process()->responsivenessTimer()->stop();
 
     m_promptReply = reply;
+#if ENABLE(TIZEN_WEBKIT2_NOTIFY_POPUP_REPLY_STATUS)
+    m_uiClient.notifyPopupReplyWaitingState(this, true);
+#endif
 #if ENABLE(TIZEN_WEBKIT2_ROTATION_WHILE_JAVASCRIPT_POPUP)
     process()->connection()->setForcelySetAllAsyncMessagesToDispatchEvenWhenWaitingForSyncReply(true);
 #endif
@@ -3787,9 +3820,12 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
         m_gestureEventQueue.removeFirst();
         m_pageClient->doneWithGestureEvent(event, handled);
 #endif
+
 #if ENABLE(TIZEN_ISF_PORT)
-        if (type == WebEvent::GestureSingleTap)
-            evas_object_focus_set(viewWidget(), true);
+        if (m_isVisible && type == WebEvent::GestureSingleTap) {
+            InputMethodContextEfl* inputMethodContext = static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->inputMethodContext();
+            inputMethodContext->updateTextInputStateByUserAction(true);
+        }
 #endif
         break;
     }
@@ -3846,7 +3882,7 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled)
 
 #if ENABLE(TIZEN_ISF_PORT)
         InputMethodContextEfl* inputMethodContext = static_cast<PageClientImpl*>(m_pageClient)->viewImpl()->inputMethodContext();
-        if (inputMethodContext && event.keyIdentifier() == "Enter" && inputMethodContext->autoCapitalType() == ECORE_IMF_AUTOCAPITAL_TYPE_NONE)
+        if (event.type() == WebEvent::KeyDown && event.keyIdentifier() == "Enter" && inputMethodContext && inputMethodContext->autoCapitalType() == ECORE_IMF_AUTOCAPITAL_TYPE_NONE)
             inputMethodContext->hideIMFContext();
 #endif