Fixed Nabi Issues 52332,54256,54601,54130,54264,54471
[apps/osp/Internet.git] / src / IntMainForm.cpp
index 611f135..c99477c 100644 (file)
@@ -55,8 +55,8 @@ using namespace Tizen::System;
 using namespace Tizen::Web;
 using namespace Tizen::Web::Controls;
 
-static const wchar_t* IDB_SEARCH_INPUT_FIELD_BG = L"I01_toolbar_input_field.9.png";
-static const wchar_t* IDB_FINDWORD_INPUT_FIELD_BG = L"I01_toolbar_input_field_findword.9.png";
+static const wchar_t* IDB_SEARCH_INPUT_FIELD_BG = L"I01_toolbar_input_field.#.png";
+static const wchar_t* IDB_FINDWORD_INPUT_FIELD_BG = L"I01_toolbar_input_field_findword.#.png";
 static const wchar_t* IDB_BTN_BACK = L"I01_icon_Back.png";
 static const wchar_t* IDB_BTN_BACK_PRESS = L"I01_icon_Back_press.png";
 static const wchar_t* IDB_CONTRLBAR_ICON_BOOKMARK = L"I01_search_list_icon_favorite.png";
@@ -68,8 +68,8 @@ static const wchar_t* IDB_CONTRLBAR_ICON_NEW_WINDOW_PRESS = L"I01_icon_plus_pres
 static const wchar_t* IDB_CONTROLBAR_ICON_CREATE_DISABLE = L"I01_controlbar_icon_create_disable.png";
 static const wchar_t* IDB_BUTTON_ON = L"00_button_on.png";
 static const wchar_t* IDB_BUTTON_OFF = L"00_button_off.png";
-static const wchar_t* IDB_ICON_BOOKMARK_OFF_TEMP = L"I01_icon_bookmark_off_temp.png";
-static const wchar_t* IDB_ICON_BOOKMARK_ON_TEMP = L"I01_icon_bookmark_on_temp.png";
+static const wchar_t* IDB_ICON_BOOKMARK_OFF_TEMP =L"00_icon_favorite_off_74x74.png";
+static const wchar_t* IDB_ICON_BOOKMARK_ON_TEMP = L"00_icon_favorite_on_74x74.png";
 static const wchar_t* IDS_TIZEN_SERVICE = L"tizen-service";
 static const wchar_t* IDS_APPID = L"AppID";
 static const wchar_t* IDS_KEY = L"key";
@@ -144,9 +144,10 @@ static const int WIDTH_CONTEXT_MENU_BUTTON_PORTRAIT = 336;
 static const int WIDTH_CONTEXT_MENU_BUTTON_LANDSCAPE = 800;
 static const int HEIGHT_CONTEXT_MENU_BUTTON = 72;
 
+static const wchar_t* APPCONTROL_OPERATION_ID_IMAGE_VIEWER = L"http://tizen.org/appcontrol/operation/view";
 MainForm::MainForm(void)
 {
-       //__isLongPressedDone = false;
+       __isLongPressedDone = false;
        __pHistory = null;
        __pAddressbar = null;
        //      __pMostVisitedSitesPanel = null;
@@ -212,7 +213,7 @@ MainForm::MainForm(void)
        __pStopBtn = null;
        __pClearBtn = null;
        __pReaderBtn = null;
-       __isWebKeypadOpened = false;
+       __isKeypadOpened = false;
        __fontSize = 44;
        __pNotification = null;
 }
@@ -473,6 +474,7 @@ MainForm::InitWebControl()
                AppLogDebug("Initialization failed");
                return E_FAILURE;
        }
+       AppLog("GetClientAreaBounds().width %d",GetClientAreaBounds().width);
        r = __pWebViewer->Construct(Rectangle(0, Y_WEBCONTROL_POSITION, GetClientAreaBounds().width,__webControlHeight + 12));
 
        if (IsFailed(r))
@@ -485,10 +487,9 @@ MainForm::InitWebControl()
        else
        {
                r = AddControl(__pWebViewer);
-
                if (IsFailed(r))
                {
-                       delete __pWebViewer;
+                       __pWebViewer->Destroy();
                        __pWebViewer = null;
                        AppLogDebug("Web addcontrol failed with %s", GetErrorMessage(r));
                        return r;
@@ -653,7 +654,7 @@ MainForm::InitFooter(void)
        }
        else if (SettingPresentationModel::GetInstance()->GetHomepage().CompareTo((L"IDS_BR_BODY_BLANK_PAGE")) == 0)
        {
-               __pFooterUrlField->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_ABOUT_C_BLANK"));
+               __pFooterUrlField->SetGuideText(CommonUtil::GetString(L"IDS_BR_BODY_BLANK_PAGE"));
        }
        else
        {
@@ -741,6 +742,19 @@ MainForm::InitFooter(void)
        __pReaderBtn->SetShowState(false);
 
        //      __pFooterPanel->Invalidate(true);
+       if(__isKeypadOpened == false && __pAddressbar && __pAddressbar->GetShowState() == false)
+       {
+//             AppLog("asdasdasdasda");
+               __pFooterPanel->SetShowState(true);
+       }
+       else if(__pAddressbar == null)
+       {
+               __pFooterPanel->SetShowState(true);
+       }
+       else
+               __pFooterPanel->SetShowState(false);
+
+       SetAddressbarMode(GetAddressbarMode());
        AppLogDebug("MainForm::InitFooter exit");
        return E_SUCCESS;
 }
@@ -754,6 +768,7 @@ MainForm::InitOptionMenu()
 
        if (__pOptionMenu != null)
        {
+               __pOptionMenu->SetFocusable(true);
                __pOptionMenu->Invalidate(true);
                return r;
        }
@@ -762,6 +777,7 @@ MainForm::InitOptionMenu()
        r = __pOptionMenu->Construct();
        TryCatch(!IsFailed(r),,"Contextmenu creation failed with%s",GetErrorMessage(r));
 
+       __pOptionMenu->SetFocusable(true);
        isPrivateBrowsing = SettingPresentationModel::GetInstance()->GetPrivateOn();
 
 
@@ -822,6 +838,7 @@ result MainForm::InitImageContextMenu(Tizen::Graphics::Point p)
        __pImageMenu->SetMaxVisibleItemsCount(4);
        __pImageMenu->AddActionEventListener(*this);
        SetControlAlwaysOnTop(*__pImageMenu, true);
+       __pImageMenu->SetFocusable(true);
 
        CATCH: return r;
 }
@@ -850,14 +867,15 @@ MainForm::InitImageLinkContextMenu(Tizen::Graphics::Point p)
        r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_LIST, direction);
        TryCatch(!IsFailed(r),, "Context image menu creation failed with%s",GetErrorMessage(r));
 
-       r = __pImageMenu->AddItem("Open in new window"/*CommonUtil::GetString(L"IDS_BR_OPT_COPY_IMAGE")*/,IDA_HYPERLINK_OPEN_CLICKED);
-       r = __pImageMenu->AddItem("Copy link URL"/*CommonUtil::GetString(L"IDS_DLNA_BODY_SHARE_IMAGE_ABB")*/,IDA_HYPERLINK_COPY_LINK_CLICKED);
+       r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_BODY_OPEN_IN_NEW_WINDOW"),IDA_HYPERLINK_OPEN_CLICKED);
+       r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_COPY_LINK_URL"),IDA_HYPERLINK_COPY_LINK_CLICKED);
        //r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SAVE_IMAGE"),IDA_HYPERLINK_SAVE_IMAGE_CLICKED);
        r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SHARE"),IDA_HYPERLINK_SHARE_IMAGE_CLICKED);
 
        __pImageMenu->SetMaxVisibleItemsCount(3);
        __pImageMenu->AddActionEventListener(*this);
        SetControlAlwaysOnTop(*__pImageMenu, true);
+       __pImageMenu->SetFocusable(true);
 
        CATCH: return r;
 
@@ -867,6 +885,7 @@ result
 MainForm::InitSelectTextContextMenu(Point p, bool pasteOption, bool onlyPasteOption = false)
 {
        result r = E_SUCCESS;
+       bool clipboardAvailable = true;
        ContextMenuAnchorDirection direction = CONTEXT_MENU_ANCHOR_DIRECTION_AUTO;
 
        AppLog("MainForm::InitSelectTextContextMenu clicked on text");
@@ -875,6 +894,8 @@ MainForm::InitSelectTextContextMenu(Point p, bool pasteOption, bool onlyPasteOpt
                delete __pImageMenu;
                __pImageMenu = null;
        }
+//     Point q(0,0);
+//     __pWebViewer->GetBlockRange(p,q);
 
        if(p.y < 150)
        {
@@ -885,6 +906,39 @@ MainForm::InitSelectTextContextMenu(Point p, bool pasteOption, bool onlyPasteOpt
        {
                direction = CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD;
        }
+
+
+       Clipboard* pClipboard = Clipboard::GetInstance();
+
+       if(pClipboard == null)
+       {
+               clipboardAvailable = false;
+       }
+       else
+       {
+               // Retrieves a latest item
+               ClipboardItem* pItem = pClipboard->RetrieveLatestItemN(CLIPBOARD_DATA_TYPE_TEXT | CLIPBOARD_DATA_TYPE_HTML);
+
+               if(pItem == null)
+               {
+                       clipboardAvailable = false;
+               }
+               else
+               {
+                       //Gets data from the clipboard item
+                       String* pString = dynamic_cast<String*>(pItem->GetData());
+
+                       if(pString == null)
+                       {
+                               clipboardAvailable = false;
+                       }
+               }
+       }
+       if(clipboardAvailable == false && onlyPasteOption == true)
+       {
+               return E_FAILURE;
+       }
+
        __pImageMenu = new (std::nothrow) ContextMenu();
        r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_GRID, direction);
        TryCatch(!IsFailed(r),, "Context image menu creation failed with%s",GetErrorMessage(r));
@@ -893,7 +947,7 @@ MainForm::InitSelectTextContextMenu(Point p, bool pasteOption, bool onlyPasteOpt
        {
                r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_COM_OPT_COPY"),IDA_COPY_TEXT_CLICKED);
        }
-       if (pasteOption || onlyPasteOption)
+       if ((pasteOption || onlyPasteOption) && clipboardAvailable == true)
        {
                r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_COM_BODY_PASTE"),IDA_PASTE_TEXT_CLICKED);
        }
@@ -906,6 +960,7 @@ MainForm::InitSelectTextContextMenu(Point p, bool pasteOption, bool onlyPasteOpt
        __pImageMenu->SetMaxVisibleItemsCount(3);
        __pImageMenu->AddActionEventListener(*this);
        SetControlAlwaysOnTop(*__pImageMenu, true);
+       __pImageMenu->SetFocusable(true);
 
        CATCH: return r;
 
@@ -915,6 +970,7 @@ result
 MainForm::InitSelectTextContextMenuF(FloatPoint p, bool pasteOption, bool onlyPasteOption = false)
 {
        result r = E_SUCCESS;
+       bool clipboardAvailable = true;
        ContextMenuAnchorDirection direction = CONTEXT_MENU_ANCHOR_DIRECTION_AUTO;
 
        AppLog("MainForm::InitSelectTextContextMenu clicked on text");
@@ -923,29 +979,75 @@ MainForm::InitSelectTextContextMenuF(FloatPoint p, bool pasteOption, bool onlyPa
                delete __pImageMenu;
                __pImageMenu = null;
        }
-
+//     FloatPoint q(0.0,0.0);
+//             __pWebViewer->GetBlockRange(p,q);
        if(p.y < 150)
        {
                p.y = p.y + 50;
                direction = CONTEXT_MENU_ANCHOR_DIRECTION_DOWNWARD;
        }
+       else if(__pWebViewer != null && (p.y > (__pWebViewer->GetHeight() + __pWebViewer->GetY())))
+       {
+               p.y = __pWebViewer->GetHeight() + __pWebViewer->GetY();
+       }
        else
        {
+               if(GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE )
+               {
+                       AppLog("asdasdafdsfdgfd");
+                       p.y = p.y - 50;
+               }
                direction = CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD;
        }
+
+
+       Clipboard* pClipboard = Clipboard::GetInstance();
+
+       if(pClipboard == null)
+       {
+               clipboardAvailable = false;
+       }
+       else
+       {
+               // Retrieves a latest item
+               ClipboardItem* pItem = pClipboard->RetrieveLatestItemN(CLIPBOARD_DATA_TYPE_TEXT | CLIPBOARD_DATA_TYPE_HTML);
+
+               if(pItem == null)
+               {
+                       clipboardAvailable = false;
+               }
+               else
+               {
+                       //Gets data from the clipboard item
+                       String* pString = dynamic_cast<String*>(pItem->GetData());
+
+                       if(pString == null)
+                       {
+                               clipboardAvailable = false;
+                       }
+               }
+       }
+       if(clipboardAvailable == false && onlyPasteOption == true)
+       {
+               return E_FAILURE;
+       }
        __pImageMenu = new (std::nothrow) ContextMenu();
        r = __pImageMenu->Construct(p, CONTEXT_MENU_STYLE_GRID, direction);
        TryCatch(!IsFailed(r),, "Context image menu creation failed with%s",GetErrorMessage(r));
 
-       if(onlyPasteOption == false)
+
+
+
+
+       if(onlyPasteOption == false && __pHitElementResult->GetAttributeValue("type").Equals(L"password",false) == false)
        {
                r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_COM_OPT_COPY"),IDA_COPY_TEXT_CLICKED);
        }
-       if (pasteOption || onlyPasteOption)
+       if ((pasteOption || onlyPasteOption) && clipboardAvailable == true)
        {
                r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_COM_BODY_PASTE"),IDA_PASTE_TEXT_CLICKED);
        }
-       if(onlyPasteOption == false)
+       if(onlyPasteOption == false && __pHitElementResult->GetAttributeValue("type").Equals(L"password",false) == false)
        {
                r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"),IDA_FIND_TEXT__CLICKED);
                r = __pImageMenu->AddItem(CommonUtil::GetString(L"IDS_BR_OPT_SHARE"),IDA_SHARE_TEXT_CLICKED);
@@ -954,6 +1056,7 @@ MainForm::InitSelectTextContextMenuF(FloatPoint p, bool pasteOption, bool onlyPa
        __pImageMenu->SetMaxVisibleItemsCount(3);
        __pImageMenu->AddActionEventListener(*this);
        SetControlAlwaysOnTop(*__pImageMenu, true);
+       __pImageMenu->SetFocusable(true);
 
        CATCH: return r;
 
@@ -986,6 +1089,11 @@ MainForm::InitFindWordPanel(void)
                                delete pBitmap;
                        }
                }
+               if(__pAddressbar)
+                       __pAddressbar->SetShowState(false);
+
+               if(__isKeypadOpened == false)
+                       __pFooterPanel->SetShowState(true);
                return r;
        }
 
@@ -1109,7 +1217,7 @@ MainForm::InitFindWordPanel(void)
        }
 
        __pFindWordCountLabelRightToLeft = static_cast<Label*>(__pFindWordControl->GetControl(L"IDC_FIND_COUNT_LABEL2", true));
-       if (__pFindWordCountLabel == null)
+       if (__pFindWordCountLabelRightToLeft == null)
        {
                AppLogException("There is some problem in the xml file. Please check.");
                return E_FAILURE;
@@ -1136,6 +1244,12 @@ MainForm::InitFindWordPanel(void)
        __pFindWordEditFieldRightToLeft->AddKeypadEventListener(*this);
        __pFindWordEditFieldRightToLeft->SetOverlayKeypadCommandButtonVisible(false);
        __pFindWordEditFieldRightToLeft->SetColor(EDIT_STATUS_HIGHLIGHTED, Color(0x00, 0x00, 0x00, 0x00));
+
+       if(__pAddressbar)
+               __pAddressbar->SetShowState(false);
+
+       if(__isKeypadOpened == false)
+               __pFooterPanel->SetShowState(true);
        return r;
 }
 
@@ -1171,7 +1285,7 @@ MainForm::CreateItem (int index, int itemWidth)
        if (pageURL.GetLength() == 0)
        {
                String nourl;
-               pAppResource->GetString(L"IDS_BR_BODY_ABOUT_C_BLANK", nourl);
+               pAppResource->GetString(L"IDS_BR_BODY_BLANK_PAGE", nourl);
                pageURL = L"<"+ nourl +">";
 
        }
@@ -1205,7 +1319,7 @@ MainForm::CreateItem (int index, int itemWidth)
        if ( pListIconImage != NULL)
        {
                listImageRect.SetBounds(screenBounds.x + 16, screenBounds.y + 28  + (__fontSize - 44)/2 , 72, 72);
-               pagetTitleRect.SetBounds(listImageRect.x + 72 + 16,10, screenBounds.width - 2 * pListIconImage->GetWidth() - 120, 60  + (__fontSize - 44));
+               pagetTitleRect.SetBounds(listImageRect.x + 72 + 16,10, screenBounds.width - 2 * pListIconImage->GetWidth() - 120, 72  + (__fontSize - 44));
                pageURLRect.SetBounds(pagetTitleRect.x, pagetTitleRect.y + pagetTitleRect.height, screenBounds.width - 2 * pListIconImage->GetWidth() - 120, 48);
 
 
@@ -1227,7 +1341,7 @@ MainForm::CreateItem (int index, int itemWidth)
        {
                if (pItem != null)
                {
-                       pItem->AddElement(pageURLRect, IDA_FORMAT_URL_STRING, pageURL, 32, CUSTOM_COLOR_GREY, CUSTOM_COLOR_GREY, CUSTOM_COLOR_GREY, true);
+                       pItem->AddElement(pageURLRect, IDA_FORMAT_URL_STRING, pageURL, 32, CUSTOM_COLOR_GREY, CUSTOM_COLOR_LISTVIEW_TEXT, CUSTOM_COLOR_LISTVIEW_TEXT, true);
                }
        }
 
@@ -1287,6 +1401,7 @@ MainForm::GetItemCount (void)
 void
 MainForm::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state)
 {
+       AppLog("MainForm::OnListViewContextItemStateChanged called");
        if(__pMostVisitedSites != null)
        {
                History* pHistory = static_cast < History* >(__pMostVisitedSites->GetAt(index));
@@ -1303,6 +1418,7 @@ MainForm::OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView& listV
 void
 MainForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
 {
+       AppLog("MainForm::OnListViewItemStateChanged called");
        History* pHistory = static_cast < History* >(__pMostVisitedSites->GetAt(index));
        String url = pHistory->GetHistoryUrl();
        if (url != null)
@@ -1383,22 +1499,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                        pApp = UiApp::GetInstance();
                        if (pApp != null)
                        {
-                               RemoveOrientationEventListener(*this);
-
-                               if(__pAddressbar)
-                               {
-                                       __pAddressbar->SetAddressbarEventListener(null);
-                               }
-
-                               if(__pWebViewer)
-                               {
-                                       __pWebViewer->RemoveTouchEventListener(*this);
-                                       __pWebViewer->SetWebUiEventListenerF(null);
-                                       __pWebViewer->SetWebKeypadEventListener(null);
-                                       __pWebViewer->SetTextSearchListener(null);
-                                       __pWebViewer->SetLoadingListener(null);
-                               }
-                               r = pApp->Terminate();
+                               r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
                                if (IsFailed(r))
                                {
                                        AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
@@ -1422,22 +1523,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                                pApp = UiApp::GetInstance();
                                if (pApp != null)
                                {
-                                       RemoveOrientationEventListener(*this);
-
-                                       if(__pAddressbar)
-                                       {
-                                               __pAddressbar->SetAddressbarEventListener(null);
-                                       }
-
-                                       if(__pWebViewer)
-                                       {
-                                               __pWebViewer->RemoveTouchEventListener(*this);
-                                               __pWebViewer->SetWebUiEventListenerF(null);
-                                               __pWebViewer->SetWebKeypadEventListener(null);
-                                               __pWebViewer->SetTextSearchListener(null);
-                                               __pWebViewer->SetLoadingListener(null);
-                                       }
-                                       r = pApp->Terminate();
+                                       r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
                                        if (IsFailed(r))
                                        {
                                                AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
@@ -1457,22 +1543,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                                        pApp = UiApp::GetInstance();
                                        if (pApp != null)
                                        {
-                                               RemoveOrientationEventListener(*this);
-
-                                               if(__pAddressbar)
-                                               {
-                                                       __pAddressbar->SetAddressbarEventListener(null);
-                                               }
-
-                                               if(__pWebViewer)
-                                               {
-                                                       __pWebViewer->RemoveTouchEventListener(*this);
-                                                       __pWebViewer->SetWebUiEventListenerF(null);
-                                                       __pWebViewer->SetWebKeypadEventListener(null);
-                                                       __pWebViewer->SetTextSearchListener(null);
-                                                       __pWebViewer->SetLoadingListener(null);
-                                               }
-                                               r = pApp->Terminate();
+                                               r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
                                                if (IsFailed(r))
                                                {
                                                        AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
@@ -1510,29 +1581,14 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                                                        pApp = UiApp::GetInstance();
                                                        if (pApp != null)
                                                        {
-
-                                                               RemoveOrientationEventListener(*this);
-
-                                                               if(__pAddressbar)
-                                                               {
-                                                                       __pAddressbar->SetAddressbarEventListener(null);
-                                                               }
-
-                                                               if(__pWebViewer)
-                                                               {
-                                                                       __pWebViewer->RemoveTouchEventListener(*this);
-                                                                       __pWebViewer->SetWebUiEventListenerF(null);
-                                                                       __pWebViewer->SetWebKeypadEventListener(null);
-                                                                       __pWebViewer->SetTextSearchListener(null);
-                                                                       __pWebViewer->SetLoadingListener(null);
-                                                               }
-                                                               r = pApp->Terminate();
+                                                               r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
                                                                return;
                                                        }
                                                }
                                                else
                                                {
-                                                       r = pSceneManager->GoBackward(BackwardSceneTransition(pWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE));
+                                                       r = pSceneManager->GoForward(ForwardSceneTransition(pWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE,SCENE_HISTORY_OPTION_ADD_HISTORY,SCENE_DESTROY_OPTION_DESTROY));
+//                                                     r = pSceneManager->GoBackward(BackwardSceneTransition(pWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE));
                                                        if (IsFailed(r))
                                                        {
                                                                AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
@@ -1573,7 +1629,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                if(__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
                {
                        __pFindWordEditField->SetFocus();
-                       __pFindWordCountLabel->SetShowState(false);
+//                     __pFindWordCountLabel->SetShowState(false);
                }
                else
                {
@@ -1899,7 +1955,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                                __pOptionMenu->InsertItemAt(4,CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"), IDA_FINDONPAGE_CLICKED);
                                __pOptionMenu->SetMaxVisibleItemsCount(6);
                        }
-                       if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE)
+                       if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
                        {
                                AppLog(" Orientation landscape");
                                __pOptionMenu->SetMaxVisibleItemsCount(5);
@@ -2029,9 +2085,9 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                __pFindWordNext->SetEnabled(false);
                __pFindWordPrev->SetEnabled(false);
                __pFindWordCountLabel->SetText(L"0/0");
-               __pWebViewer->SearchText(L"aaaabbbbcccc",true);
+               __pWebViewer->SearchTextAllAsync(L"",true);
                AppLog("akjshdasd 1");
-               if(__isWebKeypadOpened == false)
+               if(__isKeypadOpened == false)
                        __pFooterPanel->SetShowState(true);
                ShowFindWordPanel(false);
        }
@@ -2066,7 +2122,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                __currentSearchStr = L"";
                __pFindWordNext->SetEnabled(false);
                __pFindWordPrev->SetEnabled(false);
-               __pFindWordCountLabel->SetShowState(false);
+//             __pFindWordCountLabel->SetShowState(false);
                __pFindWordControl->Invalidate(true);
        }
        break;
@@ -2079,7 +2135,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                __currentSearchStr = L"";
                __pFindWordNext->SetEnabled(false);
                __pFindWordPrev->SetEnabled(false);
-               __pFindWordCountLabelRightToLeft->SetShowState(false);
+//             __pFindWordCountLabelRightToLeft->SetShowState(false);
                __pFindWordControl->Invalidate(true);
        }
        break;
@@ -2176,7 +2232,6 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                                {
                                        __pNotification->SetPositionDiff(0);
                                }
-
                                __pNotification->ShowNotification();
                        }
                }
@@ -2184,7 +2239,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                {
                        int __modalMsgBoxResult;
                        MessageBox* pMsgBox = new MessageBox();
-                       pMsgBox->Construct(CommonUtil::GetString(L"IDS_COM_FAILED_TO_SAVE_IMAGE"),CommonUtil::GetString(L"IDS_COM_FAILED_TO_SAVE_IMAGE"),MSGBOX_STYLE_OK,3000);
+                       pMsgBox->Construct(CommonUtil::GetString(L"IDS_IMGE_POP_UNABLE_TO_SAVE_IMAGE"),CommonUtil::GetString(L"IDS_IMGE_POP_UNABLE_TO_SAVE_IMAGE"),MSGBOX_STYLE_OK,3000);
                        pMsgBox->ShowAndWait(__modalMsgBoxResult);
                        delete pMsgBox;
                        pMsgBox = null;
@@ -2249,6 +2304,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                        {
                                return;
                        }
+                       pNewWindowInfo->isJavascriptInitiated = true;
                        result r = E_SUCCESS;
                        SceneManager* pSceneManager = SceneManager::GetInstance();
                        if (pSceneManager == NULL)
@@ -2415,7 +2471,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
        break;
        case IDA_COPY_TEXT_CLICKED:
        {
-               __pWebViewer->ReleaseBlock();
+//             __pWebViewer->ReleaseBlock();//as per hyunn lee request for issue 53500
                // need to implement
                //__currentSelectedStr
                // Sets data to a clip board item
@@ -2453,22 +2509,55 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                {
                        String idElement = __pHitElementResult->GetAttributeValue(L"id");
                        String nameElement = __pHitElementResult->GetAttributeValue(L"name");
+                       String classElement = __pHitElementResult->GetAttributeValue(L"class");
+                       String tagElement  = __pHitElementResult->GetTagName();
+                       String contenteditable = __pHitElementResult->GetAttributeValue("contenteditable");
                        AppLog("MainForm::IDA_PASTE_TEXT_CLICKED id is %ls",idElement.GetPointer());
+                       String str = L"document.getElementsByName('";
+                       str.Append(nameElement);
+                       str.Append("').length");
+                       String* pNameCount = __pWebViewer->EvaluateJavascriptN(str);
+
+                       str.Clear();
+                       str = L"document.getElementsByClassName('";
+                       str.Append(classElement);
+                       str.Append("').length");
+                       String* pClassCount = __pWebViewer->EvaluateJavascriptN(str);
 
                        String script;
-                       if(idElement.GetLength() != 0)
+                       if(contenteditable.Equals(L"true",false) == true)
                        {
-                               script = L"function insertAtCursor(myField, myValue) {  if (document.selection) {   document.getElementById(myField).focus();   sel = document.selection.createRange();   sel.text = myValue;  }   else if (document.getElementById(myField).selectionStart || document.getElementById(myField).selectionStart == '0'){   var startPos = document.getElementById(myField).selectionStart;   var endPos = document.getElementById(myField).selectionEnd;   document.getElementById(myField).value = document.getElementById(myField).value.substring(0, startPos)+ myValue + document.getElementById(myField).value.substring(endPos, document.getElementById(myField).value.length);   } else {    document.getElementById(myField).value += myValue;   }  } ";
-                               script.Append("insertAtCursor('");
-                               script.Append(idElement);
-                               script.Append("',");
+                               AppLog("gmail paste need to support");
+
+                               script = L"function replaceSelectedText(replacementText) { var sel, range; if (window.getSelection) { sel = window.getSelection(); if (sel.rangeCount) { range = sel.getRangeAt(0); range.deleteContents(); range.insertNode(document.createTextNode(replacementText)); } } else if (document.selection && document.selection.createRange) { range = document.selection.createRange(); range.text = replacementText; } }";
+                               script.Append("replaceSelectedText(");
                                script.Append("\"");
                                script.Append(*pString);
                                script.Append("\");");
                        }
-                       else if (nameElement.GetLength() != 0)
+                       else if(idElement.GetLength() != 0)
                        {
-                               script = L"function insertAtCursor(myField, myValue) {  if (document.selection) {   document.getElementByName(myField)[0].focus();   sel = document.selection.createRange();   sel.text = myValue;  }   else if (myField.selectionStart || myField.selectionStart == '0'){   var startPos = myField.selectionStart;   var endPos = myField.selectionEnd;   myField.value = myField.value.substring(0, startPos)+ myValue + myField.value.substring(endPos, myField.value.length);   } else {    document.getElementByName(myField)[0].value += myValue;   }  } ";
+                               script = L"function insertAtCursor(myField, myValue) {  if (document.selection) {   myField.focus();   sel = document.selection.createRange();   sel.text = myValue;  }   else if (myField.selectionStart || myField.selectionStart == '0'){   var startPos = myField.selectionStart;   var endPos = myField.selectionEnd;   myField.value = myField.value.substring(0, startPos)+ myValue + myField.value.substring(endPos, myField.value.length);   } else {    myField.value += myValue;   }  } ";
+                               script.Append("insertAtCursor(");
+                               script.Append(L"document.activeElement");
+                               script.Append(",");
+                               script.Append("\"");
+                               script.Append(*pString);
+                               script.Append("\");");
+                       }
+                       else if (classElement.GetLength() != 0 && pClassCount->Equals("1",false) == true)
+                       {
+                               script = L"function insertAtCursor(myField, myValue) {  if (document.selection) {   myField.focus();   sel = document.selection.createRange();   sel.text = myValue;  }   else if (myField.selectionStart || myField.selectionStart == '0'){   var startPos = myField.selectionStart;   var endPos = myField.selectionEnd;   myField.value = myField.value.substring(0, startPos)+ myValue + myField.value.substring(endPos, myField.value.length);   } else {    myField.value += myValue;   }  } ";
+                               script.Append("insertAtCursor(document.getElementsByClassName('");
+                               script.Append(classElement);
+                               script.Append("')[0],");
+                               script.Append("\"");
+                               script.Append(*pString);
+                               script.Append("\");");
+                       }
+                       else if (nameElement.GetLength() != 0 && pNameCount->Equals("1",false) == true)
+                       {
+                               script = L"function insertAtCursor(myField, myValue) {  if (document.selection) {   myField.focus();   sel = document.selection.createRange();   sel.text = myValue;  }   else if (myField.selectionStart || myField.selectionStart == '0'){   var startPos = myField.selectionStart;   var endPos = myField.selectionEnd;   myField.value = myField.value.substring(0, startPos)+ myValue + myField.value.substring(endPos, myField.value.length);   } else {    myField.value += myValue;   }  } ";
                                script.Append("insertAtCursor(document.getElementsByName('");
                                script.Append(nameElement);
                                script.Append("')[0],");
@@ -2476,11 +2565,24 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                                script.Append(*pString);
                                script.Append("\");");
                        }
+                       else if(tagElement.GetLength() != 0) //adding for twitter post page
+                       {
+                               script = L"function insertAtCursor(myField, myValue) {  if (document.selection) {   myField.focus();   sel = document.selection.createRange();   sel.text = myValue;  }   else if (myField.selectionStart || myField.selectionStart == '0'){   var startPos = myField.selectionStart;   var endPos = myField.selectionEnd;   myField.value = myField.value.substring(0, startPos)+ myValue + myField.value.substring(endPos, myField.value.length);   } else {    myField.value += myValue;   }  } ";
+
+                               script.Append("insertAtCursor(document.activeElement,");
+                               script.Append("\"");
+                               script.Append(*pString);
+                               script.Append("\");");
+                       }
                        AppLog("MainForm::OnTouchLongPressed script is %ls",script.GetPointer());
                        String* pStr = __pWebViewer->EvaluateJavascriptN(script);
                        delete pStr;
+                       delete pNameCount;
+                       delete pClassCount;
                }
                delete pItem;
+               if(__pWebViewer)
+                       __pWebViewer->ReleaseBlock();
        }
        break;
        case IDA_GO_BACK:
@@ -2505,7 +2607,8 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
 //             LoadUrl(url);
                if (__pWebViewer != null && __pAddressbar != null)
                {
-                       __pWebViewer->Reload();
+                       LoadUrl(url);
+                       //__pWebViewer->Reload();
                        SetAddressbarMode((AddressBarMode)ADDRESSBAR_MODE_LOADING);
                }
 
@@ -2555,6 +2658,7 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
 void
 MainForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
 {
+       AppLog("MainForm::OnFormBackRequested entered");
        result r = E_FAILURE;
        if(__pImageMenu && __pImageMenu->GetShowState() == true)
        {
@@ -2565,28 +2669,13 @@ MainForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
        {
                __pWebViewer->GoBack();
        }
-       else if(__pWindowInfo->isJavascriptInitiated == false)
+       else if(__pWindowInfo && __pWindowInfo->isJavascriptInitiated == false)
        {
                UiApp* pApp = null;
                pApp = UiApp::GetInstance();
                if (pApp != null)
                {
-                       RemoveOrientationEventListener(*this);
-
-                       if(__pAddressbar)
-                       {
-                               __pAddressbar->SetAddressbarEventListener(null);
-                       }
-
-                       if(__pWebViewer)
-                       {
-                               __pWebViewer->RemoveTouchEventListener(*this);
-                               __pWebViewer->SetWebUiEventListenerF(null);
-                               __pWebViewer->SetWebKeypadEventListener(null);
-                               __pWebViewer->SetTextSearchListener(null);
-                               __pWebViewer->SetLoadingListener(null);
-                       }
-                       r = pApp->Terminate();
+                       r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
                        if (IsFailed(r))
                        {
                                AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
@@ -2610,22 +2699,7 @@ MainForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
                        pApp = UiApp::GetInstance();
                        if (pApp != null)
                        {
-                               RemoveOrientationEventListener(*this);
-
-                               if(__pAddressbar)
-                               {
-                                       __pAddressbar->SetAddressbarEventListener(null);
-                               }
-
-                               if(__pWebViewer)
-                               {
-                                       __pWebViewer->RemoveTouchEventListener(*this);
-                                       __pWebViewer->SetWebUiEventListenerF(null);
-                                       __pWebViewer->SetWebKeypadEventListener(null);
-                                       __pWebViewer->SetTextSearchListener(null);
-                                       __pWebViewer->SetLoadingListener(null);
-                               }
-                               r = pApp->Terminate();
+                               r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
                                if (IsFailed(r))
                                {
                                        AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
@@ -2645,22 +2719,7 @@ MainForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
                                pApp = UiApp::GetInstance();
                                if (pApp != null)
                                {
-                                       RemoveOrientationEventListener(*this);
-
-                                       if(__pAddressbar)
-                                       {
-                                               __pAddressbar->SetAddressbarEventListener(null);
-                                       }
-
-                                       if(__pWebViewer)
-                                       {
-                                               __pWebViewer->RemoveTouchEventListener(*this);
-                                               __pWebViewer->SetWebUiEventListenerF(null);
-                                               __pWebViewer->SetWebKeypadEventListener(null);
-                                               __pWebViewer->SetTextSearchListener(null);
-                                               __pWebViewer->SetLoadingListener(null);
-                                       }
-                                       r = pApp->Terminate();
+                                       r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
                                        if (IsFailed(r))
                                        {
                                                AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
@@ -2670,7 +2729,7 @@ MainForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
                        }
                        else
                        {
-                               if (pSceneManager->GetCurrentSceneId() == pWindowInfo->sceneID && pWindowInfo->isJavascriptInitiated == true)
+                               if (pWindowInfo && pSceneManager->GetCurrentSceneId() == pWindowInfo->sceneID && pWindowInfo->isJavascriptInitiated == true)
                                {
                                        r = SceneRegister::DestroyAndUnRegisterScene(pWindowInfo->sceneID);
                                        if (IsFailed(r))
@@ -2698,28 +2757,14 @@ MainForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
                                                pApp = UiApp::GetInstance();
                                                if (pApp != null)
                                                {
-                                                       RemoveOrientationEventListener(*this);
-
-                                                       if(__pAddressbar)
-                                                       {
-                                                               __pAddressbar->SetAddressbarEventListener(null);
-                                                       }
-
-                                                       if(__pWebViewer)
-                                                       {
-                                                               __pWebViewer->RemoveTouchEventListener(*this);
-                                                               __pWebViewer->SetWebUiEventListenerF(null);
-                                                               __pWebViewer->SetWebKeypadEventListener(null);
-                                                               __pWebViewer->SetTextSearchListener(null);
-                                                               __pWebViewer->SetLoadingListener(null);
-                                                       }
-                                                       r = pApp->Terminate();
+                                                       r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
                                                        return;
                                                }
                                        }
                                        else
                                        {
-                                               r = pSceneManager->GoBackward(BackwardSceneTransition(pWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE));
+                                               if(pWindowInfo != null)
+                                                       r = pSceneManager->GoForward(ForwardSceneTransition(pWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE,SCENE_HISTORY_OPTION_ADD_HISTORY,SCENE_DESTROY_OPTION_DESTROY));
                                                if (IsFailed(r))
                                                {
                                                        AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
@@ -2728,9 +2773,24 @@ MainForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
                                        }
                                        break;
                                }
+//                             else if (pWindowInfo && pSceneManager->GetCurrentSceneId() == pWindowInfo->sceneID && pWindowInfo->isJavascriptInitiated == false)
+//                             {
+//                                     UiApp* pApp = null;
+//                                     pApp = UiApp::GetInstance();
+//                                     if (pApp != null)
+//                                     {
+//                                             r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
+//                                             if (IsFailed(r))
+//                                             {
+//                                                     AppLogException("MainForm::OnFormBackRequested failed with %s", GetErrorMessage(r));
+//                                                     return;
+//                                             }
+//                                     }
+//                             }
                        }
                }
        }
+       AppLog("MainForm::OnFormBackRequested exit");
 }
 
 void
@@ -2745,11 +2805,10 @@ MainForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
        MultipleWindowPresentationModel::GetInstance()->GetValue(SELECTED_SCENE_ID, &pValue);
        pSelectedScene = (String*) pValue;
 
-       // removed because some times crash is happening here
-       /*if (pSelectedScene != null)
+       if (pSelectedScene != null)
        {
                delete pSelectedScene;
-       }*/
+       }
        MultipleWindowPresentationModel::GetInstance()->SetValue(SELECTED_SCENE_ID, null);
        String* selectedSceneID = new(std::nothrow) String(currentSceneId);
        AppLogDebug("current scene id is %ls", currentSceneId.GetPointer());
@@ -2775,12 +2834,6 @@ MainForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
                __pWindowInfo = dynamic_cast< WindowInfo* >(pArgs->GetAt(0));
        }
 
-       if (selectedSceneID)
-       {
-               delete selectedSceneID;
-               selectedSceneID = null;
-       }
-
        InitFooter();
        InitAddressbar();
 
@@ -2800,15 +2853,23 @@ MainForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
        }
        else if(__pWindowInfo != null)
        {
-               if(__pWindowInfo->pageUrl.GetLength() > 0 &&previousSceneId != IDSCN_BRIGHTNESS && previousSceneId != IDSCN_HISTORY_LIST && previousSceneId != IDSCN_MULTIPLE_WINDOW && previousSceneId != IDSCN_MULTIPLE_WINDOW_GRID && previousSceneId != IDSCN_BOOKMARK_VIEW && previousSceneId != IDSCN_SETTINGS && previousSceneId != IDSCN_MAIN_VIEW)
+               if(__pWindowInfo->pageUrl.GetLength() > 0 &&previousSceneId != IDSCN_BRIGHTNESS && previousSceneId != IDSCN_HISTORY_LIST && previousSceneId != IDSCN_MULTIPLE_WINDOW && previousSceneId != IDSCN_MULTIPLE_WINDOW_GRID && previousSceneId != IDSCN_BOOKMARK_VIEW && previousSceneId != IDSCN_SETTINGS && previousSceneId.Contains(IDSCN_MAIN_VIEW) == false)
                {
                        LoadUrl(__pWindowInfo->pageUrl);
                }
-               else if (__pWindowInfo->isJavascriptInitiated == true)
+               else if(__pWindowInfo->pageUrl.GetLength() > 0 && __pWindowInfo->isAppcontrolTriggered == true)
                {
+                       LoadUrl(__pWindowInfo->pageUrl);
+                       __pWindowInfo->isAppcontrolTriggered = false;
+               }
+               else if (__pWindowInfo->isJavascriptInitiated == true && __pWindowInfo->isFirstLaunch == true)
+               {
+                       __pWindowInfo->isFirstLaunch = false;
                        AppLog("Called");
                        InitWebControl();
                        __pWindowInfo->pCurrentWeb = __pWebViewer;
+                       if(__pWindowInfo->pageUrl.GetLength() > 0)
+                               LoadUrl(__pWindowInfo->pageUrl);
                }
        }
 
@@ -2826,6 +2887,10 @@ MainForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
                }
        }
 
+       if(__pMostVisitedListView && __pMostVisitedListView->GetShowState() == true)
+       {
+               __pMostVisitedListView->UpdateList();
+       }
        if (__pAddressbar != null && pArgs != null && (previousSceneId == IDSCN_BOOKMARK_VIEW || previousSceneId == IDSCN_HISTORY_LIST))
        {
                String* pBookmarkUrl = dynamic_cast< String* >(pArgs->GetAt(0));
@@ -2887,7 +2952,10 @@ MainForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
                delete pBitmap;
        }
 
+       RelayoutControls(false);
        AppLog("ABC: OnSceneActivatedN started exit");
+       if(__pWebViewer)
+               AppLog("WebControl's width height %d %d,",__pWebViewer->GetWidth(),__pWebViewer->GetHeight());
 
 }
 
@@ -2924,13 +2992,18 @@ MainForm::OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
                pCanvas->DrawBitmap(Point(0,0),*pBitmap);
                delete pBitmap;
        }
-       if(__pWebViewer != null && __pWindowInfo != null)
+       if(__pWebViewer != null && __pWindowInfo != null && __pWindowInfo->pWebCanvasBitmap != null)
                pCanvas->DrawBitmap(__pWebViewer->GetPosition(),*__pWindowInfo->pWebCanvasBitmap);
 
        WindowInfo::pFormCanvasBitmap = new(std::nothrow) Bitmap();
-       WindowInfo::pFormCanvasBitmap->Construct(*pCanvas,Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pFooterPanel->GetHeight()));
+       if (__pFooterPanel)
+       {
+               WindowInfo::pFormCanvasBitmap->Construct(*pCanvas,Rectangle(0,0,GetClientAreaBounds().width,GetClientAreaBounds().height - __pFooterPanel->GetHeight()));
+       }
        delete pCanvas;
        delete pWebCanvas;
+       if(__pAddressbar)
+               __pAddressbar->SetShowState(false);
        AppLog("Coming here");
 }
 
@@ -3057,7 +3130,7 @@ MainForm::OnLoadingStarted(void)
                if (__pWindowInfo != NULL)
                {
                        // resetting the page title to blank, it will be received in OnPageTitleReceived()
-                       __pWindowInfo->pageTitle = L"";
+//                     __pWindowInfo->pageTitle = L"";
                        __pWindowInfo->pageUrl = __pWebViewer->GetUrl();
                }
                __pAddressbar->Invalidate(true);
@@ -3071,7 +3144,6 @@ MainForm::OnLoadingCanceled(void)
 
 }
 
-
 void
 MainForm::OnKeypadWillOpen(Tizen::Ui::Control& source)
 {
@@ -3083,14 +3155,16 @@ void
 MainForm::OnKeypadOpened(Tizen::Ui::Control& source)
 {
        AppLog("XYZ::MainForm::OnKeypadOpened");
+       __isKeypadOpened = true;
        __pFooterPanel->SetShowState(false);
-
+       RelayoutControls(false);
 }
 
 void
 MainForm::OnKeypadClosed(Tizen::Ui::Control& source)
 {
        AppLog("XYZ::MainForm::OnKeypadClosed");
+       __isKeypadOpened = false;
        __pFooterPanel->SetShowState(true);
        RelayoutControls(true);
 }
@@ -3126,6 +3200,8 @@ MainForm::OnLoadingCompleted(void)
                return;
        }
 
+       if(__pWindowInfo && __pWebViewer)
+               __pWindowInfo->pageTitle = __pWebViewer->GetTitle();
        if(__pImageMenu && __pImageMenu->GetShowState())
        {
                __pImageMenu->SetShowState(false);
@@ -3190,7 +3266,6 @@ MainForm::OnLoadingCompleted(void)
                                __pHistory->SetFavIconBitmap(*pTempBitmap);
                        }
 
-                       AppLog("MainForm::OnLoadingCompleted setting the fav icon 2");
                }
 
                Canvas* pCanvas = __pWebViewer->GetCanvasN();
@@ -3204,6 +3279,13 @@ MainForm::OnLoadingCompleted(void)
                Bitmap *pFavIcon = __pWebViewer->GetFaviconN();
                if (pFavIcon)
                {
+                       Tizen::Graphics::BufferInfo bmpInfo;
+                       pFavIcon->Lock(bmpInfo);
+                       AppLog("rrrr:: width %d height %d of the faviconbitmap from bufferinfo", bmpInfo.width, bmpInfo.height);
+
+                       AppLog("MainForm::OnLoadingCompleted setting the fav icon 2");
+
+                       AppLog("rrrr:: width %d height %d of the faviconbitmap",pFavIcon->GetWidth(),pFavIcon->GetHeight());
                        __pHistory->SetFavIconBitmap(*pFavIcon);
                        delete pFavIcon;
                }
@@ -3291,7 +3373,7 @@ MainForm::OnLoadingCompleted(void)
 void
 MainForm::OnEstimatedProgress(int progress)
 {
-       AppLogDebug("MainForm::OnEstimatedProgress entered");
+       AppLogDebug("MainForm::OnEstimatedProgress entered %d",progress);
 
        if (progress < DEFAULT_PROGRESS_PERCENTAGE)
                progress = DEFAULT_PROGRESS_PERCENTAGE;
@@ -3390,7 +3472,7 @@ MainForm::LoadUrl(String& url)
                }
                else
                {
-                               UrlEncoder::Encode(url, L"UTF-8", encodedUrl);
+                       UrlEncoder::Encode(url, L"UTF-8", encodedUrl);
                        __pWebViewer->LoadUrl(SettingPresentationModel::GetInstance()->GetSearchUrl(encodedUrl));
                }
        }
@@ -3409,14 +3491,48 @@ MainForm::LoadUrl(String& url)
 void
 MainForm::OnFocusGained(const Tizen::Ui::Control& source)
 {
+       AppLog("MainForm::OnFocusGained");
        if(__pFooterPanel)
        {
                __pFooterPanel->SetShowState(false);
        }
 
+       if(__pWebViewer)
+       {
+               __pWebViewer->ReleaseBlock();
+       }
+
        if(__pAddressbar)
        {
                __pAddressbar->SetShowState(true);
+               __pAddressbar->SetAddressbarURLFocus();
+       }
+       if(__pFindWordControl && __pFindWordControl->GetShowState() == true)
+       {
+               __currentSearchStr = L"";
+               __currentWordIndex = 0;
+               __maxOccurrances = 0;
+
+               if (__pFindWordPanelLeftToRight && __pFindWordPanelLeftToRight->GetShowState() == true)
+               {
+                       __pFindWordEditField->SetText(L"");
+                       __pFindWordEditField->HideKeypad();
+                       __pFindWordControl->SetShowState(false);
+                       __pFindWordCountLabel->SetText(L"0/0");
+               }
+               else if(__pFindWordPanelRightToLeft && __pFindWordPanelRightToLeft->GetShowState() == true)
+               {
+                       __pFindWordEditFieldRightToLeft->SetText(L"");
+                       __pFindWordEditFieldRightToLeft->HideKeypad();
+                       __pFindWordControl->SetShowState(false);
+                       __pFindWordCountLabelRightToLeft->SetText(L"0/0");
+               }
+
+               __pFindWordNext->SetEnabled(false);
+               __pFindWordPrev->SetEnabled(false);
+
+               __pWebViewer->SearchTextAllAsync(L"",true);
+               __pFindWordControl->SetShowState(false);
        }
        RelayoutControls(false);
 }
@@ -3424,7 +3540,7 @@ MainForm::OnFocusGained(const Tizen::Ui::Control& source)
 void
 MainForm::OnFocusLost(const Tizen::Ui::Control& source)
 {
-
+       AppLog("MainForm::OnFocusLost called");
 }
 
 void
@@ -3461,25 +3577,7 @@ MainForm::OnBackClicked(/*const Addressbar& addBar*/)
                pApp = UiApp::GetInstance();
                if (pApp != null)
                {
-
-                       RemoveOrientationEventListener(*this);
-
-                       if(__pAddressbar)
-                       {
-                               __pAddressbar->SetAddressbarEventListener(null);
-                       }
-
-                       if(__pWebViewer)
-                       {
-                               __pWebViewer->RemoveTouchEventListener(*this);
-                               __pWebViewer->SetWebUiEventListenerF(null);
-                               __pWebViewer->SetWebKeypadEventListener(null);
-                               __pWebViewer->SetTextSearchListener(null);
-                               __pWebViewer->SetLoadingListener(null);
-                       }
-
-
-                       r = pApp->Terminate();
+                       r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
                        if (IsFailed(r))
                        {
                                AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
@@ -3503,24 +3601,7 @@ MainForm::OnBackClicked(/*const Addressbar& addBar*/)
                        pApp = UiApp::GetInstance();
                        if (pApp != null)
                        {
-                               RemoveOrientationEventListener(*this);
-
-                               if(__pAddressbar)
-                               {
-                                       __pAddressbar->SetAddressbarEventListener(null);
-                               }
-
-                               if(__pWebViewer)
-                               {
-                                       __pWebViewer->RemoveTouchEventListener(*this);
-                                       __pWebViewer->SetWebUiEventListenerF(null);
-                                       __pWebViewer->SetWebKeypadEventListener(null);
-                                       __pWebViewer->SetTextSearchListener(null);
-                                       __pWebViewer->SetLoadingListener(null);
-                               }
-
-
-                               r = pApp->Terminate();
+                               r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
                                if (IsFailed(r))
                                {
                                        AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
@@ -3540,24 +3621,7 @@ MainForm::OnBackClicked(/*const Addressbar& addBar*/)
                                pApp = UiApp::GetInstance();
                                if (pApp != null)
                                {
-                                       RemoveOrientationEventListener(*this);
-
-                                       if(__pAddressbar)
-                                       {
-                                               __pAddressbar->SetAddressbarEventListener(null);
-                                       }
-
-                                       if(__pWebViewer)
-                                       {
-                                               __pWebViewer->RemoveTouchEventListener(*this);
-                                               __pWebViewer->SetWebUiEventListenerF(null);
-                                               __pWebViewer->SetWebKeypadEventListener(null);
-                                               __pWebViewer->SetTextSearchListener(null);
-                                               __pWebViewer->SetLoadingListener(null);
-                                       }
-
-
-                                       r = pApp->Terminate();
+                                       r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
                                        if (IsFailed(r))
                                        {
                                                AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
@@ -3593,24 +3657,7 @@ MainForm::OnBackClicked(/*const Addressbar& addBar*/)
                                        pApp = UiApp::GetInstance();
                                        if (pApp != null)
                                        {
-                                               RemoveOrientationEventListener(*this);
-
-                                               if(__pAddressbar)
-                                               {
-                                                       __pAddressbar->SetAddressbarEventListener(null);
-                                               }
-
-                                               if(__pWebViewer)
-                                               {
-                                                       __pWebViewer->RemoveTouchEventListener(*this);
-                                                       __pWebViewer->SetWebUiEventListenerF(null);
-                                                       __pWebViewer->SetWebKeypadEventListener(null);
-                                                       __pWebViewer->SetTextSearchListener(null);
-                                                       __pWebViewer->SetLoadingListener(null);
-                                               }
-
-
-                                               r = pApp->Terminate();
+                                               r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
                                                return;
                                        }
 
@@ -3620,30 +3667,14 @@ MainForm::OnBackClicked(/*const Addressbar& addBar*/)
                                        pApp = UiApp::GetInstance();
                                        if (pApp != null)
                                        {
-                                               RemoveOrientationEventListener(*this);
-
-                                               if(__pAddressbar)
-                                               {
-                                                       __pAddressbar->SetAddressbarEventListener(null);
-                                               }
-
-                                               if(__pWebViewer)
-                                               {
-                                                       __pWebViewer->RemoveTouchEventListener(*this);
-                                                       __pWebViewer->SetWebUiEventListenerF(null);
-                                                       __pWebViewer->SetWebKeypadEventListener(null);
-                                                       __pWebViewer->SetTextSearchListener(null);
-                                                       __pWebViewer->SetLoadingListener(null);
-                                               }
-
-
-                                               r = pApp->Terminate();
+                                               r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
                                                return;
                                        }
                                }
                                else
                                {
-                                       r = pSceneManager->GoBackward(BackwardSceneTransition(pWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE));
+                                       r = pSceneManager->GoForward(ForwardSceneTransition(pWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE,SCENE_HISTORY_OPTION_ADD_HISTORY,SCENE_DESTROY_OPTION_DESTROY));
+//                                     r = pSceneManager->GoBackward(BackwardSceneTransition(pWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE));
                                        if (IsFailed(r))
                                        {
                                                AppLogException("OnActionPerformed failed with %s", GetErrorMessage(r));
@@ -3747,6 +3778,12 @@ void
 MainForm::OnClipboardClosed(const Addressbar& addBar)
 {
        AppLog("XYZ::MainForm::OnClipboardClosed");
+       if (__pFooterPanel && __pAddressbar->GetShowState() == false)
+       {
+               AppLog("akjshdasd 3");
+               __pFooterPanel->SetShowState(true);
+       }
+       __isKeypadOpened = false;
        RelayoutControls(false);
 }
 
@@ -3759,6 +3796,11 @@ MainForm::OnAddressBarKeypadClosed(const Addressbar& addBar, bool footerState)
                AppLog("akjshdasd 3");
                __pFooterPanel->SetShowState(true);
        }
+       __isKeypadOpened = false;
+       if(__pNotification && __pNotification->GetShowState())
+       {
+               __pNotification->SetPosition(0,GetClientAreaBounds().height - __pNotification->GetHeight());
+       }
 
        RelayoutControls(false,footerState);
 }
@@ -3767,12 +3809,18 @@ void
 MainForm::OnAddressBarKeypadOpened(const Addressbar& addBar)
 {
        AppLog("XYZ::MainForm::OnAddressBarKeypadOpened");
+       __isKeypadOpened = true;
+       if(__pNotification && __pNotification->GetShowState())
+       {
+               __pNotification->SetPosition(0,GetClientAreaBounds().height - __pNotification->GetHeight());
+       }
        RelayoutControls(false);
 }
 
 void
 MainForm::OnAddressBarKeypadWillOpen(const Addressbar& addBar)
 {
+       __isKeypadOpened = true;
        __pFooterPanel->SetShowState(false);
 }
 
@@ -3793,6 +3841,7 @@ MainForm::OnPageTitleReceived(const Tizen::Base::String& title)
                if (__pWebViewer != null)
                {
                        __pWindowInfo->pageUrl = __pWebViewer->GetUrl();
+                       AppLog("MainForm::OnPageTitleReceived url %ls",__pWindowInfo->pageUrl.GetPointer());
                }
        }
        if (__pAddressbar != null && __pWebViewer != null)
@@ -3820,7 +3869,8 @@ MainForm::UpdateFavicon(void)
                        if (url.GetHost().GetLength() == 0)
                        {
                                Uri webUrl;
-                               webUrl.SetUri(__pWebViewer->GetUrl());
+                               if(__pWebViewer)
+                                       webUrl.SetUri(__pWebViewer->GetUrl());
                                result r = url.SetHost(webUrl.GetHost());
                                if(IsFailed(r))
                                {
@@ -3831,7 +3881,8 @@ MainForm::UpdateFavicon(void)
                        if (url.GetScheme().GetLength() == 0)
                        {
                                Uri webUrl;
-                               webUrl.SetUri(__pWebViewer->GetUrl());
+                               if(__pWebViewer)
+                                       webUrl.SetUri(__pWebViewer->GetUrl());
                                url.SetScheme(webUrl.GetScheme());
                        }
                        __pWindowInfo->faviconUrl = url.ToString();
@@ -3976,7 +4027,10 @@ MainForm::OnWebDataReceived(const Tizen::Base::String& mime,
 void
 MainForm::OnWebPageBlockSelected(Web& source, FloatPoint& startPoint, FloatPoint& endPoint)
 {
-       AppLog("MainForm::OnWebPageBlockSelected");
+       AppLog("LMN::MainForm::OnWebPageBlockSelected");
+//     if(__isLongPressedDone == false)
+//             return;
+
        if (__pHitElementResult != null)
        {
                delete __pHitElementResult;
@@ -3988,11 +4042,11 @@ MainForm::OnWebPageBlockSelected(Web& source, FloatPoint& startPoint, FloatPoint
                AppLog("MainForm::OnWebPageBlockSelected web not null");
                __pHitElementResult = __pWebViewer->GetElementByPointN(startPoint);
 
-               if(GetLastResult() == E_INVALID_ARG || (__pHitElementResult->GetTagName().CompareTo(L"INPUT") != 0 && __pHitElementResult->GetTagName().CompareTo(L"TEXTAREA") != 0))
+               if(GetLastResult() == E_INVALID_ARG || (__pHitElementResult->GetTagName().Equals(L"INPUT",false) == false && __pHitElementResult->GetTagName().Equals(L"TEXTAREA",false) == false))
                {
                        AppLog("datafirst startpoint error %s",GetErrorMessage(GetLastResult()));
                        __pHitElementResult = __pWebViewer->GetElementByPointN(endPoint);
-                       if(GetLastResult() == E_INVALID_ARG || (__pHitElementResult->GetTagName().CompareTo(L"INPUT") != 0 && __pHitElementResult->GetTagName().CompareTo(L"TEXTAREA") != 0))
+                       if(GetLastResult() == E_INVALID_ARG || (__pHitElementResult->GetTagName().Equals(L"INPUT",false) == false && __pHitElementResult->GetTagName().Equals(L"TEXTAREA",false) == false))
                        {
                                __pHitElementResult = __pWebViewer->GetElementByPointN(__longPressPoint);
                        }
@@ -4009,6 +4063,7 @@ MainForm::OnWebPageBlockSelected(Web& source, FloatPoint& startPoint, FloatPoint
        {
                String tagName = __pHitElementResult->GetTagName();
                String type = __pHitElementResult->GetAttributeValue("type");
+               String contenteditable = __pHitElementResult->GetAttributeValue("contenteditable");
 
 
                AppLog("TagName %ls",tagName.GetPointer());
@@ -4016,15 +4071,26 @@ MainForm::OnWebPageBlockSelected(Web& source, FloatPoint& startPoint, FloatPoint
                AppLog("__currentSelectedStr after clear %ls",__currentSelectedStr.GetPointer());
                __currentSelectedStr = __pWebViewer->GetTextFromBlock();
                AppLog("__currentSelectedStr after GetTextFromBlock %ls",__currentSelectedStr.GetPointer());
+               if(tagName.Equals(L"TEXTAREA",false) == true)
+               {
+                       AppLog("Tagnameseemstobe TEXTAREA");
+               }
+               else if(tagName.Equals(L"INPUT",false) == true)
+               {
+                       AppLog("Tagnameseemstobe INPUT");
+               }
 
-               if (((tagName.CompareTo(L"INPUT") == 0)  || tagName.CompareTo(L"TEXTAREA") == 0) /*&& __isLongPressedDone == true*/ && __currentSelectedStr.CompareTo(L"") !=0)
+               if (((tagName.Equals(L"INPUT",false) == true)  || tagName.Equals(L"TEXTAREA",false) == true) || contenteditable.Equals(L"true",false) == true/*&& __isLongPressedDone == true*/ && __currentSelectedStr.CompareTo(L"") !=0 )
                {
                        AppLog("MainForm::OnWebPageBlockSelected show paste option");
 
-                       InitSelectTextContextMenuF(FloatPoint(endPoint.x,endPoint.y + __pWebViewer->GetY()),true);
-                       __pImageMenu->SetShowState(true);
-                       __pImageMenu->Show();
-                       __pImageMenu->Invalidate(true);
+                       InitSelectTextContextMenuF(FloatPoint(startPoint.x,startPoint.y + __pWebViewer->GetY()),true);
+                       if(__pImageMenu)
+                       {
+                               __pImageMenu->SetShowState(true);
+                               __pImageMenu->Show();
+                               __pImageMenu->Invalidate(true);
+                       }
                }
                else /*if(__isLongPressedDone == true)*/
                {
@@ -4035,10 +4101,13 @@ MainForm::OnWebPageBlockSelected(Web& source, FloatPoint& startPoint, FloatPoint
                                __currentSelectedStr.Clear();
                                __currentSelectedStr = __pHitElementResult->GetUrl();
                        }
-                       InitSelectTextContextMenuF(FloatPoint(endPoint.x,endPoint.y + __pWebViewer->GetY()),false);
-                       __pImageMenu->SetShowState(true);
-                       __pImageMenu->Show();
-                       __pImageMenu->Invalidate(true);
+                       InitSelectTextContextMenuF(FloatPoint(startPoint.x,startPoint.y + __pWebViewer->GetY()),false);
+                       if(__pImageMenu)
+                       {
+                               __pImageMenu->SetShowState(true);
+                               __pImageMenu->Show();
+                               __pImageMenu->Invalidate(true);
+                       }
                }
 
                AppLog("MainForm::OnWebPageBlockSelected block text is %ls",__currentSelectedStr.GetPointer());
@@ -4057,6 +4126,7 @@ MainForm::OnWebPageShowRequested(Tizen::Web::Controls::Web& source)
 Web*
 MainForm::OnWebWindowCreateRequested(void)
 {
+       AppLog("MainForm::OnWebWindowCreateRequested entered");
        WindowInfo* pNewWindowInfo = MultipleWindowPresentationModel::GetInstance()->CreateNewMainViewSceneN();
 
        if (pNewWindowInfo == null)
@@ -4094,12 +4164,104 @@ MainForm::OnWebWindowCreateRequested(void)
 }
 
 void
+MainForm::OnWebWindowCloseRequested(Tizen::Web::Controls::Web& source)
+{
+       AppLog("OnWebWindowCloseRequested");
+       ArrayList* pAllWindowList = MultipleWindowPresentationModel::GetInstance()->GetAllWindowArrayList();
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       WindowInfo* pWindowInfo = null;
+       WindowInfo* pNewWindowInfo = null;
+       int totalCount = 0;
+       UiApp* pApp = null;
+       result r = E_FAILURE;
+
+       if (pAllWindowList != null)
+       {
+               totalCount = pAllWindowList->GetCount();
+       }
+
+       for (int count = 0; count < totalCount; count++)
+       {
+               pWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(count));
+
+               if (__pWindowInfo != null && pWindowInfo != null && __pWindowInfo->sceneID == pWindowInfo->sceneID)
+               {
+                       r = SceneRegister::DestroyAndUnRegisterScene(__pWindowInfo->sceneID);
+                       r = pAllWindowList->RemoveAt(count, true);
+
+                       Form* pCurrentForm = null;
+                       if(SceneManager::GetInstance()->GetCurrentScene() != null)
+                               pCurrentForm = (SceneManager::GetInstance()->GetCurrentScene()->GetForm());
+                       if (pCurrentForm)
+                       {
+                               pCurrentForm->SendUserEvent(UPDATE_MAINFORM_FOOTER_ON_WINDOWCLOSED, null);
+                       }
+
+                       if (pAllWindowList->GetCount() > 0)
+                       {
+                               pNewWindowInfo = null;
+                               pNewWindowInfo = dynamic_cast< WindowInfo* >(pAllWindowList->GetAt(pAllWindowList->GetCount() - 1));
+                       }
+                       else
+                       {
+                               WindowInfo* pNewWindowInfo = MultipleWindowPresentationModel::GetInstance()->CreateNewMainViewSceneN();
+
+                               if (pNewWindowInfo == null)
+                               {
+                                       return;
+                               }
+                               result r = E_SUCCESS;
+                               SceneManager* pSceneManager = SceneManager::GetInstance();
+                               if (pSceneManager == NULL)
+                               {
+                                       return;
+                               }
+                               ArrayList* pArgList = new(std::nothrow) ArrayList();
+                               if (pArgList == NULL)
+                               {
+                                       return;
+                               }
+                               r = pArgList->Construct();
+                               if (r == E_SUCCESS)
+                               {
+                                       pArgList->Add(*pNewWindowInfo);
+                                       result r = pSceneManager->GoForward(ForwardSceneTransition(pNewWindowInfo->sceneID, SCENE_TRANSITION_ANIMATION_TYPE_NONE),pArgList);
+                                       if (pArgList != null)
+                                       {
+                                               delete pArgList;
+                                               pArgList = null;
+                                       }
+                                       if(IsFailed(r))
+                                       {
+                                               AppLogDebug("MultipleWindowForm::OnActionPerformed GoForward failed %s",GetErrorMessage(r));
+                                               return;
+                                       }
+                               }
+
+                               pApp = UiApp::GetInstance();
+                               if (pApp != null)
+                               {
+                                       r = pApp->GetFrameAt(0)->SetShowMode(FRAME_SHOW_MODE_MINIMIZED);
+                                       return;
+                               }
+                       }
+                       r = pSceneManager->GoForward(ForwardSceneTransition(pNewWindowInfo->sceneID ,SCENE_TRANSITION_ANIMATION_TYPE_NONE,SCENE_HISTORY_OPTION_ADD_HISTORY,SCENE_DESTROY_OPTION_DESTROY));
+
+                       break;
+               }
+
+       }
+
+
+}
+
+void
 MainForm::RelayoutControls(bool showAddressbar,bool relayoutFooter)
 {
        AppLog("xyz:: MainForm::RelayoutControls called");
        __webControlPosition.y = 0;
        __webControlHeight = GetClientAreaBounds().height;
-       AppLog("Client area height: %d", __webControlHeight);
+       AppLog("Client area height: %d width %d", __webControlHeight,GetClientAreaBounds().width);
 
        AppLog("Client area height: %d", __webControlHeight);
        if(__pAddressbar != null && __pAddressbar->GetShowState() == true)
@@ -4120,15 +4282,17 @@ MainForm::RelayoutControls(bool showAddressbar,bool relayoutFooter)
                __webControlHeight -= __pFooterPanel->GetHeight();
 
                __pFooterPanel->SetBounds(0, __webControlPosition.y + __webControlHeight, GetClientAreaBounds().width, __pFooterPanel->GetHeight());
+               __webControlHeight = __webControlHeight + 12;
        }
        if (__pWebViewer != null && __pWebViewer->GetShowState() == true)
        {
-               if(__pWebViewer->GetX() == 0 && __pWebViewer->GetY() == __webControlPosition.y &&__pWebViewer->GetWidth() == GetClientAreaBounds().width &&__pWebViewer->GetHeight() == __webControlHeight + 12 )
+               if(__pWebViewer->GetX() == 0 && __pWebViewer->GetY() == __webControlPosition.y &&__pWebViewer->GetWidth() == GetClientAreaBounds().width &&__pWebViewer->GetHeight() == __webControlHeight )
                {
                }
                else
                {
-                       __pWebViewer->SetBounds(0, __webControlPosition.y, GetClientAreaBounds().width, __webControlHeight + 12);
+                       __pWebViewer->SetBounds(0, __webControlPosition.y, GetClientAreaBounds().width, __webControlHeight );
+                       AppLog("xyz:: MainForm::RelayoutControls called __webControlHeight %d",__webControlHeight);
                        __pWebViewer->Invalidate(false);
                }
        }
@@ -4247,8 +4411,12 @@ MainForm::StartWordSearch()
 
        __pFindWordPrev->SetEnabled(false);
        String *pCountStr = null;
-       result r = __pWebViewer->SearchTextAllAsync(__currentSearchStr, false);
-       AppLog("Search Result %s",GetErrorMessage(r));
+       if (__pWebViewer)
+       {
+               result r = __pWebViewer->SearchTextAllAsync(__currentSearchStr, false);
+               AppLog("Search Result %s",GetErrorMessage(r));
+       }
+
        /*__pWebViewer->EvaluateJavascriptN(L"document.body.textContent.match(/"  + __currentSearchStr + "/gi).length;");
        if (pCountStr != null)
        {
@@ -4266,21 +4434,38 @@ void MainForm::OnTextFound(int totalCount, int currentOrdinal)
        AppLog("MainForm::OnTextFound totalCount %d",totalCount);
        AppLog("MainForm::OnTextFound currentOrdinal %d",currentOrdinal);
 
-       if(totalCount == -1 || totalCount == 0)
+       if(totalCount <= 9)
        {
-               __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),84,__pFindWordCountLabel->GetHeight());
-               __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),214+80,__pFindWordEditField->GetHeight());
-//             return;
+               if (__pFindWordCountLabel)
+               {
+                       __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),84,__pFindWordCountLabel->GetHeight());
+               }
+               if (__pFindWordEditField)
+               {
+                       __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),214+80,__pFindWordEditField->GetHeight());
+               }
        }
-       else if(totalCount > 100)
+       else if(totalCount >= 100)
        {
-               __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),124,__pFindWordCountLabel->GetHeight());
-               __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),174,__pFindWordEditField->GetHeight());
+               if (__pFindWordCountLabel)
+               {
+                       __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),124,__pFindWordCountLabel->GetHeight());
+               }
+               if (__pFindWordEditField)
+               {
+                       __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),174,__pFindWordEditField->GetHeight());
+               }
        }
        else
        {
-               __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),124,__pFindWordCountLabel->GetHeight());
-               __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),174,__pFindWordEditField->GetHeight());
+               if (__pFindWordCountLabel)
+               {
+                       __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),124,__pFindWordCountLabel->GetHeight());
+               }
+               if (__pFindWordEditField)
+               {
+                       __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),174,__pFindWordEditField->GetHeight());
+               }
        }
 
        __maxOccurrances = totalCount;
@@ -4308,7 +4493,7 @@ void MainForm::OnTextFound(int totalCount, int currentOrdinal)
                return;
        }
 
-       if (totalCount == 1)
+       if (totalCount == 1 || totalCount == currentOrdinal)
        {
                __pFindWordNext->SetEnabled(false);
        }
@@ -4327,16 +4512,20 @@ void MainForm::OnTextFound(int totalCount, int currentOrdinal)
        __pFindWordCountLabel->Invalidate(false);
        __pFindWordCountLabel->Invalidate(false);
        }
-       else if(__pFindWordCountLabelRightToLeft && __pFindWordCountLabelRightToLeft->GetShowState() == true)
+       else if (__pFindWordCountLabelRightToLeft && __pFindWordCountLabelRightToLeft->GetShowState() == true)
        {
                __pFindWordCountLabelRightToLeft->SetText(countStr);
                __pFindWordCountLabelRightToLeft->Invalidate(false);
                __pFindWordCountLabelRightToLeft->Invalidate(false);
        }
-       //FindNextWord(true);
-       //Update the controls
-       __pFindWordNext->Invalidate(false);
-       __pFindWordPrev->Invalidate(false);
+       if (__pFindWordNext)
+       {
+               __pFindWordNext->Invalidate(false);
+       }
+       if (__pFindWordPrev)
+       {
+               __pFindWordPrev->Invalidate(false);
+       }
 
 }
 
@@ -4408,7 +4597,7 @@ void
 MainForm::OnWebKeypadWillOpen(Tizen::Web::Controls::Web& source)
 {
        AppLog("xyz::MainForm::OnWebKeypadWillOpen");
-       __isWebKeypadOpened = true;
+       __isKeypadOpened = true;
        __pFooterPanel->SetShowState(false);
        //      OnAddressBarKeypadOpened(*__pAddressbar);
 }
@@ -4416,7 +4605,7 @@ MainForm::OnWebKeypadWillOpen(Tizen::Web::Controls::Web& source)
 void
 MainForm::OnWebKeypadOpened(Tizen::Web::Controls::Web& source)
 {
-       __isWebKeypadOpened = true;
+       __isKeypadOpened = true;
        AppLog("xyz::MainForm::OnWebKeypadOpened");
 
        if(__pFindWordControl && __pFindWordControl->GetShowState() == true)
@@ -4459,12 +4648,33 @@ MainForm::OnWebKeypadOpened(Tizen::Web::Controls::Web& source)
 void
 MainForm::OnWebKeypadClosed(Tizen::Web::Controls::Web& source)
 {
+       AppLog("abcde::MainForm::OnWebKeypadClosed");
        AppLog("xyz::MainForm::OnWebKeypadClosed");
        AppLog("akjshdasd 4");
        __pFooterPanel->SetShowState(true);
 //     OnAddressBarKeypadClosed(*__pAddressbar);
        RelayoutControls(false);
-       __isWebKeypadOpened = false;
+       __isKeypadOpened = false;
+
+
+       if(__pImageMenu && __pImageMenu->GetShowState() == true)
+       {
+               AppLog("abcde: imagemenu visible.");
+               Point p(0,0);
+               Point q(0,0);
+               __pWebViewer->GetBlockRange(p,q);
+               if (p == Point(0,0) && q == Point(0,0))
+                       return;
+               if(p.y < 150)
+               {
+                       p.y = p.y + 100;
+
+               }
+
+               __pImageMenu->SetAnchorPosition(p);
+               __pImageMenu->Show();
+               Invalidate(true);
+       }
 }
 
 void
@@ -4500,12 +4710,16 @@ MainForm::OnTouchDoublePressed(const Control& source, const Point& currentPositi
 
 void MainForm::OnTouchLongPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
 {
-       AppLog("abcde::MainForm::OnTouchLongPressed %d, %d" ,currentPosition.x,currentPosition.y);
-       if(TouchEventManager::GetInstance()->GetTouchInfoListN()->GetCount() >1)
+       AppLog("LMN::abcde::MainForm::OnTouchLongPressed %d, %d" ,currentPosition.x,currentPosition.y);
+       if(TouchEventManager::GetInstance() && TouchEventManager::GetInstance()->GetTouchInfoListN() && TouchEventManager::GetInstance()->GetTouchInfoListN()->GetCount() >1)
        {
                AppLog("Returning because of more than one touch point.");
                return;
        }
+//     if(__pWebViewer)
+//             __pWebViewer->ReleaseBlock();
+       if(__pWebViewer)
+               __pWebViewer->SetFocus();
        __longPressPoint = currentPosition;
 
        if (__pHitElementResult != null)
@@ -4528,13 +4742,18 @@ void MainForm::OnTouchLongPressed(const Tizen::Ui::Control& source, const Tizen:
        if (__pHitElementResult->HasImage() == true)
        {
                if(__pWebViewer != null)
+               {
+                       __pWebViewer->ReleaseBlock();//N_SE-52389
                        InitImageContextMenu(Point(currentPosition.x,currentPosition.y + __pWebViewer->GetY()));
+               }
                __pImageMenu->SetShowState(true);
                __pImageMenu->Show();
                __pImageMenu->Invalidate(true);
        }
        else if(__pHitElementResult->HasUrl() == true)
        {
+               if(__pWebViewer != null)
+                       __pWebViewer->ReleaseBlock();//N_SE-52389
                String tempURl = __pHitElementResult->GetUrl();
                AppLog("tempURl is %ls", tempURl.GetPointer());
                const Bitmap* pBitmap = __pHitElementResult->GetImage();
@@ -4557,7 +4776,7 @@ void MainForm::OnTouchLongPressed(const Tizen::Ui::Control& source, const Tizen:
                String type = __pHitElementResult->GetAttributeValue("type");
                String value = __pHitElementResult->GetAttributeValue(L"value");
                String innerHtml = __pHitElementResult->GetAttributeValue(L"innerHTML");
-
+               result r = E_FAILURE;
                __currentSelectedStr.Clear();
                __currentSelectedStr = __pWebViewer->GetTextFromBlock();
 
@@ -4566,9 +4785,10 @@ void MainForm::OnTouchLongPressed(const Tizen::Ui::Control& source, const Tizen:
 
 
 
-               //__isLongPressedDone = true;
-               result r =__pWebViewer->SetBlockSelectionPosition(currentPosition);
-               if (((tagName.CompareTo(L"INPUT") == 0)  || tagName.CompareTo(L"TEXTAREA") == 0) && innerHtml.GetLength() == 0 /*&& __isWebKeypadOpened == true*/ && __currentSelectedStr.CompareTo(L"") == 0 && r == E_INVALID_ARG)
+               __isLongPressedDone = true;
+               if( type.Equals(L"submit",false) !=true && type.Equals(L"checkbox",false) !=true && type.Equals(L"range",false) !=true && type.Equals(L"file",false) !=true)
+                       r =__pWebViewer->SetBlockSelectionPosition(currentPosition);
+               if (((tagName.Equals(L"INPUT",false) == true)  || tagName.Equals(L"TEXTAREA",false) == true) && innerHtml.GetLength() == 0  && type.Equals(L"submit",false) !=true && type.Equals(L"checkbox",false) !=true && type.Equals(L"range",false) !=true  && type.Equals(L"file",false) !=true/*&& __isWebKeypadOpened == true*/ && __currentSelectedStr.Equals(L"",false) == true && r == E_INVALID_ARG)
                {
                        AppLog("MainForm::OnWebPageBlockSelected show paste option");
 
@@ -4595,7 +4815,7 @@ MainForm::OnTouchReleased(const Tizen::Ui::Control& source, const Tizen::Graphic
        {
                __pAddressbar->SetShowState(false);
        }
-       if(__pFooterPanel && __isWebKeypadOpened == false)
+       if(__pFooterPanel && __isKeypadOpened == false)
        {
                __pFooterPanel->SetShowState(true);
        }
@@ -4647,16 +4867,17 @@ MainForm::OnTouchReleased(Tizen::Ui::Control& source, const Tizen::Ui::TouchEven
                __pFindWordNext->SetEnabled(false);
                __pFindWordPrev->SetEnabled(false);
 
-               __pWebViewer->SearchText(L"aaaabbbbcccc",true);
+               __pWebViewer->SearchTextAllAsync(L"",true);
                __pFindWordControl->SetShowState(false);
        }
+       AppLog("__pAddressbar->GetShowState() %d",__pAddressbar->GetShowState());
        if(__pAddressbar->GetShowState() == false)
        {
                __pAddressbar->SetAddressbarURLFocus();
                __pFooterPanel->SetShowState(false);
        }
 
-       return true;
+       return false;
 }
 
 bool
@@ -4705,6 +4926,20 @@ MainForm::OnOrientationChanged (const Tizen::Ui::Control &source, Tizen::Ui::Ori
 
 //     if(__pFindWordControl != null)
 //             ShowFindWordPanel(__pFindWordControl->GetShowState(), false);
+
+       if(__pOptionMenu && __pOptionMenu->GetShowState() == true)
+       {
+               if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
+               {
+                       AppLog(" Orientation landscape");
+                       __pOptionMenu->SetMaxVisibleItemsCount(5);
+               }
+               else
+               {
+                       AppLog(" Orientation potrait");
+                       __pOptionMenu->SetMaxVisibleItemsCount(6);
+               }
+       }
        if(__pNotification && __pNotification->GetShowState() == true)
        {
                __pNotification->SetShowState(false);
@@ -4742,8 +4977,8 @@ MainForm::OnOrientationChanged (const Tizen::Ui::Control &source, Tizen::Ui::Ori
        }
 
 
-       if(__pOptionMenu != null)
-               __pOptionMenu->SetShowState(false);
+//     if(__pOptionMenu != null)
+//             __pOptionMenu->SetShowState(false);
 
        if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
        {
@@ -4842,6 +5077,7 @@ MainForm::OnSettingsChange(int settingvalue)
                        settings.SetAutoFittingEnabled(false);
                }
                __pWebViewer->SetSetting(settings);
+
        }
        else if (settingvalue == (int) REGISTRY_SETTING_RUN_JAVASCRIPT)
        {
@@ -5031,7 +5267,7 @@ MainForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics
                AppLog("MainForm::OnTouchPressed %d",__pFindWordControl->GetShowState());
 //             ShowFindWordPanel(__pFindWordControl->GetShowState(), true);
        }
-       //__isLongPressedDone = false;
+       __isLongPressedDone = false;
 
 
 
@@ -5088,7 +5324,7 @@ MainForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics
        {
                __pAddressbar->SetShowState(false);
        }
-       if(__pFooterPanel && __isWebKeypadOpened == false)
+       if(__pFooterPanel && __isKeypadOpened == false)
        {
                __pFooterPanel->SetShowState(true);
        }
@@ -5099,8 +5335,9 @@ MainForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics
 void
 MainForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
 {
+       AppLog("LMN::MainForm::OnTouchMoved entered");
 //     __currentWordIndex = 0;
-       //__isLongPressedDone = false;
+       __isLongPressedDone = false;
 
 }
 
@@ -5132,7 +5369,10 @@ MainForm::OnTextValueChanged (const Tizen::Ui::Control &source)
                }
                else
                {
-                       __pFindWordCountLabel->SetShowState(false);
+//                     __pFindWordCountLabel->SetShowState(false);
+                       __pFindWordCountLabel->SetBounds(__pFindWordCountLabel->GetX(),__pFindWordCountLabel->GetY(),84,__pFindWordCountLabel->GetHeight());
+                       __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),214+80,__pFindWordEditField->GetHeight());
+
                }
                __pFindWordNext->SetEnabled(false);
                __pFindWordPrev->SetEnabled(false);
@@ -5191,7 +5431,7 @@ MainForm::InitMostVisitedSitesView(Tizen::Ui::OrientationStatus orientationStatu
        result r = E_SUCCESS;
 
 
-       if (__pWebViewer != null && __pMostVisitedListView != null)
+       if (__pMostVisitedListView != null)
        {
                return E_SUCCESS;
        }
@@ -5304,20 +5544,21 @@ void MainForm::UpdateImageContent(ByteBuffer* aBuffer, String imageName)
        contentPath.Append(imageName);
        contentPath.Append(".jpg");
        contentId = contentManager.CreateContent(*aBuffer, contentPath);
-       ShowIndicatorNotification(L"Download Complete");
+       ShowIndicatorNotification(L"Download Complete",contentPath);
        AppLog("Content manager update content result %s" ,GetErrorMessage(GetLastResult()));
 }
 
 void
-MainForm::ShowIndicatorNotification(const String& messageText)
+MainForm::ShowIndicatorNotification(const String& messageText, const String& contentPath)
 {
        AppLogDebug("ENTER");
 
        NotificationRequest request;
        request.SetAlertText(messageText);
        request.SetTitleText(L"");
-       request.SetAppMessage(L"AppMessage");
-
+       request.SetAppMessage(contentPath);
+       request.SetOngoingActivityType(ONGOING_ACTIVITY_TYPE_TEXT);
+       request.SetNotificationStyle(NOTIFICATION_STYLE_THUMBNAIL);
        Tizen::App::App* pApp = Tizen::App::App::GetInstance();
        String homePath = pApp->GetAppRootPath();
        String iconPath = homePath + L"res/screen-density-xhigh/Notification_download_complete.png";
@@ -5326,8 +5567,7 @@ MainForm::ShowIndicatorNotification(const String& messageText)
 
        Tizen::Shell::NotificationManager notiMgr;
        notiMgr.Construct();
-       notiMgr.Notify(request);
-
+       notiMgr.NotifyOngoingActivity(request);
        AppLogDebug("EXIT: %s", GetErrorMessage(GetLastResult()));
        return;
 }
@@ -5611,12 +5851,21 @@ void MainForm::OnSharePopupControlStarted(void)
 void
 MainForm::OnUserEventReceivedN (RequestId requestId, Tizen::Base::Collection::IList *pArgs)
 {
-       if (requestId == BACK_GROUND_APP_EVENT)
+       if (requestId == UPDATE_MAINFORM_FOOTER_ON_WINDOWCLOSED)
+       {
+               AppLog("OnWebWindowCloseRequested mainform test 1 OnUserEventReceivedN");
+               InitFooter();
+       }
+       else if (requestId == BACK_GROUND_APP_EVENT)
        {
                if(__pWebViewer != null)
                {
                        __pWebViewer->Pause();
                }
+               if(__pImageMenu)
+               {
+                       __pImageMenu->SetShowState(false);
+               }
                if(__pAddressbar != null)
                {
                        __pAddressbar->SendUserEvent(BACK_GROUND_APP_EVENT,NULL);
@@ -5666,7 +5915,7 @@ MainForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source)
 {
        AppLog("MainForm::OnFormMenuRequested called");
        InitOptionMenu();
-       if (__pWindowInfo != NULL && __pWindowInfo->pageUrl != NULL && __pWebViewer->GetShowState() == true)
+       if (__pWindowInfo != NULL && __pWindowInfo->pageUrl != NULL && __pWebViewer && __pWebViewer->GetShowState() == true)
        {
                int bookmarkCount=0;
                bool exist = false;
@@ -5676,7 +5925,7 @@ MainForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source)
                result r = E_SUCCESS;
                Bitmap* pBitmap = null;
                String lastChar = L"";
-               if(url.SubString(url.GetLength()-1,lastChar));
+//             if(url.SubString(url.GetLength()-1,lastChar));
 //             if(lastChar == L"/")
 //             {
 //                     bool exist1 = false;
@@ -5730,7 +5979,7 @@ MainForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source)
                        __pOptionMenu->InsertItemAt(4,CommonUtil::GetString(L"IDS_BR_OPT_FIND_ON_PAGE_ABB"), IDA_FINDONPAGE_CLICKED);
                        __pOptionMenu->SetMaxVisibleItemsCount(6);
                }
-               if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE)
+               if( GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
                {
                        AppLog(" Orientation landscape");
                        __pOptionMenu->SetMaxVisibleItemsCount(5);
@@ -5745,7 +5994,13 @@ MainForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source)
                delete pBitmap;
        }
        AppLogDebug("ONACTION_PERFORMED:IDA_MOREBTN_CLICKED end");
-       __pOptionMenu->SetShowState(true);
+       if(__pAddressbar)
+               __pAddressbar->SetShowState(false);
+       SetFocus();
+       __pFooterPanel->SetShowState(true);
+       result r = __pOptionMenu->SetShowState(true);
+       AppLog("ajsghd %s",GetErrorMessage(r));
+       RelayoutControls(false);
        __pOptionMenu->Invalidate(true);
        __pOptionMenu->Show();