Fixed Nabi Issues: 53721,53372,53761,53768
[apps/osp/Internet.git] / src / IntMainForm.cpp
index 911ae38..f134e21 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";
@@ -474,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))
@@ -985,6 +986,10 @@ MainForm::InitSelectTextContextMenuF(FloatPoint p, bool pasteOption, bool onlyPa
                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 )
@@ -1336,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);
                }
        }
 
@@ -1413,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)
@@ -2465,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
@@ -2503,15 +2509,33 @@ 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* pCount = __pWebViewer->EvaluateJavascriptN(str);
+                       String* pNameCount = __pWebViewer->EvaluateJavascriptN(str);
+
+                       str.Clear();
+                       str = L"document.getElementsByName('";
+                       str.Append(nameElement);
+                       str.Append("').length");
+                       String* pClassCount = __pWebViewer->EvaluateJavascriptN(str);
 
                        String script;
-                       if(idElement.GetLength() != 0)
+                       if(contenteditable.Equals(L"true",false) == true)
+                       {
+                               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(idElement.GetLength() != 0)
                        {
                                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('");
@@ -2521,7 +2545,17 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                                script.Append(*pString);
                                script.Append("\");");
                        }
-                       else if (nameElement.GetLength() != 0 && pCount->Equals("1",false) == true)
+                       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('");
@@ -2533,10 +2567,9 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                        }
                        else if(tagElement.GetLength() != 0) //adding for twitter post page
                        {
-                               script = L"function insertAtCursor(myField, myValue) {  if (document.selection) {   document.getElementsByTagName(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.getElementsByTagName(myField)[0].value += myValue;   }  } ";
-                               script.Append("insertAtCursor(document.getElementsByTagName('");
-                               script.Append(tagElement);
-                               script.Append("')[0],");
+                               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("\");");
@@ -2544,9 +2577,12 @@ MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                        AppLog("MainForm::OnTouchLongPressed script is %ls",script.GetPointer());
                        String* pStr = __pWebViewer->EvaluateJavascriptN(script);
                        delete pStr;
-                       delete pCount;
+                       delete pNameCount;
+                       delete pClassCount;
                }
                delete pItem;
+               if(__pWebViewer)
+                       __pWebViewer->ReleaseBlock();
        }
        break;
        case IDA_GO_BACK:
@@ -2571,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);
                }
 
@@ -2913,6 +2950,8 @@ MainForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
 
        RelayoutControls(false);
        AppLog("ABC: OnSceneActivatedN started exit");
+       if(__pWebViewer)
+               AppLog("WebControl's width height %d %d,",__pWebViewer->GetWidth(),__pWebViewer->GetHeight());
 
 }
 
@@ -2949,11 +2988,14 @@ 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)
@@ -3084,7 +3126,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);
@@ -3098,7 +3140,6 @@ MainForm::OnLoadingCanceled(void)
 
 }
 
-
 void
 MainForm::OnKeypadWillOpen(Tizen::Ui::Control& source)
 {
@@ -3112,7 +3153,7 @@ MainForm::OnKeypadOpened(Tizen::Ui::Control& source)
        AppLog("XYZ::MainForm::OnKeypadOpened");
        __isKeypadOpened = true;
        __pFooterPanel->SetShowState(false);
-
+       RelayoutControls(false);
 }
 
 void
@@ -3155,6 +3196,8 @@ MainForm::OnLoadingCompleted(void)
                return;
        }
 
+       if(__pWindowInfo && __pWebViewer)
+               __pWindowInfo->pageTitle = __pWebViewer->GetTitle();
        if(__pImageMenu && __pImageMenu->GetShowState())
        {
                __pImageMenu->SetShowState(false);
@@ -3219,7 +3262,6 @@ MainForm::OnLoadingCompleted(void)
                                __pHistory->SetFavIconBitmap(*pTempBitmap);
                        }
 
-                       AppLog("MainForm::OnLoadingCompleted setting the fav icon 2");
                }
 
                Canvas* pCanvas = __pWebViewer->GetCanvasN();
@@ -3233,6 +3275,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;
                }
@@ -3419,7 +3468,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));
                }
        }
@@ -3444,6 +3493,11 @@ MainForm::OnFocusGained(const Tizen::Ui::Control& source)
                __pFooterPanel->SetShowState(false);
        }
 
+       if(__pWebViewer)
+       {
+               __pWebViewer->ReleaseBlock();
+       }
+
        if(__pAddressbar)
        {
                __pAddressbar->SetShowState(true);
@@ -3969,7 +4023,7 @@ 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;
 
@@ -4005,6 +4059,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());
@@ -4021,7 +4076,7 @@ MainForm::OnWebPageBlockSelected(Web& source, FloatPoint& startPoint, FloatPoint
                        AppLog("Tagnameseemstobe INPUT");
                }
 
-               if (((tagName.Equals(L"INPUT",false) == true)  || tagName.Equals(L"TEXTAREA",false) == true) /*&& __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");
 
@@ -4105,12 +4160,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)
@@ -4283,7 +4430,7 @@ 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)
        {
                if (__pFindWordCountLabel)
                {
@@ -4294,7 +4441,7 @@ void MainForm::OnTextFound(int totalCount, int currentOrdinal)
                        __pFindWordEditField->SetBounds(__pFindWordEditField->GetX(),__pFindWordEditField->GetY(),214+80,__pFindWordEditField->GetHeight());
                }
        }
-       else if(totalCount > 100)
+       else if(totalCount >= 100)
        {
                if (__pFindWordCountLabel)
                {
@@ -4514,6 +4661,11 @@ MainForm::OnWebKeypadClosed(Tizen::Web::Controls::Web& source)
                __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();
@@ -4554,12 +4706,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);
+       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)
@@ -4582,13 +4738,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();
@@ -4611,7 +4772,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();
 
@@ -4621,8 +4782,9 @@ void MainForm::OnTouchLongPressed(const Tizen::Ui::Control& source, const Tizen:
 
 
                __isLongPressedDone = true;
-               result 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"range",false) !=true/*&& __isWebKeypadOpened == true*/ && __currentSelectedStr.Equals(L"",false) == true && r == E_INVALID_ARG)
+               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");
 
@@ -4911,6 +5073,7 @@ MainForm::OnSettingsChange(int settingvalue)
                        settings.SetAutoFittingEnabled(false);
                }
                __pWebViewer->SetSetting(settings);
+
        }
        else if (settingvalue == (int) REGISTRY_SETTING_RUN_JAVASCRIPT)
        {
@@ -5168,6 +5331,7 @@ 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;
 
@@ -5263,7 +5427,7 @@ MainForm::InitMostVisitedSitesView(Tizen::Ui::OrientationStatus orientationStatu
        result r = E_SUCCESS;
 
 
-       if (__pWebViewer != null && __pMostVisitedListView != null)
+       if (__pMostVisitedListView != null)
        {
                return E_SUCCESS;
        }
@@ -5683,7 +5847,12 @@ 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)
                {