Changeset 21075 for S60/trunk/WebKit

Show
Ignore:
Timestamp:
04/24/07 13:37:17 (21 months ago)
Author:
spadma
Message:

yadavall, reviewed by <sachin.padma@nokia.com>

DESC: Windowless plugin support
http://bugs.webkit.org/show_bug.cgi?id=13451

  • BrowserView/src/PluginContentPlayer.cpp: (CPluginContentPlayer::CPluginContentPlayer): (CPluginContentPlayer::CountComponentControls): (CPluginContentPlayer::Start):
  • Plugin/inc/PluginWin.h: (CPluginWin::IsPluginWindowed): (CPluginWin::SetWindowedPlugin):
  • Plugin/src/NpnImplementation.cpp: (NpnGetValue): (NpnSetValue): (NpnInvalidateRect): (NpnForceRedraw):
  • Plugin/src/PluginSkin.cpp: (CPluginSkin::Draw):
  • Plugin/src/PluginWin.cpp: (CPluginWin::CPluginWin): (CPluginWin::ConstructL): (CPluginWin::~CPluginWin): (CPluginWin::NewL): (CPluginWin::SizeChanged): (CPluginWin::OfferKeyEventL): (CPluginWin::CreateStreamL): (CPluginWin::WriteStreamToFileL): (CPluginWin::ProcessEventL): (CPluginWin::RefreshPlugin): (CPluginWin::MakeVisible): (CPluginWin::HandleControlEventL): (CPluginWin::HandleGainingForeground): (CPluginWin::HandleLosingForeground): (CPluginWin::PluginScriptableObject): (CPluginWin::ForceRedraw): (CPluginWin::IsContentInteractive):
Location:
S60/trunk/WebKit
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • S60/trunk/WebKit/BrowserView/src/PluginContentPlayer.cpp

    r20806 r21075  
    99*    Copyright (c) 2006, Nokia Corporation 
    1010*    All rights reserved. 
    11 *   
     11* 
    1212*   Redistribution and use in source and binary forms, with or without 
    1313*   modification, are permitted provided that the following conditions 
    1414*   are met: 
    15 *   
     15* 
    1616*      * Redistributions of source code must retain the above copyright 
    1717*        notice, this list of conditions and the following disclaimer. 
     
    2323*        contributors may be used to endorse or promote products derived 
    2424*        from this software without specific prior written permission. 
    25 *   
     25* 
    2626*   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
    2727*   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
     
    3636*   USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 
    3737*   DAMAGE. 
    38 *   
     38* 
    3939*    Please see file patentlicense.txt for further grants. 
    4040* ============================================================================== 
     
    5959    } 
    6060 
    61 CPluginContentPlayer::CPluginContentPlayer( CBrCtl& aParent, CPluginWin* aPlugin )  
     61CPluginContentPlayer::CPluginContentPlayer( CBrCtl& aParent, CPluginWin* aPlugin ) 
    6262    : iBrCtl( aParent ), iPlugin( aPlugin ) 
    6363    { 
     
    9090TInt CPluginContentPlayer::CountComponentControls() const 
    9191    { 
    92     if( iPlugin )  
     92    if( iPlugin ) 
    9393        return 1; 
    94     else  
     94    else 
    9595        return 0; 
    9696    } 
     
    113113 
    114114    iPlugin->SetParent( this ); 
    115      
     115 
    116116    // try to guess what part the user wants to see, this way 
    117117    // we can avoid unnecessary scrolling; 
     
    134134            x = iOrgRect.iTl.iX;                                    // both edges are clipped away 
    135135        } 
    136      
     136 
    137137    // vertical 
    138138    if( y < 0 ) 
     
    148148    iPlugin->SetRect( TRect( TPoint(x,y), iOrgRect.Size() ) ); 
    149149    iPlugin->MakeVisible( ETrue ); 
    150     iPlugin->RefreshPlugin(); 
     150 
     151    CWindowGc& gc = SystemGc(); 
     152    iPlugin->RefreshPlugin(gc); 
    151153 
    152154    DrawNow(); 
  • S60/trunk/WebKit/ChangeLog

    r21043 r21075  
     1yadavall, reviewed by <sachin.padma@nokia.com> 
     2 DESC: Windowless plugin support 
     3 http://bugs.webkit.org/show_bug.cgi?id=13451 
     4 
     5        * BrowserView/src/PluginContentPlayer.cpp: 
     6        (CPluginContentPlayer::CPluginContentPlayer): 
     7        (CPluginContentPlayer::CountComponentControls): 
     8        (CPluginContentPlayer::Start): 
     9        * Plugin/inc/PluginWin.h: 
     10        (CPluginWin::IsPluginWindowed): 
     11        (CPluginWin::SetWindowedPlugin): 
     12        * Plugin/src/NpnImplementation.cpp: 
     13        (NpnGetValue): 
     14        (NpnSetValue): 
     15        (NpnInvalidateRect): 
     16        (NpnForceRedraw): 
     17        * Plugin/src/PluginSkin.cpp: 
     18        (CPluginSkin::Draw): 
     19        * Plugin/src/PluginWin.cpp: 
     20        (CPluginWin::CPluginWin): 
     21        (CPluginWin::ConstructL): 
     22        (CPluginWin::~CPluginWin): 
     23        (CPluginWin::NewL): 
     24        (CPluginWin::SizeChanged): 
     25        (CPluginWin::OfferKeyEventL): 
     26        (CPluginWin::CreateStreamL): 
     27        (CPluginWin::WriteStreamToFileL): 
     28        (CPluginWin::ProcessEventL): 
     29        (CPluginWin::RefreshPlugin): 
     30        (CPluginWin::MakeVisible): 
     31        (CPluginWin::HandleControlEventL): 
     32        (CPluginWin::HandleGainingForeground): 
     33        (CPluginWin::HandleLosingForeground): 
     34        (CPluginWin::PluginScriptableObject): 
     35        (CPluginWin::ForceRedraw): 
     36        (CPluginWin::IsContentInteractive): 
     37 
    138yadavall, reviewed by <zbujtas@gmail.com> 
    239 DESC: Fix ROM image iby file 
  • S60/trunk/WebKit/Plugin/inc/PluginWin.h

    r17905 r21075  
    1111*    Copyright (c) 2006, Nokia Corporation 
    1212*    All rights reserved. 
    13 *   
     13* 
    1414*   Redistribution and use in source and binary forms, with or without 
    1515*   modification, are permitted provided that the following conditions 
    1616*   are met: 
    17 *   
     17* 
    1818*      * Redistributions of source code must retain the above copyright 
    1919*        notice, this list of conditions and the following disclaimer. 
     
    2525*        contributors may be used to endorse or promote products derived 
    2626*        from this software without specific prior written permission. 
    27 *   
     27* 
    2828*   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
    2929*   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
     
    3838*   USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 
    3939*   DAMAGE. 
    40 *   
     40* 
    4141*    Please see file patentlicense.txt for further grants. 
    4242* ============================================================================== 
     
    5858class CPluginSkin; 
    5959class CPluginHandler; 
     60class CBitmapContext; 
    6061#ifdef  RD_BROWSER_WIDGETS 
    6162class NPObject; 
     
    9697*/ 
    9798class CPluginWin :  public CCoeControl, 
    98                     public MPluginAdapter,                                           
    99                     public MCoeControlObserver,                     
     99                    public MPluginAdapter, 
     100                    public MCoeControlObserver, 
    100101                    public MCoeForegroundObserver 
    101102    { 
     
    122123                                 const CDesCArray& aArgv, 
    123124                                 CPluginSkin& aPluginSkin, 
    124                                  const CWebKitControl& aWebKitControl); 
     125                                 CWebKitControl& aWebKitControl 
     126                               ); 
    125127 
    126128        /** 
     
    192194        */ 
    193195        void LoadPluginToViewerL(); 
    194          
     196 
    195197        /** 
    196198        * Procces a user interface event. 
     
    211213        * @return The error code from the plugin 
    212214        */ 
    213         TInt RefreshPlugin(); 
     215        TInt RefreshPlugin(CBitmapContext &aBitmapContext); 
    214216 
    215217        /** 
     
    247249        * @return void 
    248250        */ 
    249         TBool IsContentInteractive() const ;                 
     251        TBool IsContentInteractive() const ; 
     252        /** 
     253        * Check if the plugin is windowed or windowless 
     254        * 
     255        * @since 3.2 
     256        * @param None 
     257        * @return TBool 
     258        */ 
     259        TBool IsPluginWindowed() {return iWindowedPlugin;} 
     260 
    250261    public: // Functions from CCoeControl 
    251262 
     
    456467 
    457468    /** 
    458         * HandleGainingForeground  
     469        * HandleGainingForeground 
    459470        * @since 3.1 
    460471        * @return none 
    461472        */ 
    462473    void HandleGainingForeground(); 
    463      
    464      
     474 
     475 
    465476    /** 
    466         * HandleLosingForeground  
     477        * HandleLosingForeground 
    467478        * @since 3.1 
    468479        * @return none 
     
    472483#ifdef  RD_BROWSER_WIDGETS 
    473484        /** 
    474         * Return window object usable from scriptable plugins  
     485        * Return window object usable from scriptable plugins 
    475486        * @since 3.1 
    476487        * @return none 
    477         */         
    478         NPObject* WindowScriptNPObject();  
     488        */ 
     489        NPObject* WindowScriptNPObject(); 
    479490        /** 
    480491        * Get the scripting object from plugin 
     
    483494        * @return 
    484495        */ 
    485         void *PluginScriptableObject();          
     496        void *PluginScriptableObject(); 
    486497#endif //RD_BROWSER_WIDGETS 
     498 
     499        /** 
     500        * Sets the plugin's behaviour as windowed or windowless 
     501        * @since 3.2 
     502        * @return 
     503        */ 
     504        void SetWindowedPlugin(TBool aWindowedPlugin) { iWindowedPlugin = aWindowedPlugin; } 
     505 
     506        /** 
     507        * Forces a redraw of the screen 
     508        * @since 3.2 
     509        * @return 
     510        */ 
     511        void ForceRedraw(TBool aDrawNow); 
    487512 
    488513    protected: // New functions 
     
    495520        * @param aParent The parent control of the PluginInst. 
    496521        */ 
    497         CPluginWin(CPluginSkin& aPluginSkin, TInt aHandle); 
     522        CPluginWin(CPluginSkin& aPluginSkin, TInt aHandle,CWebKitControl& aWebKitControl); 
    498523 
    499524        /** 
     
    510535        */ 
    511536        void ConstructL(const TDesC& aMIMEType, const CDesCArray& aArgn, 
    512                         const CDesCArray& aArgv,const CWebKitControl& aWebKitControl); 
     537                        const CDesCArray& aArgv); 
    513538 
    514539        /** 
     
    601626 
    602627        RPointerArray<CPluginData>          iPluginDataArray; 
    603         CDesCArrayFlat                      iPluginDataFileNamesArray;         
     628        CDesCArrayFlat                      iPluginDataFileNamesArray; 
    604629 
    605630        TBool                               iPluginFocus; 
     
    610635        TBool                               iIsLoadComplete;// Flag to see if data load is complete 
    611636        TInt                                iTransactionId; // The transaction id 
    612         HBufC*                              iTopUrl;  
     637        HBufC*                              iTopUrl; 
    613638        TInt                                iReason; 
    614          
     639 
    615640        MPluginNotifier*                    iPluginNotifier;// Pointer to the plugin notifier;allows the 
    616641                                                            // browser to send events to the plugin 
     
    618643                                                               // browser to send option menu commands to plugin 
    619644        TBool                               iDeleted;       // Flag to check if plugin control has been deleted 
     645        CWebKitControl*                     iWebKitControl; 
     646 
     647        TBool                               iWindowedPlugin;//Flag that is set to true for windowed plugin. 
     648        CFbsBitmap*                         iBitmap;       //The bitmap for windowless plugin 
    620649    }; 
    621650 
  • S60/trunk/WebKit/Plugin/src/NpnImplementation.cpp

    r17301 r21075  
    99*    Copyright (c) 2006, Nokia Corporation 
    1010*    All rights reserved. 
    11 *   
     11* 
    1212*   Redistribution and use in source and binary forms, with or without 
    1313*   modification, are permitted provided that the following conditions 
    1414*   are met: 
    15 *   
     15* 
    1616*      * Redistributions of source code must retain the above copyright 
    1717*        notice, this list of conditions and the following disclaimer. 
     
    2323*        contributors may be used to endorse or promote products derived 
    2424*        from this software without specific prior written permission. 
    25 *   
     25* 
    2626*   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
    2727*   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
     
    3636*   USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 
    3737*   DAMAGE. 
    38 *   
     38* 
    3939*    Please see file patentlicense.txt for further grants. 
    4040* ============================================================================== 
     
    408408 
    409409        case NPNVnetscapeWindow: 
    410           {          
     410          { 
    411411            CPluginWin* pluginWin = (CPluginWin*)aInstance->ndata; 
    412412            if (pluginWin) 
     
    482482          } 
    483483            break; 
    484  
     484        case NPPVpluginWindowBool: 
     485          { 
     486          CPluginWin* pluginWin = (CPluginWin*)aInstance->ndata; 
     487          if (pluginWin) 
     488              { 
     489              NPBool* isWindowed = (NPBool*)aSetValue; 
     490              if (isWindowed) 
     491                  { 
     492                  pluginWin->SetWindowedPlugin(*isWindowed); 
     493                  } 
     494              } 
     495          break; 
     496          } 
    485497        default: 
    486498            break; 
    487499        }   // end of switch 
    488          
     500 
    489501    return NPERR_NO_ERROR; 
    490502    } 
     
    496508// ----------------------------------------------------------------------------- 
    497509// 
    498  void NpnInvalidateRect(NPP /*aInstance*/, NPRect * /*aRect*/) 
     510 void NpnInvalidateRect(NPP aInstance, NPRect* /*aRect*/) 
     511    { 
     512    CPluginWin* pluginWin = (CPluginWin*)aInstance->ndata; 
     513    if( pluginWin ) 
     514        { 
     515        pluginWin->ForceRedraw(EFalse); 
     516        } 
     517    } 
     518 
     519// ----------------------------------------------------------------------------- 
     520// NpnInvalidateRegion 
     521// 
     522// Unsupported. 
     523// ----------------------------------------------------------------------------- 
     524// 
     525 void NpnInvalidateRegion(NPP /*aInstance*/, NPRegion /*aRegion*/) 
    499526    { 
    500527    // This function is not supported 
     
    502529 
    503530// ----------------------------------------------------------------------------- 
    504 // NpnInvalidateRegion 
    505 // 
    506 // Unsupported. 
    507 // ----------------------------------------------------------------------------- 
    508 // 
    509  void NpnInvalidateRegion(NPP /*aInstance*/, NPRegion /*aRegion*/) 
    510     { 
    511     // This function is not supported 
    512     } 
    513  
    514 // ----------------------------------------------------------------------------- 
    515531// NpnForceRedraw 
    516532// 
     
    518534// ----------------------------------------------------------------------------- 
    519535// 
    520  void NpnForceRedraw(NPP /*aInstance*/) 
    521     { 
    522     // This function is not supported 
    523     } 
    524  
    525  
     536 void NpnForceRedraw(NPP aInstance) 
     537    { 
     538    CPluginWin* pluginWin = (CPluginWin*)aInstance->ndata; 
     539    if( pluginWin ) 
     540        { 
     541        pluginWin->ForceRedraw(ETrue); 
     542        } 
     543    } 
     544 
     545 
  • S60/trunk/WebKit/Plugin/src/PluginSkin.cpp

    r20804 r21075  
    344344 
    345345        // Force the control to be redrawn. 
    346         iPluginWin->RefreshPlugin(); 
     346        iPluginWin->RefreshPlugin(*gContext); 
     347 
    347348        } 
    348349    } 
  • S60/trunk/WebKit/Plugin/src/PluginWin.cpp

    r20589 r21075  
    88*    Copyright (c) 2006, Nokia Corporation 
    99*    All rights reserved. 
    10 *   
     10* 
    1111*   Redistribution and use in source and binary forms, with or without 
    1212*   modification, are permitted provided that the following conditions 
    1313*   are met: 
    14 *   
     14* 
    1515*      * Redistributions of source code must retain the above copyright 
    1616*        notice, this list of conditions and the following disclaimer. 
     
    2222*        contributors may be used to endorse or promote products derived 
    2323*        from this software without specific prior written permission. 
    24 *   
     24* 
    2525*   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
    2626*   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
     
    3535*   USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 
    3636*   DAMAGE. 
    37 *   
     37* 
    3838*    Please see file patentlicense.txt for further grants. 
    3939* ============================================================================== 
     
    5656#include "WebKitBridge.h" 
    5757#include "WebKitCursor.h" 
     58#include "WebKitSurface.h" 
    5859 
    5960// CONSTANTS 
     
    7273// ----------------------------------------------------------------------------- 
    7374// 
    74 CPluginWin::CPluginWin(CPluginSkin& aPluginSkin, TInt aHandle) : 
     75CPluginWin::CPluginWin(CPluginSkin& aPluginSkin, TInt aHandle, CWebKitControl& aWebKitControl) : 
    7576    iHandle(aHandle), 
    7677    iPluginSkin(&aPluginSkin), 
     78    iWebKitControl(&aWebKitControl), 
    7779    iPluginDataArray(KPluginGranularity), 
    7880    iPluginDataFileNamesArray(KPluginGranularity), 
    79     iDeleted(ETrue) 
     81    iDeleted(ETrue), 
     82    iWindowedPlugin(ETrue) 
    8083    { 
    8184    } 
     
    8790void CPluginWin::ConstructL( const TDesC& aMIMEType, 
    8891                             const CDesCArray& aArgn, 
    89                              const CDesCArray& aArgv, 
    90                              const CWebKitControl& aWebKitControl ) 
     92                             const CDesCArray& aArgv ) 
    9193    { 
    9294    __ASSERT_DEBUG( aMIMEType.Ptr() != NULL, PanicPluginInt() ); 
     
    9698    iInstance->pdata = NULL; 
    9799 
    98     iPluginHandler = &(aWebKitControl.PluginHandler()); 
     100    iPluginHandler = &(iWebKitControl->PluginHandler()); 
    99101    if ( iPluginHandler ) 
    100102        { 
     
    102104        } 
    103105 
    104      
    105     CreateWindowL((CCoeControl*)&aWebKitControl.WebKitView());               
     106 
    106107 
    107108    NPError err( NPERR_NO_ERROR ); 
     
    140141        } 
    141142 
    142     ActivateL(); 
     143    if( !iWindowedPlugin ) 
     144        { 
     145        SetContainerWindowL(*iWebKitControl->BrCtl().CCoeControlParent()); 
     146        iBitmap = new (ELeave) CFbsBitmap(); 
     147        iBitmap->Create(TSize(0,0),CStaticObjectContainer::Instance().SurfaceL().DisplayMode()); 
     148        } 
     149    else{ 
     150        CreateWindowL(&iWebKitControl->WebKitView()); 
     151        ActivateL(); 
     152        } 
    143153    iDeleted = EFalse; 
    144154 
     
    147157    SetExtent( TPoint(0,0), TSize(0,0) ); 
    148158 
    149     // Add the focus/foreground observer     
     159    // Add the focus/foreground observer 
    150160    ControlEnv()->AddForegroundObserverL( *this ) ; 
    151161    } 
     
    160170    TRAP_IGNORE( SetPluginFocusL( EFalse ) ); 
    161171 
    162     // Remove the foreground observer     
    163     ControlEnv()->RemoveForegroundObserver( *this );             
     172    // Remove the foreground observer 
     173    ControlEnv()->RemoveForegroundObserver( *this ); 
    164174 
    165175    // If soundstart destroy all the streams created 
     
    209219    // If the ref count is zero, the DLL is unloaded. 
    210220    iPluginHandler->UnloadPlugin( iHandle ); 
    211      
     221 
    212222    // Delete the top url that was loaded for this plugin 
    213223    delete iTopUrl; 
     224    delete iBitmap; 
    214225    } 
    215226 
     
    222233                              const CDesCArray& aArgn, const CDesCArray& aArgv, 
    223234                              CPluginSkin& aPluginSkin, 
    224                               const CWebKitControl& aWebKitControl ) 
    225     { 
    226     CPluginWin* self = new( ELeave ) CPluginWin( aPluginSkin, aHandle ); 
     235                              CWebKitControl& aWebKitControl ) 
     236    { 
     237    CPluginWin* self = new( ELeave ) CPluginWin( aPluginSkin, aHandle, aWebKitControl ); 
    227238    CleanupStack::PushL( self ); 
    228     self->ConstructL( aMIMEType, aArgn, aArgv, aWebKitControl ); 
     239    self->ConstructL( aMIMEType, aArgn, aArgv ); 
    229240    CleanupStack::Pop(); 
    230241    return self; 
     
    243254         NPWindow  window; 
    244255 
    245          window.window = (MPluginAdapter*)this; 
     256         if( !iWindowedPlugin ) 
     257             { 
     258             iBitmap->Resize(rect.Size()); 
     259             window.window = (CFbsBitmap*) iBitmap; 
     260             } 
     261         else{ 
     262             window.window =  (MPluginAdapter*)this; 
     263             } 
    246264 
    247265         // Coordinates for the plugin always start from (0,0) and are relative 
     
    251269         window.width = rect.Width(); 
    252270         window.height = rect.Height(); 
    253           
     271         window.type = iWindowedPlugin ? NPWindowTypeWindow : NPWindowTypeDrawable ; 
    254272         TRect clipRect = iPluginSkin->PluginWinClipRect(); 
    255273         window.clipRect.top = clipRect.iTl.iX; 
     
    257275         window.clipRect.bottom =clipRect.iBr.iX; 
    258276         window.clipRect.right = clipRect.iBr.iY; 
    259          
    260          window.type = NPWindowTypeDrawable; 
     277 
    26