Commit c35389ff authored by eseidel's avatar eseidel

2006-02-28 Eric Seidel <eseidel@apple.com>

        Reviewed by mjs.

        * DumpRenderTree/DumpRenderTree.vcproj/DumpRenderTree/DumpRenderTree.cpp:
        (main): add ability to dump render tree and read from a local file.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@13060 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 69e537ce
2006-02-28 Eric Seidel <eseidel@apple.com>
Reviewed by mjs.
* DumpRenderTree/DumpRenderTree.vcproj/DumpRenderTree/DumpRenderTree.cpp:
(main): add ability to dump render tree and read from a local file.
2006-02-27 Eric Seidel <eseidel@apple.com>
Reviewed by darin.
......
......@@ -28,19 +28,57 @@
#include "config.h"
#include "FrameWin.h"
#include "FrameView.h"
#include "Page.h"
#include "render_frames.h"
#include "DocumentImpl.h"
#include "markup.h"
#include "KWQRenderTreeDebug.h"
#include <io.h>
#include <fcntl.h>
#include <direct.h>
using namespace WebCore;
#define LOCAL_FILE_TEST 0
int main(int argc, char* argv[])
{
Page *page = new Page();
FrameWin *frame = new FrameWin(page, 0);
FrameView *frameView = new FrameView(frame);
frame->setView(frameView);
frame->begin();
#if LOCAL_FILE_TEST
char *path = "c:\\cygwin\\tmp\\test.html";
FILE *file = fopen(path, "rb");
if (!file) {
printf("Failed to open file: %s\n", path);
printf("Current path: %s\n", _getcwd(0,0));
while(1);
exit(1);
}
char buffer[4000];
int newBytes = 0;
while ((newBytes = fread(buffer, 1, 4000, file)) > 0) {
frame->write(buffer, newBytes);
}
fclose(file);
#else
frame->write("<html><body><p>hello world</p></body></html>");
#endif
frame->end();
QString markup = createMarkup(frame->document());
printf("Source:\n\n%s", markup.ascii());
QString renderDump = externalRepresentation(frame->renderer());
printf("\n\nRenderTree:\n\n%s", renderDump.ascii());
fflush(stdout);
while(1);
return 0;
}
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