From: Kunal Sinha Date: Wed, 3 Jul 2013 11:16:46 +0000 (+0530) Subject: [Token Accessibility] Bug fixing and implementing pending items X-Git-Tag: accepted/tizen/20130924.144426~1^2~184^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4d81573e1aff33a2c70afd96dbb3ae3e87fd770a;p=platform%2Fframework%2Fnative%2Fuifw.git [Token Accessibility] Bug fixing and implementing pending items Change-Id: Ie9238a0f0c8ca2879e3a435a0cfe5f2eb9dc2218 Signed-off-by: Kunal Sinha --- diff --git a/src/ui/controls/FUiCtrl_TokenEdit.cpp b/src/ui/controls/FUiCtrl_TokenEdit.cpp index 72bcfca..b907202 100644 --- a/src/ui/controls/FUiCtrl_TokenEdit.cpp +++ b/src/ui/controls/FUiCtrl_TokenEdit.cpp @@ -565,30 +565,6 @@ _TokenEdit::OnBoundsChanged(void) } bool -_TokenEdit::OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element) -{ - return false; -} - -bool -_TokenEdit::OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element) -{ - return false; -} - -bool -_TokenEdit::OnAccessibilityReadingElement(const _AccessibilityContainer& control, const _AccessibilityElement& element) -{ - return false; -} - -bool -_TokenEdit::OnAccessibilityReadElement(const _AccessibilityContainer& control, const _AccessibilityElement& element) -{ - return false; -} - -bool _TokenEdit::OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element) { return __pTokenEditPresenter->OnAccessibilityFocusIn(control, element); @@ -603,19 +579,7 @@ _TokenEdit::OnAccessibilityFocusOut(const _AccessibilityContainer& control, cons bool _TokenEdit::OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element) { - return false; -} - -bool -_TokenEdit::OnAccessibilityValueIncreased(const _AccessibilityContainer& control, const _AccessibilityElement& element) -{ - return false; -} - -bool -_TokenEdit::OnAccessibilityValueDecreased(const _AccessibilityContainer& control, const _AccessibilityElement& element) -{ - return false; + return __pTokenEditPresenter->OnAccessibilityActionPerformed(control, element); } void diff --git a/src/ui/controls/FUiCtrl_TokenEditPresenter.cpp b/src/ui/controls/FUiCtrl_TokenEditPresenter.cpp index c0248e5..3777a24 100644 --- a/src/ui/controls/FUiCtrl_TokenEditPresenter.cpp +++ b/src/ui/controls/FUiCtrl_TokenEditPresenter.cpp @@ -318,6 +318,7 @@ _TokenEditPresenter::_TokenEditPresenter(void) , __accessibilityElements() , __focusedTokenIndex(-1) , __drawFocusState(false) + , __accessibilityFocusIn(false) { } @@ -1136,6 +1137,7 @@ _TokenEditPresenter::InsertTokenAt(int index, const String& token, bool isUser) } InsertTokenAccessibilityElementAt(index); + UpdateTokenAccessibilityBounds(); if (isUser) { @@ -1619,7 +1621,6 @@ _TokenEditPresenter::SetInitialBounds(void) { __pTokenEdit->SetCursorAccessibilityBounds(tokenTextRect); } - } else { @@ -3062,6 +3063,14 @@ _TokenEditPresenter::OnTextCommitted(const String& commitText) SetCursorDisabled(false); StartCursorTimer(); } + // when pressed enter while editing a token, set cursor as global focused element. + _AccessibilityElement* pCursorAccessibilityElement = __pTokenEdit->GetCursorAccessibilityElement(); + if (pCursorAccessibilityElement && __accessibilityFocusIn) + { + _AccessibilityManager* pAccessibilityManager = _AccessibilityManager::GetInstance(); + pAccessibilityManager->SetGlobalFocusedElement(*pCursorAccessibilityElement); + pAccessibilityManager->RequestToDrawFocusUi(); + } return; } @@ -3790,6 +3799,8 @@ _TokenEditPresenter::OnBoundsChanged(void) } ChangeInternalLayout(orientation); + __pTokenEdit->UpdateAccessibilityElement(EDIT_ACCESSIBILITY_ELEMENT_TYPE_TEXT); + return; } @@ -4200,7 +4211,7 @@ _TokenEditPresenter::InsertTokenAccessibilityElementAt(int index) String labelText = pToken->GetText(); pAccessibilityElement->SetBounds(pToken->displayRect); pAccessibilityElement->SetLabel(labelText); - pContainer->AddElement(*pAccessibilityElement); + pContainer->InsertElement(*pAccessibilityElement, index); __accessibilityElements.InsertAt(pAccessibilityElement, index); } @@ -4241,7 +4252,10 @@ _TokenEditPresenter::UpdateTokenAccessibilityBounds(void) if ((__accessibilityElements.GetAt(index, pAccessibilityElement)) == E_SUCCESS) { - pAccessibilityElement->SetBounds(pToken->displayRect); + if (pAccessibilityElement) + { + pAccessibilityElement->SetBounds(pToken->displayRect); + } } } return r; @@ -4330,19 +4344,53 @@ _TokenEditPresenter::ScrollToFocusedTokenAccessibilityElement(const _Accessibili return r; } +result +_TokenEditPresenter::ScrollToTitleAccessibilityElement(void) +{ + _AccessibilityElement* pTitleAccessibilityElement = __pTokenEdit->GetTitleTextAccessibilityElement(); + if (pTitleAccessibilityElement) + { + FloatRectangle titleTextBounds = pTitleAccessibilityElement->GetBounds(); + if (titleTextBounds.y < 0) + { + float tokenTopMargin = 0.0f; + _ControlOrientation orientation = __pTokenEdit->GetOrientation(); + GET_SHAPE_CONFIG(TOKENEDIT::TOP_MARGIN, orientation, tokenTopMargin); + float newScrollValue = titleTextBounds.y - tokenTopMargin - __scrollValue; + result r = RecalculateTokenBounds(newScrollValue); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); + } + } + + return E_SUCCESS; +} + bool _TokenEditPresenter::OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element) { result r = E_SUCCESS; + _AccessibilityElement* pTitleAccessibilityElement = __pTokenEdit->GetTitleTextAccessibilityElement(); + + __accessibilityFocusIn = true; + if (__focusOutIndex < 0) // Not a token accessibility element { - return false; + if (pTitleAccessibilityElement != &element) + { + return false; + } } _Token* pToken = null; _AccessibilityElement* pCurrentElement = const_cast< _AccessibilityElement* >(&element); _AccessibilityElement* pPreviousAccessibilityElement = null; _AccessibilityElement* pNextAccessibilityElement = null; + if (pTitleAccessibilityElement == &element) + { + ScrollToTitleAccessibilityElement(); + UpdateTokenAccessibilityBounds(); + return false; + } r = __accessibilityElements.GetAt(__focusOutIndex, pPreviousAccessibilityElement); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, true, r, "[%s] Propagating.", GetErrorMessage(r)); @@ -4409,6 +4457,30 @@ _TokenEditPresenter::OnAccessibilityFocusOut(const _AccessibilityContainer& cont _AccessibilityElement* pAccessibilityElement = null; pAccessibilityElement = const_cast< _AccessibilityElement* >(&element); __accessibilityElements.IndexOf(pAccessibilityElement, __focusOutIndex); + __accessibilityFocusIn = false; + + return false; +} + +bool +_TokenEditPresenter::OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element) +{ + _AccessibilityElement* pTextAccessibilityElement = __pTokenEdit->GetTextAccessibilityElement(); + if (pTextAccessibilityElement != null) + { + if (pTextAccessibilityElement == &element) + { + if (__pTokenEdit->IsInternalFocused()) // Set cursor as global focus accessibility element only in focused mode. + { + _AccessibilityElement* pCursorAccessibilityElement = __pTokenEdit->GetCursorAccessibilityElement(); + if (pCursorAccessibilityElement) + { + _AccessibilityManager::GetInstance()->SetGlobalFocusedElement(*pCursorAccessibilityElement); + _AccessibilityManager::GetInstance()->RequestToDrawFocusUi(); + } + } + } + } return false; } diff --git a/src/ui/inc/FUiCtrl_TokenEdit.h b/src/ui/inc/FUiCtrl_TokenEdit.h index 313077e..d594f3c 100644 --- a/src/ui/inc/FUiCtrl_TokenEdit.h +++ b/src/ui/inc/FUiCtrl_TokenEdit.h @@ -141,15 +141,15 @@ public: void RemoveCursorAccessibilityElement(void); //_IAccessibilityListener callbacks - virtual bool OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element); - virtual bool OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element); - virtual bool OnAccessibilityReadingElement(const _AccessibilityContainer& control, const _AccessibilityElement& element); - virtual bool OnAccessibilityReadElement(const _AccessibilityContainer& control, const _AccessibilityElement& element); + virtual bool OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element){return false;} + virtual bool OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element){return false;} + virtual bool OnAccessibilityReadingElement(const _AccessibilityContainer& control, const _AccessibilityElement& element){return false;} + virtual bool OnAccessibilityReadElement(const _AccessibilityContainer& control, const _AccessibilityElement& element){return false;} virtual bool OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element); virtual bool OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element); virtual bool OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element); - virtual bool OnAccessibilityValueIncreased(const _AccessibilityContainer& control, const _AccessibilityElement& element); - virtual bool OnAccessibilityValueDecreased(const _AccessibilityContainer& control, const _AccessibilityElement& element); + virtual bool OnAccessibilityValueIncreased(const _AccessibilityContainer& control, const _AccessibilityElement& element){return false;} + virtual bool OnAccessibilityValueDecreased(const _AccessibilityContainer& control, const _AccessibilityElement& element){return false;} private: _TokenEdit(const _TokenEdit& rhs); diff --git a/src/ui/inc/FUiCtrl_TokenEditPresenter.h b/src/ui/inc/FUiCtrl_TokenEditPresenter.h index 7f5a255..d83272e 100644 --- a/src/ui/inc/FUiCtrl_TokenEditPresenter.h +++ b/src/ui/inc/FUiCtrl_TokenEditPresenter.h @@ -164,11 +164,11 @@ public: void RemoveTokenAccessibilityElementAt(int index); result UpdateTokenAccessibilityBounds(void); result UpdateTitleAccessibilityBounds(const FloatRectangle& titleBounds); - result ScrollToFocusedTokenAccessibilityElement(const _AccessibilityElement& element); //Accessibility callbacks bool OnAccessibilityFocusIn(const _AccessibilityContainer& control, const _AccessibilityElement& element); bool OnAccessibilityFocusOut(const _AccessibilityContainer& control, const _AccessibilityElement& element); + bool OnAccessibilityActionPerformed(const _AccessibilityContainer& control, const _AccessibilityElement& element); result ScrollToFocusedToken(void); result AttachCursorToToken(void); @@ -198,6 +198,8 @@ private: bool CheckCopyPastePopupShowStatus(void); result ChangeInternalLayout(_ControlOrientation orientation); float GetMaxTextHeight(void); + result ScrollToFocusedTokenAccessibilityElement(const _AccessibilityElement& element); + result ScrollToTitleAccessibilityElement(void); private: Tizen::Ui::Controls::_TokenEdit* __pTokenEdit; @@ -297,6 +299,8 @@ private: bool __drawFocusState; + bool __accessibilityFocusIn; + }; // _TokenEditPresenter }}} // Tizen::Ui::Controls