[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.21-584-g1e41756

simon.fraser at apple.com simon.fraser at apple.com
Fri Feb 26 22:25:53 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit a2a01097e710f57b5d73300d46b3f62d6a274f9e
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Feb 19 22:10:18 2010 +0000

    2010-02-19  Simon Fraser  <simon.fraser at apple.com>
    
            Reviewed by Dan Bernstein.
    
            <rdar://problem/7535894> Page contents missing from snapshot on Newsweek.com article
    
            Followup to avoid capturing compositing layers twice in snapshots. Add private
            methods to WebView to specify whether drawing the WebView into an image will
            include flattened compositing layers (the default behavior) or not.
    
            * WebView/WebFrame.mm:
            (-[WebFrame _drawRect:contentsOnly:]): Consult the WebView flag to see if we
            want flattening.
    
            * WebView/WebViewPrivate.h: New methods.
            * WebView/WebView.mm: Ditto.
            (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]):
            (-[WebView _setIncludesFlattenedCompositingLayersWhenDrawingToBitmap:]):
            (-[WebView _includesFlattenedCompositingLayersWhenDrawingToBitmap]):
    
            * WebView/WebViewData.h: New member variable.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55030 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index e42c190..e1d0cc3 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,25 @@
+2010-02-19  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        <rdar://problem/7535894> Page contents missing from snapshot on Newsweek.com article
+        
+        Followup to avoid capturing compositing layers twice in snapshots. Add private
+        methods to WebView to specify whether drawing the WebView into an image will
+        include flattened compositing layers (the default behavior) or not.
+
+        * WebView/WebFrame.mm:
+        (-[WebFrame _drawRect:contentsOnly:]): Consult the WebView flag to see if we
+        want flattening.
+        
+        * WebView/WebViewPrivate.h: New methods.
+        * WebView/WebView.mm: Ditto.
+        (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]):
+        (-[WebView _setIncludesFlattenedCompositingLayersWhenDrawingToBitmap:]):
+        (-[WebView _includesFlattenedCompositingLayersWhenDrawingToBitmap]):
+
+        * WebView/WebViewData.h: New member variable.
+
 2010-02-19  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/WebKit/mac/WebView/WebFrame.mm b/WebKit/mac/WebView/WebFrame.mm
index eeda4f8..267d319 100644
--- a/WebKit/mac/WebView/WebFrame.mm
+++ b/WebKit/mac/WebView/WebFrame.mm
@@ -539,9 +539,9 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
 
     FrameView* view = _private->coreFrame->view();
     
-    bool isBitmapContext = WKCGContextIsBitmapContext(ctx);
+    bool shouldFlatten = WKCGContextIsBitmapContext(ctx) && [getWebView(self) _includesFlattenedCompositingLayersWhenDrawingToBitmap];
     PaintBehavior oldBehavior = PaintBehaviorNormal;
-    if (isBitmapContext) {
+    if (shouldFlatten) {
         oldBehavior = view->paintBehavior();
         view->setPaintBehavior(oldBehavior | PaintBehaviorFlattenCompositingLayers);
     }
@@ -551,7 +551,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
     else
         _private->coreFrame->view()->paint(&context, enclosingIntRect(rect));
 
-    if (isBitmapContext)
+    if (shouldFlatten)
         view->setPaintBehavior(oldBehavior);
 }
 
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index 1c68b2c..44d4b58 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -600,6 +600,7 @@ static bool shouldEnableLoadDeferring()
     _private->drawsBackground = YES;
     _private->backgroundColor = [[NSColor colorWithDeviceWhite:1 alpha:1] retain];
     _private->usesDocumentViews = usesDocumentViews;
+    _private->includesFlattenedCompositingLayersWhenDrawingToBitmap = YES;
 
     WebFrameView *frameView = nil;
     if (_private->usesDocumentViews) {
@@ -2172,6 +2173,16 @@ static inline IMP getMethod(id o, SEL s)
     return YES;
 }
 
+- (void)_setIncludesFlattenedCompositingLayersWhenDrawingToBitmap:(BOOL)flag
+{
+    _private->includesFlattenedCompositingLayersWhenDrawingToBitmap = flag;
+}
+
+- (BOOL)_includesFlattenedCompositingLayersWhenDrawingToBitmap
+{
+    return _private->includesFlattenedCompositingLayersWhenDrawingToBitmap;
+}
+
 static WebBaseNetscapePluginView *_pluginViewForNode(DOMNode *node)
 {
     if (!node)
diff --git a/WebKit/mac/WebView/WebViewData.h b/WebKit/mac/WebView/WebViewData.h
index b0569a2..2b51f3c 100644
--- a/WebKit/mac/WebView/WebViewData.h
+++ b/WebKit/mac/WebView/WebViewData.h
@@ -137,6 +137,8 @@ extern int pluginDatabaseClientCount;
     
     // When this flag is set, we will not make any subviews underneath this WebView.  This means no WebFrameViews and no WebHTMLViews.
     BOOL usesDocumentViews;
+
+    BOOL includesFlattenedCompositingLayersWhenDrawingToBitmap;
     
 #if USE(ACCELERATED_COMPOSITING)
     // When this flag is set, next time a WebHTMLView draws, it needs to temporarily disable screen updates
diff --git a/WebKit/mac/WebView/WebViewPrivate.h b/WebKit/mac/WebView/WebViewPrivate.h
index 9c7e047..b0a7039 100644
--- a/WebKit/mac/WebView/WebViewPrivate.h
+++ b/WebKit/mac/WebView/WebViewPrivate.h
@@ -472,6 +472,10 @@ Could be worth adding to the API.
 
 // Returns YES if NSView -displayRectIgnoringOpacity:inContext: will produce a faithful representation of the content.
 - (BOOL)_isSoftwareRenderable;
+// When drawing into a bitmap context, we normally flatten compositing layers (and distort 3D transforms).
+// Clients who are able to capture their own copy of the compositing layers need to be able to disable this.
+- (void)_setIncludesFlattenedCompositingLayersWhenDrawingToBitmap:(BOOL)flag;
+- (BOOL)_includesFlattenedCompositingLayersWhenDrawingToBitmap;
 
 // SPI for PluginHalter
 + (BOOL)_isNodeHaltedPlugin:(DOMNode *)node;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list