Fixed scroll position in contentRichlyEditable field
authorbunam.jeon <bunam.jeon@samsung.com>
Wed, 11 Sep 2013 11:12:53 +0000 (20:12 +0900)
committerbunam.jeon <bunam.jeon@samsung.com>
Mon, 16 Sep 2013 10:20:08 +0000 (19:20 +0900)
[Title]    Fixed scroll position in contentRichlyEditable field
[Issue#]   N/A
[Problem]  Wrong scroll position when input field zoom in contentRichlyEditable field
[Cause]    contentRichlyEditable was not considered
[Solution] Modify scroll condition and position

Change-Id: Ied2330ff616a551fe49ffd3f9c1097080460952f

Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp
Source/WebKit2/UIProcess/API/efl/PageClientImpl.h
Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
Source/WebKit2/UIProcess/API/efl/ewk_view_private.h
Source/WebKit2/UIProcess/efl/InputMethodContextEfl.cpp

index 51dc2f1..78c642a 100755 (executable)
@@ -113,6 +113,9 @@ PageClientImpl::PageClientImpl(EwkViewImpl* viewImpl)
 #if ENABLE(TIZEN_PRERENDERING_FOR_ROTATION)
     , m_waitFrameOfNewViewortSize(false)
 #endif
+#if ENABLE(TIZEN_WEBKIT2_INPUT_FIELD_ZOOM)
+    ,m_needFocusAdjust(false)
+#endif
     , m_nonemptyLayoutRendered(false)
 #endif // #if OS(TIZEN)
 {
@@ -440,8 +443,13 @@ void PageClientImpl::didChangeViewportProperties(const WebCore::ViewportAttribut
         return;
 
     // if IME is opened, visible content rect will be updated by ewk_view_focused_node_adjust()
-    if (ewk_view_focused_node_adjust(m_viewImpl->view()))
-        return;
+#if ENABLE(TIZEN_WEBKIT2_INPUT_FIELD_ZOOM)
+    if (m_needFocusAdjust) {
+        m_needFocusAdjust = false;
+        if (ewk_view_focused_node_adjust(m_viewImpl->view()))
+            return;
+    }
+#endif
 
     float newScale = scaleFactor();
     IntPoint newScrollPosition = m_visibleContentRect.location();
index 16216ce..84c59da 100755 (executable)
@@ -273,6 +273,11 @@ public:
     bool canUpdateVisibleContentRect();
 
     bool notifiedNonemptyLayout() { return m_nonemptyLayoutRendered; }
+
+#if ENABLE(TIZEN_WEBKIT2_INPUT_FIELD_ZOOM)
+    void setNeedFocusAdjust(bool needFocusAdjust) { m_needFocusAdjust = needFocusAdjust; }
+#endif
+
 #endif // #if OS(TIZEN)
 
 private:
@@ -478,6 +483,10 @@ protected:
     bool m_waitFrameOfNewViewortSize;
 #endif
 
+#if ENABLE(TIZEN_WEBKIT2_INPUT_FIELD_ZOOM)
+    bool m_needFocusAdjust;
+#endif
+
     bool m_nonemptyLayoutRendered;
 #endif // #if OS(TIZEN)
 };
index 97bf48a..458fc83 100755 (executable)
@@ -2529,7 +2529,7 @@ void ewk_view_scale_range_get(Evas_Object* ewkView, double* minimumScale, double
         *maximumScale = constraints.maximumScale;
 }
 
-bool ewk_view_focused_node_adjust(Evas_Object* ewkView, Eina_Bool adjustForExternalKeyboard)
+bool ewk_view_focused_node_adjust(Evas_Object* ewkView, Eina_Bool adjustForExternalKeyboard, Eina_Bool adjustForContentSizeChanged)
 {
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
     EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
@@ -2545,7 +2545,8 @@ bool ewk_view_focused_node_adjust(Evas_Object* ewkView, Eina_Bool adjustForExter
 
     if ((!(static_cast<PageClient*>(impl->pageClient.get()))->isViewFocused()
         || (!adjustForExternalKeyboard && !impl->inputMethodContext())
-        || (!adjustForExternalKeyboard && !impl->inputMethodContext()->isShow()))
+        || (!adjustForContentSizeChanged && impl->pageProxy->editorState().isContentRichlyEditable)
+        || (adjustForContentSizeChanged && !impl->inputMethodContext()->isShow()))
 #if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
         && !(impl->pageClient->isClipboardWindowOpened())
 #endif
@@ -2585,7 +2586,8 @@ bool ewk_view_focused_node_adjust(Evas_Object* ewkView, Eina_Bool adjustForExter
         return false;
 
 #if ENABLE(TIZEN_WEBKIT2_INPUT_FIELD_ZOOM)
-    impl->inputFieldZoom->startInputFieldZoom(impl->transformFromScene().mapPoint(IntPoint(focusedNodeRect.x(), focusedNodeRect.y())) ,focusedNodeRect);
+    impl->inputFieldZoom->startInputFieldZoom(impl->transformFromScene().mapPoint(IntPoint(selectionRect.x(), selectionRect.y()))
+    , IntRect(focusedNodeRect.x(), selectionRect.y(), focusedNodeRect.width(), selectionRect.height()));
 #endif
 
     return true;
index ba5ad9e..4e5897e 100755 (executable)
@@ -90,7 +90,7 @@ typedef struct Ewk_Context Ewk_Context;
 typedef struct _Ewk_Geolocation Ewk_Geolocation;
 #endif
 
-bool ewk_view_focused_node_adjust(Evas_Object* object, Eina_Bool adjustForExternalKeyboard = EINA_FALSE);
+bool ewk_view_focused_node_adjust(Evas_Object* object, Eina_Bool adjustForExternalKeyboard = EINA_FALSE, Eina_Bool adjustForContentSizeChanged = EINA_FALSE);
 void ewk_view_touch_event_handler_result_set(Evas_Object* ewkView, WebKit::WebEvent::Type type, bool wasHandled);
 
 #if ENABLE(TIZEN_WEBKIT2_TILED_AC)
index 11a6a28..1071611 100755 (executable)
@@ -735,7 +735,11 @@ void InputMethodContextEfl::showIMFContext(const EditorState& editor, bool isUse
         ewk_view_focused_node_adjust(m_viewImpl->view(), EINA_TRUE);
     else {
         if (isShow())
-            ewk_view_focused_node_adjust(m_viewImpl->view(), EINA_FALSE);
+            ewk_view_focused_node_adjust(m_viewImpl->view());
+#if ENABLE(TIZEN_WEBKIT2_INPUT_FIELD_ZOOM)
+        else
+            m_viewImpl->pageClient->setNeedFocusAdjust(true);
+#endif
     }
 
     resetIMFContext();