зеркало из https://github.com/mozilla/pjs.git
Update to the debug plugin. This is not part of the build.
This commit is contained in:
Родитель
8fa2c2f229
Коммит
3f8064e4a9
|
@ -50,6 +50,13 @@ interface nsIDebugObject : nsISupports
|
|||
*/
|
||||
void DumpContent(in nsISupports aUrlToDump,in wstring aFilePath,in wstring aFileName);
|
||||
|
||||
/**
|
||||
* Compares the contents of frame model files
|
||||
* @param
|
||||
* @param
|
||||
*/
|
||||
void CompareFrameModels(in wstring aBasePath,in wstring aVerPath,in wstring aBaseFile,in wstring aVerFile, in unsigned long aFlags);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -39,6 +39,9 @@ class NS_NO_VTABLE nsIDebugPlugin : public nsISupports {
|
|||
/* void GetNextFileInDirectory ([retval] out string aFileName); */
|
||||
NS_IMETHOD GetNextFileInDirectory(char **aFileName) = 0;
|
||||
|
||||
/* void CompareLayoutFiles (in wstring aBasePath, in wstring aVerPath, in wstring aBaseFile, in wstring aVerFile, in unsigned long aFlags, [retval] out long aResult); */
|
||||
NS_IMETHOD CompareLayoutFiles(const PRUnichar *aBasePath, const PRUnichar *aVerPath, const PRUnichar *aBaseFile, const PRUnichar *aVerFile, PRUint32 aFlags, PRInt32 *aResult) = 0;
|
||||
|
||||
};
|
||||
|
||||
/* Use this macro when declaring classes that implement this interface. */
|
||||
|
@ -46,21 +49,24 @@ class NS_NO_VTABLE nsIDebugPlugin : public nsISupports {
|
|||
NS_IMETHOD GetVersion(char * *aVersion); \
|
||||
NS_IMETHOD DumpLayout(nsISupports *aWindow, const PRUnichar *aFilePath, const PRUnichar *aFileName, PRInt32 *aResult); \
|
||||
NS_IMETHOD StartDirectorySearch(const char *aFilePath); \
|
||||
NS_IMETHOD GetNextFileInDirectory(char **aFileName);
|
||||
NS_IMETHOD GetNextFileInDirectory(char **aFileName); \
|
||||
NS_IMETHOD CompareLayoutFiles(const PRUnichar *aBasePath, const PRUnichar *aVerPath, const PRUnichar *aBaseFile, const PRUnichar *aVerFile, PRUint32 aFlags, PRInt32 *aResult);
|
||||
|
||||
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
|
||||
#define NS_FORWARD_NSIDEBUGPLUGIN(_to) \
|
||||
NS_IMETHOD GetVersion(char * *aVersion) { return _to GetVersion(aVersion); } \
|
||||
NS_IMETHOD DumpLayout(nsISupports *aWindow, const PRUnichar *aFilePath, const PRUnichar *aFileName, PRInt32 *aResult) { return _to DumpLayout(aWindow, aFilePath, aFileName, aResult); } \
|
||||
NS_IMETHOD StartDirectorySearch(const char *aFilePath) { return _to StartDirectorySearch(aFilePath); } \
|
||||
NS_IMETHOD GetNextFileInDirectory(char **aFileName) { return _to GetNextFileInDirectory(aFileName); }
|
||||
NS_IMETHOD GetNextFileInDirectory(char **aFileName) { return _to GetNextFileInDirectory(aFileName); } \
|
||||
NS_IMETHOD CompareLayoutFiles(const PRUnichar *aBasePath, const PRUnichar *aVerPath, const PRUnichar *aBaseFile, const PRUnichar *aVerFile, PRUint32 aFlags, PRInt32 *aResult) { return _to CompareLayoutFiles(aBasePath, aVerPath, aBaseFile, aVerFile, aFlags, aResult); }
|
||||
|
||||
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
|
||||
#define NS_FORWARD_SAFE_NSIDEBUGPLUGIN(_to) \
|
||||
NS_IMETHOD GetVersion(char * *aVersion) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetVersion(aVersion); } \
|
||||
NS_IMETHOD DumpLayout(nsISupports *aWindow, const PRUnichar *aFilePath, const PRUnichar *aFileName, PRInt32 *aResult) { return !_to ? NS_ERROR_NULL_POINTER : _to->DumpLayout(aWindow, aFilePath, aFileName, aResult); } \
|
||||
NS_IMETHOD StartDirectorySearch(const char *aFilePath) { return !_to ? NS_ERROR_NULL_POINTER : _to->StartDirectorySearch(aFilePath); } \
|
||||
NS_IMETHOD GetNextFileInDirectory(char **aFileName) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetNextFileInDirectory(aFileName); }
|
||||
NS_IMETHOD GetNextFileInDirectory(char **aFileName) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetNextFileInDirectory(aFileName); } \
|
||||
NS_IMETHOD CompareLayoutFiles(const PRUnichar *aBasePath, const PRUnichar *aVerPath, const PRUnichar *aBaseFile, const PRUnichar *aVerFile, PRUint32 aFlags, PRInt32 *aResult) { return !_to ? NS_ERROR_NULL_POINTER : _to->CompareLayoutFiles(aBasePath, aVerPath, aBaseFile, aVerFile, aFlags, aResult); }
|
||||
|
||||
#if 0
|
||||
/* Use the code below as a template for the implementation class for this interface. */
|
||||
|
@ -115,6 +121,12 @@ NS_IMETHODIMP nsDebugPlugin::GetNextFileInDirectory(char **aFileName)
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void CompareLayoutFiles (in wstring aBasePath, in wstring aVerPath, in wstring aBaseFile, in wstring aVerFile, in unsigned long aFlags, [retval] out long aResult); */
|
||||
NS_IMETHODIMP nsDebugPlugin::CompareLayoutFiles(const PRUnichar *aBasePath, const PRUnichar *aVerPath, const PRUnichar *aBaseFile, const PRUnichar *aVerFile, PRUint32 aFlags, PRInt32 *aResult)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* End of implementation class template. */
|
||||
#endif
|
||||
|
||||
|
|
|
@ -28,5 +28,6 @@ interface nsIDebugPlugin : nsISupports {
|
|||
void DumpLayout(in nsISupports aWindow,in wstring aFilePath,in wstring aFileName,[retval] out long aResult );
|
||||
void StartDirectorySearch(in string aFilePath);
|
||||
void GetNextFileInDirectory([retval] out string aFileName);
|
||||
void CompareLayoutFiles(in wstring aBasePath,in wstring aVerPath,in wstring aBaseFile,in wstring aVerFile,in unsigned long aFlags,[retval] out long aResult);
|
||||
|
||||
};
|
||||
|
|
|
@ -117,7 +117,6 @@ NS_IMETHODIMP nsScriptablePeer::GetVersion(char * *aVersion)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsScriptablePeer::DumpLayout(nsISupports *aWindow, const PRUnichar *aFilePath, const PRUnichar *aFileName, PRInt32 *aResult)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -134,6 +133,22 @@ PRBool retVal;
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsScriptablePeer::CompareLayoutFiles(const PRUnichar *aBasePath, const PRUnichar *aVerPath,
|
||||
const PRUnichar *aBaseFile, const PRUnichar *aVerFile, PRUint32 aFlags, PRInt32 *aResult)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PRBool retVal;
|
||||
|
||||
if (mPlugin){
|
||||
mPlugin->CompareLayoutFrames(aBasePath,aVerPath,aBaseFile,aVerFile,aFlags, &retVal);
|
||||
if (retVal == NS_OK) {
|
||||
*aResult= 0;
|
||||
} else {
|
||||
*aResult = 1;
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
//
|
||||
// the following method will be callable from JavaScript
|
||||
|
|
|
@ -190,6 +190,24 @@ void nsPluginInstance::OutPutLayoutFrames(nsISupports *aWindow, const PRUnichar
|
|||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
|
||||
void nsPluginInstance::CompareLayoutFrames(const PRUnichar *aBasePath, const PRUnichar *aVerPath,
|
||||
const PRUnichar *aBaseFile, const PRUnichar *aVerFile, PRUint32 aFlags, PRInt32 *aRetVal)
|
||||
{
|
||||
nsIDebugObject *theDebugObject=NULL;
|
||||
|
||||
*aRetVal = NS_ERROR_FAILURE;
|
||||
|
||||
if (gServiceManager) {
|
||||
// get service using its contract id and use it to allocate the memory
|
||||
gServiceManager->GetServiceByContractID("@mozilla.org/debug/debugobject;1", NS_GET_IID(nsIDebugObject), (void **)&theDebugObject);
|
||||
if(theDebugObject){
|
||||
*aRetVal = theDebugObject->CompareFrameModels(aBasePath,aVerPath,aBaseFile,aVerFile,aFlags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
|
||||
void
|
||||
|
|
|
@ -62,6 +62,8 @@ public:
|
|||
// locals
|
||||
void getVersion(char* *aVersion);
|
||||
void OutPutLayoutFrames(nsISupports *aWindow,const PRUnichar *aFilePath, const PRUnichar *aFileName, PRInt32 *aRetVal);
|
||||
void CompareLayoutFrames(const PRUnichar *aBasePath, const PRUnichar *aVerPath,
|
||||
const PRUnichar *aBaseFile, const PRUnichar *aVerFile, PRUint32 aFlags, PRInt32 *aRetVal);
|
||||
void StartDirectorySearch(const char *aFilePath);
|
||||
void GetNextFileInDirectory(char **aFilePath);
|
||||
nsIDebugPlugin* getScriptablePeer();
|
||||
|
|
|
@ -2,34 +2,156 @@
|
|||
<HEAD>
|
||||
<TITLE>Debug Plug-in Test</TITLE>
|
||||
</HEAD>
|
||||
|
||||
|
||||
|
||||
<BODY>
|
||||
|
||||
<center>
|
||||
<h1> XPConnect Scriptable Debug Plug-in </h1>
|
||||
<h2> Example XPConnect Scriptable Debug Plug-in Regression Page</h1>
|
||||
</center>
|
||||
|
||||
|
||||
<br><br>
|
||||
|
||||
<center>
|
||||
|
||||
<embed type="application/debug-plugin" width=1 height=1 hidden="true"><br>
|
||||
|
||||
<script>
|
||||
var embed = document.embeds[0];
|
||||
var started = false;
|
||||
var theWindow;
|
||||
var fileDirectory;
|
||||
var baseExt;
|
||||
var verExt;
|
||||
var baseDir;
|
||||
var verDir;
|
||||
var testType;
|
||||
var compare;
|
||||
|
||||
function CompareFiles(baseDir,verDir,baselineFile,verFile)
|
||||
{
|
||||
err = embed.CompareLayoutFiles(baseDir,verDir,baselineFile,verFile,1);
|
||||
|
||||
if(err == 0) {
|
||||
WriteOutput(baselineFile,false,true);
|
||||
} else {
|
||||
WriteOutput(baselineFile + " FAILED ",false,false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function WriteOutput( Text, Replace, Success )
|
||||
{
|
||||
|
||||
textarea = document.getElementById('output');
|
||||
statusarea = document.getElementById('status');
|
||||
|
||||
if(Success){
|
||||
statusarea.innerHTML = "<font color=green>" + Text +"</font>";
|
||||
} else {
|
||||
statusarea.innerHTML = "<font color=red>" + Text + "</font>";
|
||||
}
|
||||
|
||||
|
||||
if( Replace ) {
|
||||
if(Success){
|
||||
textarea.innerHTML = "<font color=green>" + Text +"</font>";
|
||||
} else {
|
||||
textarea.innerHTML = "<font color=red>" + Text + "</font>";
|
||||
}
|
||||
} else {
|
||||
if(Success){
|
||||
textarea.innerHTML = "<font color=green>" + textarea.innerHTML + "<br>" + Text+"</font>";
|
||||
} else {
|
||||
textarea.innerHTML = "<font color=red>" + textarea.innerHTML + "<br>" + Text + "</font>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function placeWindows(outputWindow,newWindow)
|
||||
{
|
||||
|
||||
height = window.screen.availHeight/2;
|
||||
width = window.screen.availWidth;
|
||||
top = window.screen.availTop;
|
||||
left = window.screen.availLeft;
|
||||
|
||||
outputWindow.focus();
|
||||
outputWindow.moveTo(left,top);
|
||||
outputWindow.resizeTo(width,height);
|
||||
|
||||
newWindow.resizeTo(width,height);
|
||||
newWindow.moveTo(left,height);
|
||||
|
||||
|
||||
outputWindow.focus();
|
||||
yamount = outputWindow.pageYOffset;
|
||||
xamount = outputWindow.pageXOffset;
|
||||
|
||||
outputWindow.scroll(-xamount,-yamount);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function DumpFrames1(firstTime,lastFile)
|
||||
{
|
||||
|
||||
outputWindow = window;
|
||||
newWindow = window.open();
|
||||
placeWindows(outputWindow,newWindow);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
WriteOutput( "Starting Tests",true,true );
|
||||
WriteOutput( "1",false,true );
|
||||
WriteOutput( "2",false,true );
|
||||
WriteOutput( "3",false,false );
|
||||
WriteOutput( "4",false,true );
|
||||
WriteOutput( "5",false,false );
|
||||
WriteOutput( "6",false,true );
|
||||
WriteOutput( "7",false,true );
|
||||
WriteOutput( "asf",false,false );
|
||||
WriteOutput( "7",false,true );
|
||||
WriteOutput( "asdf",false,false );
|
||||
WriteOutput( "wre",false,true );
|
||||
WriteOutput( "wfw",false,true );
|
||||
WriteOutput( "jhgj",false,false );
|
||||
WriteOutput( "gjghj",false,true );
|
||||
WriteOutput( "rtj",false,false );
|
||||
|
||||
}
|
||||
|
||||
|
||||
function DumpFrames(firstTime,lastFile)
|
||||
{
|
||||
var loadingFlag;
|
||||
|
||||
if (firstTime == true) {
|
||||
var filedirectory = "file:///S|/mozilla/layout/html/tests/block";
|
||||
embed.StartDirectorySearch(filedirectory);
|
||||
WriteOutput( "Starting Tests",true,true );
|
||||
|
||||
// first verify all the fields are set up correctly
|
||||
fileDirectory = document.TestForm.RegTestDir.value;
|
||||
baseExt = document.TestForm.baseExt.value;
|
||||
verExt = document.TestForm.verExt.value;
|
||||
baseDir = document.TestForm.baseDir.value;
|
||||
verDir = document.TestForm.verDir.value;
|
||||
testType = document.getElementById('bl').checked;
|
||||
if(testType){
|
||||
// never compare if doing baseline
|
||||
compare = false;
|
||||
} else {
|
||||
// get the checkbox value
|
||||
compare = document.getElementById('comp').checked;
|
||||
}
|
||||
|
||||
//var filedirectory = "file:///S|/mozilla/layout/html/tests/table/dom";
|
||||
embed.StartDirectorySearch(fileDirectory);
|
||||
filename=embed.GetNextFileInDirectory();
|
||||
if( filename != null) {
|
||||
outputWindow = window;
|
||||
theWindow = window.open(filename);
|
||||
outputWindow = window;
|
||||
placeWindows(outputWindow,theWindow);
|
||||
}
|
||||
started = true;
|
||||
} else {
|
||||
|
@ -37,22 +159,34 @@ var loadingFlag;
|
|||
}
|
||||
|
||||
while ( filename != null) {
|
||||
alert(filename);
|
||||
outputfilename = filename.replace (".html",".tst");
|
||||
|
||||
loading = embed.DumpLayout(theWindow,"s:/tests","outputfilename");
|
||||
// take off the file path.. so we just have the file name for the output
|
||||
var startindex = filename.lastIndexOf("/");
|
||||
var outputfilename = filename.slice(startindex+1,filename.length);
|
||||
|
||||
if (testType) {
|
||||
// if checked..since we check the baseline radio button.. this is baseline
|
||||
outputfilename = outputfilename.replace (".html",baseExt);
|
||||
loading = embed.DumpLayout(theWindow,baseDir,outputfilename);
|
||||
} else {
|
||||
outputfilename = outputfilename.replace (".html",verExt);
|
||||
loading = embed.DumpLayout(theWindow,verDir,outputfilename);
|
||||
}
|
||||
|
||||
alert (loading);
|
||||
if (loading != 0) {
|
||||
setTimeout("DumpFrames(false,filename)",1000);
|
||||
alert("Waiting");
|
||||
break;
|
||||
} else {
|
||||
theWindow.close();
|
||||
if(compare){
|
||||
baseline = outputfilename.replace (verExt,baseExt);
|
||||
CompareFiles(baseDir,verDir,baseline,outputfilename);
|
||||
}
|
||||
|
||||
filename=embed.GetNextFileInDirectory();
|
||||
alert("successful");
|
||||
if( filename != null) {
|
||||
theWindow = window.open(filename);
|
||||
theWindow.location = filename;
|
||||
} else {
|
||||
// all complete
|
||||
theWindow.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -60,12 +194,87 @@ var loadingFlag;
|
|||
|
||||
</script>
|
||||
|
||||
<center>
|
||||
<h3 id="status"> OUTPUT IDLE </h3>
|
||||
<div id="output" align="left" style="overflow:auto; width:600; height:100; border:solid red">
|
||||
</div>
|
||||
<br>
|
||||
<form name="formname">
|
||||
<input type=button value="DumpFrames" onclick='DumpFrames(true,0)'>
|
||||
<form name="TestForm">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
Regression Directory
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="RegTestDir" value="file:///S|/mozilla/layout/html/tests/table/dom" size=50>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
BaseLine Extension
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="baseExt" value=".bas">
|
||||
</td>
|
||||
<td>
|
||||
Verify Extension
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="verExt" value=".ver">
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
BaseLine Output Directory
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="baseDir" value = "s:/tests/">
|
||||
</td>
|
||||
<td>
|
||||
Verify Output Directory
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="verDir" value = "s:/tests/">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Run Baseline
|
||||
</td>
|
||||
<td>
|
||||
<input id="bl" type="radio" name="testType" value="runbaseline" checked >
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Run Verify
|
||||
</td>
|
||||
<td>
|
||||
<input id="vf" type="radio" name="testType" value="runverify" >
|
||||
</td>
|
||||
<td>
|
||||
Compare Now
|
||||
<td>
|
||||
<td>
|
||||
<input id="comp" type="checkbox" name="compare" checked >
|
||||
</td)
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<input type=button value="DumpFrames" onclick='DumpFrames(true,0)'>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</form>
|
||||
|
||||
</center>
|
||||
|
||||
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
|
|
@ -58,9 +58,12 @@
|
|||
#include "nsIFrameDebug.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsStyleStruct.h"
|
||||
#include "nsIFrameUtil.h"
|
||||
#include "nsLayoutCID.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsDebugObject, nsIDebugObject)
|
||||
|
||||
static NS_DEFINE_IID(kFrameUtilCID, NS_FRAME_UTIL_CID);
|
||||
static NS_DEFINE_IID(kIFrameUtilIID, NS_IFRAME_UTIL_IID);
|
||||
|
||||
/** ---------------------------------------------------
|
||||
* See documentation in nsDebugObject.h
|
||||
|
@ -113,10 +116,18 @@ PRBool stillLoading;
|
|||
presShell->GetRootFrame(&root);
|
||||
if (NS_SUCCEEDED(CallQueryInterface(root, &fdbg))) {
|
||||
|
||||
FILE* fp = fopen("s:/testdump.txt", "wt");
|
||||
// create the string for the output
|
||||
nsCAutoString outputPath;
|
||||
outputPath.AssignWithConversion(aFilePath);
|
||||
outputPath.AppendWithConversion(aFileName);
|
||||
char* filePath = ToNewCString(outputPath);
|
||||
|
||||
FILE* fp = fopen(filePath, "wt");
|
||||
|
||||
presShell->GetPresContext(&thePC);
|
||||
fdbg->DumpRegressionData(thePC, fp, 0, PR_TRUE);
|
||||
fclose(fp);
|
||||
delete filePath;
|
||||
result = NS_OK; // the document is now loaded, and the frames are dumped.
|
||||
}
|
||||
}
|
||||
|
@ -126,5 +137,47 @@ PRBool stillLoading;
|
|||
return result;
|
||||
}
|
||||
|
||||
/** ---------------------------------------------------
|
||||
* See documentation in nsDebugObject.h
|
||||
* @update 6/21/00 dwc
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsDebugObject::CompareFrameModels(const PRUnichar *aBasePath, const PRUnichar *aVerifyPath,
|
||||
const PRUnichar *aBaseLineFileName, const PRUnichar *aVerifyFileName, PRUint32 aFlags)
|
||||
{
|
||||
nsresult result = NS_ERROR_FAILURE;
|
||||
nsCAutoString tempString;
|
||||
nsCAutoString verifyFile;
|
||||
char* baselineFilePath;
|
||||
char* verifyFilePath;
|
||||
FILE *bp,*vp;
|
||||
|
||||
|
||||
tempString.AssignWithConversion(aBasePath);
|
||||
tempString.AppendWithConversion(aBaseLineFileName);
|
||||
baselineFilePath = ToNewCString(tempString);
|
||||
|
||||
tempString.AssignWithConversion(aVerifyPath);
|
||||
tempString.AppendWithConversion(aVerifyFileName);
|
||||
verifyFilePath = ToNewCString(tempString);
|
||||
|
||||
bp = fopen(baselineFilePath, "rt");
|
||||
if (bp) {
|
||||
vp = fopen(verifyFilePath, "rt");
|
||||
if (vp) {
|
||||
nsIFrameUtil* fu;
|
||||
nsresult rv = nsComponentManager::CreateInstance(kFrameUtilCID, nsnull,
|
||||
kIFrameUtilIID, (void **)&fu);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
result = fu->CompareRegressionData(bp,vp,1);
|
||||
}
|
||||
fclose(vp);
|
||||
}
|
||||
fclose(bp);
|
||||
}
|
||||
delete baselineFilePath;
|
||||
delete verifyFilePath;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,9 +58,12 @@
|
|||
#include "nsIFrameDebug.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsStyleStruct.h"
|
||||
#include "nsIFrameUtil.h"
|
||||
#include "nsLayoutCID.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsDebugObject, nsIDebugObject)
|
||||
|
||||
static NS_DEFINE_IID(kFrameUtilCID, NS_FRAME_UTIL_CID);
|
||||
static NS_DEFINE_IID(kIFrameUtilIID, NS_IFRAME_UTIL_IID);
|
||||
|
||||
/** ---------------------------------------------------
|
||||
* See documentation in nsDebugObject.h
|
||||
|
@ -113,10 +116,18 @@ PRBool stillLoading;
|
|||
presShell->GetRootFrame(&root);
|
||||
if (NS_SUCCEEDED(CallQueryInterface(root, &fdbg))) {
|
||||
|
||||
FILE* fp = fopen("s:/testdump.txt", "wt");
|
||||
// create the string for the output
|
||||
nsCAutoString outputPath;
|
||||
outputPath.AssignWithConversion(aFilePath);
|
||||
outputPath.AppendWithConversion(aFileName);
|
||||
char* filePath = ToNewCString(outputPath);
|
||||
|
||||
FILE* fp = fopen(filePath, "wt");
|
||||
|
||||
presShell->GetPresContext(&thePC);
|
||||
fdbg->DumpRegressionData(thePC, fp, 0, PR_TRUE);
|
||||
fclose(fp);
|
||||
delete filePath;
|
||||
result = NS_OK; // the document is now loaded, and the frames are dumped.
|
||||
}
|
||||
}
|
||||
|
@ -126,5 +137,47 @@ PRBool stillLoading;
|
|||
return result;
|
||||
}
|
||||
|
||||
/** ---------------------------------------------------
|
||||
* See documentation in nsDebugObject.h
|
||||
* @update 6/21/00 dwc
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsDebugObject::CompareFrameModels(const PRUnichar *aBasePath, const PRUnichar *aVerifyPath,
|
||||
const PRUnichar *aBaseLineFileName, const PRUnichar *aVerifyFileName, PRUint32 aFlags)
|
||||
{
|
||||
nsresult result = NS_ERROR_FAILURE;
|
||||
nsCAutoString tempString;
|
||||
nsCAutoString verifyFile;
|
||||
char* baselineFilePath;
|
||||
char* verifyFilePath;
|
||||
FILE *bp,*vp;
|
||||
|
||||
|
||||
tempString.AssignWithConversion(aBasePath);
|
||||
tempString.AppendWithConversion(aBaseLineFileName);
|
||||
baselineFilePath = ToNewCString(tempString);
|
||||
|
||||
tempString.AssignWithConversion(aVerifyPath);
|
||||
tempString.AppendWithConversion(aVerifyFileName);
|
||||
verifyFilePath = ToNewCString(tempString);
|
||||
|
||||
bp = fopen(baselineFilePath, "rt");
|
||||
if (bp) {
|
||||
vp = fopen(verifyFilePath, "rt");
|
||||
if (vp) {
|
||||
nsIFrameUtil* fu;
|
||||
nsresult rv = nsComponentManager::CreateInstance(kFrameUtilCID, nsnull,
|
||||
kIFrameUtilIID, (void **)&fu);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
result = fu->CompareRegressionData(bp,vp,1);
|
||||
}
|
||||
fclose(vp);
|
||||
}
|
||||
fclose(bp);
|
||||
}
|
||||
delete baselineFilePath;
|
||||
delete verifyFilePath;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче