webengine/osswebengine/WebKit/s60/webview/WebView.cpp
branchRCL_3
changeset 44 800203832575
parent 42 a1a5d4e727e8
child 46 30342f40acbf
equal deleted inserted replaced
42:a1a5d4e727e8 44:800203832575
   209 , m_firedEvent(0)
   209 , m_firedEvent(0)
   210 , m_waitTimer(0)
   210 , m_waitTimer(0)
   211 , m_pinchZoomHandler(NULL)
   211 , m_pinchZoomHandler(NULL)
   212 , m_isPinchZoom(false)
   212 , m_isPinchZoom(false)
   213 , m_drawsMissed(0)
   213 , m_drawsMissed(0)
   214 , m_scroll(false)
       
   215 , m_thumbnailGenerator(NULL)
   214 , m_thumbnailGenerator(NULL)
   216 , m_checkerBoardBitmap(NULL)
   215 , m_checkerBoardBitmap(NULL)
   217 , m_checkerBoardDevice(NULL)
   216 , m_checkerBoardDevice(NULL)
   218 , m_checkerBoardGc(NULL)
   217 , m_checkerBoardGc(NULL)
   219 , m_checkerBoardDestroyTimer(NULL)
   218 , m_checkerBoardDestroyTimer(NULL)
   232     // operates on the WebView object
   231     // operates on the WebView object
   233     delete m_pageZoomHandler;
   232     delete m_pageZoomHandler;
   234     m_pageZoomHandler = NULL;
   233     m_pageZoomHandler = NULL;
   235 
   234 
   236     m_zoomLevelArray.Close();
   235     m_zoomLevelArray.Close();
   237     m_visiblePlugins.Reset();
       
   238     m_visiblePlugins.Close();
       
   239 
   236 
   240     // prevent frameViews to access members when topView is
   237     // prevent frameViews to access members when topView is
   241     // closing down.
   238     // closing down.
   242     m_isClosing = true;
   239     m_isClosing = true;
   243     m_page->setGroupName(String());
   240     m_page->setGroupName(String());
   397     m_userAgent = HBufC::NewL(userAgent8->Length());
   394     m_userAgent = HBufC::NewL(userAgent8->Length());
   398     m_userAgent->Des().Copy(userAgent8->Des());
   395     m_userAgent->Des().Copy(userAgent8->Des());
   399     CleanupStack::PopAndDestroy(2); // userAgent8, usrAgnt
   396     CleanupStack::PopAndDestroy(2); // userAgent8, usrAgnt
   400 
   397 
   401     MakeViewVisible(ETrue);
   398     MakeViewVisible(ETrue);
   402     m_isPluginsVisible=ETrue;
       
   403     CCoeControl::SetFocus(ETrue);
   399     CCoeControl::SetFocus(ETrue);
   404     
   400     
   405     cache()->setCapacities(0, 0, defaultCacheCapacity);
   401     cache()->setCapacities(0, 0, defaultCacheCapacity);
   406     
   402     
   407     m_waiter = new(ELeave) CActiveSchedulerWait();
   403     m_waiter = new(ELeave) CActiveSchedulerWait();
   408     
   404     
   409     m_checkerBoardDestroyTimer = CPeriodic::NewL(CActive::EPriorityIdle);
   405     m_checkerBoardDestroyTimer = CPeriodic::NewL(CActive::EPriorityIdle);
   410     m_visiblePlugins.Reset();
       
   411     
   406     
   412 }
   407 }
   413 
   408 
   414 void WebView::initializePageScalerL()
   409 void WebView::initializePageScalerL()
   415 {
   410 {
   638                       );
   633                       );
   639                   }
   634                   }
   640             }
   635             }
   641 #endif         
   636 #endif         
   642     }
   637     }
   643     mainFrame()->notifyPluginsOfPositionChange();
       
   644 }
   638 }
   645 //-------------------------------------------------------------------------------
   639 //-------------------------------------------------------------------------------
   646 // WebView::syncRepaint
   640 // WebView::syncRepaint
   647 // Repaint the current repaint region synchronously and clear it
   641 // Repaint the current repaint region synchronously and clear it
   648 //-------------------------------------------------------------------------------
   642 //-------------------------------------------------------------------------------
  2152         }
  2146         }
  2153         else if (value == "none") {
  2147         else if (value == "none") {
  2154             m_brctl->settings()->setNavigationType(SettingsContainer::NavigationTypeNone);
  2148             m_brctl->settings()->setNavigationType(SettingsContainer::NavigationTypeNone);
  2155         }
  2149         }
  2156     }
  2150     }
       
  2151     else if (name == "widgetAppBackgroundColour") {
       
  2152         if (value == "black") {
       
  2153             WebCore::Frame *frame = core(mainFrame());
       
  2154             if (frame) {
       
  2155                 WebCore::FrameView* frameView = frame->view();
       
  2156                 if (frameView) {
       
  2157                     WebCore::Color bc = Color::black;
       
  2158                     frameView->setBaseBackgroundColor(bc);
       
  2159                 }
       
  2160             }
       
  2161         }
       
  2162     }
  2157 }
  2163 }
  2158 
  2164 
  2159 //-------------------------------------------------------------------------------
  2165 //-------------------------------------------------------------------------------
  2160 // WebView::handleShowAnchorHrefL
  2166 // WebView::handleShowAnchorHrefL
  2161 // Display a popup with the url of an anchor
  2167 // Display a popup with the url of an anchor
  2263     m_zoomLevelChangedByUser = true;
  2269     m_zoomLevelChangedByUser = true;
  2264     WebFrameView* view = mainFrame()->frameView();
  2270     WebFrameView* view = mainFrame()->frameView();
  2265     if (!view) return;
  2271     if (!view) return;
  2266 
  2272 
  2267     m_dirtyZoomMode = true;
  2273     m_dirtyZoomMode = true;
  2268     m_isPluginsVisible = false;
       
  2269     mainFrame()->makeVisiblePlugins(false);
       
  2270 
  2274 
  2271     if (zoomLevel > m_startZoomLevel) {
  2275     if (zoomLevel > m_startZoomLevel) {
  2272 
  2276 
  2273         // cut m_srcRectForZooming from m_offscreenrect and enlarge it to fit the view rect
  2277         // cut m_srcRectForZooming from m_offscreenrect and enlarge it to fit the view rect
  2274 
  2278 
  2318 void WebView::restoreZoomLevel(int zoomLevel)
  2322 void WebView::restoreZoomLevel(int zoomLevel)
  2319 {
  2323 {
  2320     m_dirtyZoomMode = false;
  2324     m_dirtyZoomMode = false;
  2321     clearOffScreenBitmap();
  2325     clearOffScreenBitmap();
  2322     zoomLevelChanged(zoomLevel);
  2326     zoomLevelChanged(zoomLevel);
  2323     mainFrame()->notifyPluginsOfPositionChange();
  2327 	//update the position position after the relayout is completed, 
  2324     m_isPluginsVisible = false;
  2328 	//This will minimize the plugins flickering
  2325     mainFrame()->makeVisiblePlugins(true);
  2329     scrollStatus(false);
  2326     m_isPluginsVisible = true;
       
  2327 }
  2330 }
  2328 
  2331 
  2329 //-------------------------------------------------------------------------------
  2332 //-------------------------------------------------------------------------------
  2330 // WebView::resetZoomLevel
  2333 // WebView::resetZoomLevel
  2331 //-------------------------------------------------------------------------------
  2334 //-------------------------------------------------------------------------------
  2870 
  2873 
  2871 void WebView::setFastScrollingMode(bool fastScrolling)
  2874 void WebView::setFastScrollingMode(bool fastScrolling)
  2872 {
  2875 {
  2873   if (fastScrolling != m_viewIsFastScrolling) {
  2876   if (fastScrolling != m_viewIsFastScrolling) {
  2874   setViewIsFastScrolling (fastScrolling);
  2877   setViewIsFastScrolling (fastScrolling);
  2875   m_isPluginsVisible = false;
       
  2876   mainFrame()->makeVisiblePlugins(!m_viewIsFastScrolling);
  2878   mainFrame()->makeVisiblePlugins(!m_viewIsFastScrolling);
  2877   m_isPluginsVisible = !m_viewIsFastScrolling;
       
  2878 
  2879 
  2879   if (!m_viewIsFastScrolling) {
  2880   if (!m_viewIsFastScrolling) {
  2880     mainFrame()->notifyPluginsOfPositionChange();
  2881     mainFrame()->notifyPluginsOfPositionChange();
  2881   }
  2882   }
  2882   toggleRepaintTimer(!m_viewIsFastScrolling);
  2883   toggleRepaintTimer(!m_viewIsFastScrolling);
  3048 // WebView::setPinchBitmapZoomLevelL
  3049 // WebView::setPinchBitmapZoomLevelL
  3049 //-------------------------------------------------------------------------------
  3050 //-------------------------------------------------------------------------------
  3050 void WebView::setPinchBitmapZoomLevelL(int zoomLevel)
  3051 void WebView::setPinchBitmapZoomLevelL(int zoomLevel)
  3051 {
  3052 {
  3052     m_zoomLevelChangedByUser = true;
  3053     m_zoomLevelChangedByUser = true;
       
  3054 
       
  3055     m_isPinchZoom = true;
       
  3056     if(!m_dirtyZoomMode)
       
  3057     {
       
  3058     //If panning or scroll is in progress, we will be notifiying to plugins for collecting bitmap
       
  3059     //in case of pinchZoom, we need to deactivate the plugins which are not supported for bitmap
       
  3060     //sharing.
       
  3061     if(m_scrollingstatus)
       
  3062         {
       
  3063         m_scrollingstatus = false;
       
  3064         }
       
  3065     scrollStatus(true);
       
  3066 	}
  3053     m_dirtyZoomMode = true;
  3067     m_dirtyZoomMode = true;
  3054     m_isPluginsVisible = false;
       
  3055     m_isPinchZoom = true;
       
  3056 
  3068 
  3057     if (zoomLevel > m_startZoomLevel) {
  3069     if (zoomLevel > m_startZoomLevel) {
  3058         setPinchBitmapZoomIn(zoomLevel);
  3070         setPinchBitmapZoomIn(zoomLevel);
  3059     }
  3071     }
  3060     else {
  3072     else {
  3061         setPinchBitmapZoomOutL(zoomLevel);
  3073         setPinchBitmapZoomOutL(zoomLevel);
  3062         m_isPinchZoomOut = true;
  3074         m_isPinchZoomOut = true;
  3063     }
  3075     }
  3064     m_currentZoomLevel = zoomLevel;
  3076     m_currentZoomLevel = zoomLevel;
  3065     DrawNow();
  3077     DrawNow();
  3066     PluginSkin* pluginskin = mainFrame()->focusedPlugin();
  3078 
  3067     if(pluginskin)
       
  3068      {
       
  3069         pluginskin->deActivate();
       
  3070     }
       
  3071 }
  3079 }
  3072 
  3080 
  3073 //-------------------------------------------------------------------------------
  3081 //-------------------------------------------------------------------------------
  3074 // WebView::setPinchBitmapZoomIn
  3082 // WebView::setPinchBitmapZoomIn
  3075 //-------------------------------------------------------------------------------
  3083 //-------------------------------------------------------------------------------
  3142     
  3150     
  3143     if(!m_isPinchZoomOut)
  3151     if(!m_isPinchZoomOut)
  3144         createCheckerBoardL();
  3152         createCheckerBoardL();
  3145 }
  3153 }
  3146 
  3154 
  3147 void WebView::setScrolling(bool scroll)
       
  3148 {
       
  3149     m_scroll = scroll;
       
  3150     mainFrame()->PlayPausePlugins(m_scroll);
       
  3151 }
       
  3152 
  3155 
  3153 void drawCheckerBoard(CBitmapContext *gc,const TRect &rect)
  3156 void drawCheckerBoard(CBitmapContext *gc,const TRect &rect)
  3154 {
  3157 {
  3155     for(int i = rect.iTl.iX; i <= (rect.iTl.iX + rect.Width()); i = i + (2 * KCheckerSize)) {
  3158     for(int i = rect.iTl.iX; i <= (rect.iTl.iX + rect.Width()); i = i + (2 * KCheckerSize)) {
  3156         for(int j = rect.iTl.iY; j <= (rect.iTl.iY + rect.Height()); j = j + (2 * KCheckerSize)) {
  3159         for(int j = rect.iTl.iY; j <= (rect.iTl.iY + rect.Height()); j = j + (2 * KCheckerSize)) {
  3284             m_jsTimeouts = 0;
  3287             m_jsTimeouts = 0;
  3285         }
  3288         }
  3286     }
  3289     }
  3287 }
  3290 }
  3288 // END OF FILE
  3291 // END OF FILE
       
  3292 void WebView::scrollStatus(bool status)
       
  3293     {
       
  3294     if(m_scrollingstatus != status)
       
  3295         {
       
  3296         m_scrollingstatus = status;
       
  3297 #ifdef BRDO_MULTITOUCH_ENABLED_FF
       
  3298         mainFrame()->ScrollOrPinchStatus(m_scrollingstatus);
       
  3299 #endif         
       
  3300         }
       
  3301     }
       
  3302 
       
  3303 
       
  3304 void WebView::setViewIsScrolling(bool scrolling)
       
  3305     {
       
  3306     m_viewIsScrolling = scrolling;
       
  3307     if(!scrolling)
       
  3308         {
       
  3309         scrollStatus(scrolling);
       
  3310         }
       
  3311     };