Text selection handler disappering in Gmail.
authorSudarshan C P <sudarshan.cp@samsung.com>
Fri, 21 Jun 2013 15:30:22 +0000 (21:00 +0530)
committerTaeyun An <ty.an@samsung.com>
Mon, 16 Sep 2013 15:11:42 +0000 (00:11 +0900)
[Title] Selection handler disappears on changing
     the device orientation - gmail.com
[Issue#] WEB-3299
[Problem] Selection handler disappears on changing the
       device orientation on all edit box, even issue reproduce
       in case of scroll the page , single dumbell shown.
[Cause] After orientation/scroll offset changed to the editor,
      new editor rect is not reflecting in updateHandler.
[Solution] Required a Message sync call to update, new editor
     rect on orientation/scroll happens to redraw the update handler.

Change-Id: I34d4746d8a762f0e0b997153c4ef9e6d0acac488

Source/WebKit2/Platform/CoreIPC/HandleMessage.h [changed mode: 0644->0755]
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp

old mode 100644 (file)
new mode 100755 (executable)
index 06d6469..3083105
@@ -87,6 +87,12 @@ void callMemberFunction(const Arguments0&, Arguments2<R1, R2>& replyArgs, C* obj
     (object->*function)(replyArgs.argument1, replyArgs.argument2);
 }
 
+template<typename C, typename MF, typename R1, typename R2, typename R3>
+void callMemberFunction(const Arguments0&, Arguments3<R1, R2, R3>& replyArgs, C* object, MF function)
+{
+    (object->*function)(replyArgs.argument1, replyArgs.argument2, replyArgs.argument3);
+}
+
 template<typename C, typename MF, typename P1>
 void callMemberFunction(const Arguments1<P1>& args, Arguments0&, C* object, MF function)
 {
index 55c3b41..f7510d3 100755 (executable)
@@ -1249,7 +1249,6 @@ private:
 #endif
 
     void editorStateChanged(const EditorState&);
-
     // Back/Forward list management
     void backForwardAddItem(uint64_t itemID);
     void backForwardGoToItem(uint64_t itemID, SandboxExtension::Handle&);
index 5a3a50a..727575a 100755 (executable)
@@ -931,10 +931,14 @@ bool WebPageProxy::getSelectionHandlers(IntRect& leftRect, IntRect& rightRect)
         return false;
 
     bool result = false;
-    process()->sendSync(Messages::WebPage::GetSelectionHandlers(), Messages::WebPage::GetSelectionHandlers::Reply(leftRect, rightRect), m_pageID);
+    IntRect updateEditorRect(0, 0, 0, 0);
+    process()->sendSync(Messages::WebPage::GetSelectionHandlers(), Messages::WebPage::GetSelectionHandlers::Reply(leftRect, rightRect, updateEditorRect), m_pageID);
     if (!leftRect.size().isZero() || !rightRect.size().isZero())
         result = true;
-
+    if(m_editorState.editorRect != updateEditorRect) {
+        m_editorState.editorRect = updateEditorRect;
+        m_editorState.updateEditorRectOnly = true;
+    }
     return result;
 }
 
index 30765cc..0701649 100755 (executable)
@@ -344,7 +344,7 @@ public:
     void selectClosestWord(const WebCore::IntPoint&, bool& result);
     void setLeftSelection(const WebCore::IntPoint&, const int direction, int& result);
     void setRightSelection(const WebCore::IntPoint&, const int direction, int& result);
-    void getSelectionHandlers(WebCore::IntRect& leftRect, WebCore::IntRect& rightRect);
+    void getSelectionHandlers(WebCore::IntRect& leftRect, WebCore::IntRect& rightRect, WebCore::IntRect& updateEditorRect);
     void getSelectionText(String& result);
     void selectionRangeClear(bool& result);
     void selectionClearAllSelection(WebCore::Frame* frame);
index 0986880..e4db491 100755 (executable)
@@ -382,7 +382,7 @@ messages -> WebPage {
     SelectClosestWord(WebCore::IntPoint point) -> (bool result)
     SetLeftSelection(WebCore::IntPoint point, int direction) -> (int result)
     SetRightSelection(WebCore::IntPoint point, int direction) -> (int result)
-    GetSelectionHandlers() -> (WebCore::IntRect leftRect, WebCore::IntRect rightRect)
+    GetSelectionHandlers() -> (WebCore::IntRect leftRect, WebCore::IntRect rightRect, WebCore::IntRect updateEditorRect)
     GetSelectionText() -> (String result)
     SelectionRangeClear() -> (bool result)
     ScrollContentByCharacter(WebCore::IntPoint point, int direction) -> (bool result)
index 0468bdb..f8d9606 100755 (executable)
@@ -1334,8 +1334,8 @@ void WebPage::selectClosestWord(const IntPoint& point, bool& result)
 
     // This changes just the 'start' and 'end' positions of the VisibleSelection
     // Find handlers positions
-    IntRect leftRect, rightRect;
-    getSelectionHandlers(leftRect, rightRect);
+    IntRect leftRect, rightRect, updatedEditorRect;
+    getSelectionHandlers(leftRect, rightRect, updatedEditorRect);
     if (leftRect.size().isZero() && rightRect.size().isZero()) {
         // Sometimes there is no selected text, but isNone() returns TRUE
         // in this case ewk_frame_selection_handlers_get() returns FALSE and handlers are invalid
@@ -1368,8 +1368,8 @@ void WebPage::setLeftSelection(const IntPoint& point, const int direction, int&
         return;
 
     IntPoint pos = frameView->windowToContents(point);
-    IntRect leftRect, rightRect;
-    getSelectionHandlers(leftRect, rightRect);
+    IntRect leftRect, rightRect, updatedEditorRect;
+    getSelectionHandlers(leftRect, rightRect, updatedEditorRect);
 
     if (selectionEndNode->rendererIsEditable() && !selectionEndNode->rendererIsRichlyEditable()) {
         const int boundariesWidth = 2;
@@ -1503,9 +1503,10 @@ void WebPage::setRightSelection(const IntPoint& point, const int direction, int&
     }
 }
 
-void WebPage::getSelectionHandlers(IntRect& leftRect, IntRect& rightRect)
+void WebPage::getSelectionHandlers(IntRect& leftRect, IntRect& rightRect, WebCore::IntRect& updatedEditorRect)
 {
     Frame* focusedFrame = m_page->focusController()->focusedOrMainFrame();
+    updatedEditorRect = m_editorState.editorRect;
     if (!focusedFrame->selection()->isRange())
         return;
 
@@ -1533,15 +1534,8 @@ void WebPage::getSelectionHandlers(IntRect& leftRect, IntRect& rightRect)
                 calcFocusedRects(rootEditableElement, rects);
                 IntRect editorRect = unionRect(rects);
 
-#if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
-                if (m_editorState.editorRect != editorRect) {
-                    EditorState state = editorState();
-                    state.updateEditorRectOnly = true;
-                    setEditorState(state);
-                    send(Messages::WebPageProxy::EditorStateChanged(state));
-                }
-#endif
-
+                if (m_editorState.editorRect != editorRect)
+                    updatedEditorRect = editorRect;
                 if (leftRect.maxY() > editorRect.maxY()) {
                     leftRect.setY(editorRect.y());
                     leftRect.setHeight(editorRect.height());
@@ -1553,7 +1547,6 @@ void WebPage::getSelectionHandlers(IntRect& leftRect, IntRect& rightRect)
                 }
             }
         }
-
         // prevent from selecting zero-length selection
         if (leftRect.x() == rightRect.x() + rightRect.width()
             && leftRect.y() == rightRect.y())