webengine/osswebengine/WebKit/s60/webview/WebView.cpp
branchRCL_3
changeset 62 c711bdda59f4
parent 59 1f3c3f2f5b0a
child 64 ac77f89b1d9e
equal deleted inserted replaced
59:1f3c3f2f5b0a 62:c711bdda59f4
   195 , m_maxZoomLevel(KZoomLevelMaxValue)
   195 , m_maxZoomLevel(KZoomLevelMaxValue)
   196 , m_minZoomLevel(KZoomLevelMinValue)
   196 , m_minZoomLevel(KZoomLevelMinValue)
   197 , m_defaultZoomLevel(KZoomLevelDefaultValue)
   197 , m_defaultZoomLevel(KZoomLevelDefaultValue)
   198 , m_pageFullScreenHandler(NULL)
   198 , m_pageFullScreenHandler(NULL)
   199 , m_viewIsScrolling(false)
   199 , m_viewIsScrolling(false)
   200 , m_ptrbuffer(0)
       
   201 , m_showCursor(false)
   200 , m_showCursor(false)
   202 , m_allowRepaints(true)
   201 , m_allowRepaints(true)
   203 , m_prevEditMode(false)
   202 , m_prevEditMode(false)
   204 , m_firedEvent(0)
   203 , m_firedEvent(0)
   205 , m_waitTimer(0)
   204 , m_waitTimer(0)
   229 
   228 
   230     if (m_fastScrollTimer)
   229     if (m_fastScrollTimer)
   231         m_fastScrollTimer->Cancel();
   230         m_fastScrollTimer->Cancel();
   232     delete m_fastScrollTimer;
   231     delete m_fastScrollTimer;
   233 
   232 
   234     delete [] m_ptrbuffer;
       
   235 	delete m_pinchZoomHandler;
   233 	delete m_pinchZoomHandler;
   236     delete m_repainttimer;
   234     delete m_repainttimer;
   237     delete m_webfeptexteditor;
   235     delete m_webfeptexteditor;
   238     delete m_webcorecontext;
   236     delete m_webcorecontext;
   239     delete m_bitmapdevice;
   237     delete m_bitmapdevice;
   349     
   347     
   350     //Creates the Pinch Zoom Handler
   348     //Creates the Pinch Zoom Handler
   351     m_pinchZoomHandler = WebPagePinchZoomHandler::NewL(this);
   349     m_pinchZoomHandler = WebPagePinchZoomHandler::NewL(this);
   352     
   350     
   353     // Create the PointerEventHandler
   351     // Create the PointerEventHandler
   354     m_ptrbuffer = new TPoint[256];
       
   355     m_webpointerEventHandler = WebPointerEventHandler::NewL(this);
   352     m_webpointerEventHandler = WebPointerEventHandler::NewL(this);
   356 
   353 
   357     // Create the ScrollHandler
   354     // Create the ScrollHandler
   358     m_pageScrollHandler = WebPageScrollHandler::NewL( *this );
   355     m_pageScrollHandler = WebPageScrollHandler::NewL( *this );
   359     if (AknLayoutUtils::PenEnabled()) {
   356     if (AknLayoutUtils::PenEnabled()) {
   370     CleanupStack::PopAndDestroy(2); // userAgent8, usrAgnt
   367     CleanupStack::PopAndDestroy(2); // userAgent8, usrAgnt
   371 
   368 
   372     MakeViewVisible(ETrue);
   369     MakeViewVisible(ETrue);
   373     m_isPluginsVisible=ETrue;
   370     m_isPluginsVisible=ETrue;
   374     CCoeControl::SetFocus(ETrue);
   371     CCoeControl::SetFocus(ETrue);
   375 #ifdef BRDO_MULTITOUCH_ENABLED_FF
   372 
   376     //To enable advance pointer info for multi-touch
   373 #if defined(BRDO_MULTITOUCH_ENABLED_FF) && !defined (__WINSCW__)   
       
   374     //Enable advance pointer info for multi-touch.
   377     Window().EnableAdvancedPointers();
   375     Window().EnableAdvancedPointers();
   378 #endif 
   376 #endif 
       
   377     
   379     cache()->setCapacities(0, 0, defaultCacheCapacity);
   378     cache()->setCapacities(0, 0, defaultCacheCapacity);
   380     
   379     
   381     m_waiter = new(ELeave) CActiveSchedulerWait();
   380     m_waiter = new(ELeave) CActiveSchedulerWait();
   382 }
   381 }
   383 
   382 
   710 // WebView::collectOffscreenbitmap
   709 // WebView::collectOffscreenbitmap
   711 // Get offscreen bitmap
   710 // Get offscreen bitmap
   712 //-------------------------------------------------------------------------------
   711 //-------------------------------------------------------------------------------
   713 void WebView::collectOffscreenbitmapL(CFbsBitmap& snapshot)
   712 void WebView::collectOffscreenbitmapL(CFbsBitmap& snapshot)
   714 {
   713 {
   715     if(   m_widgetextension && m_widgetextension->IsWidgetPublising()) {
   714     if ( snapshot.Handle() == 0) {
   716         if ( snapshot.Handle() == 0) {
   715         // Create bitmap only once
   717             // Create bitmap only once
   716         (snapshot).Create(m_brctl->Size(), StaticObjectsContainer::instance()->webSurface()->displayMode());
   718             (snapshot).Create(m_brctl->Size(), StaticObjectsContainer::instance()->webSurface()->displayMode());
   717     }
   719         }
   718     CFbsBitmapDevice* device = CFbsBitmapDevice::NewL( &snapshot);
   720         CFbsBitmapDevice* device = CFbsBitmapDevice::NewL( &snapshot);
   719     CleanupStack::PushL(device);
   721         CleanupStack::PushL(device);
       
   722 
   720 
   723         WebCoreGraphicsContext* gc = WebCoreGraphicsContext::NewL( device, &snapshot, mainFrame()->frameView());
   721         WebCoreGraphicsContext* gc = WebCoreGraphicsContext::NewL( device, &snapshot, mainFrame()->frameView());
   724         CleanupStack::PushL(gc);
   722         CleanupStack::PushL(gc);
   725 
   723 
   726         if( snapshot.Handle() != 0 ) {
   724         if( snapshot.Handle() != 0 ) {
   731         if (snapshot.SizeInPixels()!=m_brctl->Size()) {
   729         if (snapshot.SizeInPixels()!=m_brctl->Size()) {
   732             snapshot.Resize(m_brctl->Size());
   730             snapshot.Resize(m_brctl->Size());
   733         }
   731         }
   734         mainFrame()->frameView()->draw( *gc, mainFrame()->frameView()->visibleRect() );
   732         mainFrame()->frameView()->draw( *gc, mainFrame()->frameView()->visibleRect() );
   735 
   733 
   736        CleanupStack::PopAndDestroy(2);
   734    CleanupStack::PopAndDestroy(2);
   737     }
       
   738 
   735 
   739 }
   736 }
   740 
   737 
   741 //-------------------------------------------------------------------------------
   738 //-------------------------------------------------------------------------------
   742 // WebView::scheduleRepaint
   739 // WebView::scheduleRepaint
  2040     // first-searched frame up to the selection. However, the API doesn't provide a way to search only up to a particular point. The only
  2037     // first-searched frame up to the selection. However, the API doesn't provide a way to search only up to a particular point. The only
  2041     // way to make sure the entire frame is searched is to pass YES for the wrapFlag. When there are no matches, this will search again
  2038     // way to make sure the entire frame is searched is to pass YES for the wrapFlag. When there are no matches, this will search again
  2042     // some content that we already searched on the first pass. In the worst case, we could search the entire contents of this frame twice.
  2039     // some content that we already searched on the first pass. In the worst case, we could search the entire contents of this frame twice.
  2043     // To fix this, we'd need to add a mechanism to specify a range in which to search.
  2040     // To fix this, we'd need to add a mechanism to specify a range in which to search.
  2044     if (wrapFlag && lastFrame) {
  2041     if (wrapFlag && lastFrame) {
  2045         if (frame->bridge()->searchFor(keyword, forward, false, true, false))
  2042         if (frame && frame->bridge() && frame->bridge()->searchFor(keyword, forward, false, true, false))
  2046             return TBrCtlDefs::EFindMatch;
  2043             return TBrCtlDefs::EFindMatch;
  2047     }
  2044     }
  2048 
  2045 
  2049     if (frame) {
  2046     if (frame) {
  2050         frame->clearSelection();
  2047         frame->clearSelection();
  2332         if ( newMinZoomLevel > m_currentZoomLevel ) newMinZoomLevel = m_currentZoomLevel;
  2329         if ( newMinZoomLevel > m_currentZoomLevel ) newMinZoomLevel = m_currentZoomLevel;
  2333     }
  2330     }
  2334     else {
  2331     else {
  2335         newMinZoomLevel = KZoomLevelDefaultValue;
  2332         newMinZoomLevel = KZoomLevelDefaultValue;
  2336     }
  2333     }
  2337 
  2334 #ifndef  BRDO_MULTITOUCH_ENABLED_FF
  2338     newMinZoomLevel = (newMinZoomLevel/m_pageZoomHandler->stepSize())*m_pageZoomHandler->stepSize();
  2335     newMinZoomLevel = (newMinZoomLevel/m_pageZoomHandler->stepSize())*m_pageZoomHandler->stepSize();
  2339 
  2336 #endif     
  2340   TBool needsUpdateArray = EFalse;
  2337   TBool needsUpdateArray = EFalse;
  2341   //Update the new array
  2338   //Update the new array
  2342   if ( m_minZoomLevel!= newMinZoomLevel)
  2339   if ( m_minZoomLevel!= newMinZoomLevel)
  2343   {
  2340   {
  2344     needsUpdateArray = ETrue;
  2341     needsUpdateArray = ETrue;
  2372     {
  2369     {
  2373     return;
  2370     return;
  2374     }
  2371     }
  2375 
  2372 
  2376     m_zoomLevelArray.Reset();
  2373     m_zoomLevelArray.Reset();
  2377 
  2374 #ifndef  BRDO_MULTITOUCH_ENABLED_FF
  2378     m_minZoomLevel = TInt(m_minZoomLevel/10) * 10;
  2375     m_minZoomLevel = TInt(m_minZoomLevel/10) * 10;
       
  2376 #endif 
       
  2377     
  2379     m_zoomLevelArray.Append(KZoomLevelDefaultValue);
  2378     m_zoomLevelArray.Append(KZoomLevelDefaultValue);
  2380 
  2379 
  2381     //construct the zoom array from the default level
  2380     //construct the zoom array from the default level
  2382     TInt toAddZoomLevel = KZoomLevelDefaultValue + KZoomLevelDefaultValue*KZoomLevelDelta/100;
  2381     TInt toAddZoomLevel = KZoomLevelDefaultValue + KZoomLevelDefaultValue*KZoomLevelDelta/100;
  2383     while (toAddZoomLevel <= m_maxZoomLevel)
  2382     while (toAddZoomLevel <= m_maxZoomLevel)
  2607     if (!m_widgetextension) {
  2606     if (!m_widgetextension) {
  2608         m_widgetextension = CWidgetExtension::NewL(*this, aWidgetCallback);
  2607         m_widgetextension = CWidgetExtension::NewL(*this, aWidgetCallback);
  2609 #if USE(LOW_BANDWIDTH_DISPLAY)
  2608 #if USE(LOW_BANDWIDTH_DISPLAY)
  2610         m_page->mainFrame()->loader()->setUseLowBandwidthDisplay(false);
  2609         m_page->mainFrame()->loader()->setUseLowBandwidthDisplay(false);
  2611 #endif
  2610 #endif
  2612     StaticObjectsContainer::instance()->setIconDatabaseEnabled(false);
  2611     if (!(m_brctl->capabilities() & TBrCtlDefs::ECapabilityAutoFormFill))    
       
  2612         StaticObjectsContainer::instance()->setIconDatabaseEnabled(false);
  2613     }
  2613     }
  2614 
  2614 
  2615     //Widgets dont need memory cache for dead objects. hence set it to 0
  2615     //Widgets dont need memory cache for dead objects. hence set it to 0
  2616     cache()->setCapacities(0, 0, 0);
  2616     cache()->setCapacities(0, 0, 0);
       
  2617     cache()->setDisabled(true);
  2617     return m_widgetextension;
  2618     return m_widgetextension;
  2618 }
  2619 }
  2619 
  2620 
  2620 //-------------------------------------------------------------------------------
  2621 //-------------------------------------------------------------------------------
  2621 // WebView::forceLayoutAndResize
  2622 // WebView::forceLayoutAndResize
  3082     //get the shift in the document so that during the next engine re-draw, the origin needs to be updated based on that
  3083     //get the shift in the document so that during the next engine re-draw, the origin needs to be updated based on that
  3083     m_pinchDocDelta.iX = (float)shiftInView.iX * 100 / zoomLevel;   
  3084     m_pinchDocDelta.iX = (float)shiftInView.iX * 100 / zoomLevel;   
  3084     m_pinchDocDelta.iY = (float)shiftInView.iY * 100 / zoomLevel;
  3085     m_pinchDocDelta.iY = (float)shiftInView.iY * 100 / zoomLevel;
  3085 }
  3086 }
  3086 
  3087 
       
  3088 void WebView::reCreatePlugins()
       
  3089 {
       
  3090       Frame* coreFrame = core(mainFrame());
       
  3091       MWebCoreObjectWidget* view = NULL;
       
  3092       for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) {
       
  3093            PassRefPtr<HTMLCollection> objects = frame->document()->objects();
       
  3094            for (Node* n = objects->firstItem(); n; n = objects->nextItem()) {
       
  3095                view = widget(n);
       
  3096                if (view) {
       
  3097                    PluginSkin* plg = static_cast<PluginSkin*>(view);
       
  3098                    if(plg->activeStreams() > 0)
       
  3099                       plg->reCreatePlugin();
       
  3100                }
       
  3101            }
       
  3102 
       
  3103            PassRefPtr<HTMLCollection> embeds = frame->document()->embeds();
       
  3104            for (Node* n = embeds->firstItem(); n; n = embeds->nextItem()) {
       
  3105                view = widget(n);
       
  3106                if (view) {
       
  3107                    PluginSkin* plg = static_cast<PluginSkin*>(view);
       
  3108                    if(plg->activeStreams() > 0)
       
  3109                       plg->reCreatePlugin();
       
  3110                }
       
  3111            }
       
  3112       }
       
  3113 }
       
  3114 
  3087 // END OF FILE
  3115 // END OF FILE