RESOLVED FIXED 27713
WINCE port: make plugin work for wince
https://bugs.webkit.org/show_bug.cgi?id=27713
Summary WINCE port: make plugin work for wince
Yong Li
Reported 2009-07-27 07:19:47 PDT
patch is following
Attachments
the patch (18.01 KB, patch)
2009-07-27 07:36 PDT, Yong Li
staikos: review-
updated (17.50 KB, patch)
2009-07-27 08:36 PDT, Yong Li
no flags
more cleanup (17.38 KB, patch)
2009-07-27 08:44 PDT, Yong Li
no flags
fix a bug (17.06 KB, patch)
2009-07-27 08:57 PDT, Yong Li
staikos: review+
Yong Li
Comment 1 2009-07-27 07:36:48 PDT
Created attachment 33545 [details] the patch
George Staikos
Comment 2 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.
Yong Li
Comment 3 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.
Yong Li
Comment 4 2009-07-27 08:36:55 PDT
Created attachment 33547 [details] updated
Yong Li
Comment 5 2009-07-27 08:44:21 PDT
Created attachment 33548 [details] more cleanup
Yong Li
Comment 6 2009-07-27 08:57:56 PDT
Created attachment 33550 [details] fix a bug
Adam Treat
Comment 7 2009-07-27 15:01:14 PDT
Landed with r46430.
Note You need to log in before you can comment on or make changes to this bug.