Bug 27713 - WINCE port: make plugin work for wince
Summary: WINCE port: make plugin work for wince
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other Other
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 23154
  Show dependency treegraph
 
Reported: 2009-07-27 07:19 PDT by Yong Li
Modified: 2009-07-28 12:14 PDT (History)
2 users (show)

See Also:


Attachments
the patch (18.01 KB, patch)
2009-07-27 07:36 PDT, Yong Li
staikos: review-
Details | Formatted Diff | Diff
updated (17.50 KB, patch)
2009-07-27 08:36 PDT, Yong Li
no flags Details | Formatted Diff | Diff
more cleanup (17.38 KB, patch)
2009-07-27 08:44 PDT, Yong Li
no flags Details | Formatted Diff | Diff
fix a bug (17.06 KB, patch)
2009-07-27 08:57 PDT, Yong Li
staikos: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yong Li 2009-07-27 07:19:47 PDT
patch is following
Comment 1 Yong Li 2009-07-27 07:36:48 PDT
Created attachment 33545 [details]
the patch
Comment 2 George Staikos 2009-07-27 07:48:04 PDT
Comment on attachment 33545 [details]
the patch


> +DWORD SHGetValue(HKEY hkey, LPCWSTR pszSubKey, LPCWSTR pszValue, LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData)
> +{
> +    HKEY key;
> +	if (RegOpenKeyEx(hkey, pszSubKey, 0, 0, &key) == ERROR_SUCCESS) {
> +        DWORD result = RegQueryValueEx(key, pszValue, 0, pdwType, (LPBYTE)pvData, pcbData);
> +        RegCloseKey(key);
> +        return result;
> +	}
> +    return ERROR_INVALID_NAME;
> +}

  Tabs should be removed.


>      HKEY key;
> +#if PLATFORM(WINCE)
> +    HRESULT result = RegOpenKeyExW(rootKey, L"Software\\MozillaPlugins", 0, 0, &key);
> +#else
>      HRESULT result = RegOpenKeyExW(rootKey, L"Software\\MozillaPlugins", 0, KEY_ENUMERATE_SUB_KEYS, &key);
> +#endif

   Does it make more sense to #define KEY_ENUMERATE_SUB_KEYS if it's not available?

>  static inline void addWindowsMediaPlayerPluginDirectory(Vector<String>& directories)
>  {
> +#if PLATFORM(WINCE)
> +#else
   Change to #if !PLATFORM(WINCE)

>  static inline void addMacromediaPluginDirectories(Vector<String>& directories)
>  {
> +#if PLATFORM(WINCE)
> +    directories.append("\\Windows\\System\\macromed\\Flash");
> +#else

   Is this valid?

> -    NP_Initialize = (NP_InitializeFuncPtr)GetProcAddress(m_module, "NP_Initialize");
> -    NP_GetEntryPoints = (NP_GetEntryPointsFuncPtr)GetProcAddress(m_module, "NP_GetEntryPoints");
> -    m_NPP_Shutdown = (NPP_ShutdownProcPtr)GetProcAddress(m_module, "NP_Shutdown");
> +    NP_Initialize = (NP_InitializeFuncPtr)GetProcAddress(m_module, _T("NP_Initialize"));
> +    NP_GetEntryPoints = (NP_GetEntryPointsFuncPtr)GetProcAddress(m_module, _T("NP_GetEntryPoints"));
> +    m_NPP_Shutdown = (NPP_ShutdownProcPtr)GetProcAddress(m_module, _T("NP_Shutdown"));

   Will this not affect the Win32 build?
 
> @@ -264,6 +284,10 @@ static bool isWindowsMessageUserGesture(UINT message)
>  LRESULT
>  PluginView::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
>  {
> +#if PLATFORM(WINCE)
> +    if (!m_pluginWndProc)
> +        return 1;
> +#endif

   Can this be unconditional on WINCE?

> +#if PLATFORM(WINCE)
> +    m_windowRect = frameView->contentsToWindow(frameRect());
> +#else
>      m_windowRect = IntRect(frameView->contentsToWindow(frameRect().location()), frameRect().size());
> +#endif

   The difference here concerns me.

> @@ -491,15 +525,24 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect)
>      m_npWindow.type = NPWindowTypeDrawable;
>      m_npWindow.window = hdc;
>  
> -    IntPoint p = static_cast<FrameView*>(parent())->contentsToWindow(frameRect().location());
> -    
>      WINDOWPOS windowpos;
>      memset(&windowpos, 0, sizeof(windowpos));
>  
> +#if PLATFORM(WINCE)
> +    IntRect r = static_cast<FrameView*>(parent())->contentsToWindow(frameRect());
> +    
> +    windowpos.x = r.x();
> +    windowpos.y = r.y();
> +    windowpos.cx = r.width();
> +    windowpos.cy = r.height();
> +#else
> +    IntPoint p = static_cast<FrameView*>(parent())->contentsToWindow(frameRect().location());
> +    
>      windowpos.x = p.x();
>      windowpos.y = p.y();
>      windowpos.cx = frameRect().width();
>      windowpos.cy = frameRect().height();
> +#endif

  Likewise.  Why are the coordinates behaving so differently?
> @@ -697,14 +770,24 @@ void PluginView::stop()
>  
>      ASSERT(m_streams.isEmpty());
>  
> +    if (m_manualStream)
> +        m_manualStream->stop();
> +
>      m_isStarted = false;

   This looks like it will affect the Win32 case.  Should probably be checked in separately if it's valid there too.

>  #if PLATFORM(WIN_OS) && PLATFORM(QT)
>          m_window = window;
>  #else
>          setPlatformWidget(window);
> +        m_isWindowed = true;
>  #endif

   Same here.
Comment 3 Yong Li 2009-07-27 08:01:24 PDT
(In reply to comment #2)
> (From update of attachment 33545 [details])
> 
> 
> >      HKEY key;
> > +#if PLATFORM(WINCE)
> > +    HRESULT result = RegOpenKeyExW(rootKey, L"Software\\MozillaPlugins", 0, 0, &key);
> > +#else
> >      HRESULT result = RegOpenKeyExW(rootKey, L"Software\\MozillaPlugins", 0, KEY_ENUMERATE_SUB_KEYS, &key);
> > +#endif
> 
>    Does it make more sense to #define KEY_ENUMERATE_SUB_KEYS if it's not
> available?
> 

KEY_ENUMERATE_SUB_KEYS is defined by OS header where RegOpenKeyExW is defined.

 
> > -    NP_Initialize = (NP_InitializeFuncPtr)GetProcAddress(m_module, "NP_Initialize");
> > -    NP_GetEntryPoints = (NP_GetEntryPointsFuncPtr)GetProcAddress(m_module, "NP_GetEntryPoints");
> > -    m_NPP_Shutdown = (NPP_ShutdownProcPtr)GetProcAddress(m_module, "NP_Shutdown");
> > +    NP_Initialize = (NP_InitializeFuncPtr)GetProcAddress(m_module, _T("NP_Initialize"));
> > +    NP_GetEntryPoints = (NP_GetEntryPointsFuncPtr)GetProcAddress(m_module, _T("NP_GetEntryPoints"));
> > +    m_NPP_Shutdown = (NPP_ShutdownProcPtr)GetProcAddress(m_module, _T("NP_Shutdown"));
> 
>    Will this not affect the Win32 build?

No, it won't affect win32 build. If GetProcAddress means GetProcAddressW, _T"" means L"". If GetProcAddress means GetProcAddressA, _T"" means "".

> 
> > @@ -264,6 +284,10 @@ static bool isWindowsMessageUserGesture(UINT message)
> >  LRESULT
> >  PluginView::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
> >  {
> > +#if PLATFORM(WINCE)
> > +    if (!m_pluginWndProc)
> > +        return 1;
> > +#endif
> 
>    Can this be unconditional on WINCE?
> 
> > +#if PLATFORM(WINCE)
> > +    m_windowRect = frameView->contentsToWindow(frameRect());
> > +#else
> >      m_windowRect = IntRect(frameView->contentsToWindow(frameRect().location()), frameRect().size());
> > +#endif
> 
>    The difference here concerns me.

Because we support zoomed view. so frameRect().size() doesn't work for us

> 
> > @@ -491,15 +525,24 @@ void PluginView::paint(GraphicsContext* context, const IntRect& rect)
> >      m_npWindow.type = NPWindowTypeDrawable;
> >      m_npWindow.window = hdc;
> >  
> > -    IntPoint p = static_cast<FrameView*>(parent())->contentsToWindow(frameRect().location());
> > -    
> >      WINDOWPOS windowpos;
> >      memset(&windowpos, 0, sizeof(windowpos));
> >  
> > +#if PLATFORM(WINCE)
> > +    IntRect r = static_cast<FrameView*>(parent())->contentsToWindow(frameRect());
> > +    
> > +    windowpos.x = r.x();
> > +    windowpos.y = r.y();
> > +    windowpos.cx = r.width();
> > +    windowpos.cy = r.height();
> > +#else
> > +    IntPoint p = static_cast<FrameView*>(parent())->contentsToWindow(frameRect().location());
> > +    
> >      windowpos.x = p.x();
> >      windowpos.y = p.y();
> >      windowpos.cx = frameRect().width();
> >      windowpos.cy = frameRect().height();
> > +#endif
> 
>   Likewise.  Why are the coordinates behaving so differently?

same reason as above.
Comment 4 Yong Li 2009-07-27 08:36:55 PDT
Created attachment 33547 [details]
updated
Comment 5 Yong Li 2009-07-27 08:44:21 PDT
Created attachment 33548 [details]
more cleanup
Comment 6 Yong Li 2009-07-27 08:57:56 PDT
Created attachment 33550 [details]
fix a bug
Comment 7 Adam Treat 2009-07-27 15:01:14 PDT
Landed with r46430.