diff options
Diffstat (limited to 'WebKit/mac/WebView')
-rw-r--r-- | WebKit/mac/WebView/WebDataSource.mm | 10 | ||||
-rw-r--r-- | WebKit/mac/WebView/WebDataSourcePrivate.h | 2 | ||||
-rw-r--r-- | WebKit/mac/WebView/WebHTMLRepresentation.mm | 2 | ||||
-rw-r--r-- | WebKit/mac/WebView/WebHTMLView.mm | 2 | ||||
-rw-r--r-- | WebKit/mac/WebView/WebPreferenceKeysPrivate.h | 1 | ||||
-rw-r--r-- | WebKit/mac/WebView/WebPreferences.mm | 13 | ||||
-rw-r--r-- | WebKit/mac/WebView/WebPreferencesPrivate.h | 3 | ||||
-rw-r--r-- | WebKit/mac/WebView/WebRenderLayer.h | 53 | ||||
-rw-r--r-- | WebKit/mac/WebView/WebRenderLayer.mm | 280 | ||||
-rw-r--r-- | WebKit/mac/WebView/WebView.mm | 28 | ||||
-rw-r--r-- | WebKit/mac/WebView/WebViewData.h | 1 | ||||
-rw-r--r-- | WebKit/mac/WebView/WebViewInternal.h | 4 |
12 files changed, 390 insertions, 9 deletions
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; |