Changeset 46430 in webkit
- Timestamp:
- Jul 27, 2009 3:00:58 PM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r46429 r46430 1 2009-07-27 Yong Li <yong.li@torchmobile.com> 2 3 Reviewed by George Staikos. 4 5 WINCE PORT: Make plugin work for WINCE 6 https://bugs.webkit.org/show_bug.cgi?id=27713 7 8 * plugins/win/PluginDatabaseWin.cpp: 9 (SHGetValue): 10 (PathRemoveFileSpec): 11 (WebCore::addWindowsMediaPlayerPluginDirectory): 12 (WebCore::addMacromediaPluginDirectories): 13 * plugins/win/PluginPackageWin.cpp: 14 (WebCore::PluginPackage::load): 15 * plugins/win/PluginViewWin.cpp: 16 (WebCore::registerPluginView): 17 (WebCore::PluginView::wndProc): 18 (WebCore::PluginView::updatePluginWidget): 19 (WebCore::PluginView::paintWindowedPluginIntoContext): 20 (WebCore::PluginView::paint): 21 (WebCore::PluginView::handleMouseEvent): 22 (WebCore::PluginView::setParent): 23 (WebCore::PluginView::setNPWindowRect): 24 (WebCore::PluginView::stop): 25 (WebCore::PluginView::init): 26 1 27 2009-07-27 Joseph Pecoraro <joepeck02@gmail.com> 2 28 -
trunk/WebCore/plugins/win/PluginDatabaseWin.cpp
r35158 r46430 2 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2008 Collabora, Ltd. All rights reserved. 4 * Copyright (C) 2008-2009 Torch Mobile, Inc. All rights reserved. 4 5 * 5 6 * Redistribution and use in source and binary forms, with or without … … 38 39 #endif 39 40 41 #if PLATFORM(WINCE) 42 // WINCE doesn't support Registry Key Access Rights. The parameter should always be 0 43 #define KEY_ENUMERATE_SUB_KEYS 0 44 45 DWORD SHGetValue(HKEY hkey, LPCWSTR pszSubKey, LPCWSTR pszValue, LPDWORD pdwType, LPVOID pvData, LPDWORD pcbData) 46 { 47 HKEY key; 48 if (RegOpenKeyEx(hkey, pszSubKey, 0, 0, &key) == ERROR_SUCCESS) { 49 DWORD result = RegQueryValueEx(key, pszValue, 0, pdwType, (LPBYTE)pvData, pcbData); 50 RegCloseKey(key); 51 return result; 52 } 53 return ERROR_INVALID_NAME; 54 } 55 56 BOOL PathRemoveFileSpec(LPWSTR moduleFileNameStr) 57 { 58 if (!*moduleFileNameStr) 59 return FALSE; 60 61 LPWSTR lastPos = 0; 62 LPWSTR curPos = moduleFileNameStr; 63 do { 64 if (*curPos == L'/' || *curPos == L'\\') 65 lastPos = curPos; 66 } while (*++curPos); 67 68 if (lastPos == curPos - 1) 69 return FALSE; 70 71 if (lastPos) 72 *lastPos = 0; 73 else { 74 moduleFileNameStr[0] = L'\\'; 75 moduleFileNameStr[1] = 0; 76 } 77 78 return TRUE; 79 } 80 #endif 81 40 82 namespace WebCore { 41 83 … … 211 253 static inline void addWindowsMediaPlayerPluginDirectory(Vector<String>& directories) 212 254 { 255 #if !PLATFORM(WINCE) 213 256 // The new WMP Firefox plugin is installed in \PFiles\Plugins if it can't find any Firefox installs 214 257 WCHAR pluginDirectoryStr[_MAX_PATH + 1]; … … 217 260 if (pluginDirectorySize > 0 && pluginDirectorySize <= _countof(pluginDirectoryStr)) 218 261 directories.append(String(pluginDirectoryStr, pluginDirectorySize - 1)); 262 #endif 219 263 220 264 DWORD type; … … 312 356 static inline void addMacromediaPluginDirectories(Vector<String>& directories) 313 357 { 358 #if !PLATFORM(WINCE) 314 359 WCHAR systemDirectoryStr[MAX_PATH]; 315 360 … … 324 369 PathCombine(macromediaDirectoryStr, systemDirectoryStr, TEXT("macromed\\Shockwave 10")); 325 370 directories.append(macromediaDirectoryStr); 371 #endif 326 372 } 327 373 -
trunk/WebCore/plugins/win/PluginPackageWin.cpp
r45721 r46430 2 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2008 Collabora, Ltd. All rights reserved. 4 * Copyright (C) 2009 Torch Mobile, Inc. All rights reserved. 4 5 * 5 6 * Redistribution and use in source and binary forms, with or without … … 245 246 return true; 246 247 } else { 248 #if !PLATFORM(WINCE) 247 249 WCHAR currentPath[MAX_PATH]; 248 250 … … 254 256 if (!::SetCurrentDirectoryW(path.charactersWithNullTermination())) 255 257 return false; 258 #endif 256 259 257 260 // Load the library 258 261 m_module = ::LoadLibraryExW(m_path.charactersWithNullTermination(), 0, LOAD_WITH_ALTERED_SEARCH_PATH); 259 262 263 #if !PLATFORM(WINCE) 260 264 if (!::SetCurrentDirectoryW(currentPath)) { 261 265 if (m_module) … … 263 267 return false; 264 268 } 269 #endif 265 270 } 266 271 … … 274 279 NPError npErr; 275 280 276 NP_Initialize = (NP_InitializeFuncPtr)GetProcAddress(m_module, "NP_Initialize");277 NP_GetEntryPoints = (NP_GetEntryPointsFuncPtr)GetProcAddress(m_module, "NP_GetEntryPoints");278 m_NPP_Shutdown = (NPP_ShutdownProcPtr)GetProcAddress(m_module, "NP_Shutdown");281 NP_Initialize = (NP_InitializeFuncPtr)GetProcAddress(m_module, _T("NP_Initialize")); 282 NP_GetEntryPoints = (NP_GetEntryPointsFuncPtr)GetProcAddress(m_module, _T("NP_GetEntryPoints")); 283 m_NPP_Shutdown = (NPP_ShutdownProcPtr)GetProcAddress(m_module, _T("NP_Shutdown")); 279 284 280 285 if (!NP_Initialize || !NP_GetEntryPoints || !m_NPP_Shutdown) 281 286 goto abort; 282 287 283 288 memset(&m_pluginFuncs, 0, sizeof(m_pluginFuncs)); 284 289 m_pluginFuncs.size = sizeof(m_pluginFuncs); -
trunk/WebCore/plugins/win/PluginViewWin.cpp
r46411 r46430 2 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2008 Collabora Ltd. All rights reserved. 4 * Copyright (C) 2008-2009 Torch Mobile, Inc. All rights reserved. 4 5 * 5 6 * Redistribution and use in source and binary forms, with or without … … 66 67 #include <wtf/ASCIICType.h> 67 68 69 #if PLATFORM(WINCE) 70 #undef LOG_NPERROR 71 #define LOG_NPERROR(x) 72 #undef LOG_PLUGIN_NET_ERROR 73 #define LOG_PLUGIN_NET_ERROR() 74 #endif 75 68 76 #if PLATFORM(QT) 69 77 #include <QWidget.h> … … 99 107 static const char* MozillaUserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0"; 100 108 109 #if !PLATFORM(WINCE) 101 110 // The code used to hook BeginPaint/EndPaint originally came from 102 111 // <http://www.fengyuan.com/article/wmprint.html>. … … 208 217 209 218 } 219 #endif 210 220 211 221 static bool registerPluginView() … … 223 233 ASSERT(Page::instanceHandle()); 224 234 235 #if PLATFORM(WINCE) 236 WNDCLASS wcex = { 0 }; 237 #else 225 238 WNDCLASSEX wcex; 226 227 239 wcex.cbSize = sizeof(WNDCLASSEX); 240 wcex.hIconSm = 0; 241 #endif 228 242 229 243 wcex.style = CS_DBLCLKS; 244 #if PLATFORM(WINCE) 245 wcex.style |= CS_PARENTDC; 246 #endif 230 247 wcex.lpfnWndProc = DefWindowProc; 231 248 wcex.cbClsExtra = 0; … … 237 254 wcex.lpszMenuName = 0; 238 255 wcex.lpszClassName = kWebPluginViewdowClassName; 239 wcex.hIconSm = 0; 240 256 257 #if PLATFORM(WINCE) 258 return !!RegisterClass(&wcex); 259 #else 241 260 return !!RegisterClassEx(&wcex); 261 #endif 242 262 } 243 263 … … 311 331 } 312 332 333 #if !PLATFORM(WINCE) 313 334 if (message == WM_PRINTCLIENT) { 314 335 // Most (all?) windowed plugins don't respond to WM_PRINTCLIENT, so we … … 318 339 m_wmPrintHDC = reinterpret_cast<HDC>(wParam); 319 340 } 341 #endif 320 342 321 343 // Call the plug-in's window proc. … … 340 362 IntRect oldClipRect = m_clipRect; 341 363 364 #if PLATFORM(WINCE) 365 m_windowRect = frameView->contentsToWindow(frameRect()); 366 #else 342 367 m_windowRect = IntRect(frameView->contentsToWindow(frameRect().location()), frameRect().size()); 368 #endif 343 369 m_clipRect = windowClipRect(); 344 370 m_clipRect.move(-m_windowRect.x(), -m_windowRect.y()); … … 427 453 void PluginView::paintWindowedPluginIntoContext(GraphicsContext* context, const IntRect& rect) const 428 454 { 455 #if !PLATFORM(WINCE) 429 456 ASSERT(m_isWindowed); 430 457 ASSERT(context->shouldIncludeChildWindows()); … … 451 478 452 479 context->releaseWindowsContext(hdc, frameRect(), false); 480 #endif 453 481 } 454 482 … … 465 493 466 494 if (m_isWindowed) { 495 #if !PLATFORM(WINCE) 467 496 if (context->shouldIncludeChildWindows()) 468 497 paintWindowedPluginIntoContext(context, rect); 498 #endif 469 499 return; 470 500 } … … 479 509 // In the Qt port we always draw in an offscreen buffer and therefore need to preserve 480 510 // the translation set in getWindowsContext. 481 #if !PLATFORM(QT) 511 #if !PLATFORM(QT) && !PLATFORM(WINCE) 482 512 if (!context->inTransparencyLayer()) { 483 513 XFORM transform; … … 492 522 m_npWindow.window = hdc; 493 523 494 IntPoint p = static_cast<FrameView*>(parent())->contentsToWindow(frameRect().location());495 496 524 WINDOWPOS windowpos; 497 525 memset(&windowpos, 0, sizeof(windowpos)); 526 527 #if PLATFORM(WINCE) 528 IntRect r = static_cast<FrameView*>(parent())->contentsToWindow(frameRect()); 529 530 windowpos.x = r.x(); 531 windowpos.y = r.y(); 532 windowpos.cx = r.width(); 533 windowpos.cy = r.height(); 534 #else 535 IntPoint p = static_cast<FrameView*>(parent())->contentsToWindow(frameRect().location()); 498 536 499 537 windowpos.x = p.x(); … … 501 539 windowpos.cx = frameRect().width(); 502 540 windowpos.cy = frameRect().height(); 541 #endif 503 542 504 543 npEvent.event = WM_WINDOWPOSCHANGED; … … 541 580 } 542 581 582 #if !PLATFORM(WINCE) 543 583 extern HCURSOR lastSetCursor; 544 584 extern bool ignoreNextSetCursor; 585 #endif 545 586 546 587 void PluginView::handleMouseEvent(MouseEvent* event) … … 607 648 event->setDefaultHandled(); 608 649 609 #if !PLATFORM(QT) 650 #if !PLATFORM(QT) && !PLATFORM(WINCE) 610 651 // Currently, Widget::setCursor is always called after this function in EventHandler.cpp 611 652 // and since we don't want that we set ignoreNextSetCursor to true here to prevent that. … … 619 660 Widget::setParent(parent); 620 661 662 #if PLATFORM(WINCE) 663 if (parent) { 664 init(); 665 if (parent->isVisible()) 666 show(); 667 else 668 hide(); 669 } 670 #else 621 671 if (parent) 622 672 init(); … … 632 682 ::SetFocus(0); 633 683 } 634 684 #endif 635 685 } 636 686 … … 655 705 return; 656 706 707 #if PLATFORM(WINCE) 708 IntRect r = static_cast<FrameView*>(parent())->contentsToWindow(rect); 709 m_npWindow.x = r.x(); 710 m_npWindow.y = r.y(); 711 712 m_npWindow.width = r.width(); 713 m_npWindow.height = r.height(); 714 715 m_npWindow.clipRect.right = r.width(); 716 m_npWindow.clipRect.bottom = r.height(); 717 #else 657 718 IntPoint p = static_cast<FrameView*>(parent())->contentsToWindow(rect.location()); 658 719 m_npWindow.x = p.x(); … … 662 723 m_npWindow.height = rect.height(); 663 724 725 m_npWindow.clipRect.right = rect.width(); 726 m_npWindow.clipRect.bottom = rect.height(); 727 #endif 664 728 m_npWindow.clipRect.left = 0; 665 729 m_npWindow.clipRect.top = 0; 666 m_npWindow.clipRect.right = rect.width();667 m_npWindow.clipRect.bottom = rect.height();668 730 669 731 if (m_plugin->pluginFuncs()->setwindow) { … … 678 740 ASSERT(platformPluginWidget()); 679 741 742 #if PLATFORM(WINCE) 743 if (!m_pluginWndProc) { 744 WNDPROC currentWndProc = (WNDPROC)GetWindowLong(platformPluginWidget(), GWL_WNDPROC); 745 if (currentWndProc != PluginViewWndProc) 746 m_pluginWndProc = (WNDPROC)SetWindowLong(platformPluginWidget(), GWL_WNDPROC, (LONG)PluginViewWndProc); 747 } 748 #else 680 749 WNDPROC currentWndProc = (WNDPROC)GetWindowLongPtr(platformPluginWidget(), GWLP_WNDPROC); 681 750 if (currentWndProc != PluginViewWndProc) 682 751 m_pluginWndProc = (WNDPROC)SetWindowLongPtr(platformPluginWidget(), GWLP_WNDPROC, (LONG)PluginViewWndProc); 752 #endif 683 753 } 684 754 } … … 702 772 // Unsubclass the window 703 773 if (m_isWindowed) { 774 #if PLATFORM(WINCE) 775 WNDPROC currentWndProc = (WNDPROC)GetWindowLong(platformPluginWidget(), GWL_WNDPROC); 776 777 if (currentWndProc == PluginViewWndProc) 778 SetWindowLong(platformPluginWidget(), GWL_WNDPROC, (LONG)m_pluginWndProc); 779 #else 704 780 WNDPROC currentWndProc = (WNDPROC)GetWindowLongPtr(platformPluginWidget(), GWLP_WNDPROC); 705 781 706 782 if (currentWndProc == PluginViewWndProc) 707 783 SetWindowLongPtr(platformPluginWidget(), GWLP_WNDPROC, (LONG)m_pluginWndProc); 784 #endif 708 785 } 709 786 … … 953 1030 if (m_isWindowed) { 954 1031 registerPluginView(); 1032 #if !PLATFORM(WINCE) 955 1033 setUpOffscreenPaintingHooks(hookedBeginPaint, hookedEndPaint); 1034 #endif 956 1035 957 1036 DWORD flags = WS_CHILD; … … 962 1041 HWND window = ::CreateWindowEx(0, kWebPluginViewdowClassName, 0, flags, 963 1042 0, 0, 0, 0, parentWindowHandle, 0, Page::instanceHandle(), 0); 1043 964 1044 #if PLATFORM(WIN_OS) && PLATFORM(QT) 965 1045 m_window = window; … … 972 1052 #if PLATFORM(WIN_OS) && PLATFORM(X86_64) && COMPILER(MSVC) 973 1053 ::SetWindowLongPtrA(platformPluginWidget(), GWLP_WNDPROC, (LONG_PTR)DefWindowProcA); 1054 #elif PLATFORM(WINCE) 1055 ::SetWindowLong(platformPluginWidget(), GWL_WNDPROC, (LONG)DefWindowProc); 974 1056 #else 975 1057 ::SetWindowLongPtrA(platformPluginWidget(), GWL_WNDPROC, (LONG)DefWindowProcA);
Note: See TracChangeset
for help on using the changeset viewer.