Changeset 51143 in webkit
- Timestamp:
- Nov 18, 2009 3:18:33 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r51140 r51143 1 2009-11-18 Kevin Watters <kevinwatters@gmail.com> 2 3 Reviewed by Kevin Ollivier. 4 5 Enable wx plugin support using the Windows implementation as a base. 6 7 https://bugs.webkit.org/show_bug.cgi?id=31636 8 9 * platform/graphics/GraphicsContext.h: 10 (WebCore::GraphicsContext::inTransparencyLayer): 11 * platform/graphics/wx/GraphicsContextWx.cpp: 12 (WebCore::GraphicsContext::getWindowsContext): 13 (WebCore::GraphicsContext::releaseWindowsContext): 14 * platform/wx/FileSystemWx.cpp: 15 (WebCore::unloadModule): 16 (WebCore::listDirectory): 17 * plugins/PluginDatabase.cpp: 18 * plugins/PluginView.cpp: 19 (WebCore::PluginView::stop): 20 (WebCore::PluginView::PluginView): 21 * plugins/PluginView.h: 22 * plugins/win/PluginViewWin.cpp: 23 (windowHandleForPageClient): 24 (WebCore::PluginView::handleMouseEvent): 25 (WebCore::PluginView::platformStart): 26 (WebCore::PluginView::snapshot): 27 * wscript: 28 1 29 2009-11-18 Andrei Popescu <andreip@google.com> 2 30 -
trunk/WebCore/platform/graphics/GraphicsContext.h
r51124 r51143 362 362 #endif 363 363 364 #if PLATFORM(QT) && defined(Q_WS_WIN)364 #if (PLATFORM(QT) && defined(Q_WS_WIN)) || (PLATFORM(WX) && PLATFORM(WIN_OS)) 365 365 HDC getWindowsContext(const IntRect&, bool supportAlphaBlend = true, bool mayCreateBitmap = true); 366 366 void releaseWindowsContext(HDC, const IntRect&, bool supportAlphaBlend = true, bool mayCreateBitmap = true); 367 367 bool shouldIncludeChildWindows() const { return false; } 368 #endif 369 370 #if PLATFORM(WX) 371 bool inTransparencyLayer() const { return false; } 368 372 #endif 369 373 -
trunk/WebCore/platform/graphics/wx/GraphicsContextWx.cpp
r50852 r51143 567 567 } 568 568 569 } 569 #if PLATFORM(WIN_OS) 570 HDC GraphicsContext::getWindowsContext(const IntRect& dstRect, bool supportAlphaBlend, bool mayCreateBitmap) 571 { 572 if (dstRect.isEmpty()) 573 return 0; 574 575 // Create a bitmap DC in which to draw. 576 BITMAPINFO bitmapInfo; 577 bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); 578 bitmapInfo.bmiHeader.biWidth = dstRect.width(); 579 bitmapInfo.bmiHeader.biHeight = dstRect.height(); 580 bitmapInfo.bmiHeader.biPlanes = 1; 581 bitmapInfo.bmiHeader.biBitCount = 32; 582 bitmapInfo.bmiHeader.biCompression = BI_RGB; 583 bitmapInfo.bmiHeader.biSizeImage = 0; 584 bitmapInfo.bmiHeader.biXPelsPerMeter = 0; 585 bitmapInfo.bmiHeader.biYPelsPerMeter = 0; 586 bitmapInfo.bmiHeader.biClrUsed = 0; 587 bitmapInfo.bmiHeader.biClrImportant = 0; 588 589 void* pixels = 0; 590 HBITMAP bitmap = ::CreateDIBSection(0, &bitmapInfo, DIB_RGB_COLORS, &pixels, 0, 0); 591 if (!bitmap) 592 return 0; 593 594 HDC displayDC = ::GetDC(0); 595 HDC bitmapDC = ::CreateCompatibleDC(displayDC); 596 ::ReleaseDC(0, displayDC); 597 598 ::SelectObject(bitmapDC, bitmap); 599 600 // Fill our buffer with clear if we're going to alpha blend. 601 if (supportAlphaBlend) { 602 BITMAP bmpInfo; 603 GetObject(bitmap, sizeof(bmpInfo), &bmpInfo); 604 int bufferSize = bmpInfo.bmWidthBytes * bmpInfo.bmHeight; 605 memset(bmpInfo.bmBits, 0, bufferSize); 606 } 607 return bitmapDC; 608 } 609 610 void GraphicsContext::releaseWindowsContext(HDC hdc, const IntRect& dstRect, bool supportAlphaBlend, bool mayCreateBitmap) 611 { 612 if (hdc) { 613 614 if (!dstRect.isEmpty()) { 615 616 HBITMAP bitmap = static_cast<HBITMAP>(GetCurrentObject(hdc, OBJ_BITMAP)); 617 BITMAP info; 618 GetObject(bitmap, sizeof(info), &info); 619 ASSERT(info.bmBitsPixel == 32); 620 621 wxBitmap bmp; 622 bmp.SetHBITMAP(bitmap); 623 #if !wxCHECK_VERSION(2,9,0) 624 if (supportAlphaBlend) 625 bmp.UseAlpha(); 626 #endif 627 m_data->context->DrawBitmap(bmp, dstRect.x(), dstRect.y(), supportAlphaBlend); 628 629 ::DeleteObject(bitmap); 630 } 631 632 ::DeleteDC(hdc); 633 } 634 } 635 #endif 636 637 } -
trunk/WebCore/platform/wx/FileSystemWx.cpp
r48344 r51143 2 2 * Copyright (C) 2007 Kevin Ollivier 3 3 * Copyright (C) 2008 Collabora, Ltd. 4 * Copyright (C) 2009 Peter Laufenberg @ Inhance Digital Corp 4 5 * 5 6 * All rights reserved. … … 36 37 #include <wx/wx.h> 37 38 #include <wx/filename.h> 39 #include <wx/dir.h> 40 #include <wx/file.h> 41 #include <wx/datetime.h> 42 #include <wx/filefn.h> 38 43 39 44 namespace WebCore { … … 115 120 } 116 121 117 bool unloadModule(PlatformModule )122 bool unloadModule(PlatformModule mod) 118 123 { 124 #if PLATFORM(WIN_OS) 125 return ::FreeLibrary(mod); 126 #else 119 127 notImplemented(); 120 128 return false; 129 #endif 121 130 } 122 131 123 132 Vector<String> listDirectory(const String& path, const String& filter) 124 133 { 134 wxArrayString file_paths; 135 136 int n_files = wxDir::GetAllFiles(path, &file_paths, _T(""), wxDIR_FILES); 137 125 138 Vector<String> entries; 126 notImplemented(); 139 140 for (int i = 0; i < n_files; i++) 141 { 142 entries.append(file_paths[i]); 143 } 144 127 145 return entries; 128 146 } -
trunk/WebCore/plugins/PluginDatabase.cpp
r50452 r51143 321 321 } 322 322 323 #if (!PLATFORM(WINCE)) && (!PLATFORM(SYMBIAN)) && (!PLATFORM(WIN_OS) || PLATFORM(WX) ||!ENABLE(NETSCAPE_PLUGIN_API))323 #if (!PLATFORM(WINCE)) && (!PLATFORM(SYMBIAN)) && (!PLATFORM(WIN_OS) || !ENABLE(NETSCAPE_PLUGIN_API)) 324 324 // For Safari/Win the following three methods are implemented 325 325 // in PluginDatabaseWin.cpp, but if we can use WebCore constructs -
trunk/WebCore/plugins/PluginView.cpp
r50804 r51143 47 47 #include "FocusController.h" 48 48 #include "PlatformMouseEvent.h" 49 #if PLATFORM(WIN_OS) && !PLATFORM(WX) &&ENABLE(NETSCAPE_PLUGIN_API)49 #if PLATFORM(WIN_OS) && ENABLE(NETSCAPE_PLUGIN_API) 50 50 #include "PluginMessageThrottlerWin.h" 51 51 #endif … … 307 307 308 308 #if ENABLE(NETSCAPE_PLUGIN_API) 309 #if !PLATFORM(WX) // FIXME: Revisit this when implementing plugins for wx310 309 #ifdef XP_WIN 311 310 // Unsubclass the window … … 324 323 } 325 324 #endif // XP_WIN 326 #endif // !PLATFORM(WX)327 325 #endif // ENABLE(NETSCAPE_PLUGIN_API) 328 326 … … 805 803 , m_needsXEmbed(false) 806 804 #endif 807 #if PLATFORM(WIN_OS) && !PLATFORM(WX) &&ENABLE(NETSCAPE_PLUGIN_API)805 #if PLATFORM(WIN_OS) && ENABLE(NETSCAPE_PLUGIN_API) 808 806 , m_pluginWndProc(0) 809 807 , m_lastMessage(0) -
trunk/WebCore/plugins/PluginView.h
r51105 r51143 46 46 #include <wtf/Vector.h> 47 47 48 #if PLATFORM(WIN_OS) && PLATFORM(QT)48 #if PLATFORM(WIN_OS) && (PLATFORM(QT) || PLATFORM(WX)) 49 49 typedef struct HWND__* HWND; 50 50 typedef HWND PlatformPluginWidget; … … 66 66 class MouseEvent; 67 67 class KURL; 68 #if PLATFORM(WIN_OS) && !PLATFORM(WX) &&ENABLE(NETSCAPE_PLUGIN_API)68 #if PLATFORM(WIN_OS) && ENABLE(NETSCAPE_PLUGIN_API) 69 69 class PluginMessageThrottlerWin; 70 70 #endif … … 184 184 const KURL& url() const { return m_url; } 185 185 186 #if PLATFORM(WIN_OS) && !PLATFORM(WX) &&ENABLE(NETSCAPE_PLUGIN_API)186 #if PLATFORM(WIN_OS) && ENABLE(NETSCAPE_PLUGIN_API) 187 187 static LRESULT CALLBACK PluginViewWndProc(HWND, UINT, WPARAM, LPARAM); 188 188 LRESULT wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); … … 227 227 void invalidateWindowlessPluginRect(const IntRect&); 228 228 229 #if PLATFORM(WIN_OS) && !PLATFORM(WX) &&ENABLE(NETSCAPE_PLUGIN_API)229 #if PLATFORM(WIN_OS) && ENABLE(NETSCAPE_PLUGIN_API) 230 230 void paintWindowedPluginIntoContext(GraphicsContext*, const IntRect&); 231 231 static HDC WINAPI hookedBeginPaint(HWND, PAINTSTRUCT*); … … 297 297 #endif 298 298 299 #if PLATFORM(WIN_OS) && !PLATFORM(WX) &&ENABLE(NETSCAPE_PLUGIN_API)299 #if PLATFORM(WIN_OS) && ENABLE(NETSCAPE_PLUGIN_API) 300 300 OwnPtr<PluginMessageThrottlerWin> m_messageThrottler; 301 301 WNDPROC m_pluginWndProc; … … 306 306 #endif 307 307 308 #if ( PLATFORM(QT) && PLATFORM(WIN_OS)) || defined(XP_MACOSX)308 #if ((PLATFORM(QT) || PLATFORM(WX)) && PLATFORM(WIN_OS)) || defined(XP_MACOSX) 309 309 // On Mac OSX and Qt/Windows the plugin does not have its own native widget, 310 310 // but is using the containing window as its reference for positioning/painting. -
trunk/WebCore/plugins/win/PluginViewWin.cpp
r49933 r51143 31 31 32 32 #include "BitmapImage.h" 33 #if !PLATFORM(WX) 33 34 #include "BitmapInfo.h" 35 #endif 34 36 #include "Document.h" 35 37 #include "DocumentLoader.h" … … 82 84 #endif 83 85 86 #if PLATFORM(WX) 87 #include <wx/defs.h> 88 #include <wx/window.h> 89 #endif 90 84 91 static inline HWND windowHandleForPageClient(PlatformPageClient client) 85 92 { … … 88 95 return 0; 89 96 return client->ownerWidget()->winId(); 97 #elif PLATFORM(WX) 98 if (!client) 99 return 0; 100 return (HWND)client->GetHandle(); 90 101 #else 91 102 return client; … … 703 714 event->setDefaultHandled(); 704 715 705 #if !PLATFORM(QT) && !PLATFORM(W INCE)716 #if !PLATFORM(QT) && !PLATFORM(WX) && !PLATFORM(WINCE) 706 717 // Currently, Widget::setCursor is always called after this function in EventHandler.cpp 707 718 // and since we don't want that we set ignoreNextSetCursor to true here to prevent that. … … 988 999 0, 0, 0, 0, parentWindowHandle, 0, Page::instanceHandle(), 0); 989 1000 990 #if PLATFORM(WIN_OS) && PLATFORM(QT)1001 #if PLATFORM(WIN_OS) && (PLATFORM(QT) || PLATFORM(WX)) 991 1002 m_window = window; 992 1003 #else … … 1031 1042 PassRefPtr<Image> PluginView::snapshot() 1032 1043 { 1044 #if !PLATFORM(WX) 1033 1045 OwnPtr<HDC> hdc(CreateCompatibleDC(0)); 1034 1046 … … 1060 1072 1061 1073 return BitmapImage::create(hbmp.get()); 1074 #else 1075 return 0; 1076 #endif 1062 1077 } 1063 1078 -
trunk/WebCore/wscript
r49907 r51143 31 31 32 32 if build_port == "wx": 33 webcore_sources['plugins'] = [ 'plugins/PluginDataNone.cpp', 34 'plugins/PluginViewNone.cpp' 35 ] 33 no_plugins = [ 'plugins/PluginDataNone.cpp', 34 'plugins/PluginViewNone.cpp', 35 'plugins/PluginPackageNone.cpp' 36 ] 36 37 37 38 if building_on_win32: 38 webcore_dirs. append('platform/wx/wxcode/win')39 webcore_dirs.extend(['platform/wx/wxcode/win', 'plugins/win']) 39 40 webcore_sources['wx-win'] = [ 40 41 # wxTimer on Windows has a bug that causes it to eat crashes in callbacks … … 42 43 # widely available (it was fixed in 2.8.10). 43 44 'platform/win/SharedTimerWin.cpp', 45 # Use the Windows plugin architecture 44 46 'page/win/PageWin.cpp', 47 'plugins/win/PluginDataWin.cpp', 48 'plugins/win/PluginDatabaseWin.cpp', 49 'plugins/win/PluginMessageThrottlerWin.cpp', 45 50 'plugins/win/PluginPackageWin.cpp', 51 'plugins/win/PluginViewWin.cpp', 46 52 ] 47 53 elif sys.platform.startswith('darwin'): … … 50 56 'platform/mac/PurgeableBufferMac.cpp', 51 57 ] 52 webcore_sources['plugins'] .append('plugins/PluginPackageNone.cpp')58 webcore_sources['plugins'] = no_plugins 53 59 else: 54 60 webcore_dirs.append('platform/wx/wxcode/gtk') 55 webcore_sources['plugins'] .append('plugins/PluginPackageNone.cpp')61 webcore_sources['plugins'] = no_plugins 56 62 57 63 from TaskGen import taskgen, feature, after -
trunk/WebKit/wx/ChangeLog
r50984 r51143 1 2009-11-18 Kevin Watters <kevinwatters@gmail.com> 2 3 Reviewed by Kevin Ollivier. 4 5 Enable wx plugin support using the Windows implementation as a base. 6 7 https://bugs.webkit.org/show_bug.cgi?id=31636 8 9 * WebKitSupport/FrameLoaderClientWx.cpp: 10 (WebCore::FrameLoaderClientWx::FrameLoaderClientWx): 11 (WebCore::FrameLoaderClientWx::finishedLoading): 12 (WebCore::FrameLoaderClientWx::committedLoad): 13 (WebCore::FrameLoaderClientWx::createPlugin): 14 (WebCore::FrameLoaderClientWx::redirectDataToPlugin): 15 (WebCore::FrameLoaderClientWx::shouldUsePluginDocument): 16 * WebKitSupport/FrameLoaderClientWx.h: 17 * WebView.cpp: 18 (wxWebView::Create): 19 1 20 2009-11-13 Kevin Ollivier <kevino@theolliviers.com> 2 21 -
trunk/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp
r50973 r51143 40 40 #include "HTMLFormElement.h" 41 41 #include "HTMLFrameOwnerElement.h" 42 #include "HTMLPluginElement.h" 42 43 #include "NotImplemented.h" 43 44 #include "Page.h" 44 45 #include "PlatformString.h" 46 #include "PluginView.h" 45 47 #include "ProgressTracker.h" 46 48 #include "RenderPart.h" … … 81 83 82 84 FrameLoaderClientWx::FrameLoaderClientWx() 83 : m_webFrame(0) 85 : m_frame(0) 86 , m_pluginView(0) 87 , m_hasSentResponseToPlugin(false) 88 , m_webFrame(0) 84 89 { 85 90 } … … 409 414 void FrameLoaderClientWx::finishedLoading(DocumentLoader*) 410 415 { 411 notImplemented(); 416 if (m_pluginView) { 417 m_pluginView->didFinishLoading(); 418 m_pluginView = 0; 419 m_hasSentResponseToPlugin = false; 420 } 412 421 } 413 422 … … 568 577 if (!m_webFrame) 569 578 return; 570 FrameLoader* fl = loader->frameLoader(); 571 fl->setEncoding(m_response.textEncodingName(), false); 572 fl->addData(data, length); 579 if (!m_pluginView) { 580 FrameLoader* fl = loader->frameLoader(); 581 fl->setEncoding(m_response.textEncodingName(), false); 582 fl->addData(data, length); 583 } 584 585 // We re-check here as the plugin can have been created 586 if (m_pluginView) { 587 if (!m_hasSentResponseToPlugin) { 588 m_pluginView->didReceiveResponse(loader->response()); 589 // didReceiveResponse sets up a new stream to the plug-in. on a full-page plug-in, a failure in 590 // setting up this stream can cause the main document load to be cancelled, setting m_pluginView 591 // to null 592 if (!m_pluginView) 593 return; 594 m_hasSentResponseToPlugin = true; 595 } 596 m_pluginView->didReceiveData(data, length); 597 } 573 598 } 574 599 … … 801 826 } 802 827 803 PassRefPtr<Widget> FrameLoaderClientWx::createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually) 804 { 805 notImplemented(); 828 PassRefPtr<Widget> FrameLoaderClientWx::createPlugin(const IntSize& size, HTMLPlugInElement* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually) 829 { 830 #if PLATFORM(WIN_OS) 831 RefPtr<PluginView> pv = PluginView::create(m_frame, size, element, url, paramNames, paramValues, mimeType, loadManually); 832 if (pv->status() == PluginStatusLoadedSuccessfully) 833 return pv; 834 #endif 806 835 return 0; 807 836 } … … 809 838 void FrameLoaderClientWx::redirectDataToPlugin(Widget* pluginWidget) 810 839 { 811 notImplemented(); 812 return; 840 ASSERT(!m_pluginView); 841 m_pluginView = static_cast<PluginView*>(pluginWidget); 842 m_hasSentResponseToPlugin = false; 813 843 } 814 844 … … 889 919 } 890 920 891 } 921 bool FrameLoaderClientWx::shouldUsePluginDocument(const String &mimeType) const 922 { 923 // NOTE: Plugin Documents are used for viewing PDFs, etc. inline, and should 924 // not be used for pages with plugins in them. 925 return false; 926 } 927 928 } -
trunk/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h
r50973 r51143 32 32 #include "FrameLoader.h" 33 33 #include "KURL.h" 34 #include "PluginView.h" 34 35 #include "ResourceResponse.h" 36 #include "HTMLPlugInElement.h" 35 37 36 38 class wxWebFrame; … … 209 211 210 212 virtual void registerForIconNotification(bool listen = true); 213 214 virtual bool shouldUsePluginDocument(const String &mimeType) const; 211 215 212 216 private: … … 214 218 Frame* m_frame; 215 219 wxWebView *m_webView; 220 PluginView* m_pluginView; 221 bool m_hasSentResponseToPlugin; 216 222 ResourceResponse m_response; 217 223 bool m_firstData; -
trunk/WebKit/wx/WebView.cpp
r50522 r51143 337 337 #if ENABLE(DATABASE) 338 338 settings->setDatabasesEnabled(true); 339 #endif 340 341 #if __WXMSW__ 342 settings->setPluginsEnabled(true); 339 343 #endif 340 344 -
trunk/WebKitTools/ChangeLog
r51114 r51143 1 2009-11-18 Kevin Watters <kevinwatters@gmail.com> 2 3 Reviewed by Kevin Ollivier. 4 5 Enable wx plugin support using the Windows implementation as a base. 6 7 https://bugs.webkit.org/show_bug.cgi?id=31636 8 9 * wx/build/settings.py: 10 1 11 2009-11-18 Kenneth Rohde Christiansen <kenneth@webkit.org> 2 12 -
trunk/WebKitTools/wx/build/settings.py
r50135 r51143 338 338 conf.env.append_value('LIB', [ 339 339 'kernel32', 'user32','gdi32','comdlg32','winspool','winmm', 340 'shell32', ' comctl32', 'ole32', 'oleaut32', 'uuid', 'advapi32',340 'shell32', 'shlwapi', 'comctl32', 'ole32', 'oleaut32', 'uuid', 'advapi32', 341 341 'wsock32', 'gdiplus', 'version']) 342 342
Note: See TracChangeset
for help on using the changeset viewer.