From: SangYong Park Date: Thu, 16 May 2013 08:25:05 +0000 (+0900) Subject: Add new access object callback X-Git-Tag: submit/tizen_2.2/20130714.131554~66 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8186b135f9bdbe0460f1ea72db4e9aa3eda04bc3;p=framework%2Fweb%2Fwebkit-efl.git Add new access object callback [Title] Add new access object callback [Issue#] N/A [Problem] Access object does not work enough. [Cause] Access object's callback is added. [Solution] Add new access object callback. Change-Id: Iccfd63a2b1f1b1a0187bcdf405d83f8182b639f9 --- diff --git a/Source/WebKit2/UIProcess/API/efl/tizen/ScreenReaderProxy.cpp b/Source/WebKit2/UIProcess/API/efl/tizen/ScreenReaderProxy.cpp index e4411d0..d14f37c 100755 --- a/Source/WebKit2/UIProcess/API/efl/tizen/ScreenReaderProxy.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tizen/ScreenReaderProxy.cpp @@ -80,30 +80,40 @@ void ScreenReaderProxy::removeViewImpl(EwkViewImpl* viewImpl) void ScreenReaderProxy::enable(EwkViewImpl* viewImpl) { - Evas_Object* accesibleObject = elm_access_object_get(viewImpl->view()); - if (!accesibleObject) + Evas_Object* accessObject = elm_access_object_get(viewImpl->view()); + if (!accessObject) return; - elm_access_action_cb_set(accesibleObject, ELM_ACCESS_ACTION_HIGHLIGHT, highlightHandler, viewImpl); - elm_access_action_cb_set(accesibleObject, ELM_ACCESS_ACTION_UNHIGHLIGHT, unhighlightHandler, viewImpl); - elm_access_action_cb_set(accesibleObject, ELM_ACCESS_ACTION_HIGHLIGHT_NEXT, highlightNextHandler, viewImpl); - elm_access_action_cb_set(accesibleObject, ELM_ACCESS_ACTION_HIGHLIGHT_PREV, highlightPrevHandler, viewImpl); - elm_access_action_cb_set(accesibleObject, ELM_ACCESS_ACTION_ACTIVATE, activateHandler, viewImpl); - elm_access_action_cb_set(accesibleObject, ELM_ACCESS_ACTION_READ, readHandler, viewImpl); + elm_access_action_cb_set(accessObject, ELM_ACCESS_ACTION_HIGHLIGHT, highlightHandler, viewImpl); + elm_access_action_cb_set(accessObject, ELM_ACCESS_ACTION_UNHIGHLIGHT, unhighlightHandler, viewImpl); + elm_access_action_cb_set(accessObject, ELM_ACCESS_ACTION_HIGHLIGHT_NEXT, highlightNextHandler, viewImpl); + elm_access_action_cb_set(accessObject, ELM_ACCESS_ACTION_HIGHLIGHT_PREV, highlightPrevHandler, viewImpl); + elm_access_action_cb_set(accessObject, ELM_ACCESS_ACTION_ACTIVATE, activateHandler, viewImpl); + elm_access_action_cb_set(accessObject, ELM_ACCESS_ACTION_SCROLL, scrollHandler, viewImpl); + elm_access_action_cb_set(accessObject, ELM_ACCESS_ACTION_MOUSE, mouseHandler, viewImpl); + elm_access_action_cb_set(accessObject, ELM_ACCESS_ACTION_UP, upHandler, viewImpl); + elm_access_action_cb_set(accessObject, ELM_ACCESS_ACTION_DOWN, downHandler, viewImpl); + elm_access_action_cb_set(accessObject, ELM_ACCESS_ACTION_BACK, backHandler, viewImpl); + elm_access_action_cb_set(accessObject, ELM_ACCESS_ACTION_READ, readHandler, viewImpl); addViewImpl(viewImpl); } void ScreenReaderProxy::disable(EwkViewImpl* viewImpl) { - Evas_Object* accesibleObject = elm_access_object_get(viewImpl->view()); - if (accesibleObject) { - elm_access_action_cb_set(accesibleObject, ELM_ACCESS_ACTION_HIGHLIGHT, 0, 0); - elm_access_action_cb_set(accesibleObject, ELM_ACCESS_ACTION_UNHIGHLIGHT, 0, 0); - elm_access_action_cb_set(accesibleObject, ELM_ACCESS_ACTION_HIGHLIGHT_NEXT, 0, 0); - elm_access_action_cb_set(accesibleObject, ELM_ACCESS_ACTION_HIGHLIGHT_PREV, 0, 0); - elm_access_action_cb_set(accesibleObject, ELM_ACCESS_ACTION_ACTIVATE, 0, 0); - elm_access_action_cb_set(accesibleObject, ELM_ACCESS_ACTION_READ, 0, 0); + Evas_Object* accessObject = elm_access_object_get(viewImpl->view()); + if (accessObject) { + elm_access_action_cb_set(accessObject, ELM_ACCESS_ACTION_HIGHLIGHT, 0, 0); + elm_access_action_cb_set(accessObject, ELM_ACCESS_ACTION_UNHIGHLIGHT, 0, 0); + elm_access_action_cb_set(accessObject, ELM_ACCESS_ACTION_HIGHLIGHT_NEXT, 0, 0); + elm_access_action_cb_set(accessObject, ELM_ACCESS_ACTION_HIGHLIGHT_PREV, 0, 0); + elm_access_action_cb_set(accessObject, ELM_ACCESS_ACTION_ACTIVATE, 0, 0); + elm_access_action_cb_set(accessObject, ELM_ACCESS_ACTION_SCROLL, 0, 0); + elm_access_action_cb_set(accessObject, ELM_ACCESS_ACTION_MOUSE, 0, 0); + elm_access_action_cb_set(accessObject, ELM_ACCESS_ACTION_UP, 0, 0); + elm_access_action_cb_set(accessObject, ELM_ACCESS_ACTION_DOWN, 0, 0); + elm_access_action_cb_set(accessObject, ELM_ACCESS_ACTION_BACK, 0, 0); + elm_access_action_cb_set(accessObject, ELM_ACCESS_ACTION_READ, 0, 0); } removeViewImpl(viewImpl); @@ -142,23 +152,26 @@ bool ScreenReaderProxy::executeAction(EwkViewImpl* viewImpl, Elm_Access_Action_I { addViewImpl(viewImpl); - if (actionInfo->action_type == ELM_ACCESS_ACTION_HIGHLIGHT_NEXT) { - if (!viewImpl->page()->moveScreenReaderFocus(true)) - return false; - } else if (actionInfo->action_type == ELM_ACCESS_ACTION_HIGHLIGHT_PREV) { - if (!viewImpl->page()->moveScreenReaderFocus(false)) - return false; - } else if (actionInfo->action_type == ELM_ACCESS_ACTION_READ) { - IntPoint localPoint = viewImpl->transformFromScene().mapPoint(IntPoint(actionInfo->x, actionInfo->y)); - viewImpl->page()->moveScreenReaderFocusByPoint(localPoint); - } else if (actionInfo->action_type == ELM_ACCESS_ACTION_ACTIVATE) { - IntPoint point(viewImpl->focusRing->centerPointInScreen()); - if (point.x() < 0 || point.y() < 0) - return false; - - point = viewImpl->transformFromScene().mapPoint(point); - viewImpl->page()->raiseTapEvent(point); - } + if (actionInfo->action_type == ELM_ACCESS_ACTION_UNHIGHLIGHT) + unhighlightHandler(viewImpl, 0, 0); + else if (actionInfo->action_type == ELM_ACCESS_ACTION_HIGHLIGHT_NEXT) + return highlightNextHandler(viewImpl, 0, 0); + else if (actionInfo->action_type == ELM_ACCESS_ACTION_HIGHLIGHT_PREV) + return highlightPrevHandler(viewImpl, 0, 0); + else if (actionInfo->action_type == ELM_ACCESS_ACTION_ACTIVATE) + activateHandler(viewImpl, 0, 0); + else if (actionInfo->action_type == ELM_ACCESS_ACTION_SCROLL) + scrollHandler(viewImpl, 0, actionInfo); + else if (actionInfo->action_type == ELM_ACCESS_ACTION_MOUSE) + mouseHandler(viewImpl, 0, actionInfo); + else if (actionInfo->action_type == ELM_ACCESS_ACTION_UP) + upHandler(viewImpl, 0, 0); + else if (actionInfo->action_type == ELM_ACCESS_ACTION_DOWN) + downHandler(viewImpl, 0, 0); + else if (actionInfo->action_type == ELM_ACCESS_ACTION_BACK) + backHandler(viewImpl, 0, 0); + else if (actionInfo->action_type == ELM_ACCESS_ACTION_READ) + readHandler(viewImpl, 0, actionInfo); return true; } @@ -168,9 +181,9 @@ Eina_Bool ScreenReaderProxy::highlightHandler(void* data, Evas_Object*, Elm_Acce if (!actionInfo) return false; - if (actionInfo->action_type == ELM_ACCESS_ACTION_HIGHLIGHT_NEXT) + if (actionInfo->action_by == ELM_ACCESS_ACTION_HIGHLIGHT_NEXT) return highlightNextHandler(data, 0, 0); - if (actionInfo->action_type == ELM_ACCESS_ACTION_HIGHLIGHT_PREV) + if (actionInfo->action_by == ELM_ACCESS_ACTION_HIGHLIGHT_PREV) return highlightPrevHandler(data, 0, 0); return true; @@ -180,6 +193,7 @@ Eina_Bool ScreenReaderProxy::unhighlightHandler(void* data, Evas_Object*, Elm_Ac { EwkViewImpl* viewImpl = static_cast(data); + viewImpl->page()->clearScreenReader(); viewImpl->focusRing->hide(false); tts_stop(screenReader().m_ttsHandle); @@ -205,8 +219,60 @@ Eina_Bool ScreenReaderProxy::activateHandler(void* data, Evas_Object*, Elm_Acces if (point.x() < 0 || point.y() < 0) return false; - viewImpl->page()->raiseTapEvent(viewImpl->transformFromScene().mapPoint(point)); + if (viewImpl->page()->raiseTapEvent(viewImpl->transformFromScene().mapPoint(point)) && viewImpl->page()->isViewVisible()) + evas_object_focus_set(viewImpl->view(), true); + + return true; +} + +Eina_Bool ScreenReaderProxy::scrollHandler(void* data, Evas_Object*, Elm_Access_Action_Info* actionInfo) +{ + if (!actionInfo) + return false; + + EwkViewImpl* viewImpl = static_cast(data); + + if (actionInfo->mouse_type == 0) { + viewImpl->gestureClient->reset(); + viewImpl->gestureClient->setGestureEnabled(true); + viewImpl->gestureClient->setMovingEnabled(true); + viewImpl->gestureClient->startPan(IntPoint(actionInfo->x, actionInfo->y)); + } else if (actionInfo->mouse_type == 1) + viewImpl->gestureClient->movePan(IntPoint(actionInfo->x, actionInfo->y)); + else if (actionInfo->mouse_type == 2) + viewImpl->gestureClient->endPan(IntPoint(actionInfo->x, actionInfo->y)); + + return true; +} + +Eina_Bool ScreenReaderProxy::mouseHandler(void* data, Evas_Object*, Elm_Access_Action_Info* actionInfo) +{ + return scrollHandler(data, 0, actionInfo); +} + +Eina_Bool ScreenReaderProxy::upHandler(void* data, Evas_Object*, Elm_Access_Action_Info*) +{ + EwkViewImpl* viewImpl = static_cast(data); + viewImpl->page()->adjustScreenReaderFocusedObjectValue(true); + + return true; +} + +Eina_Bool ScreenReaderProxy::downHandler(void* data, Evas_Object*, Elm_Access_Action_Info*) +{ + EwkViewImpl* viewImpl = static_cast(data); + viewImpl->page()->adjustScreenReaderFocusedObjectValue(false); + + return true; +} + +Eina_Bool ScreenReaderProxy::backHandler(void* data, Evas_Object*, Elm_Access_Action_Info*) +{ + EwkViewImpl* viewImpl = static_cast(data); + if (!viewImpl->pageProxy->canGoBack()) + return false; + viewImpl->pageProxy->goBack(); return true; } diff --git a/Source/WebKit2/UIProcess/API/efl/tizen/ScreenReaderProxy.h b/Source/WebKit2/UIProcess/API/efl/tizen/ScreenReaderProxy.h index a8d646b..b07f001 100755 --- a/Source/WebKit2/UIProcess/API/efl/tizen/ScreenReaderProxy.h +++ b/Source/WebKit2/UIProcess/API/efl/tizen/ScreenReaderProxy.h @@ -63,6 +63,11 @@ private: static Eina_Bool highlightNextHandler(void*, Evas_Object*, Elm_Access_Action_Info*); static Eina_Bool highlightPrevHandler(void*, Evas_Object*, Elm_Access_Action_Info*); static Eina_Bool activateHandler(void*, Evas_Object*, Elm_Access_Action_Info*); + static Eina_Bool scrollHandler(void*, Evas_Object*, Elm_Access_Action_Info*); + static Eina_Bool mouseHandler(void*, Evas_Object*, Elm_Access_Action_Info*); + static Eina_Bool upHandler(void*, Evas_Object*, Elm_Access_Action_Info*); + static Eina_Bool downHandler(void*, Evas_Object*, Elm_Access_Action_Info*); + static Eina_Bool backHandler(void*, Evas_Object*, Elm_Access_Action_Info*); static Eina_Bool readHandler(void*, Evas_Object*, Elm_Access_Action_Info*); static void didTTSStateChanged(tts_h, tts_state_e, tts_state_e, void*); diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h index 451c527..0dd740b 100755 --- a/Source/WebKit2/UIProcess/WebPageProxy.h +++ b/Source/WebKit2/UIProcess/WebPageProxy.h @@ -1018,9 +1018,11 @@ public: #endif #if ENABLE(TIZEN_SCREEN_READER) - void raiseTapEvent(const WebCore::IntPoint&); bool moveScreenReaderFocus(bool); void moveScreenReaderFocusByPoint(const WebCore::IntPoint&); + void clearScreenReaderFocus(); + bool raiseTapEvent(const WebCore::IntPoint&); + void adjustScreenReaderFocusedObjectValue(bool); void recalcScreenReaderFocusRect(); void clearScreenReader(); diff --git a/Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp b/Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp index 06e1b17..f4b5481 100755 --- a/Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp +++ b/Source/WebKit2/UIProcess/efl/WebPageProxyEfl.cpp @@ -984,16 +984,6 @@ void WebPageProxy::openLink(const IntPoint& position) #endif #if ENABLE(TIZEN_SCREEN_READER) -void WebPageProxy::raiseTapEvent(const IntPoint& position) -{ -#if ENABLE(GESTURE_EVENTS) - IntPoint globalPosition = EwkViewImpl::fromEvasObject(viewWidget())->transformToScreen().mapPoint(position); - process()->send(Messages::WebPage::RaiseTapEvent(position, globalPosition), m_pageID); -#else - UNUSED_PARAM(position); -#endif -} - bool WebPageProxy::moveScreenReaderFocus(bool forward) { bool result; @@ -1006,6 +996,25 @@ void WebPageProxy::moveScreenReaderFocusByPoint(const IntPoint& point) process()->send(Messages::WebPage::MoveScreenReaderFocusByPoint(point), m_pageID); } +void WebPageProxy::clearScreenReaderFocus() +{ + process()->send(Messages::WebPage::ClearScreenReaderFocus(), m_pageID); +} + +bool WebPageProxy::raiseTapEvent(const IntPoint& position) +{ + IntPoint globalPosition = EwkViewImpl::fromEvasObject(viewWidget())->transformToScreen().mapPoint(position); + bool result; + process()->sendSync(Messages::WebPage::RaiseTapEvent(position, globalPosition), Messages::WebPage::RaiseTapEvent::Reply(result), m_pageID); + + return result; +} + +void WebPageProxy::adjustScreenReaderFocusedObjectValue(bool up) +{ + process()->send(Messages::WebPage::AdjustScreenReaderFocusedObjectValue(up), m_pageID); +} + void WebPageProxy::recalcScreenReaderFocusRect() { if (!ScreenReaderProxy::screenReader().isEnabled()) diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h index 957a49a..fed3ddc 100755 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.h +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h @@ -792,9 +792,11 @@ public: #endif #if ENABLE(TIZEN_SCREEN_READER) - void raiseTapEvent(const WebCore::IntPoint&, const WebCore::IntPoint&); void moveScreenReaderFocus(bool, bool&); void moveScreenReaderFocusByPoint(const WebCore::IntPoint&); + void clearScreenReaderFocus(); + void raiseTapEvent(const WebCore::IntPoint&, const WebCore::IntPoint&, bool&); + void adjustScreenReaderFocusedObjectValue(bool); void recalcScreenReaderFocusRect(); void updateScreenReaderFocus(WebCore::RenderObject*); void clearScreenReader(); diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in index fe713b8..265ee2f 100755 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in @@ -438,9 +438,11 @@ messages -> WebPage { #endif #if ENABLE(TIZEN_SCREEN_READER) - RaiseTapEvent(WebCore::IntPoint position, WebCore::IntPoint globalPosition) MoveScreenReaderFocus(bool forward) -> (bool result) MoveScreenReaderFocusByPoint(WebCore::IntPoint point) + ClearScreenReaderFocus() + RaiseTapEvent(WebCore::IntPoint position, WebCore::IntPoint globalPosition) -> (bool result) + AdjustScreenReaderFocusedObjectValue(bool up) RecalcScreenReaderFocusRect() ClearScreenReader() #endif diff --git a/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp b/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp index 2d480de..cb2799c 100755 --- a/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp +++ b/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp @@ -1617,26 +1617,6 @@ void WebPage::getLinkMagnifierRect(const IntPoint& position, const IntSize& size #endif #if ENABLE(TIZEN_SCREEN_READER) -void WebPage::raiseTapEvent(const IntPoint& position, const IntPoint& globalPosition) -{ - Frame* frame = m_page->mainFrame(); - if (!frame->view()) - return; - - Vector touchPoints; - touchPoints.append(WebPlatformTouchPoint(0, WebPlatformTouchPoint::TouchPressed, globalPosition, position)); - - WebTouchEvent touchStartEvent(WebEvent::TouchStart, touchPoints, WebEvent::Modifiers(0), ecore_time_get()); - if (!frame->eventHandler()->handleTouchEvent(platform(touchStartEvent))) { - WebGestureEvent gestureEvent(WebEvent::GestureSingleTap, position, globalPosition, WebEvent::Modifiers(0), ecore_time_get()); - frame->eventHandler()->handleGestureEvent(platform(gestureEvent)); - } - - touchPoints.at(0).setState(WebPlatformTouchPoint::TouchReleased); - WebTouchEvent touchEndEvent(WebEvent::TouchEnd, touchPoints, WebEvent::Modifiers(0), ecore_time_get()); - frame->eventHandler()->handleTouchEvent(platform(touchEndEvent)); -} - static void sendScreenReaderFocusRect(WebPage* page, Node* node) { bool isImage = false; @@ -1674,6 +1654,54 @@ void WebPage::moveScreenReaderFocusByPoint(const IntPoint& point) sendScreenReaderFocusRect(this, m_screenReader->getFocusedNode()); } +void WebPage::clearScreenReaderFocus() +{ + if (!m_screenReader) + return; + + m_screenReader->clearFocus(); +} + +void WebPage::raiseTapEvent(const IntPoint& position, const IntPoint& globalPosition, bool& result) +{ + result = false; + +#if ENABLE(GESTURE_EVENTS) + Frame* frame = m_page->mainFrame(); + if (!frame->view()) + return; + + Vector touchPoints; + touchPoints.append(WebPlatformTouchPoint(0, WebPlatformTouchPoint::TouchPressed, globalPosition, position)); + + WebTouchEvent touchStartEvent(WebEvent::TouchStart, touchPoints, WebEvent::Modifiers(0), ecore_time_get()); + bool handled = frame->eventHandler()->handleTouchEvent(platform(touchStartEvent)); + + touchPoints.at(0).setState(WebPlatformTouchPoint::TouchReleased); + + WebTouchEvent touchEndEvent(WebEvent::TouchEnd, touchPoints, WebEvent::Modifiers(0), ecore_time_get()); + handled |= frame->eventHandler()->handleTouchEvent(platform(touchEndEvent)); + + if (!handled) { + WebGestureEvent gestureEvent(WebEvent::GestureSingleTap, position, globalPosition, WebEvent::Modifiers(0), ecore_time_get()); + frame->eventHandler()->handleGestureEvent(platform(gestureEvent)); + result = true; + } +#endif +} + +void WebPage::adjustScreenReaderFocusedObjectValue(bool up) +{ + if (!m_screenReader || !m_screenReader->getFocusedNode() || !m_screenReader->getFocusedNode()->toInputElement()) + return; + + ExceptionCode ec; + if (up) + m_screenReader->getFocusedNode()->toInputElement()->stepUp(ec); + else + m_screenReader->getFocusedNode()->toInputElement()->stepDown(ec); +} + void WebPage::recalcScreenReaderFocusRect() { if (!m_screenReader || !m_screenReader->getFocusedNode())