Changeset 62813 in webkit
- Timestamp:
- Jul 8, 2010 11:59:32 AM (14 years ago)
- Location:
- trunk/WebKit2
- Files:
-
- 6 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r62809 r62813 1 2010-07-08 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Add a Plugin abstract base class and a DummyPlugin that implements it 6 https://bugs.webkit.org/show_bug.cgi?id=41885 7 8 * WebKit2.xcodeproj/project.pbxproj: 9 Add files. 10 11 * WebProcess/Plugins/DummyPlugin.cpp: Added. 12 (WebKit::DummyPlugin::paint): 13 Paint a red rectangle. 14 15 * WebProcess/Plugins/Plugin.cpp: Added. 16 * WebProcess/Plugins/Plugin.h: Added. 17 Add Plugin, an abstract baseclass. 18 19 * WebProcess/Plugins/PluginView.cpp: 20 (WebKit::PluginView::PluginView): 21 (WebKit::PluginView::~PluginView): 22 (WebKit::PluginView::paint): 23 (WebKit::PluginView::viewGeometryDidChange): 24 * WebProcess/Plugins/PluginView.h: 25 (WebKit::PluginView::create): 26 Add a Plugin member function and forward PluginView calls to it. 27 28 * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: 29 (WebKit::WebFrameLoaderClient::createPlugin): 30 Make a DummyPlugin and pass it to the PluginView. 31 32 * win/WebKit2.vcproj: 33 Add files. 34 1 35 2010-07-08 Anders Carlsson <andersca@apple.com> 2 36 -
trunk/WebKit2/WebKit2.xcodeproj/project.pbxproj
r62809 r62813 49 49 1A6FB7AE11E64B6800DB1371 /* PluginView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6FB7AC11E64B6800DB1371 /* PluginView.cpp */; }; 50 50 1A6FB7AF11E64B6800DB1371 /* PluginView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6FB7AD11E64B6800DB1371 /* PluginView.h */; }; 51 1A6FB7D211E651E200DB1371 /* Plugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6FB7D011E651E200DB1371 /* Plugin.cpp */; }; 52 1A6FB7D311E651E200DB1371 /* Plugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6FB7D111E651E200DB1371 /* Plugin.h */; }; 53 1A6FB7E611E6530500DB1371 /* DummyPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6FB7E411E6530500DB1371 /* DummyPlugin.h */; }; 54 1A6FB7E711E6530500DB1371 /* DummyPlugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6FB7E511E6530500DB1371 /* DummyPlugin.cpp */; }; 51 55 1AA1CC5D100FA1A10078DEBC /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1CC5C100FA1A10078DEBC /* QuartzCore.framework */; }; 52 56 1AA1CD07100FA1BA0078DEBC /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1CD06100FA1BA0078DEBC /* Carbon.framework */; }; … … 303 307 1A6FA31011E3921E00DB1371 /* MainMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MainMac.cpp; path = mac/MainMac.cpp; sourceTree = "<group>"; }; 304 308 1A6FA31511E3923600DB1371 /* WebKitMain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitMain.cpp; sourceTree = "<group>"; }; 305 1A6FB7AC11E64B6800DB1371 /* PluginView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginView.cpp; path = Plugins/PluginView.cpp; sourceTree = "<group>"; }; 306 1A6FB7AD11E64B6800DB1371 /* PluginView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PluginView.h; path = Plugins/PluginView.h; sourceTree = "<group>"; }; 309 1A6FB7AC11E64B6800DB1371 /* PluginView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginView.cpp; sourceTree = "<group>"; }; 310 1A6FB7AD11E64B6800DB1371 /* PluginView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginView.h; sourceTree = "<group>"; }; 311 1A6FB7D011E651E200DB1371 /* Plugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Plugin.cpp; sourceTree = "<group>"; }; 312 1A6FB7D111E651E200DB1371 /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Plugin.h; sourceTree = "<group>"; }; 313 1A6FB7E411E6530500DB1371 /* DummyPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DummyPlugin.h; sourceTree = "<group>"; }; 314 1A6FB7E511E6530500DB1371 /* DummyPlugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DummyPlugin.cpp; sourceTree = "<group>"; }; 307 315 1AA1C79A100E7FC50078DEBC /* WebCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 308 316 1AA1C7DE100E846E0078DEBC /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JavaScriptCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; … … 620 628 isa = PBXGroup; 621 629 children = ( 630 1A6FB7E511E6530500DB1371 /* DummyPlugin.cpp */, 631 1A6FB7E411E6530500DB1371 /* DummyPlugin.h */, 632 1A6FB7D011E651E200DB1371 /* Plugin.cpp */, 633 1A6FB7D111E651E200DB1371 /* Plugin.h */, 622 634 1A6FB7AC11E64B6800DB1371 /* PluginView.cpp */, 623 635 1A6FB7AD11E64B6800DB1371 /* PluginView.h */, 624 636 ); 625 name= Plugins;637 path = Plugins; 626 638 sourceTree = "<group>"; 627 639 }; … … 1171 1183 BC72BA1E11E64907001EB4EA /* WebBackForwardList.h in Headers */, 1172 1184 1A6FB7AF11E64B6800DB1371 /* PluginView.h in Headers */, 1185 1A6FB7D311E651E200DB1371 /* Plugin.h in Headers */, 1186 1A6FB7E611E6530500DB1371 /* DummyPlugin.h in Headers */, 1173 1187 ); 1174 1188 runOnlyForDeploymentPostprocessing = 0; … … 1353 1367 BC72BA1D11E64907001EB4EA /* WebBackForwardList.cpp in Sources */, 1354 1368 1A6FB7AE11E64B6800DB1371 /* PluginView.cpp in Sources */, 1369 1A6FB7D211E651E200DB1371 /* Plugin.cpp in Sources */, 1370 1A6FB7E711E6530500DB1371 /* DummyPlugin.cpp in Sources */, 1355 1371 ); 1356 1372 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebKit2/WebProcess/Plugins/DummyPlugin.cpp
r62809 r62813 24 24 */ 25 25 26 #include " PluginView.h"26 #include "DummyPlugin.h" 27 27 28 #include "Plugin.h"29 28 #include <WebCore/GraphicsContext.h> 30 29 … … 33 32 namespace WebKit { 34 33 35 PluginView::PluginView()34 DummyPlugin::DummyPlugin() 36 35 { 37 36 } 38 37 39 PluginView::~PluginView()38 void DummyPlugin::initialize(const String& mimeType, const KURL&, bool loadManually) 40 39 { 41 40 } 42 43 void PluginView::setFrameRect(const WebCore::IntRect& rect)41 42 void DummyPlugin::destroy() 44 43 { 45 Widget::setFrameRect(rect);46 viewGeometryDidChange();47 44 } 48 49 void PluginView::paint(GraphicsContext* context, const IntRect& dirtyRect)45 46 void DummyPlugin::paint(GraphicsContext* context, const IntRect& dirtyRect) 50 47 { 51 if (context->paintingDisabled())52 return;53 54 IntRect paintRect = intersection(dirtyRect, frameRect());55 if (paintRect.isEmpty())56 return;57 58 48 #if PLATFORM(MAC) 59 49 CGContextRef cgContext = context->platformContext(); … … 62 52 CGColorRef redColor = CGColorCreateGenericRGB(1, 0, 0, 1); 63 53 CGContextSetFillColorWithColor(cgContext, redColor); 64 CGContextFillRect(cgContext, paintRect);54 CGContextFillRect(cgContext, dirtyRect); 65 55 CGColorRelease(redColor); 66 #endif 56 #endif 67 57 } 68 69 void PluginView::viewGeometryDidChange() 70 { 71 } 72 73 void PluginView::invalidateRect(const IntRect&) 58 59 void DummyPlugin::geometryDidChange(const IntRect& frameRect) 74 60 { 75 61 } -
trunk/WebKit2/WebProcess/Plugins/DummyPlugin.h
r62809 r62813 24 24 */ 25 25 26 #ifndef PluginView_h27 #define PluginView_h26 #ifndef DummyPlugin_h 27 #define DummyPlugin_h 28 28 29 #include <WebCore/Widget.h> 30 31 // FIXME: Eventually this should move to WebCore. 29 #include "Plugin.h" 30 #include <wtf/PassRefPtr.h> 32 31 33 32 namespace WebKit { 34 33 35 class Plugin; 36 37 class PluginView : public WebCore::Widget { 34 class DummyPlugin : public Plugin { 38 35 public: 39 static PassRefPtr< PluginView> create()36 static PassRefPtr<DummyPlugin> create() 40 37 { 41 return adoptRef(new PluginView());38 return adoptRef(new DummyPlugin); 42 39 } 43 40 44 41 private: 45 PluginView(); 46 virtual ~PluginView(); 42 DummyPlugin(); 47 43 48 void viewGeometryDidChange(); 49 50 // WebCore::Widget 51 virtual void setFrameRect(const WebCore::IntRect&); 52 virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect&); 53 virtual void invalidateRect(const WebCore::IntRect&); 54 }; 44 // Plugin 45 virtual void initialize(const WebCore::String& mimeType, const WebCore::KURL&, bool loadManually); 46 virtual void destroy(); 47 virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect& dirtyRect); 48 virtual void geometryDidChange(const WebCore::IntRect& frameRect); 49 } 55 50 56 51 } // namespace WebKit 57 52 58 #endif // PluginView_h53 #endif // DummyPlugin_h -
trunk/WebKit2/WebProcess/Plugins/Plugin.cpp
r62809 r62813 24 24 */ 25 25 26 #ifndef PluginView_h 27 #define PluginView_h 26 #include "Plugin.h" 28 27 29 #include <WebCore/Widget.h> 30 31 // FIXME: Eventually this should move to WebCore. 28 using namespace WebCore; 32 29 33 30 namespace WebKit { 34 31 35 class Plugin; 32 Plugin::Plugin() 33 { 34 } 36 35 37 class PluginView : public WebCore::Widget { 38 public: 39 static PassRefPtr<PluginView> create() 40 { 41 return adoptRef(new PluginView()); 42 } 43 44 private: 45 PluginView(); 46 virtual ~PluginView(); 47 48 void viewGeometryDidChange(); 49 50 // WebCore::Widget 51 virtual void setFrameRect(const WebCore::IntRect&); 52 virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect&); 53 virtual void invalidateRect(const WebCore::IntRect&); 54 }; 36 Plugin::~Plugin() 37 { 38 } 55 39 56 40 } // namespace WebKit 57 58 #endif // PluginView_h -
trunk/WebKit2/WebProcess/Plugins/Plugin.h
r62809 r62813 24 24 */ 25 25 26 #ifndef Plugin View_h27 #define Plugin View_h26 #ifndef Plugin_h 27 #define Plugin_h 28 28 29 #include < WebCore/Widget.h>29 #include <wtf/RefCounted.h> 30 30 31 // FIXME: Eventually this should move to WebCore. 31 namespace WebCore { 32 class GraphicsContext; 33 class IntRect; 34 class KURL; 35 class String; 36 } 32 37 33 38 namespace WebKit { 34 39 35 class Plugin; 40 class Plugin : public RefCounted<Plugin> { 41 public: 42 virtual ~Plugin(); 43 44 virtual void initialize(const WebCore::String& mimeType, const WebCore::KURL&, bool loadManually) = 0; 45 virtual void destroy() = 0; 46 virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect& dirtyRect) = 0; 47 virtual void geometryDidChange(const WebCore::IntRect& frameRect) = 0; 36 48 37 class PluginView : public WebCore::Widget { 38 public: 39 static PassRefPtr<PluginView> create() 40 { 41 return adoptRef(new PluginView()); 42 } 43 44 private: 45 PluginView(); 46 virtual ~PluginView(); 47 48 void viewGeometryDidChange(); 49 50 // WebCore::Widget 51 virtual void setFrameRect(const WebCore::IntRect&); 52 virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect&); 53 virtual void invalidateRect(const WebCore::IntRect&); 49 protected: 50 Plugin(); 54 51 }; 55 52 56 53 } // namespace WebKit 57 54 58 #endif // Plugin View_h55 #endif // Plugin_h -
trunk/WebKit2/WebProcess/Plugins/PluginView.cpp
r62809 r62813 33 33 namespace WebKit { 34 34 35 PluginView::PluginView() 35 PluginView::PluginView(PassRefPtr<Plugin> plugin) 36 : m_plugin(plugin) 36 37 { 37 38 } … … 39 40 PluginView::~PluginView() 40 41 { 42 m_plugin->destroy(); 41 43 } 42 44 … … 56 58 return; 57 59 58 #if PLATFORM(MAC) 59 CGContextRef cgContext = context->platformContext(); 60 CGContextSaveGState(cgContext); 61 62 CGColorRef redColor = CGColorCreateGenericRGB(1, 0, 0, 1); 63 CGContextSetFillColorWithColor(cgContext, redColor); 64 CGContextFillRect(cgContext, paintRect); 65 CGColorRelease(redColor); 66 #endif 60 m_plugin->paint(context, paintRect); 67 61 } 68 62 69 63 void PluginView::viewGeometryDidChange() 70 64 { 65 m_plugin->geometryDidChange(frameRect()); 71 66 } 72 67 -
trunk/WebKit2/WebProcess/Plugins/PluginView.h
r62809 r62813 37 37 class PluginView : public WebCore::Widget { 38 38 public: 39 static PassRefPtr<PluginView> create( )39 static PassRefPtr<PluginView> create(PassRefPtr<Plugin> plugin) 40 40 { 41 return adoptRef(new PluginView( ));41 return adoptRef(new PluginView(plugin)); 42 42 } 43 43 44 44 private: 45 PluginView( );45 PluginView(PassRefPtr<Plugin>); 46 46 virtual ~PluginView(); 47 47 … … 52 52 virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect&); 53 53 virtual void invalidateRect(const WebCore::IntRect&); 54 55 RefPtr<Plugin> m_plugin; 54 56 }; 55 57 -
trunk/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
r62809 r62813 26 26 #include "WebFrameLoaderClient.h" 27 27 28 #include "DummyPlugin.h" 28 29 #include "NotImplemented.h" 29 30 #include "PluginView.h" … … 767 768 { 768 769 notImplemented(); 769 return PluginView::create(); 770 771 RefPtr<DummyPlugin> plugin = DummyPlugin::create(); 772 773 return PluginView::create(plugin.release()); 770 774 } 771 775 -
trunk/WebKit2/win/WebKit2.vcproj
r62809 r62813 825 825 > 826 826 <File 827 RelativePath="..\WebProcess\Plugins\DummyPlugin.cpp" 828 > 829 </File> 830 <File 831 RelativePath="..\WebProcess\Plugins\DummyPlugin.h" 832 > 833 </File> 834 <File 835 RelativePath="..\WebProcess\Plugins\Plugin.cpp" 836 > 837 </File> 838 <File 839 RelativePath="..\WebProcess\Plugins\Plugin.h" 840 > 841 </File> 842 <File 827 843 RelativePath="..\WebProcess\Plugins\PluginView.cpp" 828 844 >
Note: See TracChangeset
for help on using the changeset viewer.