Changeset 62993 in webkit
- Timestamp:
- Jul 9, 2010 2:18:14 PM (14 years ago)
- Location:
- trunk/WebKit2
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r62973 r62993 1 2010-07-09 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Verify drawing coordinates, add crude painting support 6 https://bugs.webkit.org/show_bug.cgi?id=41984 7 8 * WebKit2.xcodeproj/project.pbxproj: 9 Add NetscapePluginMac.cpp. 10 11 * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: 12 (WebKit::NetscapePlugin::NetscapePlugin): 13 Initialize drawing and event models. 14 15 (WebKit::NetscapePlugin::initialize): 16 Call platformPostInitialize. 17 18 (WebKit::NetscapePlugin::destroy): 19 Call NPP_Destroy. 20 21 (WebKit::NetscapePlugin::paint): 22 Call platformPaint. 23 24 * WebProcess/Plugins/Netscape/NetscapePlugin.h: 25 Add member functions. 26 27 * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.cpp: Added. 28 (WebKit::NetscapePlugin::platformPostInitialize): 29 Set default event and drawing models and verify that they are compatible. 30 31 (WebKit::NetscapePlugin::platformPaint): 32 Send a paint event (assuming the Cocoa event model currently). 33 34 * WebProcess/Plugins/PluginView.cpp: 35 (WebKit::PluginView::paint): 36 Change the paint rect to be in window coordinates. 37 38 (WebKit::PluginView::viewGeometryDidChange): 39 (WebKit::PluginView::clipRectInWindowCoordinates): 40 * WebProcess/Plugins/PluginView.h: 41 1 42 2010-07-09 Anders Carlsson <andersca@apple.com> 2 43 -
trunk/WebKit2/WebKit2.xcodeproj/project.pbxproj
r62869 r62993 64 64 1AADE6FF10D855FC00D3D63D /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AADE6FE10D855FC00D3D63D /* ApplicationServices.framework */; }; 65 65 1AE117F611DBB30900981615 /* ProcessLauncher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE117F511DBB30900981615 /* ProcessLauncher.cpp */; }; 66 1AE5B7FB11E7AED200BA6767 /* NetscapePluginMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE5B7F911E7AED200BA6767 /* NetscapePluginMac.cpp */; }; 66 67 1AEFCC1211D01F96008219D3 /* PluginInfoStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AEFCC1011D01F96008219D3 /* PluginInfoStore.h */; }; 67 68 1AEFCC1311D01F96008219D3 /* PluginInfoStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AEFCC1111D01F96008219D3 /* PluginInfoStore.cpp */; }; … … 333 334 1AADE6FE10D855FC00D3D63D /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = System/Library/Frameworks/ApplicationServices.framework; sourceTree = SDKROOT; }; 334 335 1AE117F511DBB30900981615 /* ProcessLauncher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProcessLauncher.cpp; sourceTree = "<group>"; }; 336 1AE5B7F911E7AED200BA6767 /* NetscapePluginMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetscapePluginMac.cpp; sourceTree = "<group>"; }; 335 337 1AEFCC1011D01F96008219D3 /* PluginInfoStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginInfoStore.h; sourceTree = "<group>"; }; 336 338 1AEFCC1111D01F96008219D3 /* PluginInfoStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginInfoStore.cpp; sourceTree = "<group>"; }; … … 670 672 isa = PBXGroup; 671 673 children = ( 674 1AE5B7F911E7AED200BA6767 /* NetscapePluginMac.cpp */, 672 675 1A6FBA0211E6813E00DB1371 /* NetscapePluginModuleMac.cpp */, 673 676 ); … … 1413 1416 1A6FBA2B11E6862700DB1371 /* NetscapeBrowserFuncs.cpp in Sources */, 1414 1417 1A6FBD2911E69BC200DB1371 /* NetscapePlugin.cpp in Sources */, 1418 1AE5B7FB11E7AED200BA6767 /* NetscapePluginMac.cpp in Sources */, 1415 1419 ); 1416 1420 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
r62973 r62993 26 26 #include "NetscapePlugin.h" 27 27 28 #include <WebCore/GraphicsContext.h> 28 29 #include <WebCore/IntRect.h> 29 30 … … 35 36 : m_pluginModule(pluginModule) 36 37 , m_npWindow() 38 , m_isStarted(false) 39 #if PLATFORM(MAC) 40 , m_drawingModel(static_cast<NPDrawingModel>(-1)) 41 , m_eventModel(static_cast<NPEventModel>(-1)) 42 #endif 37 43 { 38 44 m_npp.ndata = this; … … 67 73 return false; 68 74 75 m_isStarted = true; 76 69 77 // FIXME: This is not correct in all cases. 70 78 m_npWindow.type = NPWindowTypeDrawable; 79 80 if (!platformPostInitialize()) { 81 destroy(); 82 return false; 83 } 71 84 72 85 return true; … … 75 88 void NetscapePlugin::destroy() 76 89 { 90 ASSERT(m_isStarted); 91 92 m_pluginModule->pluginFuncs().destroy(&m_npp, 0); 93 m_isStarted = false; 77 94 } 78 95 79 96 void NetscapePlugin::paint(GraphicsContext* context, const IntRect& dirtyRect) 80 97 { 98 platformPaint(context, dirtyRect); 81 99 } 82 100 -
trunk/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
r62973 r62993 46 46 void callSetWindow(); 47 47 48 bool platformPostInitialize(); 49 void platformPaint(WebCore::GraphicsContext*, const WebCore::IntRect& dirtyRect); 50 48 51 // Plugin 49 52 virtual bool initialize(const WebCore::KURL&, const Vector<WebCore::String>& paramNames, const Vector<WebCore::String>& paramValues, const WebCore::String& mimeType, bool loadManually); … … 55 58 NPP_t m_npp; 56 59 NPWindow m_npWindow; 57 60 58 61 WebCore::IntRect m_frameRect; 59 62 WebCore::IntRect m_clipRect; 63 64 bool m_isStarted; 65 66 #if PLATFORM(MAC) 67 NPDrawingModel m_drawingModel; 68 NPEventModel m_eventModel; 69 #endif 60 70 }; 71 72 // Move these functions to NetscapePluginWin.cpp 73 #if !PLATFORM(MAC) 74 inline bool NetscapePlugin::platformPostInitialize() 75 { 76 return true; 77 } 78 79 inline void NetscapePlugin::platformPaint(WebCore::GraphicsContext*, const WebCore::IntRect&) 80 { 81 } 82 #endif 61 83 62 84 } // namespace WebKit -
trunk/WebKit2/WebProcess/Plugins/PluginView.cpp
r62973 r62993 59 59 return; 60 60 61 IntRect paintRect = intersection(dirtyRect, frameRect()); 62 if (paintRect.isEmpty()) 61 IntRect dirtyRectInWindowCoordinates = parent()->contentsToWindow(dirtyRect); 62 63 IntRect paintRectInWindowCoordinates = intersection(dirtyRectInWindowCoordinates, clipRectInWindowCoordinates()); 64 if (paintRectInWindowCoordinates.isEmpty()) 63 65 return; 64 66 65 m_plugin->paint(context, paintRect); 67 context->save(); 68 69 // Translate the context so that the origin is at the top left corner of the plug-in view. 70 context->translate(frameRect().x(), frameRect().y()); 71 72 m_plugin->paint(context, paintRectInWindowCoordinates); 73 context->restore(); 66 74 } 67 75 … … 86 94 IntRect frameRectInWindowCoordinates = parent()->contentsToWindow(frameRect()); 87 95 96 m_plugin->geometryDidChange(frameRectInWindowCoordinates, clipRectInWindowCoordinates()); 97 } 98 99 IntRect PluginView::clipRectInWindowCoordinates() const 100 { 101 ASSERT(parent()); 102 103 // Get the frame rect in window coordinates. 104 IntRect frameRectInWindowCoordinates = parent()->contentsToWindow(frameRect()); 105 88 106 // Get the window clip rect for the enclosing layer (in window coordinates). 89 107 RenderLayer* layer = m_pluginElement->renderer()->enclosingLayer(); … … 92 110 93 111 // Intersect the two rects to get the view clip rect in window coordinates. 94 IntRect clipRectInWindowCoordinates = intersection(frameRectInWindowCoordinates, windowClipRect); 95 96 m_plugin->geometryDidChange(frameRectInWindowCoordinates, clipRectInWindowCoordinates); 112 return intersection(frameRectInWindowCoordinates, windowClipRect); 97 113 } 98 114 -
trunk/WebKit2/WebProcess/Plugins/PluginView.h
r62973 r62993 50 50 51 51 void viewGeometryDidChange(); 52 WebCore::IntRect clipRectInWindowCoordinates() const; 52 53 53 54 // WebCore::Widget
Note: See TracChangeset
for help on using the changeset viewer.