diff options
Diffstat (limited to 'WebKit/mac')
35 files changed, 951 insertions, 35 deletions
diff --git a/WebKit/mac/Carbon/CarbonWindowAdapter.mm b/WebKit/mac/Carbon/CarbonWindowAdapter.mm index c57bc37..9747350 100644 --- a/WebKit/mac/Carbon/CarbonWindowAdapter.mm +++ b/WebKit/mac/Carbon/CarbonWindowAdapter.mm @@ -81,7 +81,7 @@ #import "WebTypesInternal.h" @interface NSWindow(HIWebFrameView) -- _initContent:(const NSRect *)contentRect styleMask:(unsigned int)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag contentView:aView; +- (id)_initContent:(const NSRect *)contentRect styleMask:(unsigned int)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag contentView:aView; - (void)_oldPlaceWindow:(NSRect)frameRect; - (void)_windowMovedToRect:(NSRect)actualFrame; - (void)_setWindowNumber:(NSInteger)nativeWindow; @@ -517,7 +517,7 @@ static OSStatus NSCarbonWindowHandleEvent(EventHandlerCallRef inEventHandlerCall // Do the right thing for a Carbon window. -- _destroyRealWindow:(BOOL)orderingOut { +- (id)_destroyRealWindow:(BOOL)orderingOut { // Complain, because this should never be called. We don't support one-shot NSCarbonWindows. NSLog(@"-[NSCarbonWindow _destroyRealWindow:] is not implemented."); @@ -804,7 +804,7 @@ static OSStatus NSCarbonWindowHandleEvent(EventHandlerCallRef inEventHandlerCall return; } -- _clearModalWindowLevel { +- (id)_clearModalWindowLevel { return nil; } diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog index eaed21b..95c460b 100644 --- a/WebKit/mac/ChangeLog +++ b/WebKit/mac/ChangeLog @@ -1,3 +1,313 @@ +2010-07-21 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Anders Carlsson. + + Composited layers don't scroll in WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42771 + + Prep work: FrameView::scrollPositionChanged() sounds like a generic "did scroll" bottleneck, + but this is deceiving. It's only every called on one platform (Mac) when the NSScrollView gets + scrolled, so rename it to FrameView::scrollPositionChangedViaPlatformWidget(). + + * WebView/WebHTMLView.mm: + (-[WebHTMLView _frameOrBoundsChanged]): + +2010-07-21 Eric Carlson <eric.carlson@apple.com> + + Reviewed by Simon Fraser. + + Update plug-in proxy backed <video> and <audio> elements. + https://bugs.webkit.org/show_bug.cgi?id=42770 + <rdar://problem/7963467> + + * Plugins/WebPluginController.h: + * Plugins/WebPluginController.mm: + (-[WebPluginController dealloc]): Release _viewsNotInDocument. + (-[WebPluginController stopAllPlugins]): Stop plug-ins not in the document. + (-[WebPluginController pluginViewCreated:]): New, add a View (plug-in) to _viewsNotInDocument. + (+[WebPluginController pluginViewHidden:]): New, remove the view (plug-in) from pluginViews. + (-[WebPluginController addPlugin:]): Remove the new plug-in from _viewsNotInDocument. + + * WebCoreSupport/WebFrameLoaderClient.h: + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::createPlugin): Remove PLUGIN_PROXY_FOR_VIDEO code, the media + player proxy plug-in should never be allocated by this method. + (WebFrameLoaderClient::createMediaPlayerProxyPlugin): New, allocate a media player proxy. + + * WebView/WebView.mm: + (-[WebView _videoProxyPluginForMIMEType:]): New. Identical to _pluginForMIMEType except it doesn't + consider the arePlugInsEnabled preference. + * WebView/WebViewInternal.h: + + +2010-07-19 Chris Marrin <cmarrin@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=42118 + Disable WebGL on Leopard for now. + + LayoutTests fail on some graphics hardware on Leopard because one of the features we use, + GL_ARB_framebuffer_object, is not universally available in Leopard like it is in + SnowLeopard. This will allow LayoutTests to pass on Leopard until we add logic to use a + software OpenGL driver on machines without this support. + + * Configurations/FeatureDefines.xcconfig: + +2010-07-18 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Move PluginWidget to WebKit + https://bugs.webkit.org/show_bug.cgi?id=42530 + + * Plugins/WebBaseNetscapePluginView.h: + * Plugins/WebBaseNetscapePluginView.mm: + (-[WebBaseNetscapePluginView pluginLayer]): + Add default pluginLayer implementation. + + * WebCoreSupport/WebFrameLoaderClient.mm: + (PluginWidget::PluginWidget): + (PluginWidget::invalidateRect): + Move the guts of PluginWidget here from WebCore. + + (NetscapePluginWidget::platformLayer): + Get the layer from the plug-in view. + +2010-07-18 David Kilzer <ddkilzer@apple.com> + + <http://webkit.org/b/42522> Add missing (id) return type to Obj-C methods + + Reviewed by Dan Bernstein. + + * Carbon/CarbonWindowAdapter.mm: + (-[NSWindow(HIWebFrameView) _initContent:styleMask:backing:defer:contentView:]): + (-[CarbonWindowAdapter _destroyRealWindow:]): + (-[CarbonWindowAdapter _clearModalWindowLevel]): + * Misc/WebIconDatabase.mm: + (-[WebIconDatabase init]): + * Misc/WebNSPasteboardExtras.mm: + (-[NSFilePromiseDragSource initWithSource:]): + * WebView/WebHTMLRepresentation.mm: + (-[WebHTMLRepresentation init]): + * WebView/WebPreferences.mm: + (-[WebPreferences init]): + * WebView/WebView.mm: + (-[WebView UIDelegate]): + (-[WebView resourceLoadDelegate]): + (-[WebView downloadDelegate]): + (-[WebView policyDelegate]): + (-[WebView frameLoadDelegate]): + +2010-07-16 Zhe Su <suzhe@chromium.org> + + Reviewed by Darin Adler. + + REGRESSION(r61484): Broke focus behaviour on Qt and probably other platforms + https://bugs.webkit.org/show_bug.cgi?id=42253 + + Dummy implementation of EditorClient::willSetInputMethodState. + + * WebCoreSupport/WebEditorClient.h: + * WebCoreSupport/WebEditorClient.mm: + (WebEditorClient::willSetInputMethodState): + +2010-07-16 Dan Bernstein <mitz@apple.com> + + Reviewed by Sam Weinig. + + Part of <rdar://problem/7233974> Deprecate +[WebView _setShouldUseFontSmoothing:] + https://bugs.webkit.org/show_bug.cgi?id=29355 + + * Misc/WebKitNSStringExtras.h: + * Misc/WebKitNSStringExtras.mm: + (-[NSString _web_drawAtPoint:font:textColor:]): Now calls through to + -_web_drawAtPoint:font:textColor:allowingFontSmoothing: passing YES for the last + parameter. + (-[NSString _web_drawAtPoint:font:textColor:allowingFontSmoothing:]): Added + allowingFontSmoothing:. If font smoothing is not allowed, sets the font smoothing + mode to antialiased. Otherwise, sets it to auto. + (-[NSString _web_drawDoubledAtPoint:withTopColor:bottomColor:font:]): Instead of + changing the font smoothing setting in the graphics context, call + -_web_drawAtPoint:font:textColor:allowingFontSmoothing: passing NO for the last + parameter. + +2010-07-16 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Remove semicolons from Objective-C method declarations. + + * WebView/WebRenderLayer.mm: + (+[WebRenderLayer nameForLayer:]): + (+[WebRenderLayer compositingInfoForLayer:]): + +2010-07-16 Mikhail Naganov <mnaganov@chromium.org> + + Reviewed by Pavel Feldman. + + Make JS memory stats available via 'Performance' object (Web Timing). + This statistics is populated only if 'WebKitMemoryInfoEnabled' + preference is set. + + 'console.memory' is kept until Web Timing object becomes visible by + default (currently it is hidden under compile-time flag). These stats + are guarded with the same preference. + + https://bugs.webkit.org/show_bug.cgi?id=41617 + + * WebKit.order: + * WebView/WebPreferenceKeysPrivate.h: + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): + (-[WebPreferences memoryInfoEnabled]): + (-[WebPreferences setMemoryInfoEnabled:]): + * WebView/WebPreferencesPrivate.h: + * WebView/WebView.mm: + (-[WebView _preferencesChangedNotification:]): + +2010-07-15 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Darin Adler. + + Printing test results differ between machines, we should use ImageDiff instead + https://bugs.webkit.org/show_bug.cgi?id=20011 + + * Misc/WebCoreStatistics.h: + * Misc/WebCoreStatistics.mm: + (-[WebFrame printToCGContext:cgContext:pageWidthInPixels:]): + +2010-07-15 Daniel Bates <dbates@rim.com> + + Reviewed by Darin Adler. + + [Mac] Implement LayoutTestController::markerTextForListItem() + https://bugs.webkit.org/show_bug.cgi?id=37929 + + Implements support for markerTextForListItem in the Mac port. + + * DOM/WebDOMOperations.mm: + (+[DOMElement _DOMElementFromJSContext]): Added. + (-[DOMElement _markerTextForListItem]): Added. + * DOM/WebDOMOperationsPrivate.h: + +2010-07-14 Simon Fraser <simon.fraser@apple.com> + + Fix non-ACCELERATED_COMPOSITING build. + + * WebView/WebRenderLayer.mm: + (+[WebRenderLayer compositingInfoForLayer:]): + +2010-07-14 Simon Fraser <simon.fraser@apple.com> + + Reviewed by John Sullivan. + + <rdar://problem/8186963> Expose information about compositing layers. + + Use RenderLayerBacking::compositingLayerType() to add more information about compositing to + WebRenderLayer, via a compositingInfo property. Also show element classnames. + + Also add separator items between the various z-order lists. + + * WebView/WebRenderLayer.h: + * WebView/WebRenderLayer.mm: + (+[WebRenderLayer nameForLayer:]): + (+[WebRenderLayer compositingInfoForLayer:]): + (-[WebRenderLayer initWithRenderLayer:]): + (-[WebRenderLayer initWithName:]): + (-[WebRenderLayer initWithWebFrame:]): + (-[WebRenderLayer dealloc]): + (-[WebRenderLayer buildDescendantLayers:]): + (-[WebRenderLayer compositingInfo]): + (-[WebRenderLayer isComposited]): + (-[WebRenderLayer isSeparator]): + +2010-07-14 Darin Adler <darin@apple.com> + + Another try at fixing the Tiger build. + + Avoid non-ASCII in source files to keep Tiger compiler happy. + + * WebView/WebRenderLayer.mm: + (+[WebRenderLayer nameForLayer:]): Use %C for the non-ASCII characters. + +2010-07-14 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=42232 + Make changing Cursors work in WebKit2. + + * WebCoreSupport/WebChromeClient.h: + * WebCoreSupport/WebChromeClient.mm: + (WebChromeClient::setCursor): + * WebView/WebView.mm: + Implement cursor changing at the WebKit level for the sake of WebKit2. + This functionality is being moved from WidgetMac.mm. + (+[WebView _pointingHandCursor]): + Update to use platformCursor() instead of impl(). + +2010-07-13 Simon Fraser <simon.fraser@apple.com> + + Fix Tiger build. + + Avoid non-ASCII in souce files to keep Tiger compiler happy. + + * WebView/WebRenderLayer.mm: + (+[WebRenderLayer nameForLayer:]): + +2010-07-13 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + <rdar://problem/8186963> Expose RenderLayer hierarchy via Obj-C for debugging. + + Add a WebRenderLayer class that reflects the RenderLayer tree into a hierarchy + of Objective-C objects suitable for display in an outline view. + + * WebKit.exp: Export the WebRenderLayer Objective-C class. + * WebView/WebRenderLayer.h: Added. + * WebView/WebRenderLayer.mm: Added. + +2010-07-07 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> + + Reviewed by Darin Adler. + + Prevent assertion/duplicate loads for non-deferred subtitute-data loads + + https://bugs.webkit.org/show_bug.cgi?id=30879 + + MainResourceLoader uses the member m_initialRequest to store requests for future + deferred loads. When doing the actual load in handleDataLoadNow(), we therefore + have to clear this request so that subsequent entries into the loader will not + start yet another load. + + This can happen as a result of a PageGroupLoadDeferrer going out of scope when + returning from Chrome::runJavaScriptAlert(), which calls setDeferredLoading(false), + but only in the case of using both substitute-data and non-deferred main resource + load together. That's why two new DRT functions were added: + + * queueLoadHTMLString() + * setDeferMainResourceLoad() + + The change adds DRT hooks for Mac, Win and Qt for these two functions. For Mac + and Win the hook uses new SPI in WebDataSource. For Qt a new static member was + added to the FrameLoaderClientQt and accessed though DumpRenderTreeSupportQt. + + * WebView/WebDataSource.mm: + (-[WebDataSource _setDeferMainResourceDataLoad:]): + * WebView/WebDataSourcePrivate.h: + +2010-07-13 Philippe Normand <pnormand@igalia.com> + + Rubber-stamped by Xan Lopez. + + Updated the copyright headers of the files modified in r62476. + + * WebView/WebView.mm: + * WebView/WebViewData.h: + * WebView/WebViewInternal.h: + 2010-07-09 Alexey Proskuryakov <ap@apple.com> Reviewed by Darin Adler. diff --git a/WebKit/mac/Configurations/FeatureDefines.xcconfig b/WebKit/mac/Configurations/FeatureDefines.xcconfig index 9a3ec0b..4b363aa 100644 --- a/WebKit/mac/Configurations/FeatureDefines.xcconfig +++ b/WebKit/mac/Configurations/FeatureDefines.xcconfig @@ -34,7 +34,6 @@ ENABLE_LINK_PREFETCH = ; ENABLE_3D_CANVAS = $(ENABLE_3D_CANVAS_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -ENABLE_3D_CANVAS_1050 = ENABLE_3D_CANVAS; ENABLE_3D_CANVAS_1060 = ENABLE_3D_CANVAS; ENABLE_3D_CANVAS_1070 = ENABLE_3D_CANVAS; diff --git a/WebKit/mac/DOM/WebDOMOperations.mm b/WebKit/mac/DOM/WebDOMOperations.mm index 194a000..d21f2b0 100644 --- a/WebKit/mac/DOM/WebDOMOperations.mm +++ b/WebKit/mac/DOM/WebDOMOperations.mm @@ -29,6 +29,7 @@ #import "WebDOMOperationsPrivate.h" #import "DOMDocumentInternal.h" +#import "DOMElementInternal.h" #import "DOMNodeInternal.h" #import "DOMRangeInternal.h" #import "WebArchiveInternal.h" @@ -36,15 +37,42 @@ #import "WebFrameInternal.h" #import "WebFramePrivate.h" #import "WebKitNSStringExtras.h" +#import <JavaScriptCore/APICast.h> #import <WebCore/CSSHelper.h> #import <WebCore/Document.h> +#import <WebCore/JSElement.h> #import <WebCore/LegacyWebArchive.h> #import <WebCore/markup.h> +#import <WebCore/RenderTreeAsText.h> #import <WebKit/DOMExtensions.h> #import <WebKit/DOMHTML.h> +#import <runtime/JSLock.h> +#import <runtime/JSValue.h> #import <wtf/Assertions.h> using namespace WebCore; +using namespace JSC; + +@implementation DOMElement (WebDOMElementOperationsPrivate) + ++ (DOMElement *)_DOMElementFromJSContext:(JSContextRef)context value:(JSValueRef)value +{ + if (!context) + return 0; + + if (!value) + return 0; + + JSLock lock(SilenceAssertionsOnly); + return kit(toElement(toJS(toJS(context), value))); +} + +- (NSString *)_markerTextForListItem +{ + return WebCore::markerTextForListItem(core(self)); +} + +@end @implementation DOMNode (WebDOMNodeOperations) diff --git a/WebKit/mac/DOM/WebDOMOperationsPrivate.h b/WebKit/mac/DOM/WebDOMOperationsPrivate.h index 826aa7d..1c22e82 100644 --- a/WebKit/mac/DOM/WebDOMOperationsPrivate.h +++ b/WebKit/mac/DOM/WebDOMOperationsPrivate.h @@ -27,6 +27,12 @@ */ #import <WebKit/WebDOMOperations.h> +#import <JavaScriptCore/JSBase.h> + +@interface DOMElement (WebDOMElementOperationsPrivate) ++ (DOMElement *)_DOMElementFromJSContext:(JSContextRef)context value:(JSValueRef)value; +- (NSString *)_markerTextForListItem; +@end @interface DOMDocument (WebDOMDocumentOperationsPrivate) - (NSArray *)_focusableNodes; diff --git a/WebKit/mac/Misc/WebCoreStatistics.h b/WebKit/mac/Misc/WebCoreStatistics.h index 33e3e0f..1565c26 100644 --- a/WebKit/mac/Misc/WebCoreStatistics.h +++ b/WebKit/mac/Misc/WebCoreStatistics.h @@ -90,4 +90,5 @@ - (NSString *)pageProperty:(const char*)propertyName:(int)pageNumber; - (bool)isPageBoxVisible:(int)pageNumber; - (NSString *)pageSizeAndMarginsInPixels:(int)pageNumber:(int)width:(int)height:(int)marginTop:(int)marginRight:(int)marginBottom:(int)marginLeft; +- (void)printToCGContext:(CGContextRef)cgContext:(float)pageWidthInPixels:(float)pageHeightInPixels; @end diff --git a/WebKit/mac/Misc/WebCoreStatistics.mm b/WebKit/mac/Misc/WebCoreStatistics.mm index bbe07d5..a5d5ae1 100644 --- a/WebKit/mac/Misc/WebCoreStatistics.mm +++ b/WebKit/mac/Misc/WebCoreStatistics.mm @@ -37,6 +37,7 @@ #import <WebCore/Frame.h> #import <WebCore/GCController.h> #import <WebCore/GlyphPageTreeNode.h> +#import <WebCore/GraphicsContext.h> #import <WebCore/IconDatabase.h> #import <WebCore/JSDOMWindow.h> #import <WebCore/PageCache.h> @@ -289,4 +290,15 @@ using namespace WebCore; { return PrintContext::pageSizeAndMarginsInPixels(_private->coreFrame, pageNumber, width, height, marginTop, marginRight, marginBottom, marginLeft); } + +- (void)printToCGContext:(CGContextRef)cgContext:(float)pageWidthInPixels:(float)pageHeightInPixels +{ + Frame* coreFrame = _private->coreFrame; + if (!coreFrame) + return; + + GraphicsContext graphicsContext(cgContext); + PrintContext::spoolAllPagesWithBoundaries(coreFrame, graphicsContext, FloatSize(pageWidthInPixels, pageHeightInPixels)); +} + @end diff --git a/WebKit/mac/Misc/WebIconDatabase.mm b/WebKit/mac/Misc/WebIconDatabase.mm index f53bffa..7d0a350 100644 --- a/WebKit/mac/Misc/WebIconDatabase.mm +++ b/WebKit/mac/Misc/WebIconDatabase.mm @@ -104,7 +104,7 @@ static WebIconDatabaseClient* defaultClient() return database; } -- init +- (id)init { [super init]; WebCoreThreadViolationCheckRoundOne(); diff --git a/WebKit/mac/Misc/WebKitNSStringExtras.h b/WebKit/mac/Misc/WebKitNSStringExtras.h index f252430..ddc49f0 100644 --- a/WebKit/mac/Misc/WebKitNSStringExtras.h +++ b/WebKit/mac/Misc/WebKitNSStringExtras.h @@ -32,6 +32,7 @@ extern NSString *WebKitLocalCacheDefaultsKey; @interface NSString (WebKitExtras) +- (void)_web_drawAtPoint:(NSPoint)point font:(NSFont *)font textColor:(NSColor *)textColor allowingFontSmoothing:(BOOL)fontSmoothingIsAllowed; - (void)_web_drawAtPoint:(NSPoint)point font:(NSFont *)font textColor:(NSColor *)textColor; - (void)_web_drawDoubledAtPoint:(NSPoint)textPoint withTopColor:(NSColor *)topColor bottomColor:(NSColor *)bottomColor font:(NSFont *)font; diff --git a/WebKit/mac/Misc/WebKitNSStringExtras.mm b/WebKit/mac/Misc/WebKitNSStringExtras.mm index da46630..8fc12bd 100644 --- a/WebKit/mac/Misc/WebKitNSStringExtras.mm +++ b/WebKit/mac/Misc/WebKitNSStringExtras.mm @@ -62,12 +62,16 @@ static BOOL canUseFastRenderer(const UniChar *buffer, unsigned length) - (void)_web_drawAtPoint:(NSPoint)point font:(NSFont *)font textColor:(NSColor *)textColor { - // FIXME: Would be more efficient to change this to C++ and use Vector<UChar, 2048>. + [self _web_drawAtPoint:point font:font textColor:textColor allowingFontSmoothing:YES]; +} + +- (void)_web_drawAtPoint:(NSPoint)point font:(NSFont *)font textColor:(NSColor *)textColor allowingFontSmoothing:(BOOL)fontSmoothingIsAllowed +{ unsigned length = [self length]; Vector<UniChar, 2048> buffer(length); [self getCharacters:buffer.data()]; - + if (canUseFastRenderer(buffer.data(), length)) { // The following is a half-assed attempt to match AppKit's rounding rules for drawAtPoint. // It's probably incorrect for high DPI. @@ -84,7 +88,7 @@ static BOOL canUseFastRenderer(const UniChar *buffer, unsigned length) if (!flipped) CGContextScaleCTM(cgContext, 1, -1); - Font webCoreFont(FontPlatformData(font), ![nsContext isDrawingToScreen]); + Font webCoreFont(FontPlatformData(font), ![nsContext isDrawingToScreen], fontSmoothingIsAllowed ? AutoSmoothing : Antialiased); TextRun run(buffer.data(), length); run.disableRoundingHacks(); @@ -116,17 +120,10 @@ static BOOL canUseFastRenderer(const UniChar *buffer, unsigned length) font:(NSFont *)font { // turn off font smoothing so translucent text draws correctly (Radar 3118455) - [NSGraphicsContext saveGraphicsState]; - CGContextSetShouldSmoothFonts(static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]), false); - [self _web_drawAtPoint:textPoint - font:font - textColor:bottomColor]; + [self _web_drawAtPoint:textPoint font:font textColor:bottomColor allowingFontSmoothing:NO]; textPoint.y += 1; - [self _web_drawAtPoint:textPoint - font:font - textColor:topColor]; - [NSGraphicsContext restoreGraphicsState]; + [self _web_drawAtPoint:textPoint font:font textColor:topColor allowingFontSmoothing:NO]; } - (float)_web_widthWithFont:(NSFont *)font diff --git a/WebKit/mac/Misc/WebNSPasteboardExtras.mm b/WebKit/mac/Misc/WebNSPasteboardExtras.mm index ab3baf7..7caa47a 100644 --- a/WebKit/mac/Misc/WebNSPasteboardExtras.mm +++ b/WebKit/mac/Misc/WebNSPasteboardExtras.mm @@ -48,7 +48,7 @@ #import <wtf/StdLibExtras.h> @interface NSFilePromiseDragSource : NSObject -- initWithSource:(id)draggingSource; +- (id)initWithSource:(id)draggingSource; - (void)setTypes:(NSArray *)types onPasteboard:(NSPasteboard *)pboard; @end diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginView.h b/WebKit/mac/Plugins/WebBaseNetscapePluginView.h index 81d801a..4c8ea84 100644 --- a/WebKit/mac/Plugins/WebBaseNetscapePluginView.h +++ b/WebKit/mac/Plugins/WebBaseNetscapePluginView.h @@ -140,6 +140,10 @@ class WebHaltablePlugin; - (void)invalidatePluginContentRect:(NSRect)rect; +#ifndef BUILDING_ON_TIGER +- (CALayer *)pluginLayer; +#endif + @end diff --git a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm index bcef2a1..6ae7334 100644 --- a/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm +++ b/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm @@ -948,6 +948,14 @@ String WebHaltablePlugin::pluginName() const } } +#ifndef BUILDING_ON_TIGER +- (CALayer *)pluginLayer +{ + ASSERT_NOT_REACHED(); + return nil; +} +#endif + @end namespace WebKit { diff --git a/WebKit/mac/Plugins/WebPluginController.h b/WebKit/mac/Plugins/WebPluginController.h index ffc07a4..dc1f413 100644 --- a/WebKit/mac/Plugins/WebPluginController.h +++ b/WebKit/mac/Plugins/WebPluginController.h @@ -42,6 +42,9 @@ NSMutableArray *_views; BOOL _started; NSMutableSet *_checksInProgress; +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) + NSMutableArray *_viewsNotInDocument; +#endif } + (NSView *)plugInViewWithArguments:(NSDictionary *)arguments fromPluginPackage:(WebPluginPackage *)plugin; @@ -53,6 +56,10 @@ - (void)addPlugin:(NSView *)view; - (void)destroyPlugin:(NSView *)view; +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) +- (void)pluginViewCreated:(NSView *)view; ++ (void)pluginViewHidden:(NSView *)view; +#endif - (void)startAllPlugins; - (void)stopAllPlugins; diff --git a/WebKit/mac/Plugins/WebPluginController.mm b/WebKit/mac/Plugins/WebPluginController.mm index 1c85862..9c037c2 100644 --- a/WebKit/mac/Plugins/WebPluginController.mm +++ b/WebKit/mac/Plugins/WebPluginController.mm @@ -138,6 +138,9 @@ static NSMutableSet *pluginViews = nil; { [_views release]; [_checksInProgress release]; +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) + [_viewsNotInDocument release]; +#endif [super dealloc]; } @@ -198,9 +201,30 @@ static NSMutableSet *pluginViews = nil; for (i = 0; i < count; i++) [self stopOnePlugin:[_views objectAtIndex:i]]; +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) + count = [_viewsNotInDocument count]; + for (i = 0; i < count; i++) + [self stopOnePlugin:[_viewsNotInDocument objectAtIndex:i]]; +#endif + _started = NO; } +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) +- (void)pluginViewCreated:(NSView *)view +{ + if (!_viewsNotInDocument) + _viewsNotInDocument= [[NSMutableArray alloc] init]; + if (![_viewsNotInDocument containsObject:view]) + [_viewsNotInDocument addObject:view]; +} + ++ (void)pluginViewHidden:(NSView *)view +{ + [pluginViews removeObject:view]; +} +#endif + - (void)addPlugin:(NSView *)view { if (!_documentView) { @@ -212,6 +236,11 @@ static NSMutableSet *pluginViews = nil; [_views addObject:view]; [[_documentView _webView] addPluginInstanceView:view]; +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) + if ([_viewsNotInDocument containsObject:view]) + [_viewsNotInDocument removeObject:view]; +#endif + BOOL oldDefersCallbacks = [[self webView] defersCallbacks]; if (!oldDefersCallbacks) [[self webView] setDefersCallbacks:YES]; @@ -251,7 +280,11 @@ static NSMutableSet *pluginViews = nil; - (void)destroyPlugin:(NSView *)view { +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) + if ([_views containsObject:view] || [_viewsNotInDocument containsObject:view]) { +#else if ([_views containsObject:view]) { +#endif if (_started) [self stopOnePlugin:view]; [self destroyOnePlugin:view]; @@ -264,6 +297,9 @@ static NSMutableSet *pluginViews = nil; [pluginViews removeObject:view]; [[_documentView _webView] removePluginInstanceView:view]; [_views removeObject:view]; +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) + [_viewsNotInDocument removeObject:view]; +#endif } } @@ -310,6 +346,13 @@ static void cancelOutstandingCheck(const void *item, void *context) [pluginViews removeObject:aView]; [[_documentView _webView] removePluginInstanceView:aView]; } + +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) + count = [_viewsNotInDocument count]; + for (i = 0; i < count; i++) + [self destroyOnePlugin:[_viewsNotInDocument objectAtIndex:i]]; +#endif + [_views makeObjectsPerformSelector:@selector(removeFromSuperviewWithoutNeedingDisplay)]; [_views release]; _views = nil; diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.h b/WebKit/mac/WebCoreSupport/WebChromeClient.h index ea59c4d..707d080 100644 --- a/WebKit/mac/WebCoreSupport/WebChromeClient.h +++ b/WebKit/mac/WebCoreSupport/WebChromeClient.h @@ -127,7 +127,7 @@ public: virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>); virtual void chooseIconForFiles(const Vector<WebCore::String>&, WebCore::FileChooser*); - virtual bool setCursor(WebCore::PlatformCursorHandle) { return false; } + virtual void setCursor(const WebCore::Cursor&); virtual WebCore::FloatRect customHighlightRect(WebCore::Node*, const WebCore::AtomicString& type, const WebCore::FloatRect& lineRect); diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.mm b/WebKit/mac/WebCoreSupport/WebChromeClient.mm index 3bf310a..eb56240 100644 --- a/WebKit/mac/WebCoreSupport/WebChromeClient.mm +++ b/WebKit/mac/WebCoreSupport/WebChromeClient.mm @@ -48,6 +48,7 @@ #import <Foundation/Foundation.h> #import <WebCore/BlockExceptions.h> #import <WebCore/Console.h> +#import <WebCore/Cursor.h> #import <WebCore/Element.h> #import <WebCore/FileChooser.h> #import <WebCore/FloatRect.h> @@ -659,6 +660,14 @@ void WebChromeClient::chooseIconForFiles(const Vector<String>& filenames, FileCh chooser->iconLoaded(Icon::createIconForFiles(filenames)); } +void WebChromeClient::setCursor(const WebCore::Cursor& cursor) +{ + NSCursor *platformCursor = cursor.platformCursor(); + if ([NSCursor currentCursor] == platformCursor) + return; + [platformCursor set]; +} + KeyboardUIMode WebChromeClient::keyboardUIMode() { BEGIN_BLOCK_OBJC_EXCEPTIONS; diff --git a/WebKit/mac/WebCoreSupport/WebEditorClient.h b/WebKit/mac/WebCoreSupport/WebEditorClient.h index d7dfdd7..1cb2a59 100644 --- a/WebKit/mac/WebCoreSupport/WebEditorClient.h +++ b/WebKit/mac/WebCoreSupport/WebEditorClient.h @@ -127,6 +127,7 @@ public: virtual void showSpellingUI(bool show); virtual bool spellingUIIsShowing(); virtual void getGuessesForWord(const WebCore::String&, WTF::Vector<WebCore::String>& guesses); + virtual void willSetInputMethodState(); virtual void setInputMethodState(bool enabled); private: void registerCommandForUndoOrRedo(PassRefPtr<WebCore::EditCommand>, bool isRedo); diff --git a/WebKit/mac/WebCoreSupport/WebEditorClient.mm b/WebKit/mac/WebCoreSupport/WebEditorClient.mm index ec9024a..d2f2706 100644 --- a/WebKit/mac/WebCoreSupport/WebEditorClient.mm +++ b/WebKit/mac/WebCoreSupport/WebEditorClient.mm @@ -818,6 +818,10 @@ void WebEditorClient::getGuessesForWord(const String& word, WTF::Vector<String>& } } +void WebEditorClient::willSetInputMethodState() +{ +} + void WebEditorClient::setInputMethodState(bool) { } diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h index 60b1fbf..d750a10 100644 --- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h +++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h @@ -201,6 +201,13 @@ private: virtual PassRefPtr<WebCore::Widget> createJavaAppletWidget(const WebCore::IntSize&, WebCore::HTMLAppletElement*, const WebCore::KURL& baseURL, const Vector<WebCore::String>& paramNames, const Vector<WebCore::String>& paramValues); +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) + virtual PassRefPtr<WebCore::Widget> createMediaPlayerProxyPlugin(const WebCore::IntSize&, WebCore::HTMLMediaElement*, const WebCore::KURL&, + const Vector<WebCore::String>&, const Vector<WebCore::String>&, const WebCore::String&); + virtual void hideMediaPlayerProxyPlugin(WebCore::Widget*); + virtual void showMediaPlayerProxyPlugin(WebCore::Widget*); +#endif + virtual WebCore::ObjectContentType objectContentType(const WebCore::KURL& url, const WebCore::String& mimeType); virtual WebCore::String overrideMediaType() const; diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm index d72f4ed..1021ad9 100644 --- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm +++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm @@ -93,6 +93,9 @@ #import <WebCore/HTMLFrameElement.h> #import <WebCore/HTMLFrameOwnerElement.h> #import <WebCore/HTMLHeadElement.h> +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) +#import <WebCore/HTMLMediaElement.h> +#endif #import <WebCore/HTMLNames.h> #import <WebCore/HTMLPlugInElement.h> #import <WebCore/HistoryItem.h> @@ -103,7 +106,7 @@ #import <WebCore/MouseEvent.h> #import <WebCore/Page.h> #import <WebCore/PlatformString.h> -#import <WebCore/PluginWidget.h> +#import <WebCore/PluginViewBase.h> #import <WebCore/ResourceError.h> #import <WebCore/ResourceHandle.h> #import <WebCore/ResourceLoader.h> @@ -1502,6 +1505,20 @@ static NSView *pluginView(WebFrame *frame, WebPluginPackage *pluginPackage, return view; } +class PluginWidget : public PluginViewBase { +public: + PluginWidget(NSView *view = 0) + : PluginViewBase(view) + { + } + +private: + virtual void invalidateRect(const IntRect& rect) + { + [platformWidget() setNeedsDisplayInRect:rect]; + } +}; + #if ENABLE(NETSCAPE_PLUGIN_API) class NetscapePluginWidget : public PluginWidget { @@ -1511,6 +1528,13 @@ public: { } +#if USE(ACCELERATED_COMPOSITING) + virtual PlatformLayer* platformLayer() const + { + return [(WebBaseNetscapePluginView *)platformWidget() pluginLayer]; + } +#endif + virtual void handleEvent(Event* event) { Frame* frame = Frame::frameForWidget(this); @@ -1583,12 +1607,6 @@ PassRefPtr<Widget> WebFrameLoaderClient::createPlugin(const IntSize& size, HTMLP } NSString *extension = [[pluginURL path] pathExtension]; -#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) - // don't allow proxy plug-in selection by file extension - if (element->hasTagName(videoTag) || element->hasTagName(audioTag)) - extension = @""; -#endif - if (!pluginPackage && [extension length] != 0) { pluginPackage = [webView _pluginForExtension:extension]; if (pluginPackage) { @@ -1743,6 +1761,83 @@ PassRefPtr<Widget> WebFrameLoaderClient::createJavaAppletWidget(const IntSize& s #endif // ENABLE(JAVA_BRIDGE) } +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) +PassRefPtr<Widget> WebFrameLoaderClient::createMediaPlayerProxyPlugin(const IntSize& size, HTMLMediaElement* element, const KURL& url, + const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType) +{ + BEGIN_BLOCK_OBJC_EXCEPTIONS; + + ASSERT(paramNames.size() == paramValues.size()); + ASSERT(mimeType); + + int errorCode = 0; + WebView *webView = getWebView(m_webFrame.get()); + NSURL *URL = url; + + SEL selector = @selector(webView:plugInViewWithArguments:); + + if ([[webView UIDelegate] respondsToSelector:selector]) { + NSMutableDictionary *attributes = [[NSMutableDictionary alloc] initWithObjects:kit(paramValues) forKeys:kit(paramNames)]; + NSDictionary *arguments = [[NSDictionary alloc] initWithObjectsAndKeys: + attributes, WebPlugInAttributesKey, + [NSNumber numberWithInt:WebPlugInModeEmbed], WebPlugInModeKey, + [NSNumber numberWithBool:YES], WebPlugInShouldLoadMainResourceKey, + kit(element), WebPlugInContainingElementKey, + URL, WebPlugInBaseURLKey, // URL might be nil, so add it last + nil]; + + NSView *view = CallUIDelegate(webView, selector, arguments); + + [attributes release]; + [arguments release]; + + if (view) + return adoptRef(new PluginWidget(view)); + } + + WebBasePluginPackage *pluginPackage = [webView _videoProxyPluginForMIMEType:mimeType]; + Document* document = core(m_webFrame.get())->document(); + NSURL *baseURL = document->baseURL(); + NSView *view = nil; + + if (pluginPackage) { + if ([pluginPackage isKindOfClass:[WebPluginPackage class]]) + view = pluginView(m_webFrame.get(), (WebPluginPackage *)pluginPackage, kit(paramNames), kit(paramValues), baseURL, kit(element), false); + } else + errorCode = WebKitErrorCannotFindPlugIn; + + if (!errorCode && !view) + errorCode = WebKitErrorCannotLoadPlugIn; + + if (errorCode) { + NSError *error = [[NSError alloc] _initWithPluginErrorCode:errorCode + contentURL:URL pluginPageURL:nil pluginName:[pluginPackage name] MIMEType:mimeType]; + WebNullPluginView *nullView = [[[WebNullPluginView alloc] initWithFrame:NSMakeRect(0, 0, size.width(), size.height()) + error:error DOMElement:kit(element)] autorelease]; + view = nullView; + [error release]; + } + + ASSERT(view); + return adoptRef(new PluginWidget(view)); + + END_BLOCK_OBJC_EXCEPTIONS; + + return 0; +} + +void WebFrameLoaderClient::hideMediaPlayerProxyPlugin(Widget* widget) +{ + [WebPluginController pluginViewHidden:widget->platformWidget()]; +} + +void WebFrameLoaderClient::showMediaPlayerProxyPlugin(Widget* widget) +{ + [WebPluginController addPlugInView:widget->platformWidget()]; +} + +#endif // ENABLE(PLUGIN_PROXY_FOR_VIDEO) + String WebFrameLoaderClient::overrideMediaType() const { NSString* overrideType = [getWebView(m_webFrame.get()) mediaStyle]; diff --git a/WebKit/mac/WebKit.exp b/WebKit/mac/WebKit.exp index b2ddb18..a22179f 100644 --- a/WebKit/mac/WebKit.exp +++ b/WebKit/mac/WebKit.exp @@ -25,6 +25,7 @@ .objc_class_name_WebPanelAuthenticationHandler .objc_class_name_WebPluginDatabase .objc_class_name_WebPreferences +.objc_class_name_WebRenderLayer .objc_class_name_WebRenderNode .objc_class_name_WebResource .objc_class_name_WebScriptCallFrame diff --git a/WebKit/mac/WebKit.order b/WebKit/mac/WebKit.order index 1776616..c2b5f5d 100644 --- a/WebKit/mac/WebKit.order +++ b/WebKit/mac/WebKit.order @@ -283,6 +283,7 @@ _WKAppVersionCheckLessThan -[WebPreferences(WebPrivate) showRepaintCounter] -[WebPreferences(WebPrivate) pluginAllowedRunTime] -[WebPreferences(WebPrivate) webGLEnabled] +-[WebPreferences(WebPrivate) memoryInfoEnabled] -[WebPreferences(WebPrivate) isFrameFlatteningEnabled] -[WebView setMaintainsBackForwardList:] -[WebView setUIDelegate:] @@ -1883,6 +1884,7 @@ __ZN24WebDatabaseTrackerClient25dispatchDidModifyDatabaseEPN7WebCore14SecurityOr -[WebPreferences setUsesPageCache:] -[WebPreferences(WebPrivate) setAcceleratedCompositingEnabled:] -[WebPreferences(WebPrivate) setWebGLEnabled:] +-[WebPreferences(WebPrivate) setMemoryInfoEnabled:] +[WebPluginDatabase setAdditionalWebPlugInPaths:] -[WebDefaultUIDelegate webView:didDrawRect:] -[WebView(WebPrivate) _setPostsAcceleratedCompositingNotifications:] diff --git a/WebKit/mac/WebView/WebDataSource.mm b/WebKit/mac/WebView/WebDataSource.mm index b16aaa8..02dbc2c 100644 --- a/WebKit/mac/WebView/WebDataSource.mm +++ b/WebKit/mac/WebView/WebDataSource.mm @@ -211,6 +211,16 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl #endif } +- (void)_setDeferMainResourceDataLoad:(BOOL)flag +{ + DocumentLoader* loader = [self _documentLoader]; + + if (!loader) + return; + + loader->setDeferMainResourceDataLoad(flag); +} + @end @implementation WebDataSource (WebInternal) diff --git a/WebKit/mac/WebView/WebDataSourcePrivate.h b/WebKit/mac/WebView/WebDataSourcePrivate.h index ae8d4cf..df9c61e 100644 --- a/WebKit/mac/WebView/WebDataSourcePrivate.h +++ b/WebKit/mac/WebView/WebDataSourcePrivate.h @@ -37,4 +37,6 @@ - (BOOL)_transferApplicationCache:(NSString*)destinationBundleIdentifier; +- (void)_setDeferMainResourceDataLoad:(BOOL)flag; + @end diff --git a/WebKit/mac/WebView/WebHTMLRepresentation.mm b/WebKit/mac/WebView/WebHTMLRepresentation.mm index c009f4a..7843c9a 100644 --- a/WebKit/mac/WebView/WebHTMLRepresentation.mm +++ b/WebKit/mac/WebView/WebHTMLRepresentation.mm @@ -113,7 +113,7 @@ static NSArray *concatenateArrays(NSArray *first, NSArray *second) return staticSupportedImageMIMETypes.get(); } -- init +- (id)init { self = [super init]; if (!self) diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm index e40500c..08c8911 100644 --- a/WebKit/mac/WebView/WebHTMLView.mm +++ b/WebKit/mac/WebView/WebHTMLView.mm @@ -1201,7 +1201,7 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info) #ifndef BUILDING_ON_TIGER _private->inScrollPositionChanged = YES; #endif - coreView->scrollPositionChanged(); + coreView->scrollPositionChangedViaPlatformWidget(); #ifndef BUILDING_ON_TIGER _private->inScrollPositionChanged = NO; #endif diff --git a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h index a28be49..4175a5d 100644 --- a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h +++ b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h @@ -97,6 +97,7 @@ #define WebKitHTML5TreeBuilderEnabledPreferenceKey @"WebKitHTML5TreeBuilderEnabled" // Temporary, do not use. #define WebKitPaginateDuringLayoutEnabledPreferenceKey @"WebKitPaginateDuringLayoutEnabled" #define WebKitDNSPrefetchingEnabledPreferenceKey @"WebKitDNSPrefetchingEnabled" +#define WebKitMemoryInfoEnabledPreferenceKey @"WebKitMemoryInfoEnabled" // These are private both because callers should be using the cover methods and because the // cover methods themselves are private. diff --git a/WebKit/mac/WebView/WebPreferences.mm b/WebKit/mac/WebView/WebPreferences.mm index a376458..63915dc 100644 --- a/WebKit/mac/WebView/WebPreferences.mm +++ b/WebKit/mac/WebView/WebPreferences.mm @@ -176,7 +176,7 @@ static WebCacheModel cacheModelForMainBundle(void) @implementation WebPreferences -- init +- (id)init { // Create fake identifier static int instanceCount = 1; @@ -363,6 +363,7 @@ static WebCacheModel cacheModelForMainBundle(void) [NSNumber numberWithBool:YES], WebKitHTML5ParserEnabledPreferenceKey, [NSNumber numberWithBool:NO], WebKitHTML5TreeBuilderEnabledPreferenceKey, [NSNumber numberWithBool:YES], WebKitDNSPrefetchingEnabledPreferenceKey, + [NSNumber numberWithBool:NO], WebKitMemoryInfoEnabledPreferenceKey, nil]; // This value shouldn't ever change, which is assumed in the initialization of WebKitPDFDisplayModePreferenceKey above @@ -1281,6 +1282,16 @@ static NSString *classIBCreatorID = nil; [self _setBoolValue:flag forKey:WebKitPaginateDuringLayoutEnabledPreferenceKey]; } +- (BOOL)memoryInfoEnabled +{ + return [self _boolValueForKey:WebKitMemoryInfoEnabledPreferenceKey]; +} + +- (void)setMemoryInfoEnabled:(BOOL)flag +{ + [self _setBoolValue:flag forKey:WebKitMemoryInfoEnabledPreferenceKey]; +} + - (WebKitEditingBehavior)editingBehavior { return static_cast<WebKitEditingBehavior>([self _integerValueForKey:WebKitEditingBehaviorPreferenceKey]); diff --git a/WebKit/mac/WebView/WebPreferencesPrivate.h b/WebKit/mac/WebView/WebPreferencesPrivate.h index e94943f..073b364 100644 --- a/WebKit/mac/WebView/WebPreferencesPrivate.h +++ b/WebKit/mac/WebView/WebPreferencesPrivate.h @@ -191,6 +191,9 @@ extern NSString *WebPreferencesRemovedNotification; - (BOOL)usesProxiedOpenPanel; - (void)setUsesProxiedOpenPanel:(BOOL)enabled; +- (BOOL)memoryInfoEnabled; +- (void)setMemoryInfoEnabled:(BOOL)enabled; + // Other private methods - (void)_postPreferencesChangesNotification; + (WebPreferences *)_getInstanceForIdentifier:(NSString *)identifier; diff --git a/WebKit/mac/WebView/WebRenderLayer.h b/WebKit/mac/WebView/WebRenderLayer.h new file mode 100644 index 0000000..e09983d --- /dev/null +++ b/WebKit/mac/WebView/WebRenderLayer.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 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. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 COMPUTER, INC. OR + * 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 <Foundation/Foundation.h> + +@class WebFrame; + +@interface WebRenderLayer : NSObject +{ + NSArray *children; + NSString *name; + NSString *compositingInfo; + NSRect bounds; + BOOL composited; + BOOL separator; +} + +- (id)initWithWebFrame:(WebFrame *)frame; + +- (NSArray *)children; + +- (NSString *)name; +- (NSString *)positionString; +- (NSString *)widthString; +- (NSString *)heightString; +- (NSString *)compositingInfo; + +- (BOOL)isComposited; +- (BOOL)isSeparator; + +@end diff --git a/WebKit/mac/WebView/WebRenderLayer.mm b/WebKit/mac/WebView/WebRenderLayer.mm new file mode 100644 index 0000000..edffac2 --- /dev/null +++ b/WebKit/mac/WebView/WebRenderLayer.mm @@ -0,0 +1,280 @@ +/* + * Copyright (C) 2010 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. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 COMPUTER, INC. OR + * 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 "WebRenderLayer.h" + +#import "WebFrameInternal.h" +#import <WebCore/Frame.h> +#import <WebCore/FrameLoaderClient.h> +#import <WebCore/PlatformString.h> +#import <WebCore/RenderLayer.h> +#import <WebCore/RenderLayerBacking.h> +#import <WebCore/RenderView.h> + +using namespace WebCore; + + +@interface WebRenderLayer(Private) + +- (id)initWithRenderLayer:(RenderLayer *)layer; +- (void)buildDescendantLayers:(RenderLayer*)rootLayer; + +@end + +@implementation WebRenderLayer + ++ (NSString *)nameForLayer:(RenderLayer*)layer +{ + RenderObject* renderer = layer->renderer(); + NSString *name = [NSString stringWithUTF8String:renderer->renderName()]; + + if (Node* node = renderer->node()) { + if (node->isElementNode()) + name = [name stringByAppendingFormat:@" %@", (NSString *)static_cast<Element*>(node)->tagName()]; + if (node->hasID()) + name = [name stringByAppendingFormat:@" id=\"%@\"", (NSString *)static_cast<Element*>(node)->getIdAttribute()]; + + if (node->hasClass()) { + StyledElement* styledElement = static_cast<StyledElement*>(node); + String classes; + for (size_t i = 0; i < styledElement->classNames().size(); ++i) { + if (i > 0) + classes += " "; + classes += styledElement->classNames()[i]; + } + name = [name stringByAppendingFormat:@" class=\"%@\"", (NSString *)classes]; + } + } + + if (layer->isReflection()) + name = [name stringByAppendingString:@" (reflection)"]; + + return name; +} + ++ (NSString *)compositingInfoForLayer:(RenderLayer*)layer +{ + if (!layer->isComposited()) + return @""; + + NSString *layerType = @""; +#if USE(ACCELERATED_COMPOSITING) + RenderLayerBacking* backing = layer->backing(); + switch (backing->compositingLayerType()) { + case NormalCompositingLayer: + layerType = @"composited"; + break; + case TiledCompositingLayer: + layerType = @"composited: tiled layer"; + break; + case MediaCompositingLayer: + layerType = @"composited for plug-in, video or WebGL"; + break; + case ContainerCompositingLayer: + layerType = @"composited: container layer"; + break; + } + + if (backing->hasClippingLayer()) + layerType = [layerType stringByAppendingString:@" (clipping)"]; + + if (backing->hasAncestorClippingLayer()) + layerType = [layerType stringByAppendingString:@" (clipped)"]; +#endif + + return layerType; +} + +- (id)initWithRenderLayer:(RenderLayer*)layer +{ + if ((self = [super init])) { + name = [[WebRenderLayer nameForLayer:layer] retain]; + bounds = layer->absoluteBoundingBox(); + composited = layer->isComposited(); + compositingInfo = [[WebRenderLayer compositingInfoForLayer:layer] retain]; + } + + return self; +} + +- (id)initWithName:(NSString*)layerName +{ + if ((self = [super init])) { + name = [layerName copy]; + separator = YES; + } + + return self; +} + +// Only called on the root. +- (id)initWithWebFrame:(WebFrame *)webFrame +{ + self = [super init]; + + Frame* frame = core(webFrame); + if (!frame->loader()->client()->hasHTMLView()) { + [self release]; + return nil; + } + + RenderObject* renderer = frame->contentRenderer(); + if (!renderer) { + [self release]; + return nil; + } + + if (renderer->hasLayer()) { + RenderLayer* layer = toRenderBoxModelObject(renderer)->layer(); + + name = [[WebRenderLayer nameForLayer:layer] retain]; + bounds = layer->absoluteBoundingBox(); + composited = layer->isComposited(); + compositingInfo = [[WebRenderLayer compositingInfoForLayer:layer] retain]; + + [self buildDescendantLayers:layer]; + } + + return self; +} + +- (void)dealloc +{ + [children release]; + [name release]; + [compositingInfo release]; + [super dealloc]; +} + +- (void)buildDescendantLayers:(RenderLayer*)layer +{ + NSMutableArray *childWebLayers = [[NSMutableArray alloc] init]; + + // Build children in back to front order. + + if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) { + size_t listSize = negZOrderList->size(); + + if (listSize) { + WebRenderLayer* newLayer = [[WebRenderLayer alloc] initWithName:@"-ve z-order list"]; + [childWebLayers addObject:newLayer]; + [newLayer release]; + } + + for (size_t i = 0; i < listSize; ++i) { + RenderLayer* curLayer = negZOrderList->at(i); + + WebRenderLayer* newLayer = [[WebRenderLayer alloc] initWithRenderLayer:curLayer]; + [newLayer buildDescendantLayers:curLayer]; + + [childWebLayers addObject:newLayer]; + [newLayer release]; + } + } + + if (Vector<RenderLayer*>* normalFlowList = layer->normalFlowList()) { + size_t listSize = normalFlowList->size(); + + if (listSize) { + WebRenderLayer* newLayer = [[WebRenderLayer alloc] initWithName:@"normal flow list"]; + [childWebLayers addObject:newLayer]; + [newLayer release]; + } + + for (size_t i = 0; i < listSize; ++i) { + RenderLayer* curLayer = normalFlowList->at(i); + + WebRenderLayer* newLayer = [[WebRenderLayer alloc] initWithRenderLayer:curLayer]; + [newLayer buildDescendantLayers:curLayer]; + + [childWebLayers addObject:newLayer]; + [newLayer release]; + } + } + + if (Vector<RenderLayer*>* posZOrderList = layer->posZOrderList()) { + size_t listSize = posZOrderList->size(); + + if (listSize) { + WebRenderLayer* newLayer = [[WebRenderLayer alloc] initWithName:@"+ve z-order list"]; + [childWebLayers addObject:newLayer]; + [newLayer release]; + } + + for (size_t i = 0; i < listSize; ++i) { + RenderLayer* curLayer = posZOrderList->at(i); + + WebRenderLayer* newLayer = [[WebRenderLayer alloc] initWithRenderLayer:curLayer]; + [newLayer buildDescendantLayers:curLayer]; + + [childWebLayers addObject:newLayer]; + [newLayer release]; + } + } + + children = childWebLayers; +} + +- (NSArray *)children +{ + return children; +} + +- (NSString *)name +{ + return name; +} + +- (NSString *)positionString +{ + return [NSString stringWithFormat:@"(%.0f, %.0f)", bounds.origin.x, bounds.origin.y]; +} + +- (NSString *)widthString +{ + return [NSString stringWithFormat:@"%.0f", bounds.size.width]; +} + +- (NSString *)heightString +{ + return [NSString stringWithFormat:@"%.0f", bounds.size.height]; +} + +- (NSString *)compositingInfo +{ + return compositingInfo; +} + +- (BOOL)isComposited +{ + return composited; +} + +- (BOOL)isSeparator +{ + return separator; +} + +@end diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm index 6d61453..f7b83ea 100644 --- a/WebKit/mac/WebView/WebView.mm +++ b/WebKit/mac/WebView/WebView.mm @@ -1,6 +1,7 @@ /* * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2006 David Smith (catfish.man@gmail.com) + * Copyright (C) 2010 Igalia S.L * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -1432,6 +1433,7 @@ static bool fastDocumentTeardownEnabled() settings->setHTML5ParserEnabled([preferences html5ParserEnabled]); settings->setHTML5TreeBuilderEnabled_DO_NOT_USE([preferences html5TreeBuilderEnabled]); settings->setPaginateDuringLayoutEnabled([preferences paginateDuringLayoutEnabled]); + settings->setMemoryInfoEnabled([preferences memoryInfoEnabled]); } static inline IMP getMethod(id o, SEL s) @@ -2219,7 +2221,7 @@ static inline IMP getMethod(id o, SEL s) + (NSCursor *)_pointingHandCursor { - return handCursor().impl(); + return handCursor().platformCursor(); } - (BOOL)_postsAcceleratedCompositingNotifications @@ -2619,6 +2621,20 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) return nil; } +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) +- (WebBasePluginPackage *)_videoProxyPluginForMIMEType:(NSString *)MIMEType +{ + WebBasePluginPackage *pluginPackage = [[WebPluginDatabase sharedDatabase] pluginForMIMEType:MIMEType]; + if (pluginPackage) + return pluginPackage; + + if (_private->pluginDatabase) + return [_private->pluginDatabase pluginForMIMEType:MIMEType]; + + return nil; +} +#endif + - (WebBasePluginPackage *)_pluginForExtension:(NSString *)extension { if (![_private->preferences arePlugInsEnabled]) @@ -3084,7 +3100,7 @@ static bool needsWebViewInitThreadWorkaround() _private->UIDelegateForwarder = nil; } -- UIDelegate +- (id)UIDelegate { return _private->UIDelegate; } @@ -3095,7 +3111,7 @@ static bool needsWebViewInitThreadWorkaround() [self _cacheResourceLoadDelegateImplementations]; } -- resourceLoadDelegate +- (id)resourceLoadDelegate { return _private->resourceProgressDelegate; } @@ -3106,7 +3122,7 @@ static bool needsWebViewInitThreadWorkaround() } -- downloadDelegate +- (id)downloadDelegate { return _private->downloadDelegate; } @@ -3118,7 +3134,7 @@ static bool needsWebViewInitThreadWorkaround() _private->policyDelegateForwarder = nil; } -- policyDelegate +- (id)policyDelegate { return _private->policyDelegate; } @@ -3144,7 +3160,7 @@ static bool needsWebViewInitThreadWorkaround() #endif } -- frameLoadDelegate +- (id)frameLoadDelegate { return _private->frameLoadDelegate; } diff --git a/WebKit/mac/WebView/WebViewData.h b/WebKit/mac/WebView/WebViewData.h index 06fee4f..d097c4c 100644 --- a/WebKit/mac/WebView/WebViewData.h +++ b/WebKit/mac/WebView/WebViewData.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2010 Igalia S.L * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/WebKit/mac/WebView/WebViewInternal.h b/WebKit/mac/WebView/WebViewInternal.h index bf9b732..f95d3d3 100644 --- a/WebKit/mac/WebView/WebViewInternal.h +++ b/WebKit/mac/WebView/WebViewInternal.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2010 Igalia S.L * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -146,6 +147,9 @@ namespace WebCore { - (void)_didChangeValueForKey:(NSString *)key; - (WebBasePluginPackage *)_pluginForMIMEType:(NSString *)MIMEType; - (WebBasePluginPackage *)_pluginForExtension:(NSString *)extension; +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) +- (WebBasePluginPackage *)_videoProxyPluginForMIMEType:(NSString *)MIMEType; +#endif - (void)setCurrentNodeHighlight:(WebNodeHighlight *)nodeHighlight; - (WebNodeHighlight *)currentNodeHighlight; |