[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

simon.fraser at apple.com simon.fraser at apple.com
Thu Apr 8 02:15:50 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 26f92771803851a01f529ae63c754f8f70dc52a1
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Mar 9 01:33:22 2010 +0000

    2010-03-08  Simon Fraser  <simon.fraser at apple.com>
    
            Reviewed by Kevin Decker.
    
            <rdar://problem/7714340> Need to grab image snapshot of Core Animation plugins
    
            Allow plug-ins using the Core Animation drawing model to be captured when doing a flattening paint,
            by sending them a drawRect event as if they were software-painting.
    
            * Plugins/Hosted/NetscapePluginInstanceProxy.h:
            * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
            (WebKit::NetscapePluginInstanceProxy::snapshot):
            New snapshot() method that calls over to the plugin host, and then draws the image that comes back.
    
            * Plugins/Hosted/WebHostedNetscapePluginView.mm:
            (-[WebHostedNetscapePluginView drawRect:]): If we don't have a software renderer, but we're doing
            a flattening paint, then call the snapshot method.
    
            * Plugins/Hosted/WebKitPluginHost.defs: Added snapshot method.
    
            * Plugins/WebBaseNetscapePluginView.h:
            * Plugins/WebBaseNetscapePluginView.mm:
            (-[WebBaseNetscapePluginView inFlatteningPaint]):
            New utility method that asks the FrameView whether the current paint behavior is
            flattening.
    
            * Plugins/WebNetscapePluginView.mm:
            (-[WebNetscapePluginView drawRect:]): If the plug-in is using CA but this is a flattening
            paint, go ahead and send a drawRect event to the plug-in.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55702 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index ad8a7cd..401ac4c 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,33 @@
+2010-03-08  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Kevin Decker.
+
+        <rdar://problem/7714340> Need to grab image snapshot of Core Animation plugins
+        
+        Allow plug-ins using the Core Animation drawing model to be captured when doing a flattening paint,
+        by sending them a drawRect event as if they were software-painting.
+
+        * Plugins/Hosted/NetscapePluginInstanceProxy.h:
+        * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+        (WebKit::NetscapePluginInstanceProxy::snapshot):
+        New snapshot() method that calls over to the plugin host, and then draws the image that comes back.
+        
+        * Plugins/Hosted/WebHostedNetscapePluginView.mm:
+        (-[WebHostedNetscapePluginView drawRect:]): If we don't have a software renderer, but we're doing
+        a flattening paint, then call the snapshot method.
+        
+        * Plugins/Hosted/WebKitPluginHost.defs: Added snapshot method.
+        
+        * Plugins/WebBaseNetscapePluginView.h:
+        * Plugins/WebBaseNetscapePluginView.mm:
+        (-[WebBaseNetscapePluginView inFlatteningPaint]):
+        New utility method that asks the FrameView whether the current paint behavior is
+        flattening.
+        
+        * Plugins/WebNetscapePluginView.mm:
+        (-[WebNetscapePluginView drawRect:]): If the plug-in is using CA but this is a flattening
+        paint, go ahead and send a drawRect event to the plug-in.
+
 2010-03-08  Darin Adler  <darin at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
index 29a5a2d..ea31356 100644
--- a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
+++ b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
@@ -102,6 +102,7 @@ public:
     void syntheticKeyDownWithCommandModifier(int keyCode, char character);
     void flagsChanged(NSEvent *);
     void print(CGContextRef, unsigned width, unsigned height);
+    void snapshot(CGContextRef, unsigned width, unsigned height);
     
     void startTimers(bool throttleTimers);
     void stopTimers();
diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
index 0870df7..b00b287 100644
--- a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
+++ b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
@@ -498,6 +498,22 @@ void NetscapePluginInstanceProxy::print(CGContextRef context, unsigned width, un
     CGContextRestoreGState(context);
 }
 
+void NetscapePluginInstanceProxy::snapshot(CGContextRef context, unsigned width, unsigned height)
+{
+    uint32_t requestID = nextRequestID();
+    _WKPHPluginInstanceSnapshot(m_pluginHostProxy->port(), m_pluginID, requestID, width, height);
+    
+    auto_ptr<NetscapePluginInstanceProxy::BooleanAndDataReply> reply = waitForReply<NetscapePluginInstanceProxy::BooleanAndDataReply>(requestID);
+    if (!reply.get() || !reply->m_returnValue)
+        return;
+
+    RetainPtr<CGDataProvider> dataProvider(AdoptCF, CGDataProviderCreateWithCFData(reply->m_result.get()));
+    RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
+    RetainPtr<CGImageRef> image(AdoptCF, CGImageCreate(width, height, 8, 32, width * 4, colorSpace.get(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, dataProvider.get(), 0, false, kCGRenderingIntentDefault));
+
+    CGContextDrawImage(context, CGRectMake(0, 0, width, height), image.get());
+}
+
 void NetscapePluginInstanceProxy::stopTimers()
 {
     _WKPHPluginInstanceStopTimers(m_pluginHostProxy->port(), m_pluginID);
diff --git a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
index 6f097cc..7f18e77 100644
--- a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
@@ -377,8 +377,10 @@ extern "C" {
                 _proxy->didDraw();
             } else
                 _proxy->print(reinterpret_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]), [self bounds].size.width, [self bounds].size.height);
+        } else if ([self inFlatteningPaint]) {
+            _proxy->snapshot(reinterpret_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]), [self bounds].size.width, [self bounds].size.height);
         }
-            
+
         return;
     }
     
diff --git a/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs b/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs
index c7cec89..e1092b2 100644
--- a/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs
+++ b/WebKit/mac/Plugins/Hosted/WebKitPluginHost.defs
@@ -125,6 +125,12 @@ simpleroutine PHPluginInstancePrint(pluginHostPort :mach_port_t;
                                     width :uint32_t;
                                     height :uint32_t);
 
+simpleroutine PHPluginInstanceSnapshot(pluginHostPort :mach_port_t;
+                                    pluginID :uint32_t;
+                                    requestID :uint32_t;
+                                    width :uint32_t;
+                                    height :uint32_t);
+
 simpleroutine PHDestroyPluginInstance(pluginHostPort :mach_port_t;
                                     pluginID :uint32_t;
                                     requestID :uint32_t);
diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginView.h b/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
index 18dc004..3fdf2c3 100644
--- a/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
+++ b/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
@@ -123,6 +123,7 @@ class WebHaltablePlugin;
 - (void)addWindowObservers;
 - (void)removeWindowObservers;
 - (BOOL)shouldClipOutPlugin;
+- (BOOL)inFlatteningPaint;
 
 - (BOOL)convertFromX:(double)sourceX andY:(double)sourceY space:(NPCoordinateSpace)sourceSpace
                  toX:(double *)destX andY:(double *)destY space:(NPCoordinateSpace)destSpace;
diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
index 04a42ea..7458994 100644
--- a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
@@ -560,7 +560,18 @@ String WebHaltablePlugin::pluginName() const
     NSWindow *window = [self window];
     return !window || [window isMiniaturized] || [NSApp isHidden] || ![self isDescendantOf:[[self window] contentView]] || [self isHiddenOrHasHiddenAncestor];
 }
-    
+
+- (BOOL)inFlatteningPaint
+{
+    RenderObject* renderer = _element->renderer();
+    if (renderer && renderer->view()) {
+        if (FrameView* frameView = renderer->view()->frameView())
+            return frameView->paintBehavior() & PaintBehaviorFlattenCompositingLayers;
+    }
+
+    return NO;
+}
+
 - (BOOL)hasBeenHalted
 {
     return _hasBeenHalted;
diff --git a/WebKit/mac/Plugins/WebNetscapePluginView.mm b/WebKit/mac/Plugins/WebNetscapePluginView.mm
index dd74f5b..008b72a 100644
--- a/WebKit/mac/Plugins/WebNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/WebNetscapePluginView.mm
@@ -1397,7 +1397,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
 
 - (void)drawRect:(NSRect)rect
 {
-    if (drawingModel == NPDrawingModelCoreAnimation)
+    if (drawingModel == NPDrawingModelCoreAnimation && ![self inFlatteningPaint])
         return;
 
     if (!_isStarted)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list