webengine/osswebengine/WebKit/s60/webview/WebView.cpp
changeset 36 0ed94ceaa377
parent 27 60c5402cb945
child 37 cb62a4f66ebe
equal deleted inserted replaced
32:9a9a761f03f1 36:0ed94ceaa377
    26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    29 */
    29 */
    30 
    30 
    31 #include <Browser_platform_variant.hrh>
    31 #include <browser_platform_variant.hrh>
    32 #include "config.h"
    32 #include "config.h"
    33 #include "../../bidi.h"
    33 #include "../../bidi.h"
    34 #include "brctl.h"
    34 #include "brctl.h"
    35 #include "HistoryController.h"
    35 #include "HistoryController.h"
    36 #include "PageView.h"
    36 #include "PageView.h"
    88 #include "HTMLInputElement.h"
    88 #include "HTMLInputElement.h"
    89 
    89 
    90 using namespace HTMLNames;
    90 using namespace HTMLNames;
    91 
    91 
    92 #include <AknUtils.h>
    92 #include <AknUtils.h>
    93 #include <CUserAgent.h>
    93 #include <cuseragent.h>
    94 #include "WebPageZoomHandler.h"
    94 #include "WebPageZoomHandler.h"
    95 
    95 
    96 #include "PlatformFontCache.h"
    96 #include "PlatformFontCache.h"
    97 #include "WebPageFullScreenHandler.h"
    97 #include "WebPageFullScreenHandler.h"
    98 #include "eikon.hrh"
    98 #include "eikon.hrh"
   198 , m_ptrbuffer(0)
   198 , m_ptrbuffer(0)
   199 , m_showCursor(false)
   199 , m_showCursor(false)
   200 , m_allowRepaints(true)
   200 , m_allowRepaints(true)
   201 , m_prevEditMode(false)
   201 , m_prevEditMode(false)
   202 , m_firedEvent(0)
   202 , m_firedEvent(0)
       
   203 , m_waitTimer(0)
   203 {
   204 {
   204 }
   205 }
   205 
   206 
   206 WebView::~WebView()
   207 WebView::~WebView()
   207 {
   208 {
   239     delete m_widgetextension;
   240     delete m_widgetextension;
   240     delete m_webpointerEventHandler;
   241     delete m_webpointerEventHandler;
   241     delete m_pageScrollHandler;
   242     delete m_pageScrollHandler;
   242     delete m_pluginplayer;
   243     delete m_pluginplayer;
   243     delete m_fepTimer;
   244     delete m_fepTimer;
       
   245     delete m_waitTimer;
       
   246     delete m_waiter;
   244     delete m_popupDrawer;
   247     delete m_popupDrawer;
   245     delete m_tabbedNavigation;
   248     delete m_tabbedNavigation;
   246     delete m_userAgent;
   249     delete m_userAgent;
   247     delete m_pageFullScreenHandler;
   250     delete m_pageFullScreenHandler;
   248     delete m_bridge;
   251     delete m_bridge;
   357     MakeViewVisible(ETrue);
   360     MakeViewVisible(ETrue);
   358     m_isPluginsVisible=ETrue;
   361     m_isPluginsVisible=ETrue;
   359     CCoeControl::SetFocus(ETrue);
   362     CCoeControl::SetFocus(ETrue);
   360 
   363 
   361     cache()->setCapacities(0, 0, defaultCacheCapacity);
   364     cache()->setCapacities(0, 0, defaultCacheCapacity);
       
   365     
       
   366     m_waiter = new(ELeave) CActiveSchedulerWait();
   362 }
   367 }
   363 
   368 
   364 void WebView::initializePageScalerL()
   369 void WebView::initializePageScalerL()
   365 {
   370 {
   366     TBool lowQuality = !( m_brctl->capabilities() & TBrCtlDefs::ECapabilityGraphicalHistory );
   371     TBool lowQuality = !( m_brctl->capabilities() & TBrCtlDefs::ECapabilityGraphicalHistory );
   513         m_webFormFillPopup->MakeVisible(EFalse);
   518         m_webFormFillPopup->MakeVisible(EFalse);
   514     }
   519     }
   515 
   520 
   516     if ( visible ) {
   521     if ( visible ) {
   517       clearOffScreenBitmap();
   522       clearOffScreenBitmap();
       
   523       m_tabbedNavigation->initializeForPage();
   518       syncRepaint( mainFrame()->frameView()->visibleRect() );
   524       syncRepaint( mainFrame()->frameView()->visibleRect() );
   519     }
   525     }
   520 
   526 
   521 }
   527 }
   522 
   528 
  1463     if (m_toolbar)
  1469     if (m_toolbar)
  1464         return m_toolbar->HandleOfferKeyEventL(keyevent, eventcode);
  1470         return m_toolbar->HandleOfferKeyEventL(keyevent, eventcode);
  1465 
  1471 
  1466     if (m_popupDrawer)
  1472     if (m_popupDrawer)
  1467         return m_popupDrawer->handleOfferKeyEventL(keyevent, eventcode );
  1473         return m_popupDrawer->handleOfferKeyEventL(keyevent, eventcode );
       
  1474     
       
  1475     if (m_focusedElementType == TBrCtlDefs::EElementObjectBox 
       
  1476         || m_focusedElementType == TBrCtlDefs::EElementActivatedObjectBox) {
       
  1477         
       
  1478         Node* node = static_cast<Node*>(cursor->getElementUnderCursor());
       
  1479         MWebCoreObjectWidget* view = widget(node);
       
  1480         PluginSkin* plugin = static_cast<PluginSkin*>(view);
       
  1481         if (plugin && plugin->pluginWin() && !(plugin->pluginWin()->Windowed())) {
       
  1482             if (EKeyWasConsumed == plugin->pluginWin()->OfferKeyEventL(keyevent, eventcode))
       
  1483                 return EKeyWasConsumed;
       
  1484         }
       
  1485     }    
  1468 
  1486 
  1469     if ( m_webFormFillPopup && m_webFormFillPopup->IsVisible() && AknLayoutUtils::PenEnabled() ) {
  1487     if ( m_webFormFillPopup && m_webFormFillPopup->IsVisible() && AknLayoutUtils::PenEnabled() ) {
  1470 	    if (EKeyWasConsumed == m_webFormFillPopup->HandleKeyEventL(keyevent, eventcode)) {
  1488 	    if (EKeyWasConsumed == m_webFormFillPopup->HandleKeyEventL(keyevent, eventcode)) {
  1471             return EKeyWasConsumed;
  1489             return EKeyWasConsumed;
  1472 	    }
  1490 	    }
  1701 }
  1719 }
  1702 
  1720 
  1703 void WebView::setEditable(TBool editable)
  1721 void WebView::setEditable(TBool editable)
  1704 {
  1722 {
  1705     Frame* frame = core(mainFrame());
  1723     Frame* frame = core(mainFrame());
       
  1724     
       
  1725     page()->chrome()->client()->setElementVisibilityChanged(false);
  1706     if (!frame || m_isEditable == editable)
  1726     if (!frame || m_isEditable == editable)
  1707         return;
  1727         return;
  1708 
  1728 
  1709     m_isEditable = editable;
  1729     m_isEditable = editable;
  1710 
  1730 
  2010     memset(m_ptrbuffer,0,256*sizeof(TPoint));
  2030     memset(m_ptrbuffer,0,256*sizeof(TPoint));
  2011     TPtr8 ptr((TUint8 *)m_ptrbuffer,256*sizeof(TPoint));
  2031     TPtr8 ptr((TUint8 *)m_ptrbuffer,256*sizeof(TPoint));
  2012 
  2032 
  2013     TInt numPnts = Window().RetrievePointerMoveBuffer(ptr);
  2033     TInt numPnts = Window().RetrievePointerMoveBuffer(ptr);
  2014     int i = 0;
  2034     int i = 0;
  2015     if (m_brctl->settings()->getNavigationType() == SettingsContainer::NavigationTypeNone) {
       
  2016         if (numPnts > 20)
       
  2017             i = numPnts - 20;
       
  2018     }
       
  2019     for (; i < numPnts; i++) {
  2035     for (; i < numPnts; i++) {
  2020         TPointerEvent pe;
  2036         TPointerEvent pe;
  2021         pe.iType = TPointerEvent::EDrag;
  2037         pe.iType = TPointerEvent::EDrag;
  2022         pe.iPosition = m_ptrbuffer[i];
  2038         pe.iPosition = m_ptrbuffer[i];
  2023         m_webpointerEventHandler->HandlePointerEventL(pe);
  2039         m_webpointerEventHandler->HandlePointerEventL(pe);
  2884         WebView* that = const_cast<WebView*>(this);
  2900         WebView* that = const_cast<WebView*>(this);
  2885         that->m_widgetextension->windowObjectCleared();
  2901         that->m_widgetextension->windowObjectCleared();
  2886     }
  2902     }
  2887 }
  2903 }
  2888 
  2904 
       
  2905 void WebView::wait(double t)
       
  2906 {
       
  2907     if (!m_waitTimer) {
       
  2908         m_waitTimer = new WebCore::Timer<WebView>(this, &WebView::waitTimerCB);
       
  2909     }
       
  2910     
       
  2911     if (!m_waitTimer->isActive()) {
       
  2912         m_waitTimer->startOneShot(t);
       
  2913     }
       
  2914     
       
  2915     if (!m_waitTimer->isActive() && !m_waiter->IsStarted()) {
       
  2916         m_waiter->Start();  
       
  2917     }
       
  2918 }
       
  2919 
       
  2920 void WebView::waitTimerCB(WebCore::Timer<WebView>* t)
       
  2921 {
       
  2922     if (m_waiter->IsStarted()) {
       
  2923         m_waiter->AsyncStop();
       
  2924     }
       
  2925 }
       
  2926 
       
  2927 
  2889 // END OF FILE
  2928 // END OF FILE