webengine/osswebengine/WebKit/s60/webview/WebFrameView.cpp
branchRCL_3
changeset 49 919f36ff910f
parent 48 79859ed3eea9
equal deleted inserted replaced
48:79859ed3eea9 49:919f36ff910f
    24 #include "WebCursor.h"
    24 #include "WebCursor.h"
    25 #include "WebFrameBridge.h"
    25 #include "WebFrameBridge.h"
    26 #include "WebCoreGraphicsContext.h"
    26 #include "WebCoreGraphicsContext.h"
    27 #include "GraphicsContext.h"
    27 #include "GraphicsContext.h"
    28 #include "PlatformScrollbar.h"
    28 #include "PlatformScrollbar.h"
    29 #include "pagescaler.h"
    29 #include "PageScaler.h"
    30 #include "WebKitLogger.h"
    30 #include "webkitlogger.h"
    31 #include "BrCtl.h"
    31 #include "BrCtl.h"
    32 #include "SettingsContainer.h"
    32 #include "SettingsContainer.h"
    33 #include "StaticObjectsContainer.h"
    33 #include "StaticObjectsContainer.h"
    34 #include "WebTabbedNavigation.h"
    34 #include "WebTabbedNavigation.h"
       
    35 #include "WebPagePinchZoomHandler.h"
       
    36 #include "FocusController.h"
       
    37 #include "Frame.h"
       
    38 #include "page.h"
    35 
    39 
    36 using namespace WebCore;
    40 using namespace WebCore;
    37 
    41 
    38 WebFrameView::WebFrameView() : 
    42 WebFrameView::WebFrameView() : 
    39       m_parent(NULL),
    43       m_parent(NULL),
    69     return this;
    73     return this;
    70 }
    74 }
    71 
    75 
    72 void WebFrameView::draw(WebCoreGraphicsContext& gc, const TRect& r)
    76 void WebFrameView::draw(WebCoreGraphicsContext& gc, const TRect& r)
    73 {
    77 {
       
    78     if (m_topView->isPinchZoom())  {
       
    79         return;
       
    80     }    
       
    81     
    74     TRect vr(visibleRect());
    82     TRect vr(visibleRect());
    75     TRect rect(r);
    83     TRect rect(r);
    76     if (isScaled() || m_frame->isFrameSet())
    84 
    77         rect.Grow(1,1);             // eliminate rounding errors
       
    78     TRect frameRect(m_frameRect);
    85     TRect frameRect(m_frameRect);
    79 
    86 
    80     rect.Move(-frameRect.iTl);
    87     rect.Move(-frameRect.iTl);
    81     rect.Move(m_contentPos);
    88     rect.Move(m_contentPos);
    82     if (vr.Intersects(rect)) {
    89     if (vr.Intersects(rect)) {
    99             clip.Intersection(t);
   106             clip.Intersection(t);
   100         }
   107         }
   101         
   108         
   102         gc.setClippingRect( clip );
   109         gc.setClippingRect( clip );
   103 
   110 
       
   111 		//Converting To Doc and View co-ordinates calculation will loose 1 px 
       
   112 		//if the scalling is other than default level
       
   113         if (isScaled() || m_frame->isFrameSet())
       
   114                rect.Grow(2,2);             // eliminate rounding errors
   104         // draw frame content
   115         // draw frame content
   105         m_frame->paintRect(gc, rect);
   116         m_frame->paintRect(gc, rect);
   106         gc.cancelClipping();
   117         gc.cancelClipping();
   107         gc.setOrigin( gc.origin() + cpos);
   118         gc.setOrigin( gc.origin() + cpos);
   108         if (m_parent) {
   119         if (m_parent) {
   118             frameClip = TRect(viewCoordsInFrameCoords(frameClip.iTl), viewCoordsInFrameCoords(frameClip.iBr)); 
   129             frameClip = TRect(viewCoordsInFrameCoords(frameClip.iTl), viewCoordsInFrameCoords(frameClip.iBr)); 
   119             frameClip = TRect(toViewCoords(frameClip));
   130             frameClip = TRect(toViewCoords(frameClip));
   120             frameClip.Move(-cpos);
   131             frameClip.Move(-cpos);
   121             gc.setClippingRect( frameClip );
   132             gc.setClippingRect( frameClip );
   122         }
   133         }
       
   134   
   123         // draw frame border
   135         // draw frame border
   124         CFbsBitGc& realgc = gc.gc();
   136         CFbsBitGc& realgc = gc.gc();
   125         if (m_hasBorder && !m_frame->isFrameSet()) {
   137         if (m_hasBorder && !m_frame->isFrameSet()) {
   126             // already moved the origin
   138             // already moved the origin
   127             TRect borderRect(TPoint(-1,-1),toViewCoords(m_frameRect).Size());
   139             TRect borderRect(TPoint(-1,-1),toViewCoords(m_frameRect).Size());
   274 {
   286 {
   275     TSize s(m_frameRect.Size());
   287     TSize s(m_frameRect.Size());
   276     return TRect(m_contentPos, s );
   288     return TRect(m_contentPos, s );
   277 }
   289 }
   278 
   290 
   279 void WebFrameView::scrollTo(const TPoint& aPoint)
   291 void WebFrameView::scrollTo(const TPoint& aPoint, TBool aPluginPause)
   280 {
   292 {
       
   293     
       
   294     if(aPluginPause)
       
   295         m_topView->scrollStatus(ETrue);
       
   296 
   281     if (m_parent) {
   297     if (m_parent) {
   282         // tot:fixme frame scrolling when frame-flat is off
   298         // tot:fixme frame scrolling when frame-flat is off
   283         if (m_frame->isIframe()) {
   299         if (m_frame->isIframe()) {
   284             // iframe, support scrolling
   300             // iframe, support scrolling
   285             if (aPoint != m_contentPos) {
   301             if (aPoint != m_contentPos) {
   286                 TPoint p(nearestPointInFrame(aPoint));
   302                 TPoint p(nearestPointInFrame(aPoint));
   287                 m_contentPos = p;
   303                 m_contentPos = p;
   288                 m_frame->notifyPluginsOfScrolling();
   304                 m_frame->notifyPluginsOfPositionChange();
   289                 m_topView->syncRepaint( TRect(0,0,KMaxTInt/2,KMaxTInt/2) );
   305                 m_topView->syncRepaint( TRect(0,0,KMaxTInt/2,KMaxTInt/2) );
   290             }
   306             }
   291         }
   307         }
   292         else {
   308         else {
   293             if (aPoint.iX==0 && aPoint.iY==0) {
   309             if (aPoint.iX==0 && aPoint.iY==0) {
   318 
   334 
   319             m_topView->scrollBuffer(to, from, copyScroll);
   335             m_topView->scrollBuffer(to, from, copyScroll);
   320             m_contentPos = p;
   336             m_contentPos = p;
   321 
   337 
   322             
   338             
   323             m_frame->notifyPluginsOfScrolling();
   339             m_frame->notifyPluginsOfPositionChange();
   324             
   340             
   325             
   341             
   326             if( m_topView->pageScaler() && m_topView->pageScaler()->Visible())
   342             if( m_topView->pageScaler() && m_topView->pageScaler()->Visible())
   327                 m_topView->pageScaler()->DocumentViewportMoved();
   343                 m_topView->pageScaler()->DocumentViewportMoved();
   328 
   344 
   403         checkScrollbarVisibility();
   419         checkScrollbarVisibility();
   404         
   420         
   405         //maybe the content got smaller and we need to scroll back to view?
   421         //maybe the content got smaller and we need to scroll back to view?
   406         TPoint p( nearestPointInFrame(m_contentPos) );
   422         TPoint p( nearestPointInFrame(m_contentPos) );
   407         if (p!=m_contentPos)
   423         if (p!=m_contentPos)
       
   424         	{ 
   408             // this will also update scrollbars is necessary
   425             // this will also update scrollbars is necessary
   409             scrollTo(p);
   426             scrollTo(p);
       
   427         	} 
   410         else if (!m_parent) {
   428         else if (!m_parent) {
   411             // top level
   429             // top level
   412             m_topView->updateScrollbars(m_contentSize.iHeight, m_contentPos.iY, m_contentSize.iWidth, m_contentPos.iX);
   430             m_topView->updateScrollbars(m_contentSize.iHeight, m_contentPos.iY, m_contentSize.iWidth, m_contentPos.iX);
   413         }
   431         }
   414     }
   432     }
       
   433     moveFocus();
       
   434 }
       
   435 
       
   436 void WebFrameView::moveFocus()
       
   437 {
       
   438     // After resizing, move the focus to the correct node
       
   439 	if (m_topView && m_topView->focusedElementType() == TBrCtlDefs::EElementAnchor &&
       
   440         m_topView->brCtl()->settings()->getNavigationType() == SettingsContainer::NavigationTypeTabbed) { 
       
   441     	Frame* mainFrame = core(m_topView->mainFrame());
       
   442         FocusController* focusController = m_topView->page()->focusController();
       
   443         Frame* focusedFrame = focusController->focusedOrMainFrame();
       
   444         if (focusedFrame == NULL) {
       
   445 	 	    focusedFrame = mainFrame;
       
   446         }
       
   447         Node* node = focusedFrame->document()->focusedNode();
       
   448 	 	if (node) {
       
   449             TRect rect = node->getRect().Rect();
       
   450             TPoint viewPoint = kit(focusedFrame)->frameView()->frameCoordsInViewCoords(rect.iTl);
       
   451             WebCursor* cursor = StaticObjectsContainer::instance()->webCursor();
       
   452             cursor->setPosition(viewPoint);
       
   453 	 	}
       
   454 	 }
   415 }
   455 }
   416 
   456 
   417 void WebFrameView::setMayUseCopyScroll(TBool aCopy)
   457 void WebFrameView::setMayUseCopyScroll(TBool aCopy)
   418 {
   458 {
   419     m_mayUseCopyScroll = aCopy;
   459     m_mayUseCopyScroll = aCopy;