[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

simon.fraser at apple.com simon.fraser at apple.com
Fri Jan 21 14:36:14 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit a892004c3d4de0b043c77a50c6798edfd294398c
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Dec 23 01:17:45 2010 +0000

    2010-12-22  Simon Fraser  <simon.fraser at apple.com>
    
            Reviewed by Darin Adler.
    
            Cache snapshots of plug-ins before painting, to avoid script running during painting
            https://bugs.webkit.org/show_bug.cgi?id=51493
    
            When FrameView is asked to do a flattening paint (e.g. when Safari snapshots,
            or when printing), plug-ins which otherwise use the CA rendering model
            are sent a paint event. Some plug-ins may run script while handling this event,
            or out of process plug-ins may process queued requests at this time. Running
            script while inside layout or painting can have bad consequences, because it
            can result in arbitrary changes to the render tree.
    
            This patch avoids sending plug-ins paint events inside of painting. Instead,
            we ask the plug-ins to cache a snapshot before we paint, and then the software
            paint simply draws that snapshot.
    
            Requires manual test, because the bug happens when Safari does
            a page snapshot. It's not possible to tell the Test Netscape Plug-in
            to paint without laying out, making an automated test impossible.
    
            * manual-tests/plugins/plugin-paint-causes-layout.html: Added.
    
            * page/FrameView.h:
            * page/FrameView.cpp:
            (WebCore::FrameView::paintContents): Notify all enclosed widgets
            that a flattening paint is going to happen.
            (WebCore::FrameView::notifyWidgetsInAllFrames): Utility method
            that tells the RenderView in all subframes to notify their widgets.
    
            * platform/Widget.h:
            (WebCore::Widget::notifyWidget): Generic method that can be used
            to send messages to widgets. Current messages are just 'before flattening paint'
            and 'after flattening paint'. Message has no payload.
    
            * rendering/RenderView.h:
            * rendering/RenderView.cpp:
            (WebCore::RenderView::getRetainedWidgets):
            (WebCore::RenderView::releaseWidgets): Factor code out of updateWidgetPositions(),
            since we use it in two places now.
    
            (WebCore::RenderView::updateWidgetPositions): Use getRetainedWidgets() etc.
            (WebCore::RenderView::notifyWidgets): Retain all the widgets, then send
            them all the message.
    
            * rendering/RenderWidget.h:
            * rendering/RenderWidget.cpp:
            (WebCore::RenderWidget::notifyWidget): Pass the message to the widget.
    
            * Plugins/Hosted/WebHostedNetscapePluginView.mm:
            (-[WebHostedNetscapePluginView drawRect:]): If we have a cached snapshot,
            draw it. Also only send the snapshot message to the plugin proxy if we
            know we're snapshotting, since even if creating the snapshot image failed,
            we still don't want to call to the plug-in.
    
            * Plugins/WebBaseNetscapePluginView.h: Add a retained NSImage member for the snapshot.
            * Plugins/WebBaseNetscapePluginView.mm:
            (-[WebBaseNetscapePluginView cacheSnapshot]): Create an image and draw the snapshot into it.
            (-[WebBaseNetscapePluginView clearCachedSnapshot]): Clear the snapshot.
    
            * Plugins/WebNetscapePluginView.mm:
            (-[WebNetscapePluginView drawRect:]): If we have a cached snapshot, use it.
            * WebCoreSupport/WebFrameLoaderClient.mm:
            (NetscapePluginWidget::notifyWidget): Implement notifyWidget() and use it
            to cache and clear the snapshots.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74524 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 1475d85..2452ffc 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,53 @@
+2010-12-22  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Cache snapshots of plug-ins before painting, to avoid script running during painting
+        https://bugs.webkit.org/show_bug.cgi?id=51493
+        
+        When FrameView is asked to do a flattening paint (e.g. when Safari snapshots,
+        or when printing), plug-ins which otherwise use the CA rendering model
+        are sent a paint event. Some plug-ins may run script while handling this event,
+        or out of process plug-ins may process queued requests at this time. Running
+        script while inside layout or painting can have bad consequences, because it
+        can result in arbitrary changes to the render tree.
+        
+        This patch avoids sending plug-ins paint events inside of painting. Instead,
+        we ask the plug-ins to cache a snapshot before we paint, and then the software
+        paint simply draws that snapshot.
+        
+        Requires manual test, because the bug happens when Safari does
+        a page snapshot. It's not possible to tell the Test Netscape Plug-in
+        to paint without laying out, making an automated test impossible.
+
+        * manual-tests/plugins/plugin-paint-causes-layout.html: Added.
+
+        * page/FrameView.h:
+        * page/FrameView.cpp:
+        (WebCore::FrameView::paintContents): Notify all enclosed widgets
+        that a flattening paint is going to happen.
+        (WebCore::FrameView::notifyWidgetsInAllFrames): Utility method 
+        that tells the RenderView in all subframes to notify their widgets.
+
+        * platform/Widget.h:
+        (WebCore::Widget::notifyWidget): Generic method that can be used
+        to send messages to widgets. Current messages are just 'before flattening paint'
+        and 'after flattening paint'. Message has no payload.
+
+        * rendering/RenderView.h:
+        * rendering/RenderView.cpp:
+        (WebCore::RenderView::getRetainedWidgets):
+        (WebCore::RenderView::releaseWidgets): Factor code out of updateWidgetPositions(),
+        since we use it in two places now.
+        
+        (WebCore::RenderView::updateWidgetPositions): Use getRetainedWidgets() etc.
+        (WebCore::RenderView::notifyWidgets): Retain all the widgets, then send
+        them all the message.
+
+        * rendering/RenderWidget.h:
+        * rendering/RenderWidget.cpp:
+        (WebCore::RenderWidget::notifyWidget): Pass the message to the widget.
+
 2010-12-22  Adrienne Walker  <enne at google.com>
 
         Reviewed by Kenneth Russell.
diff --git a/WebCore/manual-tests/plugins/plugin-paint-causes-layout.html b/WebCore/manual-tests/plugins/plugin-paint-causes-layout.html
new file mode 100644
index 0000000..4781c7e
--- /dev/null
+++ b/WebCore/manual-tests/plugins/plugin-paint-causes-layout.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style type="text/css" media="screen">
+        embed {
+            position: absolute;
+            margin: 10px;
+        }
+        
+        .container {
+            position: relative;
+            border: 2px solid blue;
+            padding: 20px;
+            width: 100px;
+        }
+        
+    </style>
+    <script type="text/javascript" charset="utf-8">
+        function hideFirst()
+        {
+          var firstDiv = document.getElementById('first');
+          if (!firstDiv)
+              return;
+
+          firstDiv.parentNode.removeChild(firstDiv);
+          document.body.clientWidth;
+        }
+    </script>
+</head>
+<body>
+    <embed type="application/x-webkit-test-netscape" onpaintevent="hideFirst()" drawingmodel="coreanimation"></embed>
+
+    <p>This test should not assert or crash when loaded in Safari, when Safari captures a snapshot.</p>
+    <div id="first" class="container">
+    </div>
+
+</body>
+</html>
diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp
index 2484860..14a8fbd 100644
--- a/WebCore/page/FrameView.cpp
+++ b/WebCore/page/FrameView.cpp
@@ -2128,13 +2128,6 @@ void FrameView::paintContents(GraphicsContext* p, const IntRect& rect)
     }
 #endif
 
-    ASSERT(!m_isPainting);
-        
-    m_isPainting = true;
-        
-    // m_nodeToDraw is used to draw only one element (and its descendants)
-    RenderObject* eltRenderer = m_nodeToDraw ? m_nodeToDraw->renderer() : 0;
-
     PaintBehavior oldPaintBehavior = m_paintBehavior;
     if (m_paintBehavior == PaintBehaviorNormal)
         document->markers()->invalidateRenderedRectsForMarkersInRect(rect);
@@ -2142,11 +2135,25 @@ void FrameView::paintContents(GraphicsContext* p, const IntRect& rect)
     if (document->printing())
         m_paintBehavior |= PaintBehaviorFlattenCompositingLayers;
 
+    bool flatteningPaint = m_paintBehavior & PaintBehaviorFlattenCompositingLayers;
+    bool isRootFrame = !document->ownerElement();
+    if (flatteningPaint && isRootFrame)
+        notifyWidgetsInAllFrames(WillPaintFlattened);
+
+    ASSERT(!m_isPainting);
+    m_isPainting = true;
+
+    // m_nodeToDraw is used to draw only one element (and its descendants)
+    RenderObject* eltRenderer = m_nodeToDraw ? m_nodeToDraw->renderer() : 0;
+
     contentRenderer->layer()->paint(p, rect, m_paintBehavior, eltRenderer);
-    
-    m_paintBehavior = oldPaintBehavior;
-    
+
     m_isPainting = false;
+
+    if (flatteningPaint && isRootFrame)
+        notifyWidgetsInAllFrames(DidPaintFlattened);
+
+    m_paintBehavior = oldPaintBehavior;
     m_lastPaintTime = currentTime();
 
 #if ENABLE(DASHBOARD_SUPPORT)
@@ -2462,5 +2469,13 @@ bool FrameView::isFlippedDocument() const
         return false;
     return renderView->style()->isFlippedBlocksWritingMode();
 }
+
+void FrameView::notifyWidgetsInAllFrames(WidgetNotification notification)
+{
+    for (Frame* frame = m_frame.get(); frame; frame = frame->tree()->traverseNext(m_frame.get())) {
+        if (RenderView* root = frame->contentRenderer())
+            root->notifyWidgets(notification);
+    }
+}
     
 } // namespace WebCore
diff --git a/WebCore/page/FrameView.h b/WebCore/page/FrameView.h
index d132916..1712a3e 100644
--- a/WebCore/page/FrameView.h
+++ b/WebCore/page/FrameView.h
@@ -308,6 +308,8 @@ private:
     virtual void updateScrollCorner();
     virtual void paintScrollCorner(GraphicsContext*, const IntRect& cornerRect);
 
+    void notifyWidgetsInAllFrames(WidgetNotification);
+    
     static double sCurrentPaintTimeStamp; // used for detecting decoded resource thrash in the cache
 
     IntSize m_size;
diff --git a/WebCore/platform/Widget.h b/WebCore/platform/Widget.h
index 10c65ce..c6c1d9a 100644
--- a/WebCore/platform/Widget.h
+++ b/WebCore/platform/Widget.h
@@ -110,6 +110,8 @@ class PlatformMouseEvent;
 class ScrollView;
 class WidgetPrivate;
 
+enum WidgetNotification { WillPaintFlattened, DidPaintFlattened };
+
 // The Widget class serves as a base class for three kinds of objects:
 // (1) Scrollable areas (ScrollView)
 // (2) Scrollbars (Scrollbar)
@@ -188,6 +190,8 @@ public:
 
     virtual void handleEvent(Event*) { }
 
+    virtual void notifyWidget(WidgetNotification) { }
+
     // It is important for cross-platform code to realize that Mac has flipped coordinates.  Therefore any code
     // that tries to convert the location of a rect using the point-based convertFromContainingWindow will end
     // up with an inaccurate rect.  Always make sure to use the rect-based convertFromContainingWindow method
diff --git a/WebCore/rendering/RenderView.cpp b/WebCore/rendering/RenderView.cpp
index 2992c2c..3e4fc77 100644
--- a/WebCore/rendering/RenderView.cpp
+++ b/WebCore/rendering/RenderView.cpp
@@ -566,15 +566,10 @@ bool RenderView::printing() const
     return document()->printing();
 }
 
-void RenderView::updateWidgetPositions()
+size_t RenderView::getRetainedWidgets(Vector<RenderWidget*>& renderWidgets)
 {
-    // updateWidgetPosition() can possibly cause layout to be re-entered (via plug-ins running
-    // scripts in response to NPP_SetWindow, for example), so we need to keep the Widgets
-    // alive during enumeration.    
-
     size_t size = m_widgets.size();
 
-    Vector<RenderWidget*> renderWidgets;
     renderWidgets.reserveCapacity(size);
 
     RenderWidgetSet::const_iterator end = m_widgets.end();
@@ -583,14 +578,33 @@ void RenderView::updateWidgetPositions()
         (*it)->ref();
     }
     
+    return size;
+}
+
+void RenderView::releaseWidgets(Vector<RenderWidget*>& renderWidgets)
+{
+    size_t size = renderWidgets.size();
+
+    for (size_t i = 0; i < size; ++i)
+        renderWidgets[i]->deref(renderArena());
+}
+
+void RenderView::updateWidgetPositions()
+{
+    // updateWidgetPosition() can possibly cause layout to be re-entered (via plug-ins running
+    // scripts in response to NPP_SetWindow, for example), so we need to keep the Widgets
+    // alive during enumeration.    
+
+    Vector<RenderWidget*> renderWidgets;
+    size_t size = getRetainedWidgets(renderWidgets);
+    
     for (size_t i = 0; i < size; ++i)
         renderWidgets[i]->updateWidgetPosition();
 
     for (size_t i = 0; i < size; ++i)
         renderWidgets[i]->widgetPositionsUpdated();
 
-    for (size_t i = 0; i < size; ++i)
-        renderWidgets[i]->deref(renderArena());
+    releaseWidgets(renderWidgets);
 }
 
 void RenderView::addWidget(RenderWidget* o)
@@ -603,6 +617,17 @@ void RenderView::removeWidget(RenderWidget* o)
     m_widgets.remove(o);
 }
 
+void RenderView::notifyWidgets(WidgetNotification notification)
+{
+    Vector<RenderWidget*> renderWidgets;
+    size_t size = getRetainedWidgets(renderWidgets);
+
+    for (size_t i = 0; i < size; ++i)
+        renderWidgets[i]->notifyWidget(notification);
+
+    releaseWidgets(renderWidgets);
+}
+
 IntRect RenderView::viewRect() const
 {
     if (printing())
diff --git a/WebCore/rendering/RenderView.h b/WebCore/rendering/RenderView.h
index 9341e62..1dfd4ce 100644
--- a/WebCore/rendering/RenderView.h
+++ b/WebCore/rendering/RenderView.h
@@ -97,6 +97,8 @@ public:
     void updateWidgetPositions();
     void addWidget(RenderWidget*);
     void removeWidget(RenderWidget*);
+    
+    void notifyWidgets(WidgetNotification);
 
     // layoutDelta is used transiently during layout to store how far an object has moved from its
     // last layout location, in order to repaint correctly.
@@ -198,6 +200,9 @@ private:
         m_layoutState = state->m_next;
         state->destroy(renderArena());
     }
+
+    size_t getRetainedWidgets(Vector<RenderWidget*>&);
+    void releaseWidgets(Vector<RenderWidget*>&);
     
     friend class LayoutStateMaintainer;
         
diff --git a/WebCore/rendering/RenderWidget.cpp b/WebCore/rendering/RenderWidget.cpp
index 6ea620f..152bb2f 100644
--- a/WebCore/rendering/RenderWidget.cpp
+++ b/WebCore/rendering/RenderWidget.cpp
@@ -236,6 +236,12 @@ void RenderWidget::showSubstituteImage(PassRefPtr<Image> prpImage)
     repaint();
 }
 
+void RenderWidget::notifyWidget(WidgetNotification notification)
+{
+    if (m_widget)
+        m_widget->notifyWidget(notification);
+}
+
 void RenderWidget::paint(PaintInfo& paintInfo, int tx, int ty)
 {
     if (!shouldPaint(paintInfo, tx, ty))
diff --git a/WebCore/rendering/RenderWidget.h b/WebCore/rendering/RenderWidget.h
index b85b951..d2ec096 100644
--- a/WebCore/rendering/RenderWidget.h
+++ b/WebCore/rendering/RenderWidget.h
@@ -24,11 +24,10 @@
 
 #include "OverlapTestRequestClient.h"
 #include "RenderReplaced.h"
+#include "Widget.h"
 
 namespace WebCore {
 
-class Widget;
-
 class RenderWidget : public RenderReplaced, private OverlapTestRequestClient {
 public:
     virtual ~RenderWidget();
@@ -44,6 +43,8 @@ public:
 
     void showSubstituteImage(PassRefPtr<Image>);
 
+    void notifyWidget(WidgetNotification);
+    
     static void suspendWidgetHierarchyUpdates();
     static void resumeWidgetHierarchyUpdates();
 
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 3b1fef6..1a66b1a 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,38 @@
+2010-12-22  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Cache snapshots of plug-ins before painting, to avoid script running during painting
+        https://bugs.webkit.org/show_bug.cgi?id=51493
+
+        When FrameView is asked to do a flattening paint (e.g. when Safari snapshots,
+        or when printing), plug-ins which otherwise use the CA rendering model
+        are sent a paint event. Some plug-ins may run script while handling this event,
+        or out of process plug-ins may process queued requests at this time. Running
+        script while inside layout or painting can have bad consequences, because it
+        can result in arbitrary changes to the render tree.
+        
+        This patch avoids sending plug-ins paint events inside of painting. Instead,
+        we ask the plug-ins to cache a snapshot before we paint, and then the software
+        paint simply draws that snapshot.
+
+        * Plugins/Hosted/WebHostedNetscapePluginView.mm:
+        (-[WebHostedNetscapePluginView drawRect:]): If we have a cached snapshot,
+        draw it. Also only send the snapshot message to the plugin proxy if we
+        know we're snapshotting, since even if creating the snapshot image failed,
+        we still don't want to call to the plug-in.
+
+        * Plugins/WebBaseNetscapePluginView.h: Add a retained NSImage member for the snapshot.
+        * Plugins/WebBaseNetscapePluginView.mm:
+        (-[WebBaseNetscapePluginView cacheSnapshot]): Create an image and draw the snapshot into it.
+        (-[WebBaseNetscapePluginView clearCachedSnapshot]): Clear the snapshot.
+
+        * Plugins/WebNetscapePluginView.mm:
+        (-[WebNetscapePluginView drawRect:]): If we have a cached snapshot, use it.
+        * WebCoreSupport/WebFrameLoaderClient.mm:
+        (NetscapePluginWidget::notifyWidget): Implement notifyWidget() and use it
+        to cache and clear the snapshots.
+
 2010-12-21  Cameron Zwarich  <zwarich at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
index 362dd97..e13808d 100644
--- a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
@@ -403,6 +403,12 @@ extern "C" {
 
 - (void)drawRect:(NSRect)rect
 {
+    if (_cachedSnapshot) {
+        NSRect sourceRect = { NSZeroPoint, [_cachedSnapshot.get() size] };
+        [_cachedSnapshot.get() drawInRect:[self bounds] fromRect:sourceRect operation:NSCompositeSourceOver fraction:1];
+        return;
+    }
+
     if (_proxy) {
         if (_softwareRenderer) {
             if ([NSGraphicsContext currentContextDrawingToScreen]) {
@@ -410,7 +416,7 @@ 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] && [self supportsSnapshotting]) {
+        } else if (_snapshotting && [self supportsSnapshotting]) {
             _proxy->snapshot(reinterpret_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]), [self bounds].size.width, [self bounds].size.height);
         }
 
diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginView.h b/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
index 1a4b6bb..0f39730 100644
--- a/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
+++ b/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
@@ -70,11 +70,13 @@ class WebHaltablePlugin;
     BOOL _isPrivateBrowsingEnabled;
     BOOL _isHalted;
     BOOL _hasBeenHalted;
+    BOOL _snapshotting;
     
     RefPtr<WebCore::HTMLPlugInElement> _element;
     RetainPtr<NSString> _MIMEType;
     RetainPtr<NSURL> _baseURL;
     RetainPtr<NSURL> _sourceURL;
+    RetainPtr<NSImage> _cachedSnapshot;
     
     OwnPtr<WebHaltablePlugin> _haltable;
     
@@ -129,7 +131,10 @@ class WebHaltablePlugin;
 - (void)removeWindowObservers;
 - (BOOL)shouldClipOutPlugin;
 - (BOOL)inFlatteningPaint;
+
 - (BOOL)supportsSnapshotting;
+- (void)cacheSnapshot;
+- (void)clearCachedSnapshot;
 
 - (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 b6b8b64..7837608 100644
--- a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
@@ -579,6 +579,23 @@ String WebHaltablePlugin::pluginName() const
     return [_pluginPackage.get() supportsSnapshotting];
 }
 
+- (void)cacheSnapshot
+{
+    NSImage *snapshot = [[NSImage alloc] initWithSize: [self bounds].size];
+    _snapshotting = YES;
+    [snapshot lockFocus];
+    [self drawRect:[self bounds]];
+    [snapshot unlockFocus];
+    _snapshotting = NO;
+    
+    _cachedSnapshot.adoptNS(snapshot);
+}
+
+- (void)clearCachedSnapshot
+{
+    _cachedSnapshot.clear();
+}
+
 - (BOOL)hasBeenHalted
 {
     return _hasBeenHalted;
diff --git a/WebKit/mac/Plugins/WebNetscapePluginView.mm b/WebKit/mac/Plugins/WebNetscapePluginView.mm
index 48574bf..dbbe129 100644
--- a/WebKit/mac/Plugins/WebNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/WebNetscapePluginView.mm
@@ -1426,7 +1426,13 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
 
 - (void)drawRect:(NSRect)rect
 {
-    if (drawingModel == NPDrawingModelCoreAnimation && (![self inFlatteningPaint] || ![self supportsSnapshotting]))
+    if (_cachedSnapshot) {
+        NSRect sourceRect = { NSZeroPoint, [_cachedSnapshot.get() size] };
+        [_cachedSnapshot.get() drawInRect:[self bounds] fromRect:sourceRect operation:NSCompositeSourceOver fraction:1];
+        return;
+    }
+    
+    if (drawingModel == NPDrawingModelCoreAnimation && (!_snapshotting || ![self supportsSnapshotting]))
         return;
 
     if (!_isStarted)
diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
index 5968084..c8285dc 100644
--- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
@@ -1568,7 +1568,25 @@ public:
         else if (event->type() == eventNames().mouseoutEvent)
             [(WebBaseNetscapePluginView *)platformWidget() handleMouseExited:currentNSEvent];
     }
-    
+
+private:
+    virtual void notifyWidget(WidgetNotification notification)
+    {
+        switch (notification) {
+        case WillPaintFlattened: {
+            BEGIN_BLOCK_OBJC_EXCEPTIONS;
+            [(WebBaseNetscapePluginView *)platformWidget() cacheSnapshot];
+            END_BLOCK_OBJC_EXCEPTIONS;
+            break;
+        }
+        case DidPaintFlattened: {
+            BEGIN_BLOCK_OBJC_EXCEPTIONS;
+            [(WebBaseNetscapePluginView *)platformWidget() clearCachedSnapshot];
+            END_BLOCK_OBJC_EXCEPTIONS;
+            break;
+        }
+        }
+    }
 };
 
 #if USE(PLUGIN_HOST_PROCESS)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list