[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:21 UTC 2010


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

    2010-02-18  Simon Fraser  <simon.fraser at apple.com>
    
            Reviewed by Dan Bernstein.
    
            <rdar://problem/7535894> Page contents missing from snapshot on Newsweek.com article
    
            Add logic to determine when painting via the software rendering path will give an equivalent
            result to the accelerated compositing presentation. This tests for the presence of 3D transforms
            via the existing RenderLayerCompositor::has3DContent() method.
    
            * WebCore.base.exp: Export FrameView's isSoftwareRenderable(), paintBehavior() and setPaintBehavior().
            * page/FrameView.h:
            * page/FrameView.cpp:
            (WebCore::FrameView::isSoftwareRenderable): New method.
            (WebCore::FrameView::paintBehavior): Make this non-inline so that we can reliably export it.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54994 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index ff0dff2..15c7282 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2010-02-18  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        <rdar://problem/7535894> Page contents missing from snapshot on Newsweek.com article
+        
+        Add logic to determine when painting via the software rendering path will give an equivalent
+        result to the accelerated compositing presentation. This tests for the presence of 3D transforms
+        via the existing RenderLayerCompositor::has3DContent() method.
+        
+        * WebCore.base.exp: Export FrameView's isSoftwareRenderable(), paintBehavior() and setPaintBehavior().
+        * page/FrameView.h:
+        * page/FrameView.cpp:
+        (WebCore::FrameView::isSoftwareRenderable): New method.
+        (WebCore::FrameView::paintBehavior): Make this non-inline so that we can reliably export it.
+
 2010-02-18  Dan Bernstein  <mitz at apple.com>
 
         Reviewed by John Sullivan.
diff --git a/WebCore/WebCore.base.exp b/WebCore/WebCore.base.exp
index 6215e24..2afdd34 100644
--- a/WebCore/WebCore.base.exp
+++ b/WebCore/WebCore.base.exp
@@ -713,6 +713,9 @@ __ZN7WebCore9FrameView23updateCanHaveScrollbarsEv
 __ZN7WebCore9FrameView29forceLayoutWithPageWidthRangeEffb
 __ZN7WebCore9FrameView29setShouldUpdateWhileOffscreenEb
 __ZN7WebCore9FrameView29syncCompositingStateRecursiveEv
+__ZNK7WebCore9FrameView20isSoftwareRenderableEv
+__ZN7WebCore9FrameView16setPaintBehaviorEj
+__ZNK7WebCore9FrameView13paintBehaviorEv
 __ZN7WebCore9FrameView6createEPNS_5FrameE
 __ZN7WebCore9FrameView6createEPNS_5FrameERKNS_7IntSizeE
 __ZN7WebCore9HTMLNames10listingTagE
diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp
index 2bc4e63..5c57c64 100644
--- a/WebCore/page/FrameView.cpp
+++ b/WebCore/page/FrameView.cpp
@@ -487,6 +487,19 @@ bool FrameView::syncCompositingStateRecursive()
 #endif
 }
 
+bool FrameView::isSoftwareRenderable() const
+{
+#if USE(ACCELERATED_COMPOSITING)
+    RenderView* view = m_frame->contentRenderer();
+    if (!view)
+        return true;
+
+    return !view->compositor()->has3DContent();
+#else
+    return true;
+#endif
+}
+
 void FrameView::didMoveOnscreen()
 {
     RenderView* view = m_frame->contentRenderer();
@@ -1759,7 +1772,12 @@ void FrameView::setPaintBehavior(PaintBehavior behavior)
 {
     m_paintBehavior = behavior;
 }
-    
+
+PaintBehavior FrameView::paintBehavior() const
+{
+    return m_paintBehavior;
+}
+
 bool FrameView::isPainting() const
 {
     return m_isPainting;
diff --git a/WebCore/page/FrameView.h b/WebCore/page/FrameView.h
index b27ffd8..1d5a312 100644
--- a/WebCore/page/FrameView.h
+++ b/WebCore/page/FrameView.h
@@ -106,6 +106,10 @@ public:
     // Returns true if the sync was completed.
     bool syncCompositingStateRecursive();
 
+    // Returns true when a paint with the PaintBehaviorFlattenCompositingLayers flag set gives
+    // a faithful representation of the content.
+    bool isSoftwareRenderable() const;
+
     void didMoveOnscreen();
     void willMoveOffscreen();
 
@@ -170,7 +174,7 @@ public:
 
     virtual void paintContents(GraphicsContext*, const IntRect& damageRect);
     void setPaintBehavior(PaintBehavior);
-    PaintBehavior paintBehavior() const { return m_paintBehavior; }
+    PaintBehavior paintBehavior() const;
     bool isPainting() const;
     void setNodeToDraw(Node*);
 
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 004f8e5..1b6590d 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,22 @@
+2010-02-18  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        <rdar://problem/7535894> Page contents missing from snapshot on Newsweek.com article
+
+        Add logic to determine when painting via the software rendering path will give an equivalent
+        result to the accelerated compositing presentation. This tests for the presence of 3D transforms.
+
+        Also have -[WebFrame _drawRect:contentsOnly:] set the PaintBehaviorFlattenCompositingLayers
+        paint behavior when painting into a bitmap context, so that snapshots contain composited layers.
+
+        * WebView/WebFrame.mm:
+        (-[WebFrame _drawRect:contentsOnly:]): Set the PaintBehaviorFlattenCompositingLayers flag
+        when painting into a bitmap context.
+        * WebView/WebView.mm:
+        (-[WebView _isSoftwareRenderable]): Returns YES if all frames can be software-rendered.
+        * WebView/WebViewPrivate.h: New _isSoftwareRenderable method.
+
 2010-02-18  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 b0e4d83..eeda4f8 100644
--- a/WebKit/mac/WebView/WebFrame.mm
+++ b/WebKit/mac/WebView/WebFrame.mm
@@ -87,6 +87,7 @@
 #import <WebCore/htmlediting.h>
 #import <WebCore/markup.h>
 #import <WebCore/visible_units.h>
+#import <WebKitSystemInterface.h>
 #import <runtime/JSLock.h>
 #import <runtime/JSObject.h>
 #import <runtime/JSValue.h>
@@ -531,14 +532,27 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
 
 - (void)_drawRect:(NSRect)rect contentsOnly:(BOOL)contentsOnly
 {
-    PlatformGraphicsContext* platformContext = static_cast<PlatformGraphicsContext*>([[NSGraphicsContext currentContext] graphicsPort]);
     ASSERT([[NSGraphicsContext currentContext] isFlipped]);
-    GraphicsContext context(platformContext);
+
+    CGContextRef ctx = static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]);
+    GraphicsContext context(ctx);
+
+    FrameView* view = _private->coreFrame->view();
+    
+    bool isBitmapContext = WKCGContextIsBitmapContext(ctx);
+    PaintBehavior oldBehavior = PaintBehaviorNormal;
+    if (isBitmapContext) {
+        oldBehavior = view->paintBehavior();
+        view->setPaintBehavior(oldBehavior | PaintBehaviorFlattenCompositingLayers);
+    }
     
     if (contentsOnly)
         _private->coreFrame->view()->paintContents(&context, enclosingIntRect(rect));
     else
         _private->coreFrame->view()->paint(&context, enclosingIntRect(rect));
+
+    if (isBitmapContext)
+        view->setPaintBehavior(oldBehavior);
 }
 
 // Used by pagination code called from AppKit when a standalone web page is printed.
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index b2b33b9..1c68b2c 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -2144,19 +2144,32 @@ static inline IMP getMethod(id o, SEL s)
 - (BOOL)_isUsingAcceleratedCompositing
 {
 #if USE(ACCELERATED_COMPOSITING)
-    Frame* coreFrame = [self _mainCoreFrame];
     if (_private->usesDocumentViews) {
+        Frame* coreFrame = [self _mainCoreFrame];
         for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) {
             NSView *documentView = [[kit(frame) frameView] documentView];
             if ([documentView isKindOfClass:[WebHTMLView class]] && [(WebHTMLView *)documentView _isUsingAcceleratedCompositing])
                 return YES;
         }
     }
-
-    return NO;
-#else
+#endif
     return NO;
+}
+
+- (BOOL)_isSoftwareRenderable
+{
+#if USE(ACCELERATED_COMPOSITING)
+    if (_private->usesDocumentViews) {
+        Frame* coreFrame = [self _mainCoreFrame];
+        for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) {
+            if (FrameView* view = frame->view()) {
+                if (!view->isSoftwareRenderable())
+                    return NO;
+            }
+        }
+    }
 #endif
+    return YES;
 }
 
 static WebBaseNetscapePluginView *_pluginViewForNode(DOMNode *node)
diff --git a/WebKit/mac/WebView/WebViewPrivate.h b/WebKit/mac/WebView/WebViewPrivate.h
index 4d1145e..9c7e047 100644
--- a/WebKit/mac/WebView/WebViewPrivate.h
+++ b/WebKit/mac/WebView/WebViewPrivate.h
@@ -470,6 +470,9 @@ Could be worth adding to the API.
 - (void)_setPostsAcceleratedCompositingNotifications:(BOOL)flag;
 - (BOOL)_isUsingAcceleratedCompositing;
 
+// Returns YES if NSView -displayRectIgnoringOpacity:inContext: will produce a faithful representation of the content.
+- (BOOL)_isSoftwareRenderable;
+
 // SPI for PluginHalter
 + (BOOL)_isNodeHaltedPlugin:(DOMNode *)node;
 + (BOOL)_hasPluginForNodeBeenHalted:(DOMNode *)node;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list