Make sure that calls to [NSView visibleRect] will do the right thing for both
Netscape plugins and WebKit plugins.
Reviewed by olliej
* Plugins/WebBaseNetscapePluginView.mm:
(-[WebBaseNetscapePluginView visibleRect]):
(-[WebBaseNetscapePluginView saveAndSetNewPortStateForUpdate:]):
(-[WebBaseNetscapePluginView isOpaque]):
* Plugins/WebKitPluginContainerView.h: Added.
* Plugins/WebKitPluginContainerView.mm: Added.
(-[WebKitPluginContainerView initWithFrame:DOMElement:]):
(-[WebKitPluginContainerView dealloc]):
(-[WebKitPluginContainerView visibleRect]):
* Plugins/WebPluginController.mm:
(-[WebPluginController destroyAllPlugins]):
* WebCoreSupport/WebFrameBridge.mm:
(-[WebFrameBridge pluginViewWithPackage:attributeNames:attributeValues:baseURL:DOMElement:loadManually:]):
* WebKit.xcodeproj/project.pbxproj:
* WebView/WebHTMLView.mm:
(-[WebHTMLView addSubview:]):
(-[WebHTMLView willRemoveSubview:]):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@22019
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-06-06 David Hyatt <hyatt@apple.com>
+
+ Fix for bug 13972, quicktime doesn't respect CSS clip and overflow properties.
+ Make sure that calls to [NSView visibleRect] will do the right thing for both
+ Netscape plugins and WebKit plugins.
+
+ Reviewed by olliej
+
+ * Plugins/WebBaseNetscapePluginView.mm:
+ (-[WebBaseNetscapePluginView visibleRect]):
+ (-[WebBaseNetscapePluginView saveAndSetNewPortStateForUpdate:]):
+ (-[WebBaseNetscapePluginView isOpaque]):
+ * Plugins/WebKitPluginContainerView.h: Added.
+ * Plugins/WebKitPluginContainerView.mm: Added.
+ (-[WebKitPluginContainerView initWithFrame:DOMElement:]):
+ (-[WebKitPluginContainerView dealloc]):
+ (-[WebKitPluginContainerView visibleRect]):
+ * Plugins/WebPluginController.mm:
+ (-[WebPluginController destroyAllPlugins]):
+ * WebCoreSupport/WebFrameBridge.mm:
+ (-[WebFrameBridge pluginViewWithPackage:attributeNames:attributeValues:baseURL:DOMElement:loadManually:]):
+ * WebKit.xcodeproj/project.pbxproj:
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView addSubview:]):
+ (-[WebHTMLView willRemoveSubview:]):
+
2007-06-04 Oliver Hunt <oliver@apple.com>
Reviewed by Geoff and Justin.
npr.right = static_cast<uint16>(NSMaxX(nr));
}
+- (NSRect)visibleRect
+{
+ // WebCore may impose an additional clip (via CSS overflow or clip properties). Fetch
+ // that clip now.
+ return NSIntersectionRect([self convertRect:[element _windowClipRect] fromView:nil], [super visibleRect]);
+}
+
- (PortState)saveAndSetNewPortStateForUpdate:(BOOL)forUpdate
{
ASSERT([self currentWindow] != nil);
NSRect boundsInWindow = [self convertRect:[self bounds] toView:nil];
NSRect visibleRectInWindow = [self convertRect:[self visibleRect] toView:nil];
- // WebCore may impose an additional clip (via CSS overflow or clip properties). Fetch
- // that clip now.
- NSRect windowClipRect = [element _windowClipRect];
- visibleRectInWindow = NSIntersectionRect(visibleRectInWindow, windowClipRect);
-
// Flip Y to convert NSWindow coordinates to top-left-based window coordinates.
float borderViewHeight = [[self currentWindow] frame].size.height;
boundsInWindow.origin.y = borderViewHeight - NSMaxY(boundsInWindow);
(float)invalidRect->right - invalidRect->left, (float)invalidRect->bottom - invalidRect->top)];
}
+-(bool)isOpaque
+{
+ return YES;
+}
+
- (void)invalidateRegion:(NPRegion)invalidRegion
{
LOG(Plugins, "NPN_InvalidateRegion");
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Cocoa/Cocoa.h>
+
+@class DOMElement;
+
+@interface WebKitPluginContainerView : NSView
+{
+ DOMElement *_element;
+}
+
+- (id)initWithFrame:(NSRect)r
+ DOMElement:(DOMElement *)anElement;
+
+@end
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WebKitPluginContainerView.h"
+#import <WebKit/DOMPrivate.h>
+
+@implementation WebKitPluginContainerView
+
+- (id)initWithFrame:(NSRect)frame
+ DOMElement:(DOMElement *)anElement
+{
+ [super initWithFrame:frame];
+
+ _element = [anElement retain];
+
+ return self;
+}
+
+- (void)dealloc
+{
+ [_element release];
+ [super dealloc];
+}
+
+- (NSRect)visibleRect
+{
+ // WebCore may impose an additional clip (via CSS overflow or clip properties). Fetch
+ // that clip now.
+ return NSIntersectionRect([self convertRect:[_element _windowClipRect] fromView:nil], [super visibleRect]);
+}
+
+@end
+
[aView pluginDestroy];
}
[pluginViews removeObject:aView];
+
+ // Remove the containing view.
+ [[aView superview] removeFromSuperviewWithoutNeedingDisplay];
}
- [_views makeObjectsPerformSelector:@selector(removeFromSuperviewWithoutNeedingDisplay)];
+
[_views release];
_views = nil;
#import "WebKitErrorsPrivate.h"
#import "WebKitLogging.h"
#import "WebKitNSStringExtras.h"
+#import "WebKitPluginContainerView.h"
#import "WebKitStatisticsPrivate.h"
#import "WebKitSystemBits.h"
#import "WebLocalizableStrings.h"
}
view = [WebPluginController plugInViewWithArguments:arguments fromPluginPackage:pluginPackage];
-
+ [view setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
+
[attributes release];
- return view;
+
+ WebKitPluginContainerView* containerView = [[[WebKitPluginContainerView alloc] initWithFrame:NSZeroRect DOMElement:element] autorelease];
+ [view setFrame:NSZeroRect];
+ [containerView setAutoresizesSubviews:YES];
+ [containerView addSubview:view];
+
+ return containerView;
}
- (NSString *)valueForKey:(NSString *)key keys:(NSArray *)keys values:(NSArray *)values
A7D3C5BC0B5773C5002CA450 /* WebPasteboardHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D3C5BA0B5773C5002CA450 /* WebPasteboardHelper.h */; };
A7D3C5BD0B5773C5002CA450 /* WebPasteboardHelper.mm in Sources */ = {isa = PBXBuildFile; fileRef = A7D3C5BB0B5773C5002CA450 /* WebPasteboardHelper.mm */; };
ABDDF20D08EB0DDC001E1241 /* WebDownloadInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = ABDDF20C08EB0DDC001E1241 /* WebDownloadInternal.h */; };
+ BCDFA8F90C10B6F500D3A10C /* WebKitPluginContainerView.h in Headers */ = {isa = PBXBuildFile; fileRef = BCDFA8F80C10B6F500D3A10C /* WebKitPluginContainerView.h */; };
+ BCDFA9130C10B93E00D3A10C /* WebKitPluginContainerView.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCDFA9120C10B93E00D3A10C /* WebKitPluginContainerView.mm */; };
DD7CDEE70A23BA9E00069928 /* WebTypesInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = DD7CDEE60A23BA9E00069928 /* WebTypesInternal.h */; };
DD89682009AA87240097E7F0 /* WebElementDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = DD89681E09AA87240097E7F0 /* WebElementDictionary.h */; };
DD89682109AA87240097E7F0 /* WebElementDictionary.mm in Sources */ = {isa = PBXBuildFile; fileRef = DD89681F09AA87240097E7F0 /* WebElementDictionary.mm */; };
A7D3C5BA0B5773C5002CA450 /* WebPasteboardHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPasteboardHelper.h; sourceTree = "<group>"; };
A7D3C5BB0B5773C5002CA450 /* WebPasteboardHelper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPasteboardHelper.mm; sourceTree = "<group>"; };
ABDDF20C08EB0DDC001E1241 /* WebDownloadInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDownloadInternal.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+ BCDFA8F80C10B6F500D3A10C /* WebKitPluginContainerView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebKitPluginContainerView.h; sourceTree = "<group>"; };
+ BCDFA9120C10B93E00D3A10C /* WebKitPluginContainerView.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebKitPluginContainerView.mm; sourceTree = "<group>"; };
BE4FBECB0653DF47005EDE15 /* WebEditingDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebEditingDelegate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
BE6DC39904C62C4E004D0EF6 /* WebNSURLExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebNSURLExtras.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
BE6DC39A04C62C4E004D0EF6 /* WebNSURLExtras.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebNSURLExtras.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F5A672B90263866E01000102 /* WebBaseNetscapePluginStream.h */,
F5A672BA0263866E01000102 /* WebBaseNetscapePluginStream.mm */,
F5EBC45502134BC301CA1520 /* WebBaseNetscapePluginView.h */,
+ BCDFA8F80C10B6F500D3A10C /* WebKitPluginContainerView.h */,
2203984A0922D765009C3FFC /* WebBaseNetscapePluginViewInternal.h */,
931A72D203265920008635CE /* WebBaseNetscapePluginViewPrivate.h */,
F5EBC45602134BC301CA1520 /* WebBaseNetscapePluginView.mm */,
+ BCDFA9120C10B93E00D3A10C /* WebKitPluginContainerView.mm */,
84D4BFF70348EF7600CA2ACA /* WebNetscapePluginEmbeddedView.h */,
84D4BFF80348EF7600CA2ACA /* WebNetscapePluginEmbeddedView.mm */,
F5F7171E0288493C018635CA /* WebNetscapePluginPackage.h */,
A7D3C5BC0B5773C5002CA450 /* WebPasteboardHelper.h in Headers */,
EDE983800BCDF5FE00FDAE28 /* WebNSArrayExtras.h in Headers */,
5DE92FEF0BD7017E0059A5FD /* WebAssertions.h in Headers */,
+ BCDFA8F90C10B6F500D3A10C /* WebKitPluginContainerView.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
A70936B00B5608DC00CDB48E /* WebDragClient.mm in Sources */,
A7D3C5BD0B5773C5002CA450 /* WebPasteboardHelper.mm in Sources */,
EDE983810BCDF5FE00FDAE28 /* WebNSArrayExtras.m in Sources */,
+ BCDFA9130C10B93E00D3A10C /* WebKitPluginContainerView.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
#import "WebHTMLViewInternal.h"
#import "WebKitLogging.h"
#import "WebKitNSStringExtras.h"
+#import "WebKitPluginContainerView.h"
#import "WebKitVersionChecks.h"
#import "WebLocalizableStrings.h"
#import "WebNSAttributedStringExtras.h"
{
[super addSubview:view];
- if ([WebPluginController isPlugInView:view]) {
- [[self _pluginController] addPlugin:view];
- }
+ if ([view isKindOfClass:[WebKitPluginContainerView class]])
+ [[self _pluginController] addPlugin:[[view subviews] objectAtIndex:0]];
}
- (void)willRemoveSubview:(NSView *)subview
{
- if ([WebPluginController isPlugInView:subview])
- [[self _pluginController] destroyPlugin:subview];
+ if ([subview isKindOfClass:[WebKitPluginContainerView class]])
+ [[self _pluginController] destroyPlugin:[[subview subviews] objectAtIndex:0]];
[super willRemoveSubview:subview];
}