webengine/osswebengine/WebKit/s60/webview/WebView.cpp
branchRCL_3
changeset 40 8bfb9186a8b8
parent 38 4917f9bf7995
child 41 4bd5176e1bc8
equal deleted inserted replaced
38:4917f9bf7995 40:8bfb9186a8b8
    98 #include "eikon.hrh"
    98 #include "eikon.hrh"
    99 #include "WebScrollbarDrawer.h"
    99 #include "WebScrollbarDrawer.h"
   100 #include "EventNames.h"
   100 #include "EventNames.h"
   101 #include "Editor.h"
   101 #include "Editor.h"
   102 #include "ThumbnailGenerator.h"
   102 #include "ThumbnailGenerator.h"
       
   103 #include <kjs_window.h>
   103 
   104 
   104 using namespace WebCore;
   105 using namespace WebCore;
   105 using namespace EventNames;
   106 using namespace EventNames;
   106 
   107 
   107 const int KRepaintDelayLoading = 500*1000; // dont do repaints more often than this during loading (0.5s)
   108 const int KRepaintDelayLoading = 500*1000; // dont do repaints more often than this during loading (0.5s)
   215 , m_checkerBoardBitmap(NULL)
   216 , m_checkerBoardBitmap(NULL)
   216 , m_checkerBoardDevice(NULL)
   217 , m_checkerBoardDevice(NULL)
   217 , m_checkerBoardGc(NULL)
   218 , m_checkerBoardGc(NULL)
   218 , m_checkerBoardDestroyTimer(NULL)
   219 , m_checkerBoardDestroyTimer(NULL)
   219 , m_isPinchZoomOut(false)
   220 , m_isPinchZoomOut(false)
       
   221 , m_jsTimeouts(0)
   220 {
   222 {
   221 }
   223 }
   222 
   224 
   223 WebView::~WebView()
   225 WebView::~WebView()
   224 {
   226 {
   272     delete m_thumbnailGenerator;    
   274     delete m_thumbnailGenerator;    
   273     
   275     
   274     destroyCheckerBoard();
   276     destroyCheckerBoard();
   275     delete m_checkerBoardDestroyTimer;
   277     delete m_checkerBoardDestroyTimer;
   276     
   278     
       
   279     if (StaticObjectsContainer::instance()->webSurface()->topView() == this) 
       
   280         StaticObjectsContainer::instance()->webSurface()->setView( NULL ); 
       
   281     
   277 }
   282 }
   278 
   283 
   279 // -----------------------------------------------------------------------------
   284 // -----------------------------------------------------------------------------
   280 // WebView::ConstructL
   285 // WebView::ConstructL
   281 // Private Class Method
   286 // Private Class Method
   353 
   358 
   354     if ( m_brctl->capabilities() & TBrCtlDefs::ECapabilityWebKitLite ) {
   359     if ( m_brctl->capabilities() & TBrCtlDefs::ECapabilityWebKitLite ) {
   355         m_pageScalerEnabled = false;
   360         m_pageScalerEnabled = false;
   356     }
   361     }
   357     else  {
   362     else  {
   358         if(m_brctl->capabilities() & TBrCtlDefs::ECapabilityGraphicalPage)
   363         if((m_brctl->capabilities() & TBrCtlDefs::ECapabilityGraphicalHistory)
       
   364         	&& !(m_brctl->capabilities() & TBrCtlDefs::ECapabilityGraphicalPage))
       
   365             {
       
   366             m_thumbnailGenerator = CThumbnailGenerator::NewL(*this);          
       
   367             }
       
   368         else 
   359             {
   369             {
   360             initializePageScalerL();
   370             initializePageScalerL();
   361             m_pageScalerEnabled = true;
   371             m_pageScalerEnabled = true;
   362             }
       
   363         else if(m_brctl->capabilities() & TBrCtlDefs::ECapabilityGraphicalHistory)
       
   364             {
       
   365             m_thumbnailGenerator = CThumbnailGenerator::NewL(*this);
       
   366             }        
   372             }        
   367     }
   373     }
   368     if (m_brctl->capabilities() & TBrCtlDefs::ECapabilityAutoFormFill) {
   374     if (m_brctl->capabilities() & TBrCtlDefs::ECapabilityAutoFormFill) {
   369         m_webFormFill = new WebFormFill(this);
   375         m_webFormFill = new WebFormFill(this);
   370     }
   376     }
   562         m_webFormFillPopup->MakeVisible(EFalse);
   568         m_webFormFillPopup->MakeVisible(EFalse);
   563     }
   569     }
   564 
   570 
   565     if ( visible ) {
   571     if ( visible ) {
   566       clearOffScreenBitmap();
   572       clearOffScreenBitmap();
   567       m_tabbedNavigation->initializeForPage();
   573       if ( m_brctl && m_brctl->settings() && SettingsContainer::NavigationTypeTabbed == m_brctl->settings()->getNavigationType() ) {
       
   574           m_tabbedNavigation->initializeForPage();
       
   575       }
   568       syncRepaint( mainFrame()->frameView()->visibleRect() );
   576       syncRepaint( mainFrame()->frameView()->visibleRect() );
   569       TRAP_IGNORE( m_webfeptexteditor->EnableCcpuL() ); 
   577       TRAP_IGNORE( m_webfeptexteditor->EnableCcpuL() ); 
   570     }
   578     }
   571 
       
   572 }
   579 }
   573 
   580 
   574 
   581 
   575 
   582 
   576 void WebView::doLayout()
   583 void WebView::doLayout()
  1914     m_webcorecontext->gc().Clear();
  1921     m_webcorecontext->gc().Clear();
  1915 }
  1922 }
  1916 
  1923 
  1917 void WebView::scrollBuffer(TPoint to, TPoint from, TBool usecopyscroll)
  1924 void WebView::scrollBuffer(TPoint to, TPoint from, TBool usecopyscroll)
  1918 {
  1925 {
       
  1926     if(!IsVisible())
       
  1927         return;
       
  1928     
  1919     TRect rect(m_offscreenrect);
  1929     TRect rect(m_offscreenrect);
  1920 
  1930 
  1921     TSize bufSize( rect.Size() );
  1931     TSize bufSize( rect.Size() );
  1922 
  1932 
  1923     CFbsBitGc& gc = m_webcorecontext->gc();
  1933     CFbsBitGc& gc = m_webcorecontext->gc();
  2519     m_startZoomLevel = m_currentZoomLevel;
  2529     m_startZoomLevel = m_currentZoomLevel;
  2520 
  2530 
  2521     updateScrollbars(mainFrame()->frameView()->contentSize().iHeight, mainFrame()->frameView()->contentPos().iY,
  2531     updateScrollbars(mainFrame()->frameView()->contentSize().iHeight, mainFrame()->frameView()->contentPos().iY,
  2522         mainFrame()->frameView()->contentSize().iWidth, mainFrame()->frameView()->contentPos().iX);
  2532         mainFrame()->frameView()->contentSize().iWidth, mainFrame()->frameView()->contentPos().iX);
  2523 
  2533 
       
  2534     m_allowRepaints = true;
  2524     syncRepaint(view->visibleRect());
  2535     syncRepaint(view->visibleRect());
  2525 
  2536 
  2526     int zoomLevel = m_brctl->historyHandler()->historyController()->currentEntryZoomLevel();
  2537     int zoomLevel = m_brctl->historyHandler()->historyController()->currentEntryZoomLevel();
  2527     if (zoomLevel != m_currentZoomLevel) m_brctl->historyHandler()->historyController()->updateCurrentEntryZoomLevelIfNeeded();
  2538     if (zoomLevel != m_currentZoomLevel) m_brctl->historyHandler()->historyController()->updateCurrentEntryZoomLevelIfNeeded();
  2528 }
  2539 }
  3248     if ((aOldRect.iBr.iY * aNewZoom) % aOldZoom ) {
  3259     if ((aOldRect.iBr.iY * aNewZoom) % aOldZoom ) {
  3249         aNewRect.iBr.iY += 1;
  3260         aNewRect.iBr.iY += 1;
  3250         }
  3261         }
  3251     }
  3262     }
  3252 
  3263 
       
  3264 void WebView::pauseJsTimers()
       
  3265 {
       
  3266     if(m_jsTimeouts==0) {        
       
  3267         WebCore::Frame *frame = core(mainFrame());
       
  3268         KJS::Window* window = KJS::Window::retrieveWindow(frame);
       
  3269         if(window) {
       
  3270             m_jsTimeouts = window->pauseTimeouts();
       
  3271         }
       
  3272     }
       
  3273 }
       
  3274 
       
  3275 void WebView::resumeJsTimers()
       
  3276 {
       
  3277     if(m_jsTimeouts) {
       
  3278         WebCore::Frame *frame = core(mainFrame());
       
  3279         KJS::Window* window = KJS::Window::retrieveWindow(frame);
       
  3280         if(window) {
       
  3281             window->resumeTimeouts(m_jsTimeouts);
       
  3282             delete m_jsTimeouts;
       
  3283             m_jsTimeouts = 0;
       
  3284         }
       
  3285     }
       
  3286 }
  3253 // END OF FILE
  3287 // END OF FILE