Commit 7c332e91 authored by kdecker@apple.com's avatar kdecker@apple.com

Reviewed by Mark Rowe.

        https://bugs.webkit.org/show_bug.cgi?id=34661
        <rdar://problem/7614067> REGRESSION (Safari 4.0-> Safari 4.0.4): NPP_SetWindow no longer sets a clipRect of (0,0,0,0) when it becomes hidden
        
        * Plugins/Hosted/WebHostedNetscapePluginView.mm:
        (-[WebHostedNetscapePluginView updateAndSetWindow]): When clipping out NPDrawingModelCoreAnimation plug-ins, provide a zero'd out clipRect.
        * Plugins/WebBaseNetscapePluginView.h: Moved superviewsHaveSuperviews to the base class.
        * Plugins/WebBaseNetscapePluginView.mm:
        (-[WebBaseNetscapePluginView superviewsHaveSuperviews]): Added to the base class; extracted from WebNetscapePluginView.
        (-[WebBaseNetscapePluginView shouldClipOutPlugin]): Added new method with code extracted from WebNetscapePluginView.
        * Plugins/WebNetscapePluginView.mm:
        (-[WebNetscapePluginView saveAndSetNewPortStateForUpdate:]): When clipping out NPDrawingModelCoreAnimation plug-ins, provide a zero'd out clipRect.



git-svn-id: svn://svn.chromium.org/blink/trunk@54447 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 6ac6e802
2010-02-05 Kevin Decker <kdecker@apple.com>
Reviewed by Mark Rowe.
https://bugs.webkit.org/show_bug.cgi?id=34661
<rdar://problem/7614067> REGRESSION (Safari 4.0-> Safari 4.0.4): NPP_SetWindow no longer sets a clipRect of (0,0,0,0) when it becomes hidden
* Plugins/Hosted/WebHostedNetscapePluginView.mm:
(-[WebHostedNetscapePluginView updateAndSetWindow]): When clipping out NPDrawingModelCoreAnimation plug-ins, provide a zero'd out clipRect.
* Plugins/WebBaseNetscapePluginView.h: Moved superviewsHaveSuperviews to the base class.
* Plugins/WebBaseNetscapePluginView.mm:
(-[WebBaseNetscapePluginView superviewsHaveSuperviews]): Added to the base class; extracted from WebNetscapePluginView.
(-[WebBaseNetscapePluginView shouldClipOutPlugin]): Added new method with code extracted from WebNetscapePluginView.
* Plugins/WebNetscapePluginView.mm:
(-[WebNetscapePluginView saveAndSetNewPortStateForUpdate:]): When clipping out NPDrawingModelCoreAnimation plug-ins, provide a zero'd out clipRect.
2010-02-04 Mark Rowe <mrowe@apple.com> 2010-02-04 Mark Rowe <mrowe@apple.com>
Rubber-stamped by Dan Bernstein. Rubber-stamped by Dan Bernstein.
......
...@@ -161,12 +161,24 @@ extern "C" { ...@@ -161,12 +161,24 @@ extern "C" {
// Use AppKit to convert view coordinates to NSWindow coordinates. // Use AppKit to convert view coordinates to NSWindow coordinates.
NSRect boundsInWindow = [self convertRect:[self bounds] toView:nil]; NSRect boundsInWindow = [self convertRect:[self bounds] toView:nil];
NSRect visibleRectInWindow = [self convertRect:[self visibleRect] toView:nil]; NSRect visibleRectInWindow;
// Core Animation plug-ins need to be updated (with a 0,0,0,0 clipRect) when
// moved to a background tab. We don't do this for Core Graphics plug-ins as
// older versions of Flash have historical WebKit-specific code that isn't
// compatible with this behavior.
BOOL shouldClipOutPlugin = _pluginLayer && [self shouldClipOutPlugin];
if (!shouldClipOutPlugin)
visibleRectInWindow = [self convertRect:[self visibleRect] toView:nil];
else
visibleRectInWindow = NSZeroRect;
// Flip Y to convert NSWindow coordinates to top-left-based window coordinates. // Flip Y to convert NSWindow coordinates to top-left-based window coordinates.
float borderViewHeight = [[self currentWindow] frame].size.height; float borderViewHeight = [[self currentWindow] frame].size.height;
boundsInWindow.origin.y = borderViewHeight - NSMaxY(boundsInWindow); boundsInWindow.origin.y = borderViewHeight - NSMaxY(boundsInWindow);
visibleRectInWindow.origin.y = borderViewHeight - NSMaxY(visibleRectInWindow);
if (!shouldClipOutPlugin)
visibleRectInWindow.origin.y = borderViewHeight - NSMaxY(visibleRectInWindow);
BOOL sizeChanged = !NSEqualSizes(_previousSize, boundsInWindow.size); BOOL sizeChanged = !NSEqualSizes(_previousSize, boundsInWindow.size);
_previousSize = boundsInWindow.size; _previousSize = boundsInWindow.size;
......
...@@ -119,6 +119,7 @@ class WebHaltablePlugin; ...@@ -119,6 +119,7 @@ class WebHaltablePlugin;
- (void)addWindowObservers; - (void)addWindowObservers;
- (void)removeWindowObservers; - (void)removeWindowObservers;
- (BOOL)shouldClipOutPlugin;
- (BOOL)convertFromX:(double)sourceX andY:(double)sourceY space:(NPCoordinateSpace)sourceSpace - (BOOL)convertFromX:(double)sourceX andY:(double)sourceY space:(NPCoordinateSpace)sourceSpace
toX:(double *)destX andY:(double *)destY space:(NPCoordinateSpace)destSpace; toX:(double *)destX andY:(double *)destY space:(NPCoordinateSpace)destSpace;
......
...@@ -545,6 +545,22 @@ String WebHaltablePlugin::pluginName() const ...@@ -545,6 +545,22 @@ String WebHaltablePlugin::pluginName() const
return _isHalted; return _isHalted;
} }
- (BOOL)superviewsHaveSuperviews
{
NSView *contentView = [[self window] contentView];
for (NSView *view = self; view; view = [view superview]) {
if (view == contentView)
return YES;
}
return NO;
}
- (BOOL)shouldClipOutPlugin
{
NSWindow *window = [self window];
return !window || [window isMiniaturized] || [NSApp isHidden] || ![self superviewsHaveSuperviews] || [self isHiddenOrHasHiddenAncestor];
}
- (BOOL)hasBeenHalted - (BOOL)hasBeenHalted
{ {
return _hasBeenHalted; return _hasBeenHalted;
......
...@@ -197,19 +197,6 @@ typedef struct { ...@@ -197,19 +197,6 @@ typedef struct {
#pragma mark EVENTS #pragma mark EVENTS
- (BOOL)superviewsHaveSuperviews
{
NSView *contentView = [[self window] contentView];
NSView *view;
for (view = self; view != nil; view = [view superview]) {
if (view == contentView) {
return YES;
}
}
return NO;
}
// The WindowRef created by -[NSWindow windowRef] has a QuickDraw GrafPort that covers // The WindowRef created by -[NSWindow windowRef] has a QuickDraw GrafPort that covers
// the entire window frame (or structure region to use the Carbon term) rather then just the window content. // the entire window frame (or structure region to use the Carbon term) rather then just the window content.
// We can remove this when <rdar://problem/4201099> is fixed. // We can remove this when <rdar://problem/4201099> is fixed.
...@@ -329,12 +316,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) ...@@ -329,12 +316,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
// 3) the window is miniaturized or the app is hidden // 3) the window is miniaturized or the app is hidden
// 4) we're inside of viewWillMoveToWindow: with a nil window. In this case, superviews may already have nil // 4) we're inside of viewWillMoveToWindow: with a nil window. In this case, superviews may already have nil
// superviews and nil windows and results from convertRect:toView: are incorrect. // superviews and nil windows and results from convertRect:toView: are incorrect.
NSWindow *realWindow = [self window]; if (window.width <= 0 || window.height <= 0 || window.x < -100000 || [self shouldClipOutPlugin]) {
if (window.width <= 0 || window.height <= 0 || window.x < -100000
|| realWindow == nil || [realWindow isMiniaturized]
|| [NSApp isHidden]
|| ![self superviewsHaveSuperviews]
|| [self isHiddenOrHasHiddenAncestor]) {
// The following code tries to give plug-ins the same size they will eventually have. // The following code tries to give plug-ins the same size they will eventually have.
// The specifiedWidth and specifiedHeight variables are used to predict the size that // The specifiedWidth and specifiedHeight variables are used to predict the size that
...@@ -351,6 +333,13 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) ...@@ -351,6 +333,13 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
window.clipRect.bottom = window.clipRect.top; window.clipRect.bottom = window.clipRect.top;
window.clipRect.left = window.clipRect.right; window.clipRect.left = window.clipRect.right;
// Core Animation plug-ins need to be updated (with a 0,0,0,0 clipRect) when
// moved to a background tab. We don't do this for Core Graphics plug-ins as
// older versions of Flash have historical WebKit-specific code that isn't
// compatible with this behavior.
if (drawingModel == NPDrawingModelCoreAnimation)
getNPRect(NSZeroRect, window.clipRect);
} else { } else {
getNPRect(visibleRectInWindow, window.clipRect); getNPRect(visibleRectInWindow, window.clipRect);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment