Adjusted position for showing text selection context menu properly.
authorYuni Jeong <yhnet.jung@samsung.com>
Sun, 9 Jun 2013 07:55:55 +0000 (16:55 +0900)
committerYuni Jeong <yhnet.jung@samsung.com>
Sun, 9 Jun 2013 07:59:38 +0000 (16:59 +0900)
[Title] Adjusted position for showing text selection context menu properly.
[Issue#] N_SE-38751
[Problem] Select All context menu show wrong position in NPRuntime.
[Cause] Context menu is showned at center position of selection range.
        If center position of selection range is in invisible editor box area(outside of the editor box),
        context menu is showned at wrong position and wrong context menu is showned.
[Solution] Adjusted position for shwoing context menu to center position of visible selection range in the editor box.

Change-Id: I6bc8e9c994050e0fbead15525b3d5c9c63cfe9df

Source/WebKit2/UIProcess/API/efl/tizen/TextSelection.cpp [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index 75f80ba..2cae8ec
@@ -279,6 +279,21 @@ void TextSelection::showContextMenu()
             point = rightRect.maxXMinYCorner();
             isPresentInViewPort = true;
         }
+
+        if (isPresentInViewPort && editorState.isContentEditable) {
+            // In case of single line editor box.
+            if (leftRect == rightRect) {
+                // draw context menu at center point of visible selection range in the editor box
+                IntRect editorRect = editorState.editorRect;
+                leftRect.intersect(editorRect);
+                if (!leftRect.isEmpty())
+                    point = leftRect.center();
+                else {
+                    // not draw context menu if there is no visible selection range in the editor box
+                    isPresentInViewPort = false;
+                }
+            }
+        }
 #else
         point = leftRect.center();
 #endif