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.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63263 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 772f0294
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 WebRenderLayer files.
* WebKit.xcodeproj/project.pbxproj:
2010-07-13 Rafael Antognolli <antognolli@profusion.mobi>
Reviewed by Antonio Gomes.
......
......@@ -18,6 +18,8 @@
0ACE917310FE47E30096A45F /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0ACE917210FE47E30096A45F /* OpenGL.framework */; };
0AEBFF630F9FA8BE000D486B /* WebNetscapeContainerCheckPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 0AEBFF610F9FA8BE000D486B /* WebNetscapeContainerCheckPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
0AEBFF640F9FA8BE000D486B /* WebNetscapeContainerCheckPrivate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0AEBFF620F9FA8BE000D486B /* WebNetscapeContainerCheckPrivate.mm */; };
0F30985F11ECFE4500F559DF /* WebRenderLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F30985D11ECFE4400F559DF /* WebRenderLayer.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F30986011ECFE4500F559DF /* WebRenderLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F30985E11ECFE4500F559DF /* WebRenderLayer.mm */; };
0FD3B0F21076C3E900039B96 /* WebVideoFullscreenController.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD3B0EE1076C3E900039B96 /* WebVideoFullscreenController.h */; };
0FD3B0F31076C3E900039B96 /* WebVideoFullscreenController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FD3B0EF1076C3E900039B96 /* WebVideoFullscreenController.mm */; };
0FD3B0F41076C3E900039B96 /* WebVideoFullscreenHUDWindowController.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD3B0F01076C3E900039B96 /* WebVideoFullscreenHUDWindowController.h */; };
......@@ -371,6 +373,8 @@
0ACE917210FE47E30096A45F /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; };
0AEBFF610F9FA8BE000D486B /* WebNetscapeContainerCheckPrivate.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = WebNetscapeContainerCheckPrivate.h; sourceTree = "<group>"; };
0AEBFF620F9FA8BE000D486B /* WebNetscapeContainerCheckPrivate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebNetscapeContainerCheckPrivate.mm; sourceTree = "<group>"; };
0F30985D11ECFE4400F559DF /* WebRenderLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebRenderLayer.h; sourceTree = "<group>"; };
0F30985E11ECFE4500F559DF /* WebRenderLayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebRenderLayer.mm; sourceTree = "<group>"; };
0FD3B0EE1076C3E900039B96 /* WebVideoFullscreenController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebVideoFullscreenController.h; sourceTree = "<group>"; };
0FD3B0EF1076C3E900039B96 /* WebVideoFullscreenController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebVideoFullscreenController.mm; sourceTree = "<group>"; };
0FD3B0F01076C3E900039B96 /* WebVideoFullscreenHUDWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebVideoFullscreenHUDWindowController.h; sourceTree = "<group>"; };
......@@ -1148,6 +1152,8 @@
3944606E020F50ED0ECA1767 /* WebPreferences.h */,
F5AEBB3D024A527601C1A526 /* WebPreferences.mm */,
9CAE9D070252A4130ECA16EA /* WebPreferencesPrivate.h */,
0F30985D11ECFE4400F559DF /* WebRenderLayer.h */,
0F30985E11ECFE4500F559DF /* WebRenderLayer.mm */,
F5F81C3902B67C26018635CA /* WebRenderNode.h */,
F5F81C3A02B67C26018635CA /* WebRenderNode.mm */,
84311A1205EAAAF00088EDA4 /* WebResource.h */,
......@@ -1550,6 +1556,7 @@
41F4484F10338E8C0030E55E /* WebWorkersPrivate.h in Headers */,
C0C5B3EE1177A4A0002B0AEF /* WebUserContentURLPattern.h in Headers */,
1AA879B611CBE9BF003C664F /* WebPlatformStrategies.h in Headers */,
0F30985F11ECFE4500F559DF /* WebRenderLayer.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -1908,6 +1915,7 @@
41F4485010338E8C0030E55E /* WebWorkersPrivate.mm in Sources */,
C0C5B3EF1177A4A0002B0AEF /* WebUserContentURLPattern.mm in Sources */,
1AA879B711CBE9BF003C664F /* WebPlatformStrategies.mm in Sources */,
0F30986011ECFE4500F559DF /* WebRenderLayer.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
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.
......
......@@ -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
......
/*
* 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;
NSRect bounds;
BOOL composited;
}
- (id)initWithWebFrame:(WebFrame *)frame;
- (NSArray *)children;
- (NSString *)name;
- (NSString *)positionString;
- (NSString *)widthString;
- (NSString *)heightString;
- (BOOL)composited;
@end
/*
* 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/RenderView.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:@" ‘%@’", (NSString *)static_cast<Element*>(node)->getIdAttribute()];
}
if (layer->isReflection())
name = [name stringByAppendingString:@" (reflection)"];
return name;
}
- (id)initWithRenderLayer:(RenderLayer*)layer
{
if ((self = [super init])) {
name = [[WebRenderLayer nameForLayer:layer] retain];
bounds = layer->absoluteBoundingBox();
composited = layer->isComposited();
}
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();
[self buildDescendantLayers:layer];
}
return self;
}
- (void)dealloc
{
[children release];
[name 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();
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();
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();
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];
}
- (BOOL)composited
{
return composited;
}
@end
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