Text selection is updated by timer when webview's geometry is changed.
[framework/web/webkit-efl.git] / Source / WebKit2 / UIProcess / API / efl / tizen / TextSelection.cpp
index d961829..138368d 100755 (executable)
@@ -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);