#endif
#if ENABLE(TIZEN_SCREEN_READER)
-Eina_Bool _ewk_view_screen_reader_command_execute(Ewk_View_Smart_Data* smartData, unsigned int command, int data1, int data2)
+Eina_Bool _ewk_view_screen_reader_action_execute(Ewk_View_Smart_Data* smartData, void* actionInfo)
{
EWK_VIEW_IMPL_GET_OR_RETURN(smartData, impl, false);
- return ScreenReaderProxy::screenReader().executeCommand(impl, command, data1, data2);
+ return ScreenReaderProxy::screenReader().executeAction(impl, static_cast<Elm_Access_Action_Info*>(actionInfo));
}
#endif
#endif // #if OS(TIZEN)
// elementary steal webview's focus during mouse up event
// So, added code that events are not propagated to smart parent according to guide from EFL
evas_object_propagate_events_set(ewkView, false);
-
-#if ENABLE(TIZEN_SCREEN_READER)
- ScreenReaderProxy::screenReader().addView(smartData->priv);
-#endif
#endif // #if OS(TIZEN)
#define CONNECT(s, c) evas_object_event_callback_add(ewkView, s, c, smartData)
EwkViewImpl::removeFromPageViewMap(ewkView);
EWK_VIEW_SD_GET(ewkView, smartData);
#if ENABLE(TIZEN_SCREEN_READER)
- ScreenReaderProxy::screenReader().removeView(smartData->priv);
+ ScreenReaderProxy::screenReader().disable(smartData->priv);
#endif
if (smartData && smartData->priv)
_ewk_view_impl_del(smartData->priv);
api->formdata_candidate_is_showing = _ewk_view_smart_formdata_candidate_is_showing;
#endif
#if ENABLE(TIZEN_SCREEN_READER)
- api->screen_reader_command_execute = _ewk_view_screen_reader_command_execute;
+ api->screen_reader_action_execute = _ewk_view_screen_reader_action_execute;
#endif
#endif //#if OS(TIZEN)
impl->pageClient->setDragMode(false);
#endif
+#if ENABLE(TIZEN_SCREEN_READER)
+ if (enable)
+ ScreenReaderProxy::screenReader().enable(impl);
+#endif
+
impl->pageClient->setIsVisible(enable);
return true;
}
using namespace WebKit;
using namespace WebCore;
-const int FocusRing::s_imageOuterWidth = 4;
-const int FocusRing::s_imageInnerWidth = 2;
-
FocusRing::FocusRing(EwkViewImpl* viewImpl)
: m_viewImpl(viewImpl)
, m_focusRingObject(0)
- , m_isImageDrawing(false)
+ , m_imageOuterWidth(0)
+ , m_imageInnerWidth(0)
, m_showTimer(0)
{
}
return ECORE_CALLBACK_CANCEL;
}
-void FocusRing::setImageDrawing(bool isImageDrawing)
+void FocusRing::setImage(const String& path, int outerWidth, int innerWidth)
{
- if (m_isImageDrawing == isImageDrawing)
+ if (m_imagePath == path && m_imageOuterWidth == outerWidth && m_imageInnerWidth == innerWidth)
return;
- m_isImageDrawing = isImageDrawing;
+ m_imagePath = path;
+ m_imageOuterWidth = outerWidth;
+ m_imageInnerWidth = innerWidth;
if (m_focusRingObject) {
evas_object_del(m_focusRingObject);
void FocusRing::requestToShow(const IntPoint& position)
{
- if (m_isImageDrawing)
+ if (!m_imagePath.isNull())
return;
m_position = position;
if (m_focusRingObject)
evas_object_hide(m_focusRingObject);
else {
- if (!m_isImageDrawing)
+ if (m_imagePath.isNull())
m_focusRingObject = evas_object_rectangle_add(evas_object_evas_get(m_viewImpl->view()));
else {
m_focusRingObject = evas_object_image_add(evas_object_evas_get(m_viewImpl->view()));
- evas_object_image_file_set(m_focusRingObject, SCREEN_READER_FOCUS_RING_IMAGE_PATH, 0);
- int border = s_imageOuterWidth + s_imageInnerWidth;
+ evas_object_image_file_set(m_focusRingObject, m_imagePath.utf8().data(), 0);
+ int border = m_imageOuterWidth + m_imageInnerWidth;
evas_object_image_border_set(m_focusRingObject, border, border, border, border);
}
evas_object_repeat_events_set(m_focusRingObject, true);
}
- if (!m_isImageDrawing) {
+ if (m_imagePath.isNull()) {
evas_object_color_set(m_focusRingObject, focusRingColor.red(), focusRingColor.green(), focusRingColor.blue(), focusRingColor.alpha());
evas_object_move(m_focusRingObject, focusRingRect.x(), focusRingRect.y());
evas_object_resize(m_focusRingObject, focusRingRect.width(), focusRingRect.height());
} else {
- viewRect.inflate(-s_imageOuterWidth);
+ viewRect.inflate(-m_imageOuterWidth);
if (focusRingRect.intersects(viewRect))
focusRingRect.intersect(viewRect);
}
}
- evas_object_move(m_focusRingObject, focusRingRect.x() - s_imageOuterWidth, focusRingRect.y() - s_imageOuterWidth);
+ evas_object_move(m_focusRingObject, focusRingRect.x() - m_imageOuterWidth, focusRingRect.y() - m_imageOuterWidth);
- int width = focusRingRect.width() + s_imageOuterWidth * 2;
- int height = focusRingRect.height() + s_imageOuterWidth * 2;
+ int width = focusRingRect.width() + m_imageOuterWidth * 2;
+ int height = focusRingRect.height() + m_imageOuterWidth * 2;
evas_object_image_fill_set(m_focusRingObject, 0, 0, width, height);
evas_object_resize(m_focusRingObject, width, height);
}
void FocusRing::hide(bool onlyColorDrawing)
{
- if (m_isImageDrawing && onlyColorDrawing)
+ if (!m_imagePath.isNull() && onlyColorDrawing)
return;
if (m_showTimer) {
}
ScreenReaderProxy::ScreenReaderProxy()
- : m_isEnabled(false)
- , m_ttsHandle(0)
+ : m_ttsHandle(0)
{
- ecore_x_event_mask_set(ecore_x_window_root_first_get(), ECORE_X_EVENT_MASK_WINDOW_CONFIGURE);
- ecore_x_event_mask_set(ecore_x_window_root_first_get(), ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
- m_eventHandler = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, eventHandler, 0);
}
ScreenReaderProxy::~ScreenReaderProxy()
{
- ecore_event_handler_del(m_eventHandler);
}
-void ScreenReaderProxy::setEnabled(bool enabled)
+void ScreenReaderProxy::addViewImpl(EwkViewImpl* viewImpl)
{
- if (m_isEnabled == enabled)
+ m_viewImplSet.append(viewImpl);
+ viewImpl->focusRing->setImage(SCREEN_READER_FOCUS_RING_IMAGE_PATH, 4, 2);
+}
+
+void ScreenReaderProxy::removeViewImpl(EwkViewImpl* viewImpl)
+{
+ size_t remove = m_viewImplSet.find(viewImpl);
+ if (remove == notFound)
return;
- m_isEnabled = enabled;
+ m_viewImplSet.remove(remove);
+ viewImpl->page()->clearScreenReader();
+ viewImpl->focusRing->setImage(String(), 0, 0);
- if (enabled) {
- if (tts_create(&m_ttsHandle)
- || tts_set_state_changed_cb(m_ttsHandle, didTTSStateChanged, 0)
- || tts_prepare(m_ttsHandle)) {
- tts_destroy(m_ttsHandle);
- m_ttsHandle = 0;
- }
- } else {
- tts_destroy(m_ttsHandle);
- m_ttsHandle = 0;
+ if (!m_viewImplSet.isEmpty() || !m_ttsHandle)
+ return;
- for (size_t i = 0; i < m_viewSet.size(); ++i) {
- m_viewSet[i]->page()->clearScreenReader();
- m_viewSet[i]->focusRing->setImageDrawing(false);
- }
- }
+ tts_destroy(m_ttsHandle);
+ m_ttsHandle = 0;
}
-void ScreenReaderProxy::addView(EwkViewImpl* viewImpl)
+void ScreenReaderProxy::enable(EwkViewImpl* viewImpl)
{
- m_viewSet.append(viewImpl);
+ Evas_Object* accesibleObject = elm_access_object_get(viewImpl->view());
+ if (!accesibleObject)
+ 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);
+
+ addViewImpl(viewImpl);
}
-void ScreenReaderProxy::removeView(EwkViewImpl* viewImpl)
+void ScreenReaderProxy::disable(EwkViewImpl* viewImpl)
{
- size_t remove = m_viewSet.find(viewImpl);
- ASSERT(remove != notFound);
- m_viewSet.remove(remove);
+ 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);
+ }
+
+ removeViewImpl(viewImpl);
}
void ScreenReaderProxy::setText(const String& text)
return;
}
+ if (!m_ttsHandle) {
+ if (tts_create(&m_ttsHandle)
+ || tts_set_state_changed_cb(m_ttsHandle, didTTSStateChanged, 0)
+ || tts_set_mode(m_ttsHandle, TTS_MODE_SCREEN_READER)
+ || tts_prepare(m_ttsHandle)) {
+ tts_destroy(m_ttsHandle);
+ m_ttsHandle = 0;
+ return;
+ }
+ }
+
tts_state_e state;
if (!tts_get_state(m_ttsHandle, &state)) {
if (state == TTS_STATE_READY)
}
}
-EwkViewImpl* ScreenReaderProxy::getView(const unsigned int window)
+bool ScreenReaderProxy::executeAction(EwkViewImpl* viewImpl, Elm_Access_Action_Info* actionInfo)
{
- for (size_t i = 0; i < m_viewSet.size(); ++i) {
- Ecore_Evas* ee = ecore_evas_ecore_evas_get(evas_object_evas_get(m_viewSet[i]->view()));
- Ecore_X_Window viewWindow = ecore_evas_software_x11_window_get(ee);
- if (!viewWindow)
- viewWindow = ecore_evas_gl_x11_window_get(ee);
- if (window == viewWindow)
- return m_viewSet[i];
- }
-
- return 0;
-}
+ if (!m_viewImplSet.contains(viewImpl))
+ addViewImpl(viewImpl);
-bool ScreenReaderProxy::executeCommand(EwkViewImpl* viewImpl, unsigned command, int data1, int data2)
-{
- setEnabled(true);
-
- if (command == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_NEXT || command == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_NEXT) {
+ if (actionInfo->action_type == ELM_ACCESS_ACTION_HIGHLIGHT_NEXT) {
if (!viewImpl->page()->moveScreenReaderFocus(true))
return false;
- } else if (command == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_PREV || command == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_PREV) {
+ } else if (actionInfo->action_type == ELM_ACCESS_ACTION_HIGHLIGHT_PREV) {
if (!viewImpl->page()->moveScreenReaderFocus(false))
return false;
- } else if (command == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ) {
- IntPoint localPoint = viewImpl->transformFromScene().mapPoint(IntPoint(data1, data2));
+ } 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 (command == ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_ACTIVATE) {
+ } else if (actionInfo->action_type == ELM_ACCESS_ACTION_ACTIVATE) {
IntPoint point(viewImpl->focusRing->centerPointInScreen());
if (point.x() < 0 || point.y() < 0)
return false;
viewImpl->page()->raiseTapEvent(point);
}
- viewImpl->focusRing->setImageDrawing(true);
return true;
}
-Eina_Bool ScreenReaderProxy::eventHandler(void* data, int type, void* event)
+Eina_Bool ScreenReaderProxy::highlightHandler(void* data, Evas_Object*, Elm_Access_Action_Info* actionInfo)
+{
+ if (!actionInfo)
+ return false;
+
+ if (actionInfo->action_type == ELM_ACCESS_ACTION_HIGHLIGHT_NEXT)
+ return highlightNextHandler(data, 0, 0);
+ if (actionInfo->action_type == ELM_ACCESS_ACTION_HIGHLIGHT_PREV)
+ return highlightPrevHandler(data, 0, 0);
+
+ return true;
+}
+
+Eina_Bool ScreenReaderProxy::unhighlightHandler(void* data, Evas_Object*, Elm_Access_Action_Info*)
{
- static Ecore_X_Atom screenReaderAtom = ecore_x_atom_get("_E_MOD_ACC_SCR_READER_");
+ EwkViewImpl* viewImpl = static_cast<EwkViewImpl*>(data);
- Ecore_X_Event_Client_Message* e = static_cast<Ecore_X_Event_Client_Message*>(event);
- if (e->message_type == screenReaderAtom) {
- screenReader().setEnabled(static_cast<Eina_Bool>(e->data.l[0]));
- return ECORE_CALLBACK_PASS_ON;
- } else if (e->message_type != ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL)
- return ECORE_CALLBACK_PASS_ON;
+ viewImpl->focusRing->hide(false);
+ tts_stop(screenReader().m_ttsHandle);
- EwkViewImpl* viewImpl = screenReader().getView(static_cast<unsigned int>(e->data.l[0]));
- if (!viewImpl)
- return ECORE_CALLBACK_PASS_ON;
+ return true;
+}
- bool result = screenReader().executeCommand(viewImpl, static_cast<Ecore_X_Atom>(e->data.l[1]), e->data.l[2], e->data.l[3]);
- return result ? ECORE_CALLBACK_DONE : ECORE_CALLBACK_PASS_ON;
+Eina_Bool ScreenReaderProxy::highlightNextHandler(void* data, Evas_Object*, Elm_Access_Action_Info*)
+{
+ EwkViewImpl* viewImpl = static_cast<EwkViewImpl*>(data);
+ return viewImpl->page()->moveScreenReaderFocus(true);
+}
+
+Eina_Bool ScreenReaderProxy::highlightPrevHandler(void* data, Evas_Object*, Elm_Access_Action_Info*)
+{
+ EwkViewImpl* viewImpl = static_cast<EwkViewImpl*>(data);
+ return viewImpl->page()->moveScreenReaderFocus(false);
+}
+
+Eina_Bool ScreenReaderProxy::activateHandler(void* data, Evas_Object*, Elm_Access_Action_Info*)
+{
+ EwkViewImpl* viewImpl = static_cast<EwkViewImpl*>(data);
+ IntPoint point(viewImpl->focusRing->centerPointInScreen());
+ if (point.x() < 0 || point.y() < 0)
+ return false;
+
+ viewImpl->page()->raiseTapEvent(viewImpl->transformFromScene().mapPoint(point));
+
+ return true;
+}
+
+Eina_Bool ScreenReaderProxy::readHandler(void* data, Evas_Object*, Elm_Access_Action_Info* actionInfo)
+{
+ if (!actionInfo)
+ return false;
+
+ EwkViewImpl* viewImpl = static_cast<EwkViewImpl*>(data);
+ IntPoint localPoint = viewImpl->transformFromScene().mapPoint(IntPoint(actionInfo->x, actionInfo->y));
+
+ viewImpl->page()->moveScreenReaderFocusByPoint(localPoint);
+
+ return true;
}
void ScreenReaderProxy::didTTSStateChanged(tts_h, tts_state_e, tts_state_e currentState, void*)