From eca8579a62006108aa6a49d8169ea7a3af41df6b Mon Sep 17 00:00:00 2001 From: Yuni Jeong Date: Mon, 13 May 2013 23:49:43 +0900 Subject: [PATCH] Fixed when user tap on linkable contents, somtimes focus ring is not shown. [Title] Fixed when user tap on linkable contents, somtimes focus ring is not shown. [Issue#] P130508-1455 [Problem] When user tap on linkable contents, somtimes focus ring is not shown [Cause] 1. When user tap quickly, hide() function was called before show() function is called by timer for showing focus ring. - timing issue 2. When user tap any point that is not linkable contents around linkable contents, tap operation is worked by touch adjust feature and focus ring is not shown. [Solution] 1. Added routine to call hide() function by timer. 2. Added touch adjust feature to routine for getting focus ring rect. Change-Id: I56263a00a5e1f3a42cfb7522a1541bb623066005 --- Source/WebKit2/UIProcess/API/efl/ewk_view.cpp | 8 ++-- .../WebKit2/UIProcess/API/efl/tizen/FocusRing.cpp | 50 +++++++++++++++++++++- Source/WebKit2/UIProcess/API/efl/tizen/FocusRing.h | 5 +++ Source/WebKit2/UIProcess/WebPageProxy.h | 4 ++ Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp | 9 ++++ Source/WebKit2/WebProcess/WebPage/WebPage.h | 4 ++ .../WebKit2/WebProcess/WebPage/WebPage.messages.in | 5 +++ .../WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp | 21 +++++++++ 8 files changed, 100 insertions(+), 6 deletions(-) diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp index c05808b..f154f52 100755 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp @@ -413,13 +413,13 @@ static Eina_Bool _ewk_view_smart_gesture_start(Ewk_View_Smart_Data* smartData, c impl->focusRing->requestToShow(IntPoint(event->position.x, event->position.y)); } else if (event->type == EWK_GESTURE_PAN) { if (impl->exceedTouchMoveThreshold) - impl->focusRing->hide(); + impl->focusRing->requestToHide(); } else { if (event->type != EWK_GESTURE_LONG_PRESS) { #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2) if (!impl->pageClient->isContextMenuVisible()) #endif - impl->focusRing->hide(); + impl->focusRing->requestToHide(); } } } @@ -526,7 +526,7 @@ static Eina_Bool _ewk_view_smart_gesture_end(Ewk_View_Smart_Data* smartData, con #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2) if (!impl->pageClient->isContextMenuVisible() || impl->pageClient->isTextSelectionMode()) #endif - impl->focusRing->hide(); + impl->focusRing->requestToHide(); } #endif @@ -587,7 +587,7 @@ static Eina_Bool _ewk_view_smart_gesture_move(Ewk_View_Smart_Data* smartData, co #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING) if (impl->focusRing && !(event->type == EWK_GESTURE_PAN && !impl->exceedTouchMoveThreshold)) - impl->focusRing->hide(); + impl->focusRing->requestToHide(true); #endif switch (event->type) { diff --git a/Source/WebKit2/UIProcess/API/efl/tizen/FocusRing.cpp b/Source/WebKit2/UIProcess/API/efl/tizen/FocusRing.cpp index 826a80e..cba19d7 100755 --- a/Source/WebKit2/UIProcess/API/efl/tizen/FocusRing.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tizen/FocusRing.cpp @@ -24,6 +24,10 @@ #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING) #include "PageClientImpl.h" +#if ENABLE(TOUCH_ADJUSTMENT) +#include +#endif + using namespace WebKit; using namespace WebCore; @@ -33,6 +37,7 @@ FocusRing::FocusRing(EwkViewImpl* viewImpl) , m_imageOuterWidth(0) , m_imageInnerWidth(0) , m_showTimer(0) + , m_hideTimer(0) { } @@ -41,6 +46,9 @@ FocusRing::~FocusRing() if (m_showTimer) ecore_timer_del(m_showTimer); + if (m_hideTimer) + ecore_timer_del(m_hideTimer); + if (m_focusRingObject) evas_object_del(m_focusRingObject); } @@ -80,8 +88,12 @@ void FocusRing::requestToShow(const IntPoint& position) void FocusRing::show(const IntRect& rect, const bool includeOnlyImage) { - if (rect.isEmpty()) - m_showTimer = 0; + if (rect.isEmpty()) { + if (m_showTimer) { + ecore_timer_del(m_showTimer); + m_showTimer = 0; + } + } PageClientImpl* pageClientImpl = m_viewImpl->pageClient.get(); EINA_SAFETY_ON_NULL_RETURN(pageClientImpl); @@ -92,7 +104,18 @@ void FocusRing::show(const IntRect& rect, const bool includeOnlyImage) if (rect.isEmpty()) { #if ENABLE(TIZEN_WEBKIT2_HIT_TEST) IntPoint contentsPosition = m_viewImpl->transformFromScene().mapPoint(m_position); +#if ENABLE(TOUCH_ADJUSTMENT) + Evas_Coord size = elm_config_finger_size_get(); + IntSize fingerSize = IntSize(size, size); +#if ENABLE(TIZEN_WEBKIT2_TILED_BACKING_STORE) + double scaleFactor = pageClientImpl->scaleFactor(); + if (scaleFactor - 1 > numeric_limits::epsilon()) + fingerSize.scale(1 / scaleFactor, 1 / scaleFactor); +#endif + WebHitTestResult::Data hitTestResultData = m_viewImpl->page()->hitTestResultAtPoint(contentsPosition, WebHitTestResult::HitTestModeDefault, fingerSize); +#else WebHitTestResult::Data hitTestResultData = m_viewImpl->page()->hitTestResultAtPoint(contentsPosition); +#endif if (hitTestResultData.focusedRect.isEmpty()) return; @@ -173,6 +196,24 @@ void FocusRing::show(const IntRect& rect, const bool includeOnlyImage) evas_object_show(m_focusRingObject); } +void FocusRing::requestToHide(bool immediately) +{ + if (immediately) { + hide(); + return; + } + + if (m_hideTimer) + ecore_timer_del(m_hideTimer); + m_hideTimer = ecore_timer_add((double)s_hideTimerTime/1000.0, hideTimerCallback, this); +} + +Eina_Bool FocusRing::hideTimerCallback(void* data) +{ + static_cast(data)->hide(); + return ECORE_CALLBACK_CANCEL; +} + void FocusRing::hide(bool onlyColorDrawing) { if (!m_imagePath.isNull() && onlyColorDrawing) @@ -183,6 +224,11 @@ void FocusRing::hide(bool onlyColorDrawing) m_showTimer = 0; } + if (m_hideTimer) { + ecore_timer_del(m_hideTimer); + m_hideTimer = 0; + } + if (m_focusRingObject && evas_object_visible_get(m_focusRingObject)) evas_object_hide(m_focusRingObject); diff --git a/Source/WebKit2/UIProcess/API/efl/tizen/FocusRing.h b/Source/WebKit2/UIProcess/API/efl/tizen/FocusRing.h index 03a1770..f15a6c2 100755 --- a/Source/WebKit2/UIProcess/API/efl/tizen/FocusRing.h +++ b/Source/WebKit2/UIProcess/API/efl/tizen/FocusRing.h @@ -41,6 +41,7 @@ public: void setImage(const String&, int, int); void requestToShow(const WebCore::IntPoint&); + void requestToHide(bool immediately = false); void show(const WebCore::IntRect&, const bool includeOnlyImage = false); void hide(bool = true); @@ -54,6 +55,9 @@ private: static const int s_showTimerTime = 100; static Eina_Bool showTimerCallback(void* data); + static const int s_hideTimerTime = 200; + static Eina_Bool hideTimerCallback(void* data); + private: FocusRing(EwkViewImpl* viewImpl); void internalShow(bool, const WebCore::IntRect&); @@ -67,6 +71,7 @@ private: int m_imageInnerWidth; Ecore_Timer* m_showTimer; + Ecore_Timer* m_hideTimer; WebCore::IntPoint m_position; WebCore::IntRect m_rect; diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h index 24ef015..28e8fed 100755 --- a/Source/WebKit2/UIProcess/WebPageProxy.h +++ b/Source/WebKit2/UIProcess/WebPageProxy.h @@ -519,8 +519,12 @@ public: #endif #if ENABLE(TIZEN_WEBKIT2_HIT_TEST) +#if ENABLE(TOUCH_ADJUSTMENT) + WebHitTestResult::Data hitTestResultAtPoint(const WebCore::IntPoint&, int hitTestMode = WebHitTestResult::HitTestModeDefault, const WebCore::IntSize& area = WebCore::IntSize()); +#else WebHitTestResult::Data hitTestResultAtPoint(const WebCore::IntPoint&, int hitTestMode = WebHitTestResult::HitTestModeDefault); #endif +#endif #if ENABLE(TIZEN_CONTEXT_MENU_WEBKIT_2) void hideContextMenu(); String contextMenuAbsoluteLinkURLString(); diff --git a/Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp b/Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp index d3d538a..720a9a8 100755 --- a/Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp +++ b/Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp @@ -410,14 +410,23 @@ void WebPageProxy::initializeTizenClient(const WKPageTizenClient* client) } #if ENABLE(TIZEN_WEBKIT2_HIT_TEST) +#if ENABLE(TOUCH_ADJUSTMENT) +WebHitTestResult::Data WebPageProxy::hitTestResultAtPoint(const IntPoint& point, int hitTestMode, const IntSize& area) +#else WebHitTestResult::Data WebPageProxy::hitTestResultAtPoint(const IntPoint& point, int hitTestMode) +#endif { WebHitTestResult::Data hitTestResultData; if (!isValid()) return hitTestResultData; +#if ENABLE(TOUCH_ADJUSTMENT) + process()->sendSync(Messages::WebPage::HitTestResultAtPoint(point, hitTestMode, area), + Messages::WebPage::HitTestResultAtPoint::Reply(hitTestResultData), m_pageID); +#else process()->sendSync(Messages::WebPage::HitTestResultAtPoint(point, hitTestMode), Messages::WebPage::HitTestResultAtPoint::Reply(hitTestResultData), m_pageID); +#endif return hitTestResultData; } diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h index 8c69ad3..6257029 100755 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.h +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h @@ -289,8 +289,12 @@ public: void createPagesToPDF(const WebCore::IntSize&, const WebCore::IntSize&, const String&); #endif #if ENABLE(TIZEN_WEBKIT2_HIT_TEST) +#if ENABLE(TOUCH_ADJUSTMENT) + void hitTestResultAtPoint(const WebCore::IntPoint&, int hitTestMode, const WebCore::IntSize&, WebHitTestResult::Data&); +#else void hitTestResultAtPoint(const WebCore::IntPoint&, int hitTestMode, WebHitTestResult::Data&); #endif +#endif #if ENABLE(TIZEN_WEB_STORAGE) void getStorageQuotaBytes(uint64_t callbackID); diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in index 86db050..4e204a2 100755 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in @@ -71,8 +71,13 @@ messages -> WebPage { RequestUpdateFormNavigation() MoveFocus(int newIndex) #if ENABLE(TIZEN_WEBKIT2_HIT_TEST) +#if ENABLE(TOUCH_ADJUSTMENT) + HitTestResultAtPoint(WebCore::IntPoint point, int hitTestMode, WebCore::IntSize area) -> (WebKit::WebHitTestResult::Data hitTestResultData) +#endif +#if !ENABLE(TOUCH_ADJUSTMENT) HitTestResultAtPoint(WebCore::IntPoint point, int hitTestMode) -> (WebKit::WebHitTestResult::Data hitTestResultData) #endif +#endif SuspendJavaScriptAndResources() ResumeJavaScriptAndResources() diff --git a/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp b/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp index ffeb668..412487f 100755 --- a/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp +++ b/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp @@ -899,9 +899,22 @@ static IntRect getNodeRect(Node* node, Node* focusableNode, bool isImage) #if ENABLE(TIZEN_WEBKIT2_HIT_TEST) #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING) +#if ENABLE(TOUCH_ADJUSTMENT) +static IntRect getFocusedRect(HitTestResult hitTestResult, Page* page, const IntSize& area) +#else static IntRect getFocusedRect(HitTestResult hitTestResult, Page* page) +#endif { Node* node = hitTestResult.innerNode(); +#if ENABLE(TOUCH_ADJUSTMENT) + Node* adjustedNode = 0; + IntPoint adustedPoint; + Frame* mainFrame = page->mainFrame(); + mainFrame->eventHandler()->bestClickableNodeForTouchPoint(hitTestResult.roundedPoint(), IntSize(area.width() / 2, area.height() / 2), adustedPoint, adjustedNode); + + if (adjustedNode) + node = adjustedNode; +#endif if (!node) return IntRect(); @@ -935,7 +948,11 @@ static IntRect getFocusedRect(HitTestResult hitTestResult, Page* page) } #endif +#if ENABLE(TOUCH_ADJUSTMENT) +void WebPage::hitTestResultAtPoint(const IntPoint& point, int hitTestMode, const IntSize& area, WebHitTestResult::Data& hitTestResultData) +#else void WebPage::hitTestResultAtPoint(const IntPoint& point, int hitTestMode, WebHitTestResult::Data& hitTestResultData) +#endif { Frame* frame = m_page->mainFrame(); FrameView* frameView = frame->view(); @@ -972,7 +989,11 @@ void WebPage::hitTestResultAtPoint(const IntPoint& point, int hitTestMode, WebHi hitTestResultData.hitTestMode = hitTestMode; #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING) +#if ENABLE(TOUCH_ADJUSTMENT) + hitTestResultData.focusedRect = getFocusedRect(hitTestResult, m_page.get(), area); +#else hitTestResultData.focusedRect = getFocusedRect(hitTestResult, m_page.get()); +#endif if (hitTestResult.innerNode() && hitTestResult.innerNode()->renderer() && hitTestResult.innerNode()->renderer()->style()) { hitTestResultData.focusedColor = hitTestResult.innerNode()->renderer()->style()->tapHighlightColor(); if (!hitTestResultData.focusedColor.hasAlpha()) -- 2.7.4