webengine/osswebengine/WebKit/s60/webview/WebPointerEventHandler.cpp
branchRCL_3
changeset 42 a1a5d4e727e8
parent 40 8bfb9186a8b8
child 44 800203832575
equal deleted inserted replaced
41:4bd5176e1bc8 42:a1a5d4e727e8
   103 // WebPointerEventHandler::HandleGestureEventL
   103 // WebPointerEventHandler::HandleGestureEventL
   104 // ======================================================================
   104 // ======================================================================
   105 void  WebPointerEventHandler::HandleGestureEventL(const TStmGestureEvent& aGesture)
   105 void  WebPointerEventHandler::HandleGestureEventL(const TStmGestureEvent& aGesture)
   106 {
   106 {
   107     TStmGestureUid uid = aGesture.Code();
   107     TStmGestureUid uid = aGesture.Code();
   108 
       
   109     if (m_webview->pinchZoomHandler()->isPinchActive() && uid != stmGesture::EGestureUidPinch)
   108     if (m_webview->pinchZoomHandler()->isPinchActive() && uid != stmGesture::EGestureUidPinch)
   110         return;
   109         return;
   111 
   110     
   112     TBrCtlDefs::TBrCtlElementType elType = m_webview->focusedElementType();
   111     TBrCtlDefs::TBrCtlElementType elType = m_webview->focusedElementType();
   113 
   112     
   114     PluginSkin* plugin = m_webview->mainFrame()->focusedPlugin();
   113     bool pluginConsumable = isPluginConsumable(uid);
   115     if (plugin && plugin->pluginWin()) {
   114     
   116         if (plugin->pluginWin()->HandleGesture(aGesture)) {
   115     if (pluginConsumable && m_webview->getVisiblePlugins().Count() > 0) {
   117          if(!plugin->isActive()) {
   116         for ( int i=0; i < m_webview->getVisiblePlugins().Count(); i++) {
   118             plugin->activate();
   117              PluginSkin* plugin = m_webview->getVisiblePlugins()[i];
   119          }
   118              if (plugin && plugin->pluginWin() && plugin->pluginWin()->containsPoint(*m_webview,aGesture.CurrentPos())) {
   120          else {
   119                  if (plugin->pluginWin()->HandleGesture(aGesture)) {
   121             m_webview->mainFrame()->frameView()->topView()->setFocusedElementType(TBrCtlDefs::EElementActivatedObjectBox);
   120                      if(!plugin->isActive()) {
   122             m_webview->page()->focusController()->setFocusedNode(plugin->getElement(), m_webview->page()->focusController()->focusedOrMainFrame());                        
   121                          plugin->activate();
   123             m_webview->brCtl()->updateDefaultSoftkeys();
   122                      }
   124          }
   123                      else {
   125          return;
   124                          m_webview->mainFrame()->frameView()->topView()->setFocusedElementType(TBrCtlDefs::EElementActivatedObjectBox);
       
   125                          m_webview->page()->focusController()->setFocusedNode(plugin->getElement(), m_webview->page()->focusController()->focusedOrMainFrame());                        
       
   126                          m_webview->brCtl()->updateDefaultSoftkeys();
       
   127                      }
       
   128                      return;
       
   129                  }
       
   130                  break;
       
   131              }
   126         }
   132         }
   127     }
   133     }
   128 
   134 
   129     updateCursor(aGesture.CurrentPos());
   135     updateCursor(aGesture.CurrentPos());
   130     if (IS_TABBED_NAVIGATION) {
   136     if (IS_TABBED_NAVIGATION) {
   131         m_webview->tabbedNavigation()->updateCursorPosition(aGesture.CurrentPos());
   137         m_webview->tabbedNavigation()->updateCursorPosition(aGesture.CurrentPos());
   132     }
   138     }
   133 
       
   134 
   139 
   135     switch(uid) {
   140     switch(uid) {
   136         case stmGesture::EGestureUidTouch:
   141         case stmGesture::EGestureUidTouch:
   137         {
   142         {
   138             if (m_webview->viewIsScrolling()) {
   143             if (m_webview->viewIsScrolling()) {
   606     if (m_isHighlighted){
   611     if (m_isHighlighted){
   607         dehighlight();
   612         dehighlight();
   608     }
   613     }
   609     m_webview->pinchZoomHandler()->handlePinchGestureEventL(aGesture);
   614     m_webview->pinchZoomHandler()->handlePinchGestureEventL(aGesture);
   610 }
   615 }
       
   616 
       
   617 
       
   618 //-----------------------------------------------------------------------------
       
   619 // WebPointerEventHandler::isPluginConsumable
       
   620 //-----------------------------------------------------------------------------
       
   621 bool WebPointerEventHandler::isPluginConsumable(const TStmGestureUid uid)
       
   622 {
       
   623     //  Gestures which a Plugin can consume
       
   624     return (uid == stmGesture::EGestureUidRelease ||
       
   625             uid == stmGesture::EGestureUidTap ||
       
   626             uid == stmGesture::EGestureUidTouch ||
       
   627             uid == stmGesture::EGestureUidLongPress ||
       
   628             (uid == stmGesture::EGestureUidPan && m_webview->widgetExtension())); // Currently Pan is consumed in Widget mode
       
   629 }