From 8cc3da9b2fc641fb88910849d2c863f42be5869a Mon Sep 17 00:00:00 2001 From: "prathmesh.m" Date: Thu, 6 Jun 2013 12:16:35 +0530 Subject: [PATCH] Implemented scolling of page with extending selection [Title] Implemented scrolling of page with selection [Issue#] P130603-0415 [Problem] Extending the selection(right and left) beyond the visible area, page is not getting scrolled. [Cause] No implementation present [Solution] Added implementation for scrolling of the page when selection is extended beyond the visible area Change-Id: I33e1083042b22c30a144ac5807153a2af8a43be3 --- .../UIProcess/API/efl/tizen/TextSelection.cpp | 33 ++++++++++++++++++++++ .../UIProcess/API/efl/tizen/TextSelection.h | 4 +++ 2 files changed, 37 insertions(+) mode change 100644 => 100755 Source/WebKit2/UIProcess/API/efl/tizen/TextSelection.h diff --git a/Source/WebKit2/UIProcess/API/efl/tizen/TextSelection.cpp b/Source/WebKit2/UIProcess/API/efl/tizen/TextSelection.cpp index 588801a..ee5330b 100755 --- a/Source/WebKit2/UIProcess/API/efl/tizen/TextSelection.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tizen/TextSelection.cpp @@ -48,6 +48,7 @@ TextSelection::TextSelection(EwkViewImpl* viewImpl) , m_selectedHandle(0) #endif , m_handleMovingDirection(HandleMovingDirectionNormal) + , m_isSelectionInScrollingMode(false) { ASSERT(viewWidget); @@ -359,8 +360,36 @@ void TextSelection::hideContextMenu() m_viewImpl->page()->hideContextMenu(); } +void TextSelection::scrollContentWithSelectionIfRequired(const IntPoint& evasPoint) +{ + EditorState editorState = m_viewImpl->page()->editorState(); + if (editorState.isContentEditable) + return; + + setSelectionScrollingStatus(true); + IntRect unscaledVisibleContentRect = m_viewImpl->pageClient->visibleContentRect(); + const int scrollClipValue = 50; + if (evasPoint.y() >= (unscaledVisibleContentRect.height() - scrollClipValue)) + m_viewImpl->pageClient->scrollBy(IntSize(0, m_rightHandle->getHandleRect().height())); + else if (evasPoint.y() <= scrollClipValue) { + IntSize scrollSize(0, m_rightHandle->getHandleRect().height()); + scrollSize.scale(-1); + m_viewImpl->pageClient->scrollBy(scrollSize); + } + + if (evasPoint.x() >= (unscaledVisibleContentRect.width() - scrollClipValue)) + m_viewImpl->pageClient->scrollBy(IntSize(m_rightHandle->getHandleRect().width(),0)); + else if (evasPoint.x() <= scrollClipValue) { + IntSize scrollSize(m_rightHandle->getHandleRect().width(), 0); + scrollSize.scale(-1); + m_viewImpl->pageClient->scrollBy(scrollSize); + } + setSelectionScrollingStatus(false); +} + void TextSelection::setLeftSelectionToEvasPoint(const IntPoint& evasPoint) { + scrollContentWithSelectionIfRequired(evasPoint); int result = m_viewImpl->page()->setLeftSelection(m_viewImpl->transformFromScene().mapPoint(evasPoint), m_handleMovingDirection); if (result) m_handleMovingDirection = result; @@ -369,6 +398,7 @@ void TextSelection::setLeftSelectionToEvasPoint(const IntPoint& evasPoint) void TextSelection::setRightSelectionToEvasPoint(const IntPoint& evasPoint) { + scrollContentWithSelectionIfRequired(evasPoint); int result = m_viewImpl->page()->setRightSelection(m_viewImpl->transformFromScene().mapPoint(evasPoint), m_handleMovingDirection); if (result) m_handleMovingDirection = result; @@ -431,6 +461,9 @@ bool TextSelection::isMagnifierVisible() void TextSelection::updateHandlesAndContextMenu(bool isShow, bool isScrolling) { + if (getSelectionScrollingStatus()) + return; + if (isTextSelectionDowned() && !isScrolling) { showMagnifier(); return; diff --git a/Source/WebKit2/UIProcess/API/efl/tizen/TextSelection.h b/Source/WebKit2/UIProcess/API/efl/tizen/TextSelection.h old mode 100644 new mode 100755 index dcfbb1f..d937298 --- a/Source/WebKit2/UIProcess/API/efl/tizen/TextSelection.h +++ b/Source/WebKit2/UIProcess/API/efl/tizen/TextSelection.h @@ -117,6 +117,9 @@ private: static Eina_Bool showTimerCallback(void* data); void showHandlesAndContextMenu(); + void scrollContentWithSelectionIfRequired(const WebCore::IntPoint& evasPoint); + int getSelectionScrollingStatus() { return m_isSelectionInScrollingMode; } + void setSelectionScrollingStatus(bool status) { m_isSelectionInScrollingMode = status; } #if ENABLE(TIZEN_WEBKIT2_GET_TEXT_STYLE_FOR_SELECTION) void informTextStyleState(); @@ -137,6 +140,7 @@ private: TextSelectionHandle* m_selectedHandle; #endif int m_handleMovingDirection; + bool m_isSelectionInScrollingMode; }; } // namespace WebKit -- 2.7.4