When selection handler are out of view port,context menu should come in middle of...
authorSudarshan C P <sudarshan.cp@samsung.com>
Fri, 30 Aug 2013 23:38:02 +0000 (05:08 +0530)
committerTaeyun An <ty.an@samsung.com>
Thu, 10 Oct 2013 07:51:14 +0000 (16:51 +0900)
    [Title] When selection handler are out of view port,context menu should come in middle of the window.
    [Issue#] P130813-04751
    [Problem] After selecting select all option,when selection handler are out of viewport,
             context menu not showing in the middle of the window,
    [Cause] Context menu draw based on the left and right hanlder position,not handled the
            selection handler out of viewport scenario to placing into middle of the window.
    [Solution] Added new implementation to place the selection handler on middle of the window,
              in case of selection handler out of viewport.

Change-Id: Iaffe3c0416e7870c50377df94a338bda694d6d1a

Source/WebKit2/UIProcess/API/efl/tizen/TextSelection.cpp

index 138368d..7b25e6a 100755 (executable)
@@ -309,9 +309,7 @@ void TextSelection::showContextMenu()
     if (editorState.selectionIsRange) {
         WebCore::IntRect leftRect, rightRect;
         int selectionDirection = LToR;
-        if (!m_viewImpl->page()->getSelectionHandlers(leftRect, rightRect, selectionDirection))
-            return;
-
+        m_viewImpl->page()->getSelectionHandlers(leftRect, rightRect, selectionDirection);
 #if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE)
         // Checking if this point is in viewport area. If the calcualated
         // point/Left/Right point are in view port then draw else do not draw the
@@ -336,6 +334,16 @@ void TextSelection::showContextMenu()
             point = rightRect.maxXMinYCorner();
             isPresentInViewPort = true;
         }
+        else if (leftRect.y() < viewportRect.y() && rightRect.maxY() > viewportRect.maxY()) {
+            // If left and right selection handler is not present in the view port,
+            // always context menu shows middle of the view port.
+            // Selection on position element in case of selectAll handled same
+            // as other browser
+            point = viewportRect.center();
+            leftRect = viewportRect;
+            rightRect = viewportRect;
+            isPresentInViewPort = true;
+        }
 
         if (isPresentInViewPort && editorState.isContentEditable) {
             // In case of single line editor box.