From a4cdf807e749fcdf8e7e9b9d6aabc28dd767c3e1 Mon Sep 17 00:00:00 2001 From: "bunam.jeon" Date: Wed, 11 Sep 2013 20:12:53 +0900 Subject: [PATCH] Fixed scroll position in contentRichlyEditable field [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 | 12 ++++++++++-- Source/WebKit2/UIProcess/API/efl/PageClientImpl.h | 9 +++++++++ Source/WebKit2/UIProcess/API/efl/ewk_view.cpp | 8 +++++--- Source/WebKit2/UIProcess/API/efl/ewk_view_private.h | 2 +- Source/WebKit2/UIProcess/efl/InputMethodContextEfl.cpp | 6 +++++- 5 files changed, 30 insertions(+), 7 deletions(-) diff --git a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp index 51dc2f1..78c642a 100755 --- a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp +++ b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp @@ -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(); diff --git a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h index 16216ce..84c59da 100755 --- a/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h +++ b/Source/WebKit2/UIProcess/API/efl/PageClientImpl.h @@ -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) }; diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp index 97bf48a..458fc83 100755 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp @@ -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(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; diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h index ba5ad9e..4e5897e 100755 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h @@ -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) diff --git a/Source/WebKit2/UIProcess/efl/InputMethodContextEfl.cpp b/Source/WebKit2/UIProcess/efl/InputMethodContextEfl.cpp index 11a6a28..1071611 100755 --- a/Source/WebKit2/UIProcess/efl/InputMethodContextEfl.cpp +++ b/Source/WebKit2/UIProcess/efl/InputMethodContextEfl.cpp @@ -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(); -- 2.7.4