[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

simon.fraser at apple.com simon.fraser at apple.com
Sun Feb 20 23:02:18 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 8c9d54038f63bb019dbf61d7fbee6bf3d881beef
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Jan 15 06:48:32 2011 +0000

    2011-01-14  Simon Fraser  <simon.fraser at apple.com>
    
            Reviewed by Dan Bernstein.
    
            Plugins render incorrectly with transformed ancestors
            https://bugs.webkit.org/show_bug.cgi?id=52507
    
            -[NSView visibleRect] gives the wrong answer if there are CSS transforms
            in the ancestor chain of a plugin.
    
            So use of this method with calls to -actualVisibleRectInWindow, which
            maps rects through the render tree to compute the correct rect,
            clipping via windowClipRect() if necessary.
    
            Not testable, because doing so relies on the behavior of some
            plugins, which stop rendering if setWindow passes an empty rect.
    
            * Plugins/Hosted/WebHostedNetscapePluginView.mm:
            (-[WebHostedNetscapePluginView updateAndSetWindow]):
            * Plugins/WebBaseNetscapePluginView.h:
            * Plugins/WebBaseNetscapePluginView.mm:
            (-[WebBaseNetscapePluginView actualVisibleRectInWindow]):
            * Plugins/WebNetscapePluginView.mm:
            (-[WebNetscapePluginView saveAndSetNewPortStateForUpdate:]):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75873 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 9e7b4a8..20ef1e9 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,28 @@
+2011-01-14  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        Plugins render incorrectly with transformed ancestors
+        https://bugs.webkit.org/show_bug.cgi?id=52507
+        
+        -[NSView visibleRect] gives the wrong answer if there are CSS transforms
+        in the ancestor chain of a plugin.
+        
+        So use of this method with calls to -actualVisibleRectInWindow, which
+        maps rects through the render tree to compute the correct rect,
+        clipping via windowClipRect() if necessary.
+        
+        Not testable, because doing so relies on the behavior of some
+        plugins, which stop rendering if setWindow passes an empty rect.
+
+        * Plugins/Hosted/WebHostedNetscapePluginView.mm:
+        (-[WebHostedNetscapePluginView updateAndSetWindow]):
+        * Plugins/WebBaseNetscapePluginView.h:
+        * Plugins/WebBaseNetscapePluginView.mm:
+        (-[WebBaseNetscapePluginView actualVisibleRectInWindow]):
+        * Plugins/WebNetscapePluginView.mm:
+        (-[WebNetscapePluginView saveAndSetNewPortStateForUpdate:]):
+
 2011-01-14  Yuzo Fujishima  <yuzo at google.com>
 
         Reviewed by Antti Koivisto.
diff --git a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
index e13808d..ed53b0a 100644
--- a/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
@@ -194,7 +194,7 @@ extern "C" {
     // compatible with this behavior.    
     BOOL shouldClipOutPlugin = _pluginLayer && [self shouldClipOutPlugin];
     if (!shouldClipOutPlugin)
-        visibleRectInWindow = [self convertRect:[self visibleRect] toView:windowContentView];
+        visibleRectInWindow = [self actualVisibleRectInWindow];
     else
         visibleRectInWindow = NSZeroRect;
     
diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginView.h b/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
index 0f39730..448b750 100644
--- a/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
+++ b/WebKit/mac/Plugins/WebBaseNetscapePluginView.h
@@ -142,6 +142,8 @@ class WebHaltablePlugin;
 
 - (void)invalidatePluginContentRect:(NSRect)rect;
 
+- (NSRect)actualVisibleRectInWindow; // takes transforms into account.
+
 #ifndef BUILDING_ON_TIGER
 - (CALayer *)pluginLayer;
 #endif
diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
index 7f73443..59a80c9 100644
--- a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
@@ -963,6 +963,21 @@ String WebHaltablePlugin::pluginName() const
     }
 }
 
+- (NSRect)actualVisibleRectInWindow
+{
+    RenderObject* renderer = _element->renderer();
+    if (!renderer || !renderer->view())
+        return NSZeroRect;
+
+    FrameView* frameView = renderer->view()->frameView();
+    if (!frameView)
+        return NSZeroRect;
+
+    IntRect widgetRect = renderer->absoluteClippedOverflowRect();
+    widgetRect = frameView->contentsToWindow(widgetRect);
+    return intersection(toRenderWidget(renderer)->windowClipRect(), widgetRect);
+}
+
 #ifndef BUILDING_ON_TIGER
 - (CALayer *)pluginLayer
 {
diff --git a/WebKit/mac/Plugins/WebNetscapePluginView.mm b/WebKit/mac/Plugins/WebNetscapePluginView.mm
index b215c8d..f2abab7 100644
--- a/WebKit/mac/Plugins/WebNetscapePluginView.mm
+++ b/WebKit/mac/Plugins/WebNetscapePluginView.mm
@@ -281,7 +281,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
     // of 1. For non-1.0 scale factors this assumption is false.
     NSView *windowContentView = [[self window] contentView];
     NSRect boundsInWindow = [self convertRect:[self bounds] toView:windowContentView];
-    NSRect visibleRectInWindow = [self convertRect:[self visibleRect] toView:windowContentView];
+    NSRect visibleRectInWindow = [self actualVisibleRectInWindow];
     
     // Flip Y to convert -[NSWindow contentView] coordinates to top-left-based window coordinates.
     float borderViewHeight = [[self currentWindow] frame].size.height;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list