From: BINDUCHAITANYA TUMMALA Date: Tue, 2 Jul 2013 14:16:43 +0000 (+0530) Subject: modification of formdatawindow fix for N_SE-43749 X-Git-Tag: submit/tizen_2.2/20130714.153306~16^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=437cda9ad5f7fda452ae9bd4b2811b129c2c0f05;p=framework%2Fosp%2Fweb.git modification of formdatawindow fix for N_SE-43749 Change-Id: Ibd3e114f278d2d88a4255e761b753325c271aa58 Signed-off-by: BINDUCHAITANYA TUMMALA --- diff --git a/src/controls/FWebCtrl_FormDataWindow.cpp b/src/controls/FWebCtrl_FormDataWindow.cpp index cb8c5fd..bea08c0 100644 --- a/src/controls/FWebCtrl_FormDataWindow.cpp +++ b/src/controls/FWebCtrl_FormDataWindow.cpp @@ -45,9 +45,6 @@ namespace Tizen { namespace Web { namespace Controls { -static const int MAX_LIST_ITEM_COUNT = 3; - - _FormDataWindow::_FormDataWindow(void) : __pListView(null) , __pWebView(null) @@ -71,9 +68,12 @@ _FormDataWindow::Construct(const Rectangle& rect, _WebImpl* pImpl, Evas_Object* result r = layout.Construct(VERTICAL_DIRECTION_DOWNWARD); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); - GET_SHAPE_CONFIG(CONTEXTMENU::LIST_ITEM_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, __listItemHeight); + GET_COLOR_CONFIG(LIST::ELEMENT_TEXT_NORMAL, __normalColor); + GET_COLOR_CONFIG(LIST::ELEMENT_TEXT_PRESSED, __pressedColor); + GET_COLOR_CONFIG(LIST::ELEMENT_TEXT_HIGHLIGHTED, __highlightedColor); + + __listItemHeight = rect.height; Rectangle windowRect(rect); - windowRect.height = MAX_LIST_ITEM_COUNT*__listItemHeight; r = Window::Construct(layout, windowRect, true, true); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Error Propogating.", GetErrorMessage(r)); @@ -125,7 +125,26 @@ _FormDataWindow::CreateItem(int index, int itemWidth) result r = pItem->Construct(Dimension(itemWidth, __listItemHeight), LIST_ANNEX_STYLE_NORMAL); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r)); - r = pItem->AddElement(Rectangle(0, 0, itemWidth, __listItemHeight), ID_FORMAT_STRING, *pListElement, true); + int listItemHeight = 0; + int listItemTextSize = 0; + int listItemLeftMargin = 0; + + GET_SHAPE_CONFIG(LIST::LIST_DEFAULT_ITEM_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, listItemHeight); + GET_SHAPE_CONFIG(LIST::LIST_ITEM_TEXT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, listItemTextSize); + GET_SHAPE_CONFIG(LIST::LIST_ITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, listItemLeftMargin); + + if (__listItemHeight > listItemHeight) + { + __listItemHeight = listItemHeight; + } + + if (__listItemHeight*2/3 < listItemTextSize) + { + listItemTextSize = __listItemHeight*2/3; + } + + Rectangle itemRect = Rectangle(listItemLeftMargin, 0, itemWidth, __listItemHeight); + r = pItem->AddElement(itemRect, ID_FORMAT_STRING, *pListElement, listItemTextSize, __normalColor, __pressedColor, __highlightedColor); SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r)); return pItem.release(); @@ -187,6 +206,8 @@ _FormDataWindow::UpdateList(Eina_List* pDataList, const Rectangle& rect) __listElementArray.RemoveAll(true); + __listItemHeight = rect.height; + int itemCount = eina_list_count(pDataList); for (int itemIndex = 0; itemIndex < itemCount; itemIndex++) @@ -204,9 +225,54 @@ _FormDataWindow::UpdateList(Eina_List* pDataList, const Rectangle& rect) __pListView->UpdateList(); - Rectangle rec(rect); - rec.height = (itemCount >= MAX_LIST_ITEM_COUNT) ? (MAX_LIST_ITEM_COUNT*__listItemHeight) : (itemCount*__listItemHeight); - SetBounds(rec); + int windowHeight = itemCount*__listItemHeight; + + Rectangle webRect = __pWebImpl->GetBounds();//is it better to take application rect + int bottomLimit = webRect.y + webRect.height; + int topLimit = webRect.y; + Rectangle windowRect(rect); + + if (__pWebImpl->IsKeypadVisible()) + { + Rectangle keyRect = __pWebImpl->GetPreviousKeypadBounds(); + bottomLimit = keyRect.y; + } + + int windowBottom = rect.y + windowHeight; + + while (true) + { + if (windowBottom > bottomLimit) + { + int newWindowTop = rect.y - rect.height - windowHeight; + if (newWindowTop < topLimit)//check in reverse direction + { + if (--itemCount) + { + windowHeight = itemCount*__listItemHeight; + windowBottom = rect.y + windowHeight; + } + else + { + break; + } + } + else + {//reverse direction is good + windowRect.y = rect.y - rect.height - windowHeight; + break; + } + } + else + { + //rect is good + break; + } + } + + windowRect.height = windowHeight; + __pListView->SetBounds(Rectangle(0, 0, windowRect.width, windowRect.height)); + SetBounds(windowRect); return E_SUCCESS; } diff --git a/src/controls/FWebCtrl_FormDataWindow.h b/src/controls/FWebCtrl_FormDataWindow.h index 9e22941..d422536 100644 --- a/src/controls/FWebCtrl_FormDataWindow.h +++ b/src/controls/FWebCtrl_FormDataWindow.h @@ -103,6 +103,7 @@ private: Evas_Object* __pWebView; _WebImpl* __pWebImpl; int __listItemHeight; + Tizen::Graphics::Color __normalColor, __pressedColor, __highlightedColor; }; // _FormDataWindow }}} //Tizen::Web::Controls