Commit 615a7e07 authored by darin's avatar darin

WebCore:

        Reviewed by John.

	- added an API for dumping the external representation of the render tree for testing

        * kwq/KWQRenderTreeDebug.h: Added.
        * kwq/KWQRenderTreeDebug.cpp: Added.

        * kwq/KWQTextStream.h: Added more overloads for operator<<.
        * kwq/KWQTextStream.mm: (QTextStream::operator<<): Implemented them.

        * kwq/WebCoreBridge.h: Added renderTreeAsExternalRepresentation.
        * kwq/WebCoreBridge.mm: (-[WebCoreBridge renderTreeAsExternalRepresentation]): Added.

	- removed remnants of an earlier more-naive cut at this same sort of thing
	- removed ForwardingHeaders from the project since that doesn't really help Project Builder

        * kwq/WebCoreTestController.h: Removed.
        * kwq/WebCoreTestController.m: Removed.
        * WebCore.exp: Removed WebCoreTestController.
        * WebCore-combined.exp: Re-generated.
        * WebCore.pbproj/project.pbxproj: Removed WebCoreTestController and ForwardingHeaders.

WebKit:

        Reviewed by John.

	- added an API for dumping the external representation of the render tree for testing

        * Misc.subproj/WebCoreStatistics.h: Added renderTreeAsExternalRepresentation.
        * Misc.subproj/WebCoreStatistics.m: (-[WebFrame renderTreeAsExternalRepresentation]): Added.

	- removed remnants of an earlier more-naive cut at this same sort of thing

        * Misc.subproj/WebTestController.h: Removed.
        * Misc.subproj/WebTestController.m: Removed.
        * WebKit.exp: Removed WebTestController.
        * WebKit.pbproj/project.pbxproj: Removed WebTestController.

	- other changes

        * WebCoreSupport.subproj/WebBridge.m: Had added new copyright date to touch a file.
	That's not needed any more, but the date should be updated anyway.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3333 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f7bab12f
2003-01-16 Darin Adler <darin@apple.com>
Reviewed by John.
- added an API for dumping the external representation of the render tree for testing
* kwq/KWQRenderTreeDebug.h: Added.
* kwq/KWQRenderTreeDebug.cpp: Added.
* kwq/KWQTextStream.h: Added more overloads for operator<<.
* kwq/KWQTextStream.mm: (QTextStream::operator<<): Implemented them.
* kwq/WebCoreBridge.h: Added renderTreeAsExternalRepresentation.
* kwq/WebCoreBridge.mm: (-[WebCoreBridge renderTreeAsExternalRepresentation]): Added.
- removed remnants of an earlier more-naive cut at this same sort of thing
- removed ForwardingHeaders from the project since that doesn't really help Project Builder
* kwq/WebCoreTestController.h: Removed.
* kwq/WebCoreTestController.m: Removed.
* WebCore.exp: Removed WebCoreTestController.
* WebCore-combined.exp: Re-generated.
* WebCore.pbproj/project.pbxproj: Removed WebCoreTestController and ForwardingHeaders.
=== Safari-52 ===
2003-01-15 Trey Matteson <trey@apple.com>
......
2003-01-16 Darin Adler <darin@apple.com>
Reviewed by John.
- added an API for dumping the external representation of the render tree for testing
* kwq/KWQRenderTreeDebug.h: Added.
* kwq/KWQRenderTreeDebug.cpp: Added.
* kwq/KWQTextStream.h: Added more overloads for operator<<.
* kwq/KWQTextStream.mm: (QTextStream::operator<<): Implemented them.
* kwq/WebCoreBridge.h: Added renderTreeAsExternalRepresentation.
* kwq/WebCoreBridge.mm: (-[WebCoreBridge renderTreeAsExternalRepresentation]): Added.
- removed remnants of an earlier more-naive cut at this same sort of thing
- removed ForwardingHeaders from the project since that doesn't really help Project Builder
* kwq/WebCoreTestController.h: Removed.
* kwq/WebCoreTestController.m: Removed.
* WebCore.exp: Removed WebCoreTestController.
* WebCore-combined.exp: Re-generated.
* WebCore.pbproj/project.pbxproj: Removed WebCoreTestController and ForwardingHeaders.
=== Safari-52 ===
2003-01-15 Trey Matteson <trey@apple.com>
......
......@@ -6,7 +6,6 @@
.objc_class_name_WebCoreImageRendererFactory
.objc_class_name_WebCoreJavaScript
.objc_class_name_WebCoreSettings
.objc_class_name_WebCoreTestController
.objc_class_name_WebCoreTextRendererFactory
.objc_class_name_WebCoreViewFactory
_WebCoreFileButtonFilenameChanged
......
......@@ -6,7 +6,6 @@
.objc_class_name_WebCoreImageRendererFactory
.objc_class_name_WebCoreJavaScript
.objc_class_name_WebCoreSettings
.objc_class_name_WebCoreTestController
.objc_class_name_WebCoreTextRendererFactory
.objc_class_name_WebCoreViewFactory
_WebCoreFileButtonFilenameChanged
......
This diff is collapsed.
/*
* Copyright (C) 2002 Apple Computer, Inc. All rights reserved.
* Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -23,21 +23,88 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import <Foundation/Foundation.h>
#ifndef NDEBUG
@protocol WebCoreDrawingObserver <NSObject>
- (void)filledRect:(NSRect)r;
- (void)strokedRect:(NSRect)r;
- (void)filledOval:(NSRect)r;
- (void)strokedOval:(NSRect)r;
- (void)strokedArcWithCenter:(NSPoint)p radius:(float)radius startAngle:(float)startAngle endAngle:(float)endAngle;
- (void)drewLineFrom:(NSPoint)p1 to:(NSPoint)p2 width:(float)width;
@end
#include "KWQRenderTreeDebug.h"
@interface WebCoreTestController : NSObject
#include "htmltags.h"
#include "khtmlview.h"
#include "render_replaced.h"
#include "render_table.h"
#include "KWQKHTMLPart.h"
#include "KWQTextStream.h"
using khtml::RenderObject;
using khtml::RenderTableCell;
using khtml::RenderWidget;
static QTextStream &operator<<(QTextStream &ts, const RenderObject &o)
{
ts << o.renderName();
ts << " ";
if (o.isInline()) ts << "il ";
if (o.childrenInline()) ts << "ci ";
if (o.isFloating()) ts << "fl ";
if (o.isAnonymousBox()) ts << "an ";
if (o.isRelPositioned()) ts << "rp ";
if (o.isPositioned()) ts << "ps ";
if (o.overhangingContents()) ts << "oc ";
if (o.layouted()) ts << "lt ";
if (o.mouseInside()) ts << "mi ";
if (o.style() && o.style()->zIndex()) ts << "zI: " << o.style()->zIndex();
if (o.element() && o.element()->active()) ts << "act ";
if (o.element() && o.element()->hasAnchor()) ts << "anchor ";
if (o.element() && o.element()->focused()) ts << "focus ";
if (o.element()) ts << " <" << getTagName(o.element()->id()).string() << ">";
ts << " (" << o.xPos() << "," << o.yPos() << "," << o.width() << "," << o.height() << ")";
if (o.isTableCell()) {
const RenderTableCell &c = static_cast<const RenderTableCell &>(o);
ts << " [r=" << c.row() << " c=" << c.col() << " rs=" << c.rowSpan() << " cs=" << c.colSpan() << "]";
}
return ts;
}
+ (void)setDrawingObserver:(id <WebCoreDrawingObserver>)observer;
static void write(QTextStream &ts, const RenderObject &o, int indent = 0)
{
{
QString indentationSpaces;
indentationSpaces.fill(' ', indent * 2);
ts << indentationSpaces;
}
ts << o << '\n';
for (RenderObject *child = o.firstChild(); child; child = child->nextSibling()) {
write(ts, *child, indent + 1);
}
if (o.isWidget()) {
KHTMLView *view = dynamic_cast<KHTMLView *>(static_cast<const RenderWidget &>(o).widget());
if (view) {
RenderObject *root = KWQ(view->part())->renderer();
if (root) {
write(ts, *root, indent + 1);
}
}
}
}
QString externalRepresentation(const RenderObject *o)
{
QString s;
{
QTextStream ts(&s);
if (o) {
write(ts, *o);
}
}
return s;
}
@end
#endif // NDEBUG
/*
* Copyright (C) 2002 Apple Computer, Inc. All rights reserved.
* Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -23,12 +23,14 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "WebCoreTestController.h"
#ifndef NDEBUG
@implementation WebCoreTestController
#include "KWQString.h"
+ (void)setDrawingObserver:(id <WebCoreDrawingObserver>)observer
{
namespace khtml {
class RenderObject;
}
@end
QString externalRepresentation(const khtml::RenderObject *);
#endif
......@@ -41,12 +41,22 @@ public:
QTextStream(QString *, int mode = IO_WriteOnly);
QTextStream &operator<<(char);
QTextStream &operator<<(const QChar &);
QTextStream &operator<<(short);
QTextStream &operator<<(unsigned short);
QTextStream &operator<<(int);
QTextStream &operator<<(unsigned);
QTextStream &operator<<(long);
QTextStream &operator<<(unsigned long);
QTextStream &operator<<(float);
QTextStream &operator<<(double);
QTextStream &operator<<(const char *);
QTextStream &operator<<(const QCString &);
QTextStream &operator<<(const QString &);
QTextStream &operator<<(const QTextStreamManipulator &);
QTextStream &operator<<(const QCString &);
QTextStream &operator<<(void *);
QTextStream &operator<<(const QTextStreamManipulator &);
private:
QTextStream(const QTextStream &);
QTextStream &operator=(const QTextStream &);
......
......@@ -51,6 +51,48 @@ QTextStream &QTextStream::operator<<(char c)
return *this;
}
QTextStream &QTextStream::operator<<(short i)
{
char buffer[10];
sprintf(buffer, "%d", i);
return *this << buffer;
}
QTextStream &QTextStream::operator<<(unsigned short i)
{
char buffer[10];
sprintf(buffer, "%u", i);
return *this << buffer;
}
QTextStream &QTextStream::operator<<(int i)
{
char buffer[10];
sprintf(buffer, "%d", i);
return *this << buffer;
}
QTextStream &QTextStream::operator<<(unsigned i)
{
char buffer[10];
sprintf(buffer, "%u", i);
return *this << buffer;
}
QTextStream &QTextStream::operator<<(long i)
{
char buffer[10];
sprintf(buffer, "%ld", i);
return *this << buffer;
}
QTextStream &QTextStream::operator<<(unsigned long i)
{
char buffer[10];
sprintf(buffer, "%lu", i);
return *this << buffer;
}
QTextStream &QTextStream::operator<<(const char *s)
{
if (_hasByteArray) {
......
/*
* Copyright (C) 2002 Apple Computer, Inc. All rights reserved.
* Copyright (C) 2002, 2003 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -146,6 +146,7 @@ enum FrameBorderStyle {
- (NSObject *)copyDOMTree:(id <WebCoreDOMTreeCopier>)copier;
- (NSObject *)copyRenderTree:(id <WebCoreRenderTreeCopier>)copier;
- (NSString *)renderTreeAsExternalRepresentation;
- (NSDictionary *)elementAtPoint:(NSPoint)point;
......
......@@ -45,10 +45,11 @@
#import "KWQAssertions.h"
#import "KWQCharsets.h"
#import "KWQFont.h"
#import "KWQDOMNode.h"
#import "KWQFont.h"
#import "KWQFrame.h"
#import "KWQPageState.h"
#import "KWQRenderTreeDebug.h"
#import "WebCoreDOMPrivate.h"
#import "WebCoreImageRenderer.h"
......@@ -659,4 +660,13 @@ static bool initializedObjectCacheSize = FALSE;
return _part->keyEvent(event);
}
- (NSString *)renderTreeAsExternalRepresentation
{
#ifdef NDEBUG
return nil;
#else
return externalRepresentation(_part->renderer()).getNSString();
#endif
}
@end
2003-01-16 Darin Adler <darin@apple.com>
Reviewed by John.
- added an API for dumping the external representation of the render tree for testing
* Misc.subproj/WebCoreStatistics.h: Added renderTreeAsExternalRepresentation.
* Misc.subproj/WebCoreStatistics.m: (-[WebFrame renderTreeAsExternalRepresentation]): Added.
- removed remnants of an earlier more-naive cut at this same sort of thing
* Misc.subproj/WebTestController.h: Removed.
* Misc.subproj/WebTestController.m: Removed.
* WebKit.exp: Removed WebTestController.
* WebKit.pbproj/project.pbxproj: Removed WebTestController.
- other changes
* WebCoreSupport.subproj/WebBridge.m: Had added new copyright date to touch a file.
That's not needed any more, but the date should be updated anyway.
=== Safari-52 ===
2003-01-15 Maciej Stachowiak <mjs@apple.com>
......
......@@ -3,11 +3,13 @@
// WebKit
//
// Created by Darin Adler on Thu Mar 28 2002.
// Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
// Copyright (c) 2002, 2003 Apple Computer, Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <WebKit/WebFrame.h>
@interface WebCoreStatistics : NSObject
{
}
......@@ -24,3 +26,7 @@
+ (void)garbageCollectJavaScriptObjects;
@end
@interface WebFrame (WebKitDebug)
- (NSString *)renderTreeAsExternalRepresentation;
@end
......@@ -3,7 +3,7 @@
// WebKit
//
// Created by Darin Adler on Thu Mar 28 2002.
// Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
// Copyright (c) 2002, 2003 Apple Computer, Inc. All rights reserved.
//
#import "WebCoreStatistics.h"
......@@ -11,6 +11,9 @@
#import <WebCore/WebCoreCache.h>
#import <WebCore/WebCoreJavaScript.h>
#import <WebKit/WebBridge.h>
#import <WebKit/WebFramePrivate.h>
@implementation WebCoreStatistics
+ (NSArray *)statistics
......@@ -59,3 +62,12 @@ + (void)garbageCollectJavaScriptObjects
}
@end
@implementation WebFrame (WebKitDebug)
- (NSString *)renderTreeAsExternalRepresentation
{
return [[self _bridge] renderTreeAsExternalRepresentation];
}
@end
//
// WebTestController.h
// WebKit
//
// Created by Darin Adler on Thu Aug 08 2002.
// Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
@protocol WebDrawingObserver <NSObject>
@end
@interface WebTestController : NSObject
{
}
+ (void)setDrawingObserver:(id <WebDrawingObserver>)observer;
@end
//
// WebTestController.m
// WebKit
//
// Created by Darin Adler on Thu Aug 08 2002.
// Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
//
#import "WebTestController.h"
#import <WebCore/WebCoreTestController.h>
@interface WebForwardingDrawingObserver : NSObject <WebCoreDrawingObserver>
{
id <WebDrawingObserver> _target;
}
- initWithTarget:(id <WebDrawingObserver>)target;
@end
@implementation WebForwardingDrawingObserver
- initWithTarget:(id <WebDrawingObserver>)target
{
self = [super init];
if (self == nil) {
return nil;
}
_target = [target retain];
return self;
}
- (void)filledRect:(NSRect)r
{
}
- (void)strokedRect:(NSRect)r
{
}
- (void)filledOval:(NSRect)r
{
}
- (void)strokedOval:(NSRect)r
{
}
- (void)strokedArcWithCenter:(NSPoint)p radius:(float)radius startAngle:(float)startAngle endAngle:(float)endAngle
{
}
- (void)drewLineFrom:(NSPoint)p1 to:(NSPoint)p2 width:(float)width
{
}
@end
@implementation WebTestController
+ (void)setDrawingObserver:(id <WebDrawingObserver>)observer
{
WebForwardingDrawingObserver *forwardingObserver =
[[WebForwardingDrawingObserver alloc] initWithTarget:observer];
[WebCoreTestController setDrawingObserver:forwardingObserver];
[forwardingObserver release];
}
@end
/*
WebBridge.m
Copyright (c) 2002, Apple, Inc. All rights reserved.
Copyright (c) 2002, 2003, Apple Computer, Inc. All rights reserved.
*/
#import <WebKit/WebBridge.h>
......
......@@ -21,7 +21,6 @@
.objc_class_name_WebResourceLoadDelegate
.objc_class_name_WebStandardPanels
.objc_class_name_WebStringTruncator
.objc_class_name_WebTestController
.objc_class_name_WebTextView
.objc_class_name_WebURLsWithTitles
.objc_class_name_WebView
......
......@@ -225,7 +225,6 @@
65490EC203666DFC000CED4B,
F560BEBE030DAF4401C1A526,
F59668CA02AD2923018635CA,
F501251D0302EA04018635CE,
517FA6AC03709FCE00CA2D3A,
F8CA15B9029A39D901000122,
93154EF303A41270008635CE,
......@@ -352,7 +351,6 @@
9345DDB10365FB27008635CE,
F560BEBF030DAF4401C1A526,
F59668CB02AD2923018635CA,
F501251E0302EA04018635CE,
517FA6AD03709FCE00CA2D3A,
517FA6AE03709FCE00CA2D3A,
F8CA15BA029A39D901000122,
......@@ -2528,33 +2526,6 @@
//F52
//F53
//F54
F501251B0302EA04018635CE = {
fileEncoding = 4;
isa = PBXFileReference;
path = WebTestController.h;
refType = 4;
};
F501251C0302EA04018635CE = {
fileEncoding = 4;
isa = PBXFileReference;
path = WebTestController.m;
refType = 4;
};
F501251D0302EA04018635CE = {
fileRef = F501251B0302EA04018635CE;
isa = PBXBuildFile;
settings = {
ATTRIBUTES = (
Private,
);
};
};
F501251E0302EA04018635CE = {
fileRef = F501251C0302EA04018635CE;
isa = PBXBuildFile;
settings = {
};
};
F5065217027F555001C1A526 = {
children = (
F5065219027F557E01C1A526,
......@@ -2867,8 +2838,6 @@
F53444CF02E87CBA018635CA,
F5F81C3902B67C26018635CA,
F5F81C3A02B67C26018635CA,
F501251B0302EA04018635CE,
F501251C0302EA04018635CE,
);
isa = PBXGroup;
name = Debug;
......
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