Implemented scrolling of text when the magnifier is on
authorprathmesh.m <prathmesh.m@samsung.com>
Wed, 3 Apr 2013 02:12:22 +0000 (11:12 +0900)
committerGerrit Code Review <gerrit2@kim11>
Thu, 4 Apr 2013 06:17:08 +0000 (15:17 +0900)
[Title] Implemented scrolling of text when the magnifier is on
  and implemented the movement of touch point with blocking of
  magnifier
[Issue#] N/A
[Problem] The movement of magnifier and caret was stopped when
  the mouse move went out side the inputbox and the text inside
  the input box was not scrolled
[Cause] When the mousemove point was out side the inputbox
the handlers were blocked
[Solution] Implemented mousemove and handled the case where
   mousedown is done on inputbox and mouse move point is outside
   the input box and also scrolled the text ant the end of input
   box

Change-Id: I514714871b9c1238ea3d8dbc7fcef5f9be5aa896

Source/WebKit2/UIProcess/API/efl/tizen/TextSelection.cpp
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

index 8bc2e77..75039b6 100755 (executable)
@@ -490,15 +490,29 @@ void TextSelection::textSelectionMove(const IntPoint& point, bool isStartedTextS
         return;
     }
 
-    WebCore::IntPoint viewPoint = m_viewImpl->transformFromScene().mapPoint(point);
+    WebCore::IntPoint viewPoint;
     EditorState editorState = m_viewImpl->page()->editorState();
     if (editorState.isContentEditable) {
         IntRect mapRect = m_viewImpl->transformToScene().mapRect(editorState.editorRect);
-        if(mapRect.contains(point)) {
+        IntPoint updatedPoint = point;
+        if ((point.y() < mapRect.y()) || (point.y() > ((mapRect.y()) + (mapRect.height()))))
+            updatedPoint.setY((mapRect.y()) + ((mapRect.height())/2) );
+
+        if (point.x() < mapRect.x()) {
+            updatedPoint.setX(mapRect.x());
+            if (m_viewImpl->page()->scrollContentByCharacter(point,WebCore::DirectionBackward))
+                updateMagnifier(updatedPoint);
+        } else if (point.x() > ((mapRect.x()) + (mapRect.width()))) {
+            updatedPoint.setX((mapRect.x()) + (mapRect.width()));
+            if (m_viewImpl->page()->scrollContentByCharacter(point,WebCore::DirectionForward))
+                updateMagnifier(updatedPoint);
+        } else {
+            viewPoint = m_viewImpl->transformFromScene().mapPoint(updatedPoint);
             m_viewImpl->page()->selectClosestWord(viewPoint, isStartedTextSelectionFromOutside);
-            updateMagnifier(point);
+            updateMagnifier(updatedPoint);
         }
     } else {
+        viewPoint = m_viewImpl->transformFromScene().mapPoint(point);
         m_viewImpl->page()->selectClosestWord(viewPoint, isStartedTextSelectionFromOutside);
         updateMagnifier(point);
     }
index 8ea0f1d..633e3d5 100755 (executable)
 #include <WebCore/ContentSecurityPolicy.h>
 #endif
 
+#if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION)
+#include <WebCore/VisibleSelection.h>
+#endif
+
 namespace CoreIPC {
     class ArgumentDecoder;
     class Connection;
@@ -999,6 +1003,7 @@ void recordingSurfaceSetEnableSet(bool enable);
     bool getSelectionHandlers(WebCore::IntRect& leftRect, WebCore::IntRect& rightRect);
     String getSelectionText();
     bool selectionRangeClear();
+    bool scrollContentByCharacter(const WebCore::IntPoint&, WebCore::SelectionDirection direction);
 #endif
 
 #if ENABLE(TIZEN_LINK_MAGNIFIER)
index 92a8f8b..b78b01d 100755 (executable)
@@ -906,6 +906,16 @@ bool WebPageProxy::selectionRangeClear()
     process()->sendSync(Messages::WebPage::SelectionRangeClear(), Messages::WebPage::SelectionRangeClear::Reply(result), m_pageID);
     return result;
 }
+
+bool WebPageProxy::scrollContentByCharacter(const IntPoint& point, SelectionDirection direction)
+{
+    if (!isValid())
+        return false;
+
+    bool result = false;
+    process()->sendSync(Messages::WebPage::ScrollContentByCharacter(point, direction), Messages::WebPage::ScrollContentByCharacter::Reply(result), m_pageID);
+    return result;
+}
 #endif
 
 #if ENABLE(TIZEN_LINK_MAGNIFIER)
index cb8611a..7f8aab6 100755 (executable)
@@ -300,6 +300,7 @@ public:
     void getSelectionText(String& result);
     void selectionRangeClear(bool& result);
     void selectionClearAllSelection(WebCore::Frame* frame);
+    void scrollContentByCharacter(const WebCore::IntPoint&, int direction, bool& result);
 #endif
 
 #if ENABLE(TIZEN_OFFLINE_PAGE_SAVE)
index 5d778ea..b0abe26 100755 (executable)
@@ -384,6 +384,7 @@ messages -> WebPage {
     GetSelectionHandlers() -> (WebCore::IntRect leftRect, WebCore::IntRect rightRect)
     GetSelectionText() -> (String result)
     SelectionRangeClear() -> (bool result)
+    ScrollContentByCharacter(WebCore::IntPoint point, int direction) -> (bool result)
 #endif
 
 #if ENABLE(TIZEN_OFFLINE_PAGE_SAVE)
index 0766b71..c276791 100755 (executable)
@@ -1514,6 +1514,17 @@ void WebPage::selectionClearAllSelection(Frame* frame)
     } else if (frame->tree()->nextSibling())
         selectionClearAllSelection(frame->tree()->nextSibling());
 }
+
+void WebPage::scrollContentByCharacter(const IntPoint&, int direction, bool& result)
+{
+    result = false;
+
+    Frame* focusedFrame = m_page->focusController()->focusedOrMainFrame();
+    if (direction)
+        result = focusedFrame->selection()->modify(FrameSelection::AlterationMove, DirectionBackward, CharacterGranularity, UserTriggered);
+    else
+        result = focusedFrame->selection()->modify(FrameSelection::AlterationMove, DirectionForward, CharacterGranularity, UserTriggered);
+}
 #endif
 
 #if ENABLE(TIZEN_LINK_MAGNIFIER)