webengine/osswebengine/WebKit/s60/misc/WebTabbedNavigation.cpp
changeset 10 a359256acfc6
parent 5 10e98eab6f85
child 15 60c5402cb945
equal deleted inserted replaced
5:10e98eab6f85 10:a359256acfc6
   105 {
   105 {
   106     if (handleSelectElementScrolling(m_webView, verticalDir)) {
   106     if (handleSelectElementScrolling(m_webView, verticalDir)) {
   107         StaticObjectsContainer::instance()->webCursor()->cursorUpdate(true);
   107         StaticObjectsContainer::instance()->webCursor()->cursorUpdate(true);
   108         return true;
   108         return true;
   109     }
   109     }
       
   110     // DOM can be changed so check if we are still inside the document
       
   111     // If not reset tabbed navigation parameters to the closest point in document.
       
   112     TSize contentSize = m_webView->mainFrame()->frameView()->contentSize();
       
   113     TPoint contentPos = m_webView->mainFrame()->frameView()->contentPos();
       
   114     TRect docRect = TRect(contentPos, contentSize - contentPos);
       
   115     if (!docRect.Contains(m_focusPosition)) {
       
   116         TInt viewW = m_webView->Rect().Width();
       
   117         TInt viewH = m_webView->Rect().Height();
       
   118         if (m_focusPosition.iX > contentSize.iWidth || 
       
   119             m_focusPosition.iX < contentPos.iX) {
       
   120             m_focusPosition.iX = (horizontalDir == -1) ? contentPos.iX + viewW : contentPos.iX;
       
   121         }
       
   122         
       
   123         if (m_focusPosition.iY > contentSize.iHeight || 
       
   124             m_focusPosition.iY < contentPos.iY) {
       
   125             m_focusPosition.iY = (verticalDir == -1) ? contentPos.iY + viewH : contentPos.iY;
       
   126         }
       
   127 
       
   128         m_selectedElementRect.SetRect(m_focusPosition.iX, m_focusPosition.iY, m_focusPosition.iX, m_focusPosition.iY);
       
   129         m_node = NULL;    
       
   130     }
       
   131     
   110     bool ret = m_firstNavigationOnPage;
   132     bool ret = m_firstNavigationOnPage;
   111     Frame* focusedFrame = m_webView->page()->focusController()->focusedFrame();
   133     Frame* focusedFrame = m_webView->page()->focusController()->focusedFrame();
   112     if (focusedFrame == NULL) focusedFrame = m_webView->page()->mainFrame();
   134     if (focusedFrame == NULL) focusedFrame = m_webView->page()->mainFrame();
   113     if (focusedFrame->document()) {
   135     if (focusedFrame->document()) {
   114         Node* focusNode = focusedFrame->document()->focusedNode();
   136         Node* focusNode = focusedFrame->document()->focusedNode();
   186             } // if (n->isFocusable() && n->isElementNode())
   208             } // if (n->isFocusable() && n->isElementNode())
   187         } // for (Node* n = elements->firstItem(); n; n = elements->nextItem())
   209         } // for (Node* n = elements->firstItem(); n; n = elements->nextItem())
   188         f = f->tree()->traverseNext();
   210         f = f->tree()->traverseNext();
   189     } // while ( f )
   211     } // while ( f )
   190     // Remember new selection
   212     // Remember new selection
   191     TPoint contentPos = m_webView->mainFrame()->frameView()->contentPos();
   213     contentPos = m_webView->mainFrame()->frameView()->contentPos();
   192     if (selectedNode) {
   214     if (selectedNode) {
   193         // Found an element to jump to
   215         // Found an element to jump to
   194         m_selectedElementRect = selectedRect;
   216         m_selectedElementRect = selectedRect;
   195         m_focusPosition = selectedPoint;
   217         m_focusPosition = selectedPoint;
   196         m_node = selectedNode;
   218         m_node = selectedNode;