From f443518988627a1924f9a58474c47ad61c71aa7f Mon Sep 17 00:00:00 2001 From: Yuni Jeong Date: Wed, 31 Jul 2013 23:15:08 +0900 Subject: [PATCH] Text selection is updated by timer when webview's geometry is changed. [Title] Text selection is updated by timer when webview's geometry is changed. [Issue#] P130730-4510 [Problem] When text selection is working and screen is rotated in Email composer, webview is not scrolled smoothly. [Cause] Whenever webview is scrolled, webview's geometry is changed. And whenever webview's geometry is changed, text selection is updated immediately. So, function to show context menu is called too many during scrolling. [Solution] Added timer for updating text selection. - When webview's geometry is chagned, text selection is updated by timer. Change-Id: I1cfdcf0145d6de08a95a0d17535dc50210faad95 --- Source/WebKit2/UIProcess/API/efl/ewk_view.cpp | 5 ++++- Source/WebKit2/UIProcess/API/efl/tizen/TextSelection.cpp | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp index 7198e61..c9e3cca 100755 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp @@ -1032,7 +1032,10 @@ static void _ewk_view_smart_calculate(Evas_Object* ewkView) impl->pageClient->frameRectChanged(); #endif #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) - impl->pageClient->updateTextSelectionHandlesAndContextMenu(true); + if (impl->pageClient->isTextSelectionMode()) { + impl->pageClient->updateTextSelectionHandlesAndContextMenu(false); + impl->pageClient->requestToShowTextSelectionHandlesAndContextMenu(); + } #endif #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING) if (impl->focusRing()) diff --git a/Source/WebKit2/UIProcess/API/efl/tizen/TextSelection.cpp b/Source/WebKit2/UIProcess/API/efl/tizen/TextSelection.cpp index d961829..138368d 100755 --- a/Source/WebKit2/UIProcess/API/efl/tizen/TextSelection.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tizen/TextSelection.cpp @@ -208,8 +208,8 @@ void TextSelection::updateHandlers() if (!m_viewImpl->page()->getSelectionHandlers(leftRect, rightRect, selectionDirection)) return; - m_lastLeftHandleRect = leftRect; - m_lastRightHandleRect = rightRect; + m_lastLeftHandleRect = m_viewImpl->transformToScene().mapRect(leftRect); + m_lastRightHandleRect = m_viewImpl->transformToScene().mapRect(rightRect); AffineTransform toEvasTransform = m_viewImpl->transformToScene(); WebCore::IntPoint leftEvasPoint ; @@ -551,6 +551,9 @@ void TextSelection::updateHandlesAndContextMenu(bool isShow, bool isScrolling) if (m_viewImpl->gestureClient->isGestureWorking()) return; + if (m_showTimer) + return; + updateHandlers(); showContextMenu(); } else { @@ -777,6 +780,12 @@ bool TextSelection::isAutomaticClearEnabled() void TextSelection::requestToShow() { + EditorState editorState = m_viewImpl->page()->editorState(); + if (!editorState.selectionIsRange && editorState.isContentEditable) { + setIsTextSelectionMode(false); + return; + } + if (m_showTimer) ecore_timer_del(m_showTimer); m_showTimer = ecore_timer_loop_add((double)200.0/1000.0, showTimerCallback, this); @@ -795,6 +804,8 @@ void TextSelection::showHandlesAndContextMenu() WebCore::IntRect leftRect, rightRect; int selectionDirection = LToR; if (m_viewImpl->page()->getSelectionHandlers(leftRect, rightRect, selectionDirection)) { + leftRect = m_viewImpl->transformToScene().mapRect(leftRect); + rightRect = m_viewImpl->transformToScene().mapRect(rightRect); if ((leftRect == m_lastLeftHandleRect) && (rightRect == m_lastRightHandleRect)) { if (m_showTimer) { ecore_timer_del(m_showTimer); -- 2.7.4