Move towards replacing viewer by reorganizing files and renaming classes. b=137331 r+sr=bryner

This commit is contained in:
dbaron%dbaron.org 2003-06-27 21:37:29 +00:00
Родитель a835d37852
Коммит fb9db912e3
16 изменённых файлов: 94 добавлений и 1066 удалений

Просмотреть файл

@ -26,7 +26,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS += public src idl
DIRS = src
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -1,36 +0,0 @@
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = layout_debug
DEFINES=-D_IMPL_NS_UI
XPIDLSRCS = \
nsIFrameDebugObject.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -1,112 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Don Cone <dcone@netscape.com>
* Sion Fraser <sfraser@netscape.com>
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIDOMWindow;
interface nsILocalFile;
[scriptable, uuid(1B4CD090-0531-11d6-A876-00105A183419)]
interface nsIFrameDebugObject : nsISupports
{
/**
* Output the given string to a file, optionally truncating the file first.
* @param aFile the file to output to
* @param aTruncateFile whether to trunate the file first
* @param aOutputString the string to write out
*/
void outputTextToFile(in nsILocalFile aFile, in boolean aTruncateFile, in string aOutputString);
/**
* Dumps the content of a window
* @param aWindowToDump the window to dump (may be an iframe etc)
* @param aFile the file to dump to. It will be created if necessary, otherwise
truncated. If nil, write to stdout.
* @param aFlagsMask some flags that determine what to dump
* @param aFlagsMask some flags that determine what to dump
* @param aResult a status value indicating whether the dump happened,
whether the page was still loading, or whether some other error happened.
*/
const short DUMP_FLAGS_MASK_DEFAULT = 0;
const short DUMP_FLAGS_MASK_DUMP_STYLE = 1;
const long DUMP_RESULT_COMPLETED = 0; // loaded OK
const long DUMP_RESULT_LOADING = 1; // still loading
const long DUMP_RESULT_ERROR = 2; // an error occurred
long dumpFrameModel(in nsIDOMWindow aWindowToDump, in nsILocalFile aFile, in unsigned long aFlagsMask);
/**
* Compares the contents of frame model files
* @param aBaseFile the baseline file, opened with read permissions
* @param aVerFile file containing the results to verify, opened with read permissions
* @param aFlags flags specifying output verbosity
* @param aResult result of the comparison: zero if the files are same, non-zero if different
*/
const short COMPARE_FLAGS_VERBOSE = 0;
const short COMPARE_FLAGS_BRIEF = 1;
long compareFrameModels(in nsILocalFile aBaseFile, in nsILocalFile aVerFile, in unsigned long aFlags);
/**
* Methods to dump various types of data. In all casese, if aDestFile is nil,
* data is written to stdout.
*/
void dumpContent(in nsIDOMWindow aWindow, in nsILocalFile aDestFile);
void dumpFrames(in nsIDOMWindow aWindow, in nsILocalFile aDestFile);
void dumpViews(in nsIDOMWindow aWindow, in nsILocalFile aDestFile);
void dumpWebShells(in nsIDOMWindow aWindow, in nsILocalFile aDestFile);
void dumpStyleSheets(in nsIDOMWindow aWindow, in nsILocalFile aDestFile);
void dumpStyleContexts(in nsIDOMWindow aWindow, in nsILocalFile aDestFile);
void dumpReflowStats(in nsIDOMWindow aWindow, in nsILocalFile aDestFile);
/**
* Turn reflow stats on or off for the given window. Requires that
* you built with MOZ_REFLOW_PERF=1
*/
void setShowReflowStats(in nsIDOMWindow aWindow, in boolean inShow);
attribute boolean showFrameBorders; // whether to show frame borders
attribute boolean showEventTargetFrameBorder; // whether to show event target frame borders
};

Просмотреть файл

@ -1,36 +0,0 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = layout_debug
EXPORTS = \
nsLayoutDebugCIID.h \
$(NULL)
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -1,51 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsFrameDebugCIID_h__
#define nsFrameDebugCIID_h__
#include "nsISupports.h"
#include "nsIFactory.h"
#include "nsIComponentManager.h"
#define NS_FRAME_DEBUG_OBJECT_CID \
{ 0x698c54f4, 0x4ea9, 0x11d7, \
{ 0x85, 0x9f, 0x00, 0x03, 0x93, 0x63, 0x65, 0x92 } }
#endif // nsFrameDebugCIID_h__

Просмотреть файл

@ -28,32 +28,39 @@ include $(DEPTH)/config/autoconf.mk
MODULE = layout_debug
LIBRARY_NAME = gkdebug
EXPORT_LIBRARY = 1
EXPORT_LIBRARY = 1
IS_COMPONENT = 1
MODULE_NAME = nsLayoutDebugModule
REQUIRES= xpcom \
string \
debugobject\
windowwatcher\
docshell\
string \
dom\
gfx\
content\
necko\
layout\
widget \
locale \
view \
pref \
imglib2 \
unicharutil \
$(NULL)
string \
windowwatcher\
docshell\
string \
dom\
gfx\
content\
necko\
layout\
widget \
locale \
view \
pref \
imglib2 \
unicharutil \
$(NULL)
XPIDLSRCS = \
nsILayoutRegressionTester.idl \
$(NULL)
EXPORTS = \
nsLayoutDebugCIID.h \
$(NULL)
CPPSRCS = \
nsDebugObject.cpp \
nsDebugFactory.cpp \
nsRegressionTester.cpp \
$(NULL)
EXTRA_DSO_LDOPTS = \

Просмотреть файл

@ -40,21 +40,21 @@
#include "nsLayoutDebugCIID.h"
#include "nsIFactory.h"
#include "nsISupports.h"
#include "nsDebugObject.h"
#include "nsRegressionTester.h"
#include "nsIGenericFactory.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDebugObject)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsRegressionTester)
static const nsModuleComponentInfo components[] =
{
{ "nsDebugObject",
NS_FRAME_DEBUG_OBJECT_CID,
"@mozilla.org/layout_debug/framedebugobject;1",
nsDebugObjectConstructor
{ "nsRegressionTester",
NS_REGRESSION_TESTER_CID,
"@mozilla.org/layout_debug/regressiontester;1",
nsRegressionTesterConstructor
}
};

Просмотреть файл

@ -1,675 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
*
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.h"
#include "nsDebugObject.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsIWindowWatcher.h"
#include "nsVoidArray.h"
#include "prmem.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeNode.h"
#include "nsIDOMWindowInternal.h"
#include "nsIPresShell.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIURI.h"
#include "nsIDOMHTMLDocument.h"
#include "nsISimpleEnumerator.h"
#include "nsIScriptGlobalObject.h"
#include "nsIDocShell.h"
#include "nsIFrameDebug.h"
#include "nsIFrame.h"
#include "nsStyleStruct.h"
#include "nsIFrameUtil.h"
#include "nsLayoutCID.h"
#include "nsNetUtil.h"
#include "nsILocalFile.h"
#include "nsIPrefService.h"
#include "nsIViewManager.h"
#include "nsIView.h"
#include "nsIStyleSet.h"
static NS_DEFINE_CID(kFrameUtilCID, NS_FRAME_UTIL_CID);
static NS_DEFINE_CID(kLayoutDebuggerCID, NS_LAYOUT_DEBUGGER_CID);
nsDebugObject::nsDebugObject()
{
}
nsDebugObject::~nsDebugObject()
{
}
NS_IMPL_ISUPPORTS1(nsDebugObject, nsIFrameDebugObject)
NS_IMETHODIMP
nsDebugObject::OutputTextToFile(nsILocalFile *aFile, PRBool aTruncateFile, const char *aOutputString)
{
NS_ENSURE_ARG(aOutputString);
FILE* fp = stdout;
if (aFile)
{
const char* options = (aTruncateFile) ? "wt" : "at";
nsresult rv = aFile->OpenANSIFileDesc(options, &fp);
if (NS_FAILED(rv)) return rv;
}
fprintf(fp, aOutputString);
fprintf(fp, "\n");
if (fp != stdout)
fclose(fp);
return NS_OK;
}
NS_IMETHODIMP
nsDebugObject::DumpFrameModel(nsIDOMWindow *aWindowToDump, nsILocalFile *aDestFile, PRUint32 aFlagsMask, PRInt32 *aResult)
{
NS_ENSURE_ARG(aWindowToDump);
NS_ENSURE_ARG_POINTER(aResult);
nsresult rv = NS_ERROR_NOT_AVAILABLE;
PRUint32 busyFlags;
PRBool stillLoading;
*aResult = DUMP_RESULT_ERROR;
nsCOMPtr<nsIDocShell> docShell;
rv = GetDocShellFromWindow(aWindowToDump, getter_AddRefs(docShell));
if (NS_FAILED(rv)) return rv;
// find out if the document is loaded
docShell->GetBusyFlags(&busyFlags);
stillLoading = busyFlags && (nsIDocShell::BUSY_FLAGS_BUSY | nsIDocShell::BUSY_FLAGS_PAGE_LOADING);
if (stillLoading)
{
*aResult = DUMP_RESULT_LOADING;
return NS_OK;
}
nsCOMPtr<nsIPresShell> presShell;
docShell->GetPresShell(getter_AddRefs(presShell));
nsIFrame* root;
presShell->GetRootFrame(&root);
nsIFrameDebug* fdbg;
rv = CallQueryInterface(root, &fdbg);
if (NS_FAILED(rv)) return rv;
PRBool dumpStyle = (aFlagsMask & DUMP_FLAGS_MASK_DUMP_STYLE) != 0;
FILE* fp = stdout;
if (aDestFile)
{
rv = aDestFile->OpenANSIFileDesc("w", &fp);
if (NS_FAILED(rv)) return rv;
}
nsCOMPtr<nsIPresContext> presContext;
presShell->GetPresContext(getter_AddRefs(presContext));
fdbg->DumpRegressionData(presContext, fp, 0, dumpStyle);
if (fp != stdout)
fclose(fp);
*aResult = DUMP_RESULT_COMPLETED;
return NS_OK;
}
/* void dumpContent (in nsIDOMWindow aWindow, in nsILocalFile aDestFile); */
NS_IMETHODIMP
nsDebugObject::DumpContent(nsIDOMWindow *aWindow, nsILocalFile *aDestFile)
{
NS_ENSURE_ARG(aWindow);
nsCOMPtr<nsIDocShell> docShell;
nsresult rv = GetDocShellFromWindow(aWindow, getter_AddRefs(docShell));
if (NS_FAILED(rv)) return rv;
FILE* fp = stdout;
if (aDestFile)
{
rv = aDestFile->OpenANSIFileDesc("w", &fp);
if (NS_FAILED(rv)) return rv;
}
DumpContentRecurse(docShell, fp);
DumpMultipleWebShells(aWindow, fp);
if (fp != stdout)
fclose(fp);
return NS_OK;
}
/* void dumpFrames (in nsIDOMWindow aWindow, in nsILocalFile aDestFile); */
NS_IMETHODIMP
nsDebugObject::DumpFrames(nsIDOMWindow *aWindow, nsILocalFile *aDestFile)
{
NS_ENSURE_ARG(aWindow);
nsCOMPtr<nsIDocShell> docShell;
nsresult rv = GetDocShellFromWindow(aWindow, getter_AddRefs(docShell));
if (NS_FAILED(rv)) return rv;
FILE* fp = stdout;
if (aDestFile)
{
rv = aDestFile->OpenANSIFileDesc("w", &fp);
if (NS_FAILED(rv)) return rv;
}
DumpFramesRecurse(docShell, fp);
DumpMultipleWebShells(aWindow, fp);
if (fp != stdout)
fclose(fp);
return NS_OK;
}
NS_IMETHODIMP
nsDebugObject::DumpViews(nsIDOMWindow *aWindow, nsILocalFile *aDestFile)
{
NS_ENSURE_ARG(aWindow);
nsCOMPtr<nsIDocShell> docShell;
nsresult rv = GetDocShellFromWindow(aWindow, getter_AddRefs(docShell));
if (NS_FAILED(rv)) return rv;
FILE* fp = stdout;
if (aDestFile)
{
rv = aDestFile->OpenANSIFileDesc("w", &fp);
if (NS_FAILED(rv)) return rv;
}
DumpViewsRecurse(docShell, fp);
DumpMultipleWebShells(aWindow, fp);
if (fp != stdout)
fclose(fp);
return NS_OK;
}
/* void dumpWebShells (in nsIDOMWindow aWindow, in nsILocalFile aDestFile); */
NS_IMETHODIMP
nsDebugObject::DumpWebShells(nsIDOMWindow *aWindow, nsILocalFile *aDestFile)
{
NS_ENSURE_ARG(aWindow);
nsCOMPtr<nsIDocShell> docShell;
nsresult rv = GetDocShellFromWindow(aWindow, getter_AddRefs(docShell));
nsCOMPtr<nsIDocShellTreeItem> shellAsItem(do_QueryInterface(docShell));
if (!shellAsItem) return NS_ERROR_FAILURE;
FILE* outFile = stdout;
if (aDestFile)
{
rv = aDestFile->OpenANSIFileDesc("w", &outFile);
if (NS_FAILED(rv)) return rv;
}
DumpAWebShell(shellAsItem, outFile);
if (outFile != stdout)
fclose(outFile);
return NS_OK;
}
NS_IMETHODIMP
nsDebugObject::DumpStyleSheets(nsIDOMWindow *aWindow, nsILocalFile *aDestFile)
{
NS_ENSURE_ARG(aWindow);
nsCOMPtr<nsIPresShell> presShell;
nsresult rv = GetPresShellFromWindow(aWindow, getter_AddRefs(presShell));
if (NS_FAILED(rv)) return rv;
FILE* outFile = stdout;
if (aDestFile)
{
rv = aDestFile->OpenANSIFileDesc("w", &outFile);
if (NS_FAILED(rv)) return rv;
}
nsCOMPtr<nsIStyleSet> styleSet;
presShell->GetStyleSet(getter_AddRefs(styleSet));
if (styleSet)
styleSet->List(outFile);
else
fputs("null style set\n", outFile);
if (outFile != stdout)
fclose(outFile);
return NS_OK;
}
NS_IMETHODIMP
nsDebugObject::DumpStyleContexts(nsIDOMWindow *aWindow, nsILocalFile *aDestFile)
{
NS_ENSURE_ARG(aWindow);
nsCOMPtr<nsIPresShell> presShell;
nsresult rv = GetPresShellFromWindow(aWindow, getter_AddRefs(presShell));
if (NS_FAILED(rv)) return rv;
FILE* outFile = stdout;
if (aDestFile)
{
rv = aDestFile->OpenANSIFileDesc("w", &outFile);
if (NS_FAILED(rv)) return rv;
}
nsCOMPtr<nsIStyleSet> styleSet;
presShell->GetStyleSet(getter_AddRefs(styleSet));
if (styleSet)
{
nsIFrame* root;
presShell->GetRootFrame(&root);
if (root)
fputs("null root frame\n", outFile);
else
styleSet->ListContexts(root, outFile);
}
else
fputs("null style set\n", outFile);
if (outFile != stdout)
fclose(outFile);
return NS_OK;
}
/* void dumpReflowStats (in nsIDOMWindow aWindow, in nsILocalFile aDestFile); */
NS_IMETHODIMP
nsDebugObject::DumpReflowStats(nsIDOMWindow *aWindow, nsILocalFile* /* aDestFile */)
{
NS_ENSURE_ARG(aWindow);
nsCOMPtr<nsIPresShell> presShell;
nsresult rv = GetPresShellFromWindow(aWindow, getter_AddRefs(presShell));
if (NS_FAILED(rv)) return rv;
#ifdef MOZ_REFLOW_PERF
presShell->DumpReflows();
#else
fprintf(stdout, "***********************************\n");
fprintf(stdout, "Sorry, you haven't built with MOZ_REFLOW_PERF=1\n");
fprintf(stdout, "***********************************\n");
#endif
return NS_OK;
}
NS_IMETHODIMP
nsDebugObject::CompareFrameModels(nsILocalFile *aBaseFile, nsILocalFile *aVerFile, PRUint32 aFlags, PRInt32 *aResult)
{
NS_ENSURE_ARG(aBaseFile);
NS_ENSURE_ARG(aVerFile);
NS_ENSURE_ARG_POINTER(aResult);
*aResult = NS_OK;
nsresult rv;
FILE* baseFile;
rv = aBaseFile->OpenANSIFileDesc("r", &baseFile);
if (NS_FAILED(rv)) return rv;
FILE* verFile;
rv = aVerFile->OpenANSIFileDesc("r", &verFile);
if (NS_FAILED(rv)) {
fclose(baseFile);
return rv;
}
nsCOMPtr<nsIFrameUtil> frameUtil = do_CreateInstance(kFrameUtilCID, &rv);
if (NS_SUCCEEDED(rv))
{
PRInt32 outputLevel = (aFlags == COMPARE_FLAGS_VERBOSE) ? 0 : 1;
rv = frameUtil->CompareRegressionData(baseFile, verFile, outputLevel);
}
fclose(verFile);
fclose(baseFile);
*aResult = NS_FAILED(rv);
return NS_OK;
}
NS_IMETHODIMP
nsDebugObject::GetShowFrameBorders(PRBool *aShowFrameBorders)
{
NS_ENSURE_ARG_POINTER(aShowFrameBorders);
NS_ENSURE_SUCCESS(EnsureLayoutDebugger(), NS_ERROR_FAILURE);
return mLayoutDebugger->GetShowFrameBorders(aShowFrameBorders);
}
NS_IMETHODIMP
nsDebugObject::SetShowFrameBorders(PRBool aShowFrameBorders)
{
NS_ENSURE_SUCCESS(EnsureLayoutDebugger(), NS_ERROR_FAILURE);
nsresult rv = mLayoutDebugger->SetShowFrameBorders(aShowFrameBorders);
RefreshAllWindows();
return rv;
}
NS_IMETHODIMP
nsDebugObject::GetShowEventTargetFrameBorder(PRBool *aShowEventTargetFrameBorder)
{
NS_ENSURE_ARG_POINTER(aShowEventTargetFrameBorder);
NS_ENSURE_SUCCESS(EnsureLayoutDebugger(), NS_ERROR_FAILURE);
return mLayoutDebugger->GetShowEventTargetFrameBorder(aShowEventTargetFrameBorder);
}
NS_IMETHODIMP
nsDebugObject::SetShowEventTargetFrameBorder(PRBool aShowEventTargetFrameBorder)
{
NS_ENSURE_SUCCESS(EnsureLayoutDebugger(), NS_ERROR_FAILURE);
nsresult rv = mLayoutDebugger->SetShowEventTargetFrameBorder(aShowEventTargetFrameBorder);
RefreshAllWindows();
return rv;
}
NS_IMETHODIMP
nsDebugObject::SetShowReflowStats(nsIDOMWindow *aWindow, PRBool inShow)
{
nsCOMPtr<nsIPresShell> presShell;
nsresult rv = GetPresShellFromWindow(aWindow, getter_AddRefs(presShell));
if (NS_FAILED(rv)) return rv;
#ifdef MOZ_REFLOW_PERF
presShell->SetPaintFrameCount(inShow);
#else
printf("***********************************************\n");
printf("Sorry, you haven't built with MOZ_REFLOW_PERF=1\n");
printf("***********************************************\n");
#endif
return NS_OK;
}
nsresult
nsDebugObject::EnsureLayoutDebugger()
{
if (!mLayoutDebugger)
{
nsresult rv;
mLayoutDebugger = do_CreateInstance(kLayoutDebuggerCID, &rv);
if (NS_FAILED(rv))
return rv;
}
return NS_OK;
}
nsresult
nsDebugObject::RefreshAllWindows()
{
nsresult rv;
// hack. Toggle the underline links pref to get stuff to redisplay
nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefBranch)
{
PRBool underlineLinksPref;
rv = prefBranch->GetBoolPref("browser.underline_anchors", &underlineLinksPref);
if (NS_SUCCEEDED(rv))
{
prefBranch->SetBoolPref("browser.underline_anchors", !underlineLinksPref);
prefBranch->SetBoolPref("browser.underline_anchors", underlineLinksPref);
}
}
return NS_OK;
}
nsresult
nsDebugObject::GetDocShellFromWindow(nsIDOMWindow* inWindow, nsIDocShell** outShell)
{
nsCOMPtr<nsIScriptGlobalObject> scriptObj(do_QueryInterface(inWindow));
if (!scriptObj) return NS_ERROR_FAILURE;
return scriptObj->GetDocShell(outShell);
}
nsresult
nsDebugObject::GetPresShellFromWindow(nsIDOMWindow* inWindow, nsIPresShell** outShell)
{
nsCOMPtr<nsIDocShell> docShell;
GetDocShellFromWindow(inWindow, getter_AddRefs(docShell));
if (!docShell) return NS_ERROR_FAILURE;
nsresult rv = docShell->GetPresShell(outShell);
if (NS_FAILED(rv)) return rv;
if (!*outShell) return NS_ERROR_FAILURE;
return NS_OK;
}
#if 0
#pragma mark -
#endif
void
nsDebugObject::DumpMultipleWebShells(nsIDOMWindow* aWindow, FILE* aOut)
{
nsCOMPtr<nsIDocShell> docShell;
GetDocShellFromWindow(aWindow, getter_AddRefs(docShell));
if (!docShell) return;
PRInt32 count;
nsCOMPtr<nsIDocShellTreeNode> docShellAsNode(do_QueryInterface(docShell));
if (docShellAsNode) {
docShellAsNode->GetChildCount(&count);
if (count > 0) {
nsCOMPtr<nsIDocShellTreeItem> docShellAsStupidItem(do_QueryInterface(docShell));
fprintf(aOut, "webshells= \n");
DumpAWebShell(docShellAsStupidItem, aOut);
}
}
}
void
nsDebugObject::DumpAWebShell(nsIDocShellTreeItem* aShellItem, FILE* aOut, PRInt32 aIndent)
{
nsXPIDLString name;
nsAutoString str;
nsCOMPtr<nsIDocShellTreeItem> parent;
PRInt32 i;
for (i = aIndent; --i >= 0; ) fprintf(aOut, " ");
fprintf(aOut, "%p '", aShellItem);
aShellItem->GetName(getter_Copies(name));
aShellItem->GetSameTypeParent(getter_AddRefs(parent));
str.Assign(name);
fputs(NS_LossyConvertUCS2toASCII(str).get(), aOut);
fprintf(aOut, "' parent=%p <\n", parent.get());
aIndent++;
nsCOMPtr<nsIDocShellTreeNode> shellAsNode(do_QueryInterface(aShellItem));
PRInt32 numChildren;
shellAsNode->GetChildCount(&numChildren);
for (i = 0; i < numChildren; i++) {
nsCOMPtr<nsIDocShellTreeItem> child;
shellAsNode->GetChildAt(i, getter_AddRefs(child));
if (child) {
DumpAWebShell(child, aOut, aIndent);
}
}
aIndent--;
for (i = aIndent; --i >= 0; ) fprintf(aOut, " ");
fputs(">\n", aOut);
}
void
nsDebugObject::DumpContentRecurse(nsIDocShell* inDocShell, FILE* inDestFile)
{
if (inDocShell)
{
fprintf(inDestFile, "docshell=%p \n", inDocShell);
nsCOMPtr<nsIPresShell> presShell;
inDocShell->GetPresShell(getter_AddRefs(presShell));
if (presShell)
{
nsCOMPtr<nsIDocument> doc;
presShell->GetDocument(getter_AddRefs(doc));
if (doc)
{
nsCOMPtr<nsIContent> root;
doc->GetRootContent(getter_AddRefs(root));
if (root)
root->List(inDestFile);
}
}
else
{
fputs("null pres shell\n", inDestFile);
}
// dump the frames of the sub documents
nsCOMPtr<nsIDocShellTreeNode> docShellAsNode(do_QueryInterface(inDocShell));
PRInt32 numChildren;
docShellAsNode->GetChildCount(&numChildren);
for (PRInt32 i = 0; i < numChildren; i++)
{
nsCOMPtr<nsIDocShellTreeItem> child;
docShellAsNode->GetChildAt(i, getter_AddRefs(child));
nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
if (child)
DumpContentRecurse(childAsShell, inDestFile);
}
}
}
void
nsDebugObject::DumpFramesRecurse(nsIDocShell* aDocShell, FILE* inDestFile)
{
if (aDocShell)
{
fprintf(inDestFile, "webshell=%p \n", aDocShell);
nsCOMPtr<nsIPresShell> presShell;
aDocShell->GetPresShell(getter_AddRefs(presShell));
if (presShell)
{
nsIFrame* root;
presShell->GetRootFrame(&root);
if (root)
{
nsCOMPtr<nsIPresContext> presContext;
presShell->GetPresContext(getter_AddRefs(presContext));
nsIFrameDebug* fdbg;
if (NS_SUCCEEDED(CallQueryInterface(root, &fdbg)))
fdbg->List(presContext, inDestFile, 0);
}
}
else
{
fputs("null pres shell\n", inDestFile);
}
// dump the frames of the sub documents
nsCOMPtr<nsIDocShellTreeNode> docShellAsNode(do_QueryInterface(aDocShell));
PRInt32 numChildren;
docShellAsNode->GetChildCount(&numChildren);
for (PRInt32 i = 0; i < numChildren; i++)
{
nsCOMPtr<nsIDocShellTreeItem> child;
docShellAsNode->GetChildAt(i, getter_AddRefs(child));
nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
if (childAsShell)
DumpFramesRecurse(childAsShell, inDestFile);
}
}
}
void
nsDebugObject::DumpViewsRecurse(nsIDocShell* aDocShell, FILE* inDestFile)
{
if (aDocShell)
{
fprintf(inDestFile, "webshell=%p \n", aDocShell);
nsCOMPtr<nsIPresShell> presShell;
aDocShell->GetPresShell(getter_AddRefs(presShell));
if (presShell)
{
nsCOMPtr<nsIViewManager> vm;
presShell->GetViewManager(getter_AddRefs(vm));
if (vm)
{
nsIView* root;
vm->GetRootView(root);
if (root)
root->List(inDestFile);
}
}
else
{
fputs("null pres shell\n", inDestFile);
}
// dump the frames of the sub documents
nsCOMPtr<nsIDocShellTreeNode> docShellAsNode(do_QueryInterface(aDocShell));
PRInt32 numChildren;
docShellAsNode->GetChildCount(&numChildren);
for (PRInt32 i = 0; i < numChildren; i++)
{
nsCOMPtr<nsIDocShellTreeItem> child;
docShellAsNode->GetChildAt(i, getter_AddRefs(child));
nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
if (childAsShell)
DumpViewsRecurse(childAsShell, inDestFile);
}
}
}

Просмотреть файл

@ -1,69 +0,0 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications, Inc. Portions created by Netscape are
* Copyright (C) 1999, Mozilla. All Rights Reserved.
*
* Contributor(s):
*/
#ifndef nsDebugObject_h__
#define nsDebugObject_h__
#include "nsCOMPtr.h"
#include "nsIFrameDebugObject.h"
#include "nsILayoutDebugger.h"
class nsIDOMWindow;
class nsIPresShell;
class nsIDocShell;
class nsIDocShellTreeItem;
//*****************************************************************************
//*** nsDebugObject
//*****************************************************************************
class nsDebugObject : public nsIFrameDebugObject
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIFRAMEDEBUGOBJECT
nsDebugObject();
virtual ~nsDebugObject();
protected:
nsresult EnsureLayoutDebugger();
nsresult RefreshAllWindows();
nsresult GetDocShellFromWindow(nsIDOMWindow* inWindow, nsIDocShell** outShell);
nsresult GetPresShellFromWindow(nsIDOMWindow* inWindow, nsIPresShell** outShell);
void DumpAWebShell(nsIDocShellTreeItem* inShellItem, FILE* inDestFile, PRInt32 inIndent = 0);
void DumpMultipleWebShells(nsIDOMWindow* inWindow, FILE* inDestFile);
void DumpContentRecurse(nsIDocShell* inDocShell, FILE* inDestFile);
void DumpFramesRecurse(nsIDocShell* aDocShell, FILE* inDestFile);
void DumpViewsRecurse(nsIDocShell* aDocShell, FILE* inDestFile);
protected:
nsCOMPtr<nsILayoutDebugger> mLayoutDebugger;
};
#endif /* nsDebugObject_h__ */

Просмотреть файл

@ -44,7 +44,7 @@ interface nsIDOMWindow;
interface nsILocalFile;
[scriptable, uuid(1B4CD090-0531-11d6-A876-00105A183419)]
interface nsIFrameDebugObject : nsISupports
interface nsILayoutRegressionTester : nsISupports
{
/**

Просмотреть файл

@ -43,7 +43,7 @@
#include "nsIFactory.h"
#include "nsIComponentManager.h"
#define NS_FRAME_DEBUG_OBJECT_CID \
#define NS_REGRESSION_TESTER_CID \
{ 0x698c54f4, 0x4ea9, 0x11d7, \
{ 0x85, 0x9f, 0x00, 0x03, 0x93, 0x63, 0x65, 0x92 } }

Просмотреть файл

@ -38,7 +38,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.h"
#include "nsDebugObject.h"
#include "nsRegressionTester.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
@ -74,18 +74,18 @@ static NS_DEFINE_CID(kFrameUtilCID, NS_FRAME_UTIL_CID);
static NS_DEFINE_CID(kLayoutDebuggerCID, NS_LAYOUT_DEBUGGER_CID);
nsDebugObject::nsDebugObject()
nsRegressionTester::nsRegressionTester()
{
}
nsDebugObject::~nsDebugObject()
nsRegressionTester::~nsRegressionTester()
{
}
NS_IMPL_ISUPPORTS1(nsDebugObject, nsIFrameDebugObject)
NS_IMPL_ISUPPORTS1(nsRegressionTester, nsILayoutRegressionTester)
NS_IMETHODIMP
nsDebugObject::OutputTextToFile(nsILocalFile *aFile, PRBool aTruncateFile, const char *aOutputString)
nsRegressionTester::OutputTextToFile(nsILocalFile *aFile, PRBool aTruncateFile, const char *aOutputString)
{
NS_ENSURE_ARG(aOutputString);
@ -106,7 +106,7 @@ nsDebugObject::OutputTextToFile(nsILocalFile *aFile, PRBool aTruncateFile, const
NS_IMETHODIMP
nsDebugObject::DumpFrameModel(nsIDOMWindow *aWindowToDump, nsILocalFile *aDestFile, PRUint32 aFlagsMask, PRInt32 *aResult)
nsRegressionTester::DumpFrameModel(nsIDOMWindow *aWindowToDump, nsILocalFile *aDestFile, PRUint32 aFlagsMask, PRInt32 *aResult)
{
NS_ENSURE_ARG(aWindowToDump);
NS_ENSURE_ARG_POINTER(aResult);
@ -162,7 +162,7 @@ nsDebugObject::DumpFrameModel(nsIDOMWindow *aWindowToDump, nsILocalFile *aDestFi
/* void dumpContent (in nsIDOMWindow aWindow, in nsILocalFile aDestFile); */
NS_IMETHODIMP
nsDebugObject::DumpContent(nsIDOMWindow *aWindow, nsILocalFile *aDestFile)
nsRegressionTester::DumpContent(nsIDOMWindow *aWindow, nsILocalFile *aDestFile)
{
NS_ENSURE_ARG(aWindow);
@ -187,7 +187,7 @@ nsDebugObject::DumpContent(nsIDOMWindow *aWindow, nsILocalFile *aDestFile)
/* void dumpFrames (in nsIDOMWindow aWindow, in nsILocalFile aDestFile); */
NS_IMETHODIMP
nsDebugObject::DumpFrames(nsIDOMWindow *aWindow, nsILocalFile *aDestFile)
nsRegressionTester::DumpFrames(nsIDOMWindow *aWindow, nsILocalFile *aDestFile)
{
NS_ENSURE_ARG(aWindow);
@ -211,7 +211,7 @@ nsDebugObject::DumpFrames(nsIDOMWindow *aWindow, nsILocalFile *aDestFile)
}
NS_IMETHODIMP
nsDebugObject::DumpViews(nsIDOMWindow *aWindow, nsILocalFile *aDestFile)
nsRegressionTester::DumpViews(nsIDOMWindow *aWindow, nsILocalFile *aDestFile)
{
NS_ENSURE_ARG(aWindow);
@ -236,7 +236,7 @@ nsDebugObject::DumpViews(nsIDOMWindow *aWindow, nsILocalFile *aDestFile)
/* void dumpWebShells (in nsIDOMWindow aWindow, in nsILocalFile aDestFile); */
NS_IMETHODIMP
nsDebugObject::DumpWebShells(nsIDOMWindow *aWindow, nsILocalFile *aDestFile)
nsRegressionTester::DumpWebShells(nsIDOMWindow *aWindow, nsILocalFile *aDestFile)
{
NS_ENSURE_ARG(aWindow);
@ -260,7 +260,7 @@ nsDebugObject::DumpWebShells(nsIDOMWindow *aWindow, nsILocalFile *aDestFile)
}
NS_IMETHODIMP
nsDebugObject::DumpStyleSheets(nsIDOMWindow *aWindow, nsILocalFile *aDestFile)
nsRegressionTester::DumpStyleSheets(nsIDOMWindow *aWindow, nsILocalFile *aDestFile)
{
NS_ENSURE_ARG(aWindow);
@ -288,7 +288,7 @@ nsDebugObject::DumpStyleSheets(nsIDOMWindow *aWindow, nsILocalFile *aDestFile)
}
NS_IMETHODIMP
nsDebugObject::DumpStyleContexts(nsIDOMWindow *aWindow, nsILocalFile *aDestFile)
nsRegressionTester::DumpStyleContexts(nsIDOMWindow *aWindow, nsILocalFile *aDestFile)
{
NS_ENSURE_ARG(aWindow);
@ -324,7 +324,7 @@ nsDebugObject::DumpStyleContexts(nsIDOMWindow *aWindow, nsILocalFile *aDestFile)
/* void dumpReflowStats (in nsIDOMWindow aWindow, in nsILocalFile aDestFile); */
NS_IMETHODIMP
nsDebugObject::DumpReflowStats(nsIDOMWindow *aWindow, nsILocalFile* /* aDestFile */)
nsRegressionTester::DumpReflowStats(nsIDOMWindow *aWindow, nsILocalFile* /* aDestFile */)
{
NS_ENSURE_ARG(aWindow);
@ -344,7 +344,7 @@ nsDebugObject::DumpReflowStats(nsIDOMWindow *aWindow, nsILocalFile* /* aDestFile
}
NS_IMETHODIMP
nsDebugObject::CompareFrameModels(nsILocalFile *aBaseFile, nsILocalFile *aVerFile, PRUint32 aFlags, PRInt32 *aResult)
nsRegressionTester::CompareFrameModels(nsILocalFile *aBaseFile, nsILocalFile *aVerFile, PRUint32 aFlags, PRInt32 *aResult)
{
NS_ENSURE_ARG(aBaseFile);
NS_ENSURE_ARG(aVerFile);
@ -378,7 +378,7 @@ nsDebugObject::CompareFrameModels(nsILocalFile *aBaseFile, nsILocalFile *aVerFil
}
NS_IMETHODIMP
nsDebugObject::GetShowFrameBorders(PRBool *aShowFrameBorders)
nsRegressionTester::GetShowFrameBorders(PRBool *aShowFrameBorders)
{
NS_ENSURE_ARG_POINTER(aShowFrameBorders);
NS_ENSURE_SUCCESS(EnsureLayoutDebugger(), NS_ERROR_FAILURE);
@ -386,7 +386,7 @@ nsDebugObject::GetShowFrameBorders(PRBool *aShowFrameBorders)
}
NS_IMETHODIMP
nsDebugObject::SetShowFrameBorders(PRBool aShowFrameBorders)
nsRegressionTester::SetShowFrameBorders(PRBool aShowFrameBorders)
{
NS_ENSURE_SUCCESS(EnsureLayoutDebugger(), NS_ERROR_FAILURE);
nsresult rv = mLayoutDebugger->SetShowFrameBorders(aShowFrameBorders);
@ -395,7 +395,7 @@ nsDebugObject::SetShowFrameBorders(PRBool aShowFrameBorders)
}
NS_IMETHODIMP
nsDebugObject::GetShowEventTargetFrameBorder(PRBool *aShowEventTargetFrameBorder)
nsRegressionTester::GetShowEventTargetFrameBorder(PRBool *aShowEventTargetFrameBorder)
{
NS_ENSURE_ARG_POINTER(aShowEventTargetFrameBorder);
NS_ENSURE_SUCCESS(EnsureLayoutDebugger(), NS_ERROR_FAILURE);
@ -403,7 +403,7 @@ nsDebugObject::GetShowEventTargetFrameBorder(PRBool *aShowEventTargetFrameBorder
}
NS_IMETHODIMP
nsDebugObject::SetShowEventTargetFrameBorder(PRBool aShowEventTargetFrameBorder)
nsRegressionTester::SetShowEventTargetFrameBorder(PRBool aShowEventTargetFrameBorder)
{
NS_ENSURE_SUCCESS(EnsureLayoutDebugger(), NS_ERROR_FAILURE);
nsresult rv = mLayoutDebugger->SetShowEventTargetFrameBorder(aShowEventTargetFrameBorder);
@ -412,7 +412,7 @@ nsDebugObject::SetShowEventTargetFrameBorder(PRBool aShowEventTargetFrameBorder)
}
NS_IMETHODIMP
nsDebugObject::SetShowReflowStats(nsIDOMWindow *aWindow, PRBool inShow)
nsRegressionTester::SetShowReflowStats(nsIDOMWindow *aWindow, PRBool inShow)
{
nsCOMPtr<nsIPresShell> presShell;
nsresult rv = GetPresShellFromWindow(aWindow, getter_AddRefs(presShell));
@ -430,7 +430,7 @@ nsDebugObject::SetShowReflowStats(nsIDOMWindow *aWindow, PRBool inShow)
}
nsresult
nsDebugObject::EnsureLayoutDebugger()
nsRegressionTester::EnsureLayoutDebugger()
{
if (!mLayoutDebugger)
{
@ -444,7 +444,7 @@ nsDebugObject::EnsureLayoutDebugger()
}
nsresult
nsDebugObject::RefreshAllWindows()
nsRegressionTester::RefreshAllWindows()
{
nsresult rv;
// hack. Toggle the underline links pref to get stuff to redisplay
@ -464,7 +464,7 @@ nsDebugObject::RefreshAllWindows()
nsresult
nsDebugObject::GetDocShellFromWindow(nsIDOMWindow* inWindow, nsIDocShell** outShell)
nsRegressionTester::GetDocShellFromWindow(nsIDOMWindow* inWindow, nsIDocShell** outShell)
{
nsCOMPtr<nsIScriptGlobalObject> scriptObj(do_QueryInterface(inWindow));
if (!scriptObj) return NS_ERROR_FAILURE;
@ -474,7 +474,7 @@ nsDebugObject::GetDocShellFromWindow(nsIDOMWindow* inWindow, nsIDocShell** outSh
nsresult
nsDebugObject::GetPresShellFromWindow(nsIDOMWindow* inWindow, nsIPresShell** outShell)
nsRegressionTester::GetPresShellFromWindow(nsIDOMWindow* inWindow, nsIPresShell** outShell)
{
nsCOMPtr<nsIDocShell> docShell;
GetDocShellFromWindow(inWindow, getter_AddRefs(docShell));
@ -492,7 +492,7 @@ nsDebugObject::GetPresShellFromWindow(nsIDOMWindow* inWindow, nsIPresShell** out
#endif
void
nsDebugObject::DumpMultipleWebShells(nsIDOMWindow* aWindow, FILE* aOut)
nsRegressionTester::DumpMultipleWebShells(nsIDOMWindow* aWindow, FILE* aOut)
{
nsCOMPtr<nsIDocShell> docShell;
GetDocShellFromWindow(aWindow, getter_AddRefs(docShell));
@ -512,7 +512,7 @@ nsDebugObject::DumpMultipleWebShells(nsIDOMWindow* aWindow, FILE* aOut)
void
nsDebugObject::DumpAWebShell(nsIDocShellTreeItem* aShellItem, FILE* aOut, PRInt32 aIndent)
nsRegressionTester::DumpAWebShell(nsIDocShellTreeItem* aShellItem, FILE* aOut, PRInt32 aIndent)
{
nsXPIDLString name;
nsAutoString str;
@ -547,7 +547,7 @@ nsDebugObject::DumpAWebShell(nsIDocShellTreeItem* aShellItem, FILE* aOut, PRInt3
void
nsDebugObject::DumpContentRecurse(nsIDocShell* inDocShell, FILE* inDestFile)
nsRegressionTester::DumpContentRecurse(nsIDocShell* inDocShell, FILE* inDestFile)
{
if (inDocShell)
{
@ -588,7 +588,7 @@ nsDebugObject::DumpContentRecurse(nsIDocShell* inDocShell, FILE* inDestFile)
void
nsDebugObject::DumpFramesRecurse(nsIDocShell* aDocShell, FILE* inDestFile)
nsRegressionTester::DumpFramesRecurse(nsIDocShell* aDocShell, FILE* inDestFile)
{
if (aDocShell)
{
@ -633,7 +633,7 @@ nsDebugObject::DumpFramesRecurse(nsIDocShell* aDocShell, FILE* inDestFile)
void
nsDebugObject::DumpViewsRecurse(nsIDocShell* aDocShell, FILE* inDestFile)
nsRegressionTester::DumpViewsRecurse(nsIDocShell* aDocShell, FILE* inDestFile)
{
if (aDocShell)
{

Просмотреть файл

@ -19,12 +19,12 @@
* Contributor(s):
*/
#ifndef nsDebugObject_h__
#define nsDebugObject_h__
#ifndef nsRegressionTester_h__
#define nsRegressionTester_h__
#include "nsCOMPtr.h"
#include "nsIFrameDebugObject.h"
#include "nsILayoutRegressionTester.h"
#include "nsILayoutDebugger.h"
class nsIDOMWindow;
@ -33,16 +33,16 @@ class nsIDocShell;
class nsIDocShellTreeItem;
//*****************************************************************************
//*** nsDebugObject
//*** nsRegressionTester
//*****************************************************************************
class nsDebugObject : public nsIFrameDebugObject
class nsRegressionTester : public nsILayoutRegressionTester
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIFRAMEDEBUGOBJECT
NS_DECL_NSILAYOUTREGRESSIONTESTER
nsDebugObject();
virtual ~nsDebugObject();
nsRegressionTester();
virtual ~nsRegressionTester();
protected:
@ -66,4 +66,4 @@ protected:
#endif /* nsDebugObject_h__ */
#endif /* nsRegressionTester_h__ */

Просмотреть файл

@ -7,54 +7,54 @@
<script type="application/x-javascript" language="Javascript">
const nsIFrameDebugObject = Components.interfaces.nsIFrameDebugObject;
const nsILayoutRegressionTester = Components.interfaces.nsILayoutRegressionTester;
function SetShowFrameBorders(inShow)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/framedebugobject;1"].createInstance(nsIFrameDebugObject);
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.showFrameBorders = inShow;
}
function SetShowEventTargetBorders(inShow)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/framedebugobject;1"].createInstance(nsIFrameDebugObject);
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.showEventTargetFrameBorder = inShow;
}
function SetShowReflowStats(theWindow, inShow)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/framedebugobject;1"].createInstance(nsIFrameDebugObject);
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.setShowReflowStats(theWindow, inShow);
}
function DumpFrames(inWindow)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/framedebugobject;1"].createInstance(nsIFrameDebugObject);
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.dumpFrames(inWindow, null);
}
function DumpContent(inWindow)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/framedebugobject;1"].createInstance(nsIFrameDebugObject);
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.dumpContent(inWindow, null);
}
function DumpViews(inWindow)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/framedebugobject;1"].createInstance(nsIFrameDebugObject);
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.dumpViews(inWindow, null);
}
function DumpWebShells(inWindow)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/framedebugobject;1"].createInstance(nsIFrameDebugObject);
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.dumpWebShells(inWindow, null);
}
@ -77,7 +77,7 @@ function IframeLoaded()
function SetShowFrameBorders(inShow)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/framedebugobject;1"].createInstance(nsIFrameDebugObject);
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.showFrameBorders = inShow;
}
</script>

Просмотреть файл

@ -6,54 +6,54 @@
</head>
<script type="application/x-javascript" language="Javascript">
const nsIFrameDebugObject = Components.interfaces.nsIFrameDebugObject;
const nsILayoutRegressionTester = Components.interfaces.nsILayoutRegressionTester;
function SetShowFrameBorders(inShow)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/framedebugobject;1"].createInstance(nsIFrameDebugObject);
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.showFrameBorders = inShow;
}
function SetShowEventTargetBorders(inShow)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/framedebugobject;1"].createInstance(nsIFrameDebugObject);
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.showEventTargetFrameBorder = inShow;
}
function SetShowReflowStats(theWindow, inShow)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/framedebugobject;1"].createInstance(nsIFrameDebugObject);
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.setShowReflowStats(theWindow, inShow);
}
function DumpFrames()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/framedebugobject;1"].createInstance(nsIFrameDebugObject);
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.dumpFrames(window, null);
}
function DumpContent()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/framedebugobject;1"].createInstance(nsIFrameDebugObject);
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.dumpContent(window, null);
}
function DumpViews()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/framedebugobject;1"].createInstance(nsIFrameDebugObject);
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.dumpViews(window, null);
}
function DumpWebShells()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/framedebugobject;1"].createInstance(nsIFrameDebugObject);
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.dumpWebShells(window, null);
}

Просмотреть файл

@ -1,7 +1,7 @@
const nsIFilePicker = Components.interfaces.nsIFilePicker;
const nsIFrameDebugObject = Components.interfaces.nsIFrameDebugObject;
const nsILayoutRegressionTester = Components.interfaces.nsILayoutRegressionTester;
const kTestTypeBaseline = 1;
const kTestTypeVerify = 2;
@ -320,7 +320,7 @@ function ChooseOutputDirectory(inputElementID)
function CompareFrameDumps(testFileBasename, baselineDir, baselineExt, verifyDir, verifyExt)
{
var debugObject = Components.classes["@mozilla.org/layout_debug/framedebugobject;1"].createInstance(nsIFrameDebugObject);
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
var baseFile = baselineDir.clone();
baseFile.append(testFileBasename + baselineExt);
@ -328,7 +328,7 @@ function CompareFrameDumps(testFileBasename, baselineDir, baselineExt, verifyDir
var verifyFile = verifyDir.clone();
verifyFile.append(testFileBasename + verifyExt);
var filesDiffer = debugObject.compareFrameModels(baseFile, verifyFile, nsIFrameDebugObject.COMPARE_FLAGS_BRIEF);
var filesDiffer = debugObject.compareFrameModels(baseFile, verifyFile, nsILayoutRegressionTester.COMPARE_FLAGS_BRIEF);
if (filesDiffer)
{
WriteOutput("Test file '" + baseFile.leafName + "' failed", false, "red");
@ -341,13 +341,13 @@ function CompareFrameDumps(testFileBasename, baselineDir, baselineExt, verifyDir
function DumpFrames(testWindow, testFileName, outputDir, outputFileExtension)
{
var debugObject = Components.classes["@mozilla.org/layout_debug/framedebugobject;1"].createInstance(nsIFrameDebugObject);
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
var outputFile = outputDir.clone();
outputFile.append(testFileName.replace(".html", outputFileExtension));
dump("Dumping frame model for " + testFileName + " to " + outputFile.leafName + "\n");
var result = debugObject.dumpFrameModel(testWindow, outputFile, nsIFrameDebugObject.DUMP_FLAGS_MASK_DEFAULT);
var result = debugObject.dumpFrameModel(testWindow, outputFile, nsILayoutRegressionTester.DUMP_FLAGS_MASK_DEFAULT);
if (result != 0)
{
WriteOutput("dumpFrameModel for " + testFileName + " failed", false, "orange");