Add UI code, intended to replace viewer, into extensions/layout-debug/. Separate UI-related features out of existing regression testing interface. b=137331 r+sr=bryner

This commit is contained in:
dbaron%dbaron.org 2003-07-08 21:08:23 +00:00
parent e204fa5373
commit 2fa292cbc3
24 changed files with 1969 additions and 606 deletions

View File

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

View File

@ -34,24 +34,26 @@ MODULE_NAME = nsLayoutDebugModule
REQUIRES= xpcom \
string \
windowwatcher\
docshell\
windowwatcher \
docshell \
string \
dom\
gfx\
content\
necko\
layout\
dom \
gfx \
content \
necko \
layout \
widget \
locale \
view \
pref \
imglib2 \
unicharutil \
appshell \
$(NULL)
XPIDLSRCS = \
nsILayoutRegressionTester.idl \
nsILayoutDebuggingTools.idl \
$(NULL)
EXPORTS = \
@ -60,6 +62,8 @@ EXPORTS = \
CPPSRCS = \
nsDebugFactory.cpp \
nsLayoutDebugCLH.cpp \
nsLayoutDebuggingTools.cpp \
nsRegressionTester.cpp \
$(NULL)

View File

@ -41,20 +41,32 @@
#include "nsIFactory.h"
#include "nsISupports.h"
#include "nsRegressionTester.h"
#include "nsLayoutDebuggingTools.h"
#include "nsLayoutDebugCLH.h"
#include "nsIGenericFactory.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsRegressionTester)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsLayoutDebuggingTools)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsLayoutDebugCLH)
static const nsModuleComponentInfo components[] =
{
{ "nsRegressionTester",
NS_REGRESSION_TESTER_CID,
"@mozilla.org/layout_debug/regressiontester;1",
"@mozilla.org/layout-debug/regressiontester;1",
nsRegressionTesterConstructor
},
{ "nsLayoutDebuggingTools",
NS_LAYOUT_DEBUGGINGTOOLS_CID,
NS_LAYOUT_DEBUGGINGTOOLS_CONTRACTID,
nsLayoutDebuggingToolsConstructor
},
{ "LayoutDebug Startup Handler",
NS_LAYOUTDEBUGCLH_CID,
"@mozilla.org/commandlinehandler/general-startup;1?type=layoutdebug",
nsLayoutDebugCLHConstructor,
nsLayoutDebugCLH::RegisterProc,
nsLayoutDebugCLH::UnregisterProc
}
};

View File

@ -0,0 +1,84 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
// vim:cindent:tabstop=4:expandtab:shiftwidth=4:
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* 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 layout debugging code.
*
* The Initial Developer of the Original Code is L. David Baron.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* L. David Baron <dbaron@dbaron.org> (original author)
*
* 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIDOMWindow;
/**
* A series of hooks into non-IDL-ized layout code to allow all the
* layout debugging functions to be used from chrome.
*/
[scriptable, uuid(4b968d4b-9c08-4635-a7e0-55084843f0fd)]
interface nsILayoutDebuggingTools : nsISupports
{
/*
* Initialize debugger object to act on a docshell.
*/
void init(in nsIDOMWindow win);
/*
* Notify the debugger that the docshell has been told to load a new
* URI.
*/
void newURILoaded();
/* Toggle various debugging states */
attribute boolean visualDebugging;
attribute boolean visualEventDebugging;
attribute boolean paintFlashing;
attribute boolean paintDumping;
attribute boolean invalidateDumping;
attribute boolean eventDumping;
attribute boolean motionEventDumping;
attribute boolean crossingEventDumping;
attribute boolean reflowCounts;
/* Run various tests. */
void dumpWebShells();
void dumpContent();
void dumpFrames();
void dumpViews();
void dumpStyleSheets();
void dumpStyleContexts();
void dumpReflowStats();
};

View File

@ -46,15 +46,6 @@ interface nsILocalFile;
[scriptable, uuid(1B4CD090-0531-11d6-A876-00105A183419)]
interface nsILayoutRegressionTester : 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)
@ -84,29 +75,5 @@ interface nsILayoutRegressionTester : nsISupports
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
};

View File

@ -47,5 +47,11 @@
{ 0x698c54f4, 0x4ea9, 0x11d7, \
{ 0x85, 0x9f, 0x00, 0x03, 0x93, 0x63, 0x65, 0x92 } }
#define NS_LAYOUT_DEBUGGINGTOOLS_CONTRACTID \
"@mozilla.org/layout-debug/layout-debuggingtools;1"
// 3f4c3b63-e640-4712-abbf-fff1301ceb60
#define NS_LAYOUT_DEBUGGINGTOOLS_CID { 0x3f4c3b68, 0xe640, 0x4712, \
{ 0xab, 0xbf, 0xff, 0xf1, 0x30, 0x1c, 0xeb, 0x60}}
#endif // nsFrameDebugCIID_h__

View File

@ -0,0 +1,62 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
// vim:cindent:tabstop=4:expandtab:shiftwidth=4:
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* 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 layout debugging code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* L. David Baron <dbaron@dbaron.org> (original author)
*
* 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsLayoutDebugCLH.h"
#include "nsString.h"
#include "plstr.h"
nsLayoutDebugCLH::nsLayoutDebugCLH()
{
}
nsLayoutDebugCLH::~nsLayoutDebugCLH()
{
}
NS_IMPL_ISUPPORTS1(nsLayoutDebugCLH, nsICmdLineHandler)
CMDLINEHANDLER_IMPL(nsLayoutDebugCLH, "-layoutdebug",
"general.startup.layoutdebug",
"chrome://layoutdebug/content/",
"Start with Layout Debugger",
"@mozilla.org/commandlinehandler/general-startup;1?type=layoutdebug",
"LayoutDebug Startup Handler",
PR_TRUE,
"",
PR_TRUE)

View File

@ -0,0 +1,60 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
// vim:cindent:tabstop=4:expandtab:shiftwidth=4:
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* 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 layout debugging code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* L. David Baron <dbaron@dbaron.org> (original author)
*
* 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsLayoutDebugCLH_h_
#define nsLayoutDebugCLH_h_
#include "nsICmdLineHandler.h"
#define NS_LAYOUTDEBUGCLH_CID \
{ 0xa8f52633, 0x5ecf, 0x424a, \
{ 0xa1, 0x47, 0x47, 0xc3, 0x22, 0xf7, 0xbc, 0xe2 }}
class nsLayoutDebugCLH : public nsICmdLineHandler
{
public:
nsLayoutDebugCLH();
virtual ~nsLayoutDebugCLH();
NS_DECL_ISUPPORTS
NS_DECL_NSICMDLINEHANDLER
CMDLINEHANDLER_REGISTERPROC_DECLS
};
#endif /* !defined(nsLayoutDebugCLH_h_) */

View File

@ -0,0 +1,617 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
// vim:cindent:tabstop=4:expandtab:shiftwidth=4:
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* 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 layout debugging code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* L. David Baron <dbaron@dbaron.org> (original author)
*
* 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsLayoutDebuggingTools.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeNode.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDOMWindow.h"
#include "nsIScriptGlobalObject.h"
#include "nsIDocumentViewer.h"
#include "nsIServiceManager.h"
#include "nsIAtom.h"
#include "nsQuickSort.h"
#include "nsIPref.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIPresShell.h"
#include "nsIViewManager.h"
#include "nsIStyleSet.h"
#include "nsIFrame.h"
#include "nsIFrameDebug.h"
#include "nsILayoutDebugger.h"
#include "nsLayoutCID.h"
static NS_DEFINE_CID(kLayoutDebuggerCID, NS_LAYOUT_DEBUGGER_CID);
#include "nsISelectionController.h"
static already_AddRefed<nsIContentViewer>
doc_viewer(nsIDocShell *aDocShell)
{
if (!aDocShell)
return nsnull;
nsIContentViewer *result = nsnull;
aDocShell->GetContentViewer(&result);
return result;
}
static already_AddRefed<nsIPresShell>
pres_shell(nsIDocShell *aDocShell)
{
nsCOMPtr<nsIDocumentViewer> dv =
do_QueryInterface(nsCOMPtr<nsIContentViewer>(doc_viewer(aDocShell)));
if (!dv)
return nsnull;
nsIPresShell *result = nsnull;
dv->GetPresShell(&result);
return result;
}
#if 0 // not currently needed
static already_AddRefed<nsIPresContext>
pres_context(nsIDocShell *aDocShell)
{
nsCOMPtr<nsIDocumentViewer> dv =
do_QueryInterface(nsCOMPtr<nsIContentViewer>(doc_viewer(aDocShell)));
if (!dv)
return nsnull;
nsIPresContext *result = nsnull;
dv->GetPresContext(result);
return result;
}
#endif
static already_AddRefed<nsIViewManager>
view_manager(nsIDocShell *aDocShell)
{
nsCOMPtr<nsIPresShell> shell(pres_shell(aDocShell));
if (!shell)
return nsnull;
nsIViewManager *result = nsnull;
shell->GetViewManager(&result);
return result;
}
static already_AddRefed<nsIDocument>
document(nsIDocShell *aDocShell)
{
nsCOMPtr<nsIContentViewer> cv(doc_viewer(aDocShell));
if (!cv)
return nsnull;
nsCOMPtr<nsIDOMDocument> domDoc;
cv->GetDOMDocument(getter_AddRefs(domDoc));
if (!domDoc)
return nsnull;
nsIDocument *result = nsnull;
CallQueryInterface(domDoc, &result);
return result;
}
static already_AddRefed<nsIStyleSet>
style_set(nsIDocShell *aDocShell)
{
nsCOMPtr<nsIPresShell> shell(pres_shell(aDocShell));
if (!shell)
return nsnull;
nsIStyleSet *result = nsnull;
shell->GetStyleSet(&result);
return result;
}
nsLayoutDebuggingTools::nsLayoutDebuggingTools()
: mPaintFlashing(PR_FALSE),
mPaintDumping(PR_FALSE),
mInvalidateDumping(PR_FALSE),
mEventDumping(PR_FALSE),
mMotionEventDumping(PR_FALSE),
mCrossingEventDumping(PR_FALSE),
mReflowCounts(PR_FALSE)
{
NS_INIT_ISUPPORTS();
NewURILoaded();
}
nsLayoutDebuggingTools::~nsLayoutDebuggingTools()
{
}
NS_IMPL_ISUPPORTS1(nsLayoutDebuggingTools, nsILayoutDebuggingTools)
NS_IMETHODIMP
nsLayoutDebuggingTools::Init(nsIDOMWindow *aWin)
{
{
nsCOMPtr<nsIScriptGlobalObject> global = do_QueryInterface(aWin);
if (!global)
return NS_ERROR_UNEXPECTED;
global->GetDocShell(getter_AddRefs(mDocShell));
}
mPrefs = do_GetService(NS_PREF_CONTRACTID);
GetBoolPref("nglayout.debug.paint_flashing", &mPaintFlashing);
GetBoolPref("nglayout.debug.paint_dumping", &mPaintDumping);
GetBoolPref("nglayout.debug.invalidate_dumping", &mInvalidateDumping);
GetBoolPref("nglayout.debug.event_dumping", &mEventDumping);
GetBoolPref("nglayout.debug.motion_event_dumping", &mMotionEventDumping);
GetBoolPref("nglayout.debug.crossing_event_dumping", &mCrossingEventDumping);
GetBoolPref("layout.reflow.showframecounts", &mReflowCounts);
{
nsCOMPtr<nsILayoutDebugger> ld = do_GetService(kLayoutDebuggerCID);
if (ld) {
ld->GetShowFrameBorders(&mVisualDebugging);
ld->GetShowEventTargetFrameBorder(&mVisualEventDebugging);
}
}
return NS_OK;
}
NS_IMETHODIMP
nsLayoutDebuggingTools::NewURILoaded()
{
// Reset all the state that should be reset between pages.
// XXX Some of these should instead be transferred between pages!
mEditorMode = PR_FALSE;
mVisualDebugging = PR_FALSE;
mVisualEventDebugging = PR_FALSE;
mReflowCounts = PR_FALSE;
ForceRefresh();
return NS_OK;
}
NS_IMETHODIMP
nsLayoutDebuggingTools::GetVisualDebugging(PRBool *aVisualDebugging)
{
*aVisualDebugging = mVisualDebugging;
return NS_OK;
}
NS_IMETHODIMP
nsLayoutDebuggingTools::SetVisualDebugging(PRBool aVisualDebugging)
{
nsCOMPtr<nsILayoutDebugger> ld = do_GetService(kLayoutDebuggerCID);
if (!ld)
return NS_ERROR_UNEXPECTED;
mVisualDebugging = aVisualDebugging;
ld->SetShowFrameBorders(aVisualDebugging);
ForceRefresh();
return NS_OK;
}
NS_IMETHODIMP
nsLayoutDebuggingTools::GetVisualEventDebugging(PRBool *aVisualEventDebugging)
{
*aVisualEventDebugging = mVisualEventDebugging;
return NS_OK;
}
NS_IMETHODIMP
nsLayoutDebuggingTools::SetVisualEventDebugging(PRBool aVisualEventDebugging)
{
nsCOMPtr<nsILayoutDebugger> ld = do_GetService(kLayoutDebuggerCID);
if (!ld)
return NS_ERROR_UNEXPECTED;
mVisualEventDebugging = aVisualEventDebugging;
ld->SetShowEventTargetFrameBorder(aVisualEventDebugging);
ForceRefresh();
return NS_OK;
}
NS_IMETHODIMP
nsLayoutDebuggingTools::GetPaintFlashing(PRBool *aPaintFlashing)
{
*aPaintFlashing = mPaintFlashing;
return NS_OK;
}
NS_IMETHODIMP
nsLayoutDebuggingTools::SetPaintFlashing(PRBool aPaintFlashing)
{
mPaintFlashing = aPaintFlashing;
return SetBoolPrefAndRefresh("nglayout.debug.paint_flashing", mPaintFlashing);
}
NS_IMETHODIMP
nsLayoutDebuggingTools::GetPaintDumping(PRBool *aPaintDumping)
{
*aPaintDumping = mPaintDumping;
return NS_OK;
}
NS_IMETHODIMP
nsLayoutDebuggingTools::SetPaintDumping(PRBool aPaintDumping)
{
mPaintDumping = aPaintDumping;
return SetBoolPrefAndRefresh("nglayout.debug.paint_dumping", mPaintDumping);
}
NS_IMETHODIMP
nsLayoutDebuggingTools::GetInvalidateDumping(PRBool *aInvalidateDumping)
{
*aInvalidateDumping = mInvalidateDumping;
return NS_OK;
}
NS_IMETHODIMP
nsLayoutDebuggingTools::SetInvalidateDumping(PRBool aInvalidateDumping)
{
mInvalidateDumping = aInvalidateDumping;
return SetBoolPrefAndRefresh("nglayout.debug.invalidate_dumping", mInvalidateDumping);
}
NS_IMETHODIMP
nsLayoutDebuggingTools::GetEventDumping(PRBool *aEventDumping)
{
*aEventDumping = mEventDumping;
return NS_OK;
}
NS_IMETHODIMP
nsLayoutDebuggingTools::SetEventDumping(PRBool aEventDumping)
{
mEventDumping = aEventDumping;
return SetBoolPrefAndRefresh("nglayout.debug.event_dumping", mEventDumping);
}
NS_IMETHODIMP
nsLayoutDebuggingTools::GetMotionEventDumping(PRBool *aMotionEventDumping)
{
*aMotionEventDumping = mMotionEventDumping;
return NS_OK;
}
NS_IMETHODIMP
nsLayoutDebuggingTools::SetMotionEventDumping(PRBool aMotionEventDumping)
{
mMotionEventDumping = aMotionEventDumping;
return SetBoolPrefAndRefresh("nglayout.debug.motion_event_dumping", mMotionEventDumping);
}
NS_IMETHODIMP
nsLayoutDebuggingTools::GetCrossingEventDumping(PRBool *aCrossingEventDumping)
{
*aCrossingEventDumping = mCrossingEventDumping;
return NS_OK;
}
NS_IMETHODIMP
nsLayoutDebuggingTools::SetCrossingEventDumping(PRBool aCrossingEventDumping)
{
mCrossingEventDumping = aCrossingEventDumping;
return SetBoolPrefAndRefresh("nglayout.debug.crossing_event_dumping", mCrossingEventDumping);
}
NS_IMETHODIMP
nsLayoutDebuggingTools::GetReflowCounts(PRBool* aShow)
{
*aShow = mReflowCounts;
return NS_OK;
}
NS_IMETHODIMP
nsLayoutDebuggingTools::SetReflowCounts(PRBool aShow)
{
nsCOMPtr<nsIPresShell> shell(pres_shell(mDocShell));
if (shell) {
#ifdef MOZ_REFLOW_PERF
shell->SetPaintFrameCount(aShow);
SetBoolPrefAndRefresh("layout.reflow.showframecounts", aShow);
mReflowCounts = aShow;
#else
printf("************************************************\n");
printf("Sorry, you have not built with MOZ_REFLOW_PERF=1\n");
printf("************************************************\n");
#endif
}
return NS_OK;
}
static void DumpAWebShell(nsIDocShellTreeItem* aShellItem, FILE* out, PRInt32 aIndent)
{
nsXPIDLString name;
nsCOMPtr<nsIDocShellTreeItem> parent;
PRInt32 i, n;
for (i = aIndent; --i >= 0; )
fprintf(out, " ");
fprintf(out, "%p '", NS_STATIC_CAST(void*, aShellItem));
aShellItem->GetName(getter_Copies(name));
aShellItem->GetSameTypeParent(getter_AddRefs(parent));
fputs(NS_LossyConvertUCS2toASCII(name).get(), out);
fprintf(out, "' parent=%p <\n", NS_STATIC_CAST(void*, parent));
++aIndent;
nsCOMPtr<nsIDocShellTreeNode> shellAsNode(do_QueryInterface(aShellItem));
shellAsNode->GetChildCount(&n);
for (i = 0; i < n; ++i) {
nsCOMPtr<nsIDocShellTreeItem> child;
shellAsNode->GetChildAt(i, getter_AddRefs(child));
if (child) {
DumpAWebShell(child, out, aIndent);
}
}
--aIndent;
for (i = aIndent; --i >= 0; )
fprintf(out, " ");
fputs(">\n", out);
}
NS_IMETHODIMP
nsLayoutDebuggingTools::DumpWebShells()
{
nsCOMPtr<nsIDocShellTreeItem> shellAsItem(do_QueryInterface(mDocShell));
DumpAWebShell(shellAsItem, stdout, 0);
return NS_OK;
}
static
void
DumpContentRecur(nsIDocShell* aDocShell, FILE* out)
{
#ifdef DEBUG
if (nsnull != aDocShell) {
fprintf(out, "docshell=%p \n", NS_STATIC_CAST(void*, aDocShell));
nsCOMPtr<nsIDocument> doc(document(aDocShell));
if (doc) {
nsCOMPtr<nsIContent> root;
doc->GetRootContent(getter_AddRefs(root));
if (root) {
root->List(out);
}
}
else {
fputs("no document\n", out);
}
// dump the frames of the sub documents
PRInt32 i, n;
nsCOMPtr<nsIDocShellTreeNode> docShellAsNode(do_QueryInterface(aDocShell));
docShellAsNode->GetChildCount(&n);
for (i = 0; i < n; ++i) {
nsCOMPtr<nsIDocShellTreeItem> child;
docShellAsNode->GetChildAt(i, getter_AddRefs(child));
nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
if (child) {
DumpContentRecur(childAsShell, out);
}
}
}
#endif
}
NS_IMETHODIMP
nsLayoutDebuggingTools::DumpContent()
{
DumpContentRecur(mDocShell, stdout);
return NS_OK;
}
static void
DumpFramesRecur(nsIDocShell* aDocShell, FILE* out)
{
if (nsnull != aDocShell) {
fprintf(out, "webshell=%p \n", NS_STATIC_CAST(void*, aDocShell));
nsCOMPtr<nsIPresShell> shell(pres_shell(aDocShell));
if (shell) {
nsIFrame* root;
shell->GetRootFrame(&root);
if (root) {
nsCOMPtr<nsIPresContext> presContext;
shell->GetPresContext(getter_AddRefs(presContext));
nsIFrameDebug* fdbg;
if (NS_SUCCEEDED(CallQueryInterface(root, &fdbg))) {
fdbg->List(presContext, out, 0);
}
}
}
else {
fputs("null pres shell\n", out);
}
// dump the frames of the sub documents
PRInt32 i, n;
nsCOMPtr<nsIDocShellTreeNode> docShellAsNode(do_QueryInterface(aDocShell));
docShellAsNode->GetChildCount(&n);
for (i = 0; i < n; ++i) {
nsCOMPtr<nsIDocShellTreeItem> child;
docShellAsNode->GetChildAt(i, getter_AddRefs(child));
nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
if (childAsShell) {
DumpFramesRecur(childAsShell, out);
}
}
}
}
NS_IMETHODIMP
nsLayoutDebuggingTools::DumpFrames()
{
DumpFramesRecur(mDocShell, stdout);
return NS_OK;
}
static
void
DumpViewsRecur(nsIDocShell* aDocShell, FILE* out)
{
if (aDocShell) {
fprintf(out, "docshell=%p \n", NS_STATIC_CAST(void*, aDocShell));
nsCOMPtr<nsIViewManager> vm(view_manager(aDocShell));
if (vm) {
nsIView* root;
vm->GetRootView(root);
if (nsnull != root) {
root->List(out);
}
}
else {
fputs("null view manager\n", out);
}
// dump the views of the sub documents
PRInt32 i, n;
nsCOMPtr<nsIDocShellTreeNode> docShellAsNode(do_QueryInterface(aDocShell));
docShellAsNode->GetChildCount(&n);
for (i = 0; i < n; i++) {
nsCOMPtr<nsIDocShellTreeItem> child;
docShellAsNode->GetChildAt(i, getter_AddRefs(child));
nsCOMPtr<nsIDocShell> childAsShell(do_QueryInterface(child));
if (childAsShell) {
DumpViewsRecur(childAsShell, out);
}
}
}
}
NS_IMETHODIMP
nsLayoutDebuggingTools::DumpViews()
{
DumpViewsRecur(mDocShell, stdout);
return NS_OK;
}
NS_IMETHODIMP
nsLayoutDebuggingTools::DumpStyleSheets()
{
#ifdef DEBUG
FILE *out = stdout;
nsCOMPtr<nsIStyleSet> styleSet(style_set(mDocShell));
if (styleSet)
styleSet->List(out);
else
fputs("null style set\n", out);
#endif
return NS_OK;
}
NS_IMETHODIMP
nsLayoutDebuggingTools::DumpStyleContexts()
{
#ifdef DEBUG
FILE *out = stdout;
nsCOMPtr<nsIPresShell> shell(pres_shell(mDocShell));
if (shell) {
nsCOMPtr<nsIStyleSet> styleSet;
shell->GetStyleSet(getter_AddRefs(styleSet));
if (!styleSet) {
fputs("null style set\n", out);
} else {
nsIFrame* root;
shell->GetRootFrame(&root);
if (!root) {
fputs("null root frame\n", out);
} else {
styleSet->ListContexts(root, out);
}
}
} else {
fputs("null pres shell\n", out);
}
#endif
return NS_OK;
}
NS_IMETHODIMP
nsLayoutDebuggingTools::DumpReflowStats()
{
#ifdef DEBUG
nsCOMPtr<nsIPresShell> shell(pres_shell(mDocShell));
if (shell) {
#ifdef MOZ_REFLOW_PERF
shell->DumpReflows();
#else
printf("************************************************\n");
printf("Sorry, you have not built with MOZ_REFLOW_PERF=1\n");
printf("************************************************\n");
#endif
}
#endif
return NS_OK;
}
void nsLayoutDebuggingTools::ForceRefresh()
{
nsCOMPtr<nsIViewManager> vm(view_manager(mDocShell));
if (!vm)
return;
nsIView* root = nsnull;
vm->GetRootView(root);
if (root) {
vm->UpdateView(root, NS_VMREFRESH_IMMEDIATE);
}
}
nsresult
nsLayoutDebuggingTools::SetBoolPrefAndRefresh(const char * aPrefName,
PRBool aNewVal)
{
NS_ENSURE_TRUE(mPrefs && aPrefName, NS_OK);
mPrefs->SetBoolPref(aPrefName, aNewVal);
mPrefs->SavePrefFile(nsnull);
ForceRefresh();
return NS_OK;
}
nsresult
nsLayoutDebuggingTools::GetBoolPref(const char * aPrefName,
PRBool *aValue)
{
NS_ENSURE_TRUE(mPrefs && aPrefName, NS_OK);
mPrefs->GetBoolPref(aPrefName, aValue);
return NS_OK;
}

View File

@ -0,0 +1,72 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
// vim:cindent:tabstop=4:expandtab:shiftwidth=4:
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* 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 layout debugging code.
*
* The Initial Developer of the Original Code is L. David Baron.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* L. David Baron <dbaron@dbaron.org> (original author)
*
* 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsILayoutDebuggingTools.h"
#include "nsIDocShell.h"
#include "nsCOMPtr.h"
#include "nsIPref.h"
class nsLayoutDebuggingTools : public nsILayoutDebuggingTools {
public:
nsLayoutDebuggingTools();
virtual ~nsLayoutDebuggingTools();
NS_DECL_ISUPPORTS
NS_DECL_NSILAYOUTDEBUGGINGTOOLS
protected:
void ForceRefresh();
nsresult GetBoolPref(const char * aPrefName, PRBool *aValue);
nsresult SetBoolPrefAndRefresh(const char * aPrefName, PRBool aNewValue);
nsCOMPtr<nsIDocShell> mDocShell;
nsCOMPtr<nsIPref> mPrefs;
PRBool mEditorMode;
PRBool mVisualDebugging;
PRBool mVisualEventDebugging;
PRBool mPaintFlashing;
PRBool mPaintDumping;
PRBool mInvalidateDumping;
PRBool mEventDumping;
PRBool mMotionEventDumping;
PRBool mCrossingEventDumping;
PRBool mReflowCounts;
};

View File

@ -84,27 +84,6 @@ nsRegressionTester::~nsRegressionTester()
NS_IMPL_ISUPPORTS1(nsRegressionTester, nsILayoutRegressionTester)
NS_IMETHODIMP
nsRegressionTester::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
nsRegressionTester::DumpFrameModel(nsIDOMWindow *aWindowToDump, nsILocalFile *aDestFile, PRUint32 aFlagsMask, PRInt32 *aResult)
{
@ -160,189 +139,6 @@ nsRegressionTester::DumpFrameModel(nsIDOMWindow *aWindowToDump, nsILocalFile *aD
return NS_OK;
}
/* void dumpContent (in nsIDOMWindow aWindow, in nsILocalFile aDestFile); */
NS_IMETHODIMP
nsRegressionTester::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
nsRegressionTester::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
nsRegressionTester::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
nsRegressionTester::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
nsRegressionTester::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
nsRegressionTester::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
nsRegressionTester::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
nsRegressionTester::CompareFrameModels(nsILocalFile *aBaseFile, nsILocalFile *aVerFile, PRUint32 aFlags, PRInt32 *aResult)
{
@ -377,92 +173,6 @@ nsRegressionTester::CompareFrameModels(nsILocalFile *aBaseFile, nsILocalFile *aV
return NS_OK;
}
NS_IMETHODIMP
nsRegressionTester::GetShowFrameBorders(PRBool *aShowFrameBorders)
{
NS_ENSURE_ARG_POINTER(aShowFrameBorders);
NS_ENSURE_SUCCESS(EnsureLayoutDebugger(), NS_ERROR_FAILURE);
return mLayoutDebugger->GetShowFrameBorders(aShowFrameBorders);
}
NS_IMETHODIMP
nsRegressionTester::SetShowFrameBorders(PRBool aShowFrameBorders)
{
NS_ENSURE_SUCCESS(EnsureLayoutDebugger(), NS_ERROR_FAILURE);
nsresult rv = mLayoutDebugger->SetShowFrameBorders(aShowFrameBorders);
RefreshAllWindows();
return rv;
}
NS_IMETHODIMP
nsRegressionTester::GetShowEventTargetFrameBorder(PRBool *aShowEventTargetFrameBorder)
{
NS_ENSURE_ARG_POINTER(aShowEventTargetFrameBorder);
NS_ENSURE_SUCCESS(EnsureLayoutDebugger(), NS_ERROR_FAILURE);
return mLayoutDebugger->GetShowEventTargetFrameBorder(aShowEventTargetFrameBorder);
}
NS_IMETHODIMP
nsRegressionTester::SetShowEventTargetFrameBorder(PRBool aShowEventTargetFrameBorder)
{
NS_ENSURE_SUCCESS(EnsureLayoutDebugger(), NS_ERROR_FAILURE);
nsresult rv = mLayoutDebugger->SetShowEventTargetFrameBorder(aShowEventTargetFrameBorder);
RefreshAllWindows();
return rv;
}
NS_IMETHODIMP
nsRegressionTester::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
nsRegressionTester::EnsureLayoutDebugger()
{
if (!mLayoutDebugger)
{
nsresult rv;
mLayoutDebugger = do_CreateInstance(kLayoutDebuggerCID, &rv);
if (NS_FAILED(rv))
return rv;
}
return NS_OK;
}
nsresult
nsRegressionTester::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
nsRegressionTester::GetDocShellFromWindow(nsIDOMWindow* inWindow, nsIDocShell** outShell)
{
@ -471,205 +181,3 @@ nsRegressionTester::GetDocShellFromWindow(nsIDOMWindow* inWindow, nsIDocShell**
return scriptObj->GetDocShell(outShell);
}
nsresult
nsRegressionTester::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
nsRegressionTester::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
nsRegressionTester::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
nsRegressionTester::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
nsRegressionTester::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
nsRegressionTester::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);
}
}
}

View File

@ -45,23 +45,7 @@ public:
virtual ~nsRegressionTester();
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;
};

View File

@ -0,0 +1,29 @@
#
# 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
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,63 @@
<?xml version="1.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 The JavaScript Debugger
-
- 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.
-
- Alternatively, the contents of this file may be used under the
- terms of the GNU Public License (the "GPL"), in which case the
- provisions of the GPL are applicable instead of those above.
- If you wish to allow use of your version of this file only
- under the terms of the GPL and not to allow others to use your
- version of this file under the MPL, indicate your decision by
- deleting the provisions above and replace them with the notice
- and other provisions required by the GPL. If you do not delete
- the provisions above, a recipient may use your version of this
- file under either the MPL or the GPL.
-
- Contributor(s):
- Robert Ginda, <rginda@netscape.com>, original author
- L. David Baron, <dbaron@fas.harvard.edu>, modified for Layout Debugger
-
-->
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
<!-- list all the packages being supplied by this jar -->
<RDF:Seq about="urn:mozilla:package:root">
<RDF:li resource="urn:mozilla:package:layoutdebug"/>
</RDF:Seq>
<!-- package information -->
<RDF:Description about="urn:mozilla:package:layoutdebug"
chrome:displayName="Layout Debugger"
chrome:author="mozilla.org"
chrome:name="layoutdebug">
</RDF:Description>
<!-- overlay information -->
<RDF:Seq about="urn:mozilla:overlays">
<RDF:li resource="chrome://communicator/content/tasksOverlay.xul"/>
</RDF:Seq>
<RDF:Seq about="chrome://communicator/content/tasksOverlay.xul">
<RDF:li>chrome://layoutdebug/content/layoutdebug-overlay.xul</RDF:li>
</RDF:Seq>
</RDF:RDF>

View File

@ -0,0 +1,62 @@
<?xml version="1.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 The JavaScript Debugger
-
- 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.
-
- Alternatively, the contents of this file may be used under the
- terms of the GNU Public License (the "GPL"), in which case the
- provisions of the GPL are applicable instead of those above.
- If you wish to allow use of your version of this file only
- under the terms of the GPL and not to allow others to use your
- version of this file under the MPL, indicate your decision by
- deleting the provisions above and replace them with the notice
- and other provisions required by the GPL. If you do not delete
- the provisions above, a recipient may use your version of this
- file under either the MPL or the GPL.
-
- Contributor(s):
- Robert Ginda, <rginda@netscape.com>, original author
- L. David Baron, <dbaron@fas.harvard.edu>, modified for Layout Debugger
-
-->
<!--
This file contains the nodes that will be overlayed on top of
<chrome://communicator/content/tasksOverlay.xul>.
Declare XML entites that this file refers to in layoutdebug-overlay.dtd.
-->
<!DOCTYPE window SYSTEM "chrome://layoutdebug/locale/layoutdebug-overlay.dtd" >
<overlay id="layoutdebugTaskMenuID"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!--
This is the id that the menuitem will be appended to. see tasksOverlay.xul
-->
<menupopup id="taskPopup">
<menuitem label="&ldbCmd.label;"
accesskey="&ldbCmd.accesskey;"
oncommand="toOpenWindowByType('mozapp:layoutdebug',
'chrome://layoutdebug/content/');"/>
</menupopup>
</overlay>

View File

@ -0,0 +1,406 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* 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 layout debugging UI.
*
* The Initial Developer of the Original Code is L. David Baron.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* L. David Baron <dbaron@dbaron.org> (original author)
*
* 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 MPL, 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 MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gBrowser;
var gProgressListener;
var gDebugger;
var gRTestIndexList;
var gRTestURLList = null;
const nsILayoutDebuggingTools = Components.interfaces.nsILayoutDebuggingTools;
const nsIDocShell = Components.interfaces.nsIDocShell;
const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
const NS_LAYOUT_DEBUGGINGTOOLS_CONTRACTID = "@mozilla.org/layout-debug/layout-debuggingtools;1";
function nsLDBBrowserContentListener()
{
this.init();
}
nsLDBBrowserContentListener.prototype = {
init : function()
{
this.mStatusText = document.getElementById("status-text");
this.mURLBar = document.getElementById("urlbar");
this.mForwardButton = document.getElementById("forward-button");
this.mBackButton = document.getElementById("back-button");
this.mStopButton = document.getElementById("stop-button");
},
QueryInterface : function(aIID)
{
if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
aIID.equals(Components.interfaces.nsISupports))
return this;
throw Components.results.NS_NOINTERFACE;
},
// nsIWebProgressListener implementation
onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus)
{
if (aStateFlags & nsIWebProgressListener.STATE_START) {
this.setButtonEnabled(this.mStopButton, true);
this.setButtonEnabled(this.mForwardButton, gBrowser.canGoForward);
this.setButtonEnabled(this.mBackButton, gBrowser.canGoBack);
this.mLoading = true;
} else if (aStateFlags & nsIWebProgressListener.STATE_STOP) {
this.setButtonEnabled(this.mStopButton, false);
this.mStatusText.value = "";
if (gRTestURLList && this.mLoading) {
// Let other things happen in the first 20ms, since this
// doesn't really seem to be when the page is done loading.
setTimeout("gRTestURLList.doneURL()", 20);
}
this.mLoading = false;
}
},
onProgressChange : function(aWebProgress, aRequest,
aCurSelfProgress, aMaxSelfProgress,
aCurTotalProgress, aMaxTotalProgress)
{
},
onLocationChange : function(aWebProgress, aRequest, aLocation)
{
this.mURLBar.value = aLocation.spec;
},
onStatusChange : function(aWebProgress, aRequest, aStatus, aMessage)
{
this.mStatusText.value = aMessage;
},
onSecurityChange : function(aWebProgress, aRequest, aState)
{
},
// non-interface methods
setButtonEnabled : function(aButtonElement, aEnabled)
{
if (aEnabled)
aButtonElement.removeAttribute("disabled");
else
aButtonElement.setAttribute("disabled", "true");
},
mStatusText : null,
mURLBar : null,
mForwardButton : null,
mBackButton : null,
mStopButton : null,
mLoading : false,
}
function OnLDBLoad()
{
gBrowser = document.getElementById("browser");
gProgressListener = new nsLDBBrowserContentListener();
gBrowser.addProgressListener(gProgressListener);
gDebugger = Components.classes[NS_LAYOUT_DEBUGGINGTOOLS_CONTRACTID].
createInstance(nsILayoutDebuggingTools);
if (window.arguments && window.arguments[0])
gBrowser.loadURI(window.arguments[0]);
else
gBrowser.goHome();
// XXX Shouldn't this be gBrowser.contentWindow?
var win = gBrowser.docShell.getInterface(Components.interfaces.nsIDOMWindow);
gDebugger.init(win);
checkPersistentMenus();
gRTestIndexList = new RTestIndexList();
}
function checkPersistentMenu(item)
{
var menuitem = document.getElementById("menu_" + item);
menuitem.setAttribute("checked", gDebugger[item]);
}
function checkPersistentMenus()
{
// Restore the toggles that are stored in prefs.
checkPersistentMenu("paintFlashing");
checkPersistentMenu("paintDumping");
checkPersistentMenu("invalidateDumping");
checkPersistentMenu("eventDumping");
checkPersistentMenu("motionEventDumping");
checkPersistentMenu("crossingEventDumping");
checkPersistentMenu("reflowCounts");
}
function OnLDBUnload()
{
gBrowser.removeProgressListener(gProgressListener);
}
function toggle(menuitem)
{
// trim the initial "menu_"
var feature = menuitem.id.substring(5);
gDebugger[feature] = menuitem.getAttribute("checked") == "true";
}
const LDB_RDFNS = "http://mozilla.org/newlayout/LDB-rdf#";
const NC_RDFNS = "http://home.netscape.com/NC-rdf#";
function RTestIndexList() {
this.init();
}
RTestIndexList.prototype = {
init : function()
{
const nsIPrefService = Components.interfaces.nsIPrefService;
const PREF_SERVICE_CONTRACTID = "@mozilla.org/preferences-service;1";
const PREF_BRANCH_NAME = "layout_debugger.rtest_url.";
const nsIRDFService = Components.interfaces.nsIRDFService;
const RDF_SERVICE_CONTRACTID = "@mozilla.org/rdf/rdf-service;1";
const nsIRDFDataSource = Components.interfaces.nsIRDFDataSource;
const RDF_DATASOURCE_CONTRACTID =
"@mozilla.org/rdf/datasource;1?name=in-memory-datasource";
this.mPrefService = Components.classes[PREF_SERVICE_CONTRACTID].
getService(nsIPrefService);
this.mPrefBranch = this.mPrefService.getBranch(PREF_BRANCH_NAME);
this.mRDFService = Components.classes[RDF_SERVICE_CONTRACTID].
getService(nsIRDFService);
this.mDataSource = Components.classes[RDF_DATASOURCE_CONTRACTID].
createInstance(nsIRDFDataSource);
this.mLDB_Root = this.mRDFService.GetResource(LDB_RDFNS + "Root");
this.mNC_Name = this.mRDFService.GetResource(NC_RDFNS + "name");
this.mNC_Child = this.mRDFService.GetResource(NC_RDFNS + "child");
this.load();
document.getElementById("menu_RTest_baseline").database.
AddDataSource(this.mDataSource);
document.getElementById("menu_RTest_verify").database.
AddDataSource(this.mDataSource);
document.getElementById("menu_RTest_remove").database.
AddDataSource(this.mDataSource);
},
save : function()
{
this.mPrefBranch.deleteBranch("");
const nsIRDFLiteral = Components.interfaces.nsIRDFLiteral;
const nsIRDFResource = Components.interfaces.nsIRDFResource;
var etor = this.mDataSource.GetTargets(this.mLDB_Root,
this.mNC_Child, true);
var i = 0;
while (etor.hasMoreElements()) {
var resource = etor.getNext().QueryInterface(nsIRDFResource);
var literal = this.mDataSource.GetTarget(resource, this.mNC_Name, true);
literal = literal.QueryInterface(nsIRDFLiteral);
this.mPrefBranch.setCharPref(i.toString(), literal.Value);
++i;
}
this.mPrefService.savePrefFile(null);
},
load : function()
{
var count = {value:null};
var prefList = this.mPrefBranch.getChildList("", count);
var i = 0;
for (var pref in prefList) {
var file = this.mPrefBranch.getCharPref(pref);
var resource = this.mRDFService.GetResource(file);
var literal = this.mRDFService.GetLiteral(file);
this.mDataSource.Assert(this.mLDB_Root, this.mNC_Child, resource, true);
this.mDataSource.Assert(resource, this.mNC_Name, literal, true);
++i;
}
},
/* Add a new list of regression tests to the menus. */
add : function()
{
const nsIFilePicker = Components.interfaces.nsIFilePicker;
const NS_FILEPICKER_CONTRACTID = "@mozilla.org/filepicker;1";
var fp = Components.classes[NS_FILEPICKER_CONTRACTID].
createInstance(nsIFilePicker);
// XXX l10n (but this is just for 5 developers, so no problem)
fp.init(window, "New Regression Test List", nsIFilePicker.modeOpen);
fp.appendFilters(nsIFilePicker.filterAll);
fp.defaultString = "rtest.lst";
if (fp.show() != nsIFilePicker.returnOK)
return;
var file = fp.file.persistentDescriptor;
var resource = this.mRDFService.GetResource(file);
var literal = this.mRDFService.GetLiteral(file);
this.mDataSource.Assert(this.mLDB_Root, this.mNC_Child, resource, true);
this.mDataSource.Assert(resource, this.mNC_Name, literal, true);
this.save();
},
remove : function(file)
{
var resource = this.mRDFService.GetResource(file);
var literal = this.mRDFService.GetLiteral(file);
this.mDataSource.Unassert(this.mLDB_Root, this.mNC_Child, resource);
this.mDataSource.Unassert(resource, this.mNC_Name, literal);
this.save();
},
mPrefBranch : null,
mPrefService : null,
mRDFService : null,
mDataSource : null,
mLDB_Root : null,
mNC_Child : null,
mNC_Name : null,
}
const nsIFileInputStream = Components.interfaces.nsIFileInputStream;
const nsILineInputStream = Components.interfaces.nsILineInputStream;
const nsILocalFile = Components.interfaces.nsILocalFile;
const nsIFileURL = Components.interfaces.nsIFileURL;
const NS_LOCAL_FILE_CONTRACTID = "@mozilla.org/file/local;1";
const NS_STANDARDURL_CONTRACTID = "@mozilla.org/network/standard-url;1";
const NS_LOCALFILEINPUTSTREAM_CONTRACTID =
"@mozilla.org/network/file-input-stream;1";
function RunRTest(aFilename, aIsBaseline)
{
if (gRTestURLList) {
// XXX Does alert work?
alert("Already running regression test.\n");
return;
}
dump("Running " + (aIsBaseline?"baseline":"verify") + " test for " + aFilename + ".\n");
var listFile = Components.classes[NS_LOCAL_FILE_CONTRACTID].
createInstance(nsILocalFile);
listFile.persistentDescriptor = aFilename;
gRTestURLList = new RTestURLList(listFile, aIsBaseline);
gRTestURLList.startURL();
}
function RTestURLList(aLocalFile, aIsBaseline) {
this.init(aLocalFile, aIsBaseline);
}
RTestURLList.prototype = {
init : function(aLocalFile, aIsBaseline)
{
this.mIsBaseline = aIsBaseline;
this.mURLs = new Array();
this.readFileList(aLocalFile);
},
readFileList : function(aLocalFile)
{
var dirURL = Components.classes[NS_STANDARDURL_CONTRACTID].
createInstance(nsIFileURL);
dirURL.file = aLocalFile.parent;
var fis = Components.classes[NS_LOCALFILEINPUTSTREAM_CONTRACTID].
createInstance(nsIFileInputStream);
fis.init(aLocalFile, -1, -1, false);
var lis = fis.QueryInterface(nsILineInputStream);
var line = {value:null};
while (lis.readLine(line)) {
var str = line.value;
str = /^[^#]*/.exec(str); // strip everything after "#"
str = /\S*/.exec(str); // take the first chunk of non-whitespace
if (!str || str == "")
continue;
var item = dirURL.resolve(str);
if (item.match(/\/rtest.lst$/)) {
var itemurl = Components.classes[NS_STANDARDURL_CONTRACTID].
createInstance(nsIFileURL);
itemurl.spec = item;
this.readFileList(itemurl.file);
} else {
this.mURLs.push(item);
}
}
},
doneURL : function() {
// XXX Dump or compare regression test data here!
this.mCurrentURL = null;
this.startURL();
},
startURL : function() {
this.mCurrentURL = this.mURLs.shift();
if (!this.mCurrentURL) {
gRTestURLList = null;
return;
}
gBrowser.loadURI(this.mCurrentURL);
},
mURLs : null,
mCurrentURL : null,
mIsBaseline : null,
}

View File

@ -0,0 +1,225 @@
<?xml version="1.0"?>
<!-- vim:sw=2:ts=8:et:
-
-
- 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 JavaScript Debugger
-
- 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.
-
- Alternatively, the contents of this file may be used under the
- terms of the GNU Public License (the "GPL"), in which case the
- provisions of the GPL are applicable instead of those above.
- If you wish to allow use of your version of this file only
- under the terms of the GPL and not to allow others to use your
- version of this file under the MPL, indicate your decision by
- deleting the provisions above and replace them with the notice
- and other provisions required by the GPL. If you do not delete
- the provisions above, a recipient may use your version of this
- file under either the MPL or the GPL.
-
- Contributor(s):
- Robert Ginda, <rginda@netscape.com>, original author
- L. David Baron, <dbaron@fas.harvard.edu>, modified for Layout Debugger
-
-->
<!DOCTYPE window [
<!ENTITY % layoutdebugDTD
SYSTEM "chrome://layoutdebug/locale/layoutdebug.dtd">
%layoutdebugDTD;
<!ENTITY W3C_RDFNS "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<!ENTITY NC_RDFNS "http://home.netscape.com/NC-rdf#">
<!ENTITY LDB_RDFNS "http://mozilla.org/newlayout/LDB-rdf#">
]>
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css" ?>
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
<?xul-overlay href="chrome://communicator/content/tasksOverlay.xul"?>
<!--
NOTE: Because this window is used for layout regression tests, the
persist attribute should never be used on anything. Otherwise there
is a risk of running baseline and verify runs under different
conditions.
-->
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:rdf="&W3C_RDFNS;"
id="main-window"
align="stretch"
title="&ldb.MainWindow.title;"
titlemodifier="&ldb.MainWindow.title;"
contenttitlesetting="true"
titlemenuseparator=" - "
windowtype="mozapp:layoutdebug"
onload="OnLDBLoad();"
onunload="OnLDBUnload();"
width="610" height="450"
screenX="4" screenY="4"
>
<script src="chrome://layoutdebug/content/layoutdebug.js"/>
<commandset id="tasksCommands">
<command id="cmd_close" oncommand="window.close();"/>
<command id="cmd_quit"/>
</commandset>
<keyset id="tasksKeys">
<key id="key_close"/>
<key id="key_quit"/>
</keyset>
<vbox flex="1">
<toolbox>
<menubar id="main-menubar">
<menu id="menu_File">
<menupopup id="menu_FilePopup">
<menuitem id="menu_close"/>
</menupopup>
</menu>
<menu id="menu_Edit">
<menupopup>
<menuitem id="menu_cut" />
<menuitem id="menu_copy" />
<menuitem id="menu_paste" />
<menuitem id="menu_delete" />
<menuitem id="menu_selectAll" />
</menupopup>
</menu>
<menu label="&ldb.RegressionTestMenu.label;"
accesskey="&ldb.RegressionTestMenu.accesskey;">
<menupopup>
<menu label="&ldb.RunBaselineMenu.label;"
accesskey="&ldb.RunBaselineMenu.accesskey;"
id="menu_RTest_baseline"
datasources="rdf:null"
containment="&NC_RDFNS;child"
ref="&LDB_RDFNS;Root">
<template>
<menupopup>
<menuitem uri="rdf:*"
label="rdf:&NC_RDFNS;name"
name="rdf:&NC_RDFNS;name"
oncommand="RunRTest(this.getAttribute('name'), true);" />
</menupopup>
</template>
</menu>
<menu label="&ldb.RunVerifyMenu.label;"
accesskey="&ldb.RunVerifyMenu.accesskey;"
id="menu_RTest_verify"
datasources="rdf:null"
containment="&NC_RDFNS;child"
ref="&LDB_RDFNS;Root">
<template>
<menupopup>
<menuitem uri="rdf:*"
label="rdf:&NC_RDFNS;name"
name="rdf:&NC_RDFNS;name"
oncommand="RunRTest(this.getAttribute('name'), false);" />
</menupopup>
</template>
</menu>
<menuseparator />
<menuitem id="menu_AddNewList" label="&ldb.AddNewList.label;" accesskey="&ldb.AddNewList.accesskey;" oncommand="gRTestIndexList.add();" />
<menu label="&ldb.RemoveListMenu.label;"
accesskey="&ldb.RemoveListMenu.accesskey;"
id="menu_RTest_remove"
datasources="rdf:null"
containment="&NC_RDFNS;child"
ref="&LDB_RDFNS;Root">
<template>
<menupopup>
<menuitem uri="rdf:*"
label="rdf:&NC_RDFNS;name"
name="rdf:&NC_RDFNS;name"
oncommand="gRTestIndexList.remove(this.getAttribute('name'));" />
</menupopup>
</template>
</menu>
</menupopup>
</menu>
<menu label="&ldb.ToggleMenu.label;"
accesskey="&ldb.ToggleMenu.accesskey;">
<menupopup>
<menuitem type="checkbox" id="menu_visualDebugging" label="&ldb.visualDebugging.label;" accesskey="&ldb.visualDebugging.accesskey;" oncommand="toggle(this);" />
<menuitem type="checkbox" id="menu_visualEventDebugging" label="&ldb.visualEventDebugging.label;" accesskey="&ldb.visualEventDebugging.accesskey;" oncommand="toggle(this);" />
<menuseparator />
<menuitem type="checkbox" id="menu_paintFlashing" label="&ldb.paintFlashing.label;" accesskey="&ldb.paintFlashing.accesskey;" oncommand="toggle(this);" />
<menuitem type="checkbox" id="menu_paintDumping" label="&ldb.paintDumping.label;" accesskey="&ldb.paintDumping.accesskey;" oncommand="toggle(this);" />
<menuitem type="checkbox" id="menu_invalidateDumping" label="&ldb.invalidateDumping.label;" accesskey="&ldb.invalidateDumping.accesskey;" oncommand="toggle(this);" />
<menuseparator />
<menuitem type="checkbox" id="menu_eventDumping" label="&ldb.eventDumping.label;" accesskey="&ldb.eventDumping.accesskey;" oncommand="toggle(this);" />
<menuitem type="checkbox" id="menu_motionEventDumping" label="&ldb.motionEventDumping.label;" accesskey="&ldb.motionEventDumping.accesskey;" oncommand="toggle(this);" />
<menuitem type="checkbox" id="menu_crossingEventDumping" label="&ldb.crossingEventDumping.label;" accesskey="&ldb.crossingEventDumping.accesskey;" oncommand="toggle(this);" />
<menuseparator />
<menuitem type="checkbox" id="menu_reflowCounts" label="&ldb.reflowCounts.label;" accesskey="&ldb.reflowCounts.accesskey;" oncommand="toggle(this);" />
</menupopup>
</menu>
<menu label="&ldb.DumpMenu.label;"
accesskey="&ldb.DumpMenu.accesskey;">
<menupopup>
<menuitem id="menu_dumpWebShells" label="&ldb.dumpWebShells.label;" accesskey="&ldb.dumpWebShells.accesskey;" oncommand="gDebugger.dumpWebShells();" />
<menuitem id="menu_dumpContent" label="&ldb.dumpContent.label;" accesskey="&ldb.dumpContent.accesskey;" oncommand="gDebugger.dumpContent();" />
<menuitem id="menu_dumpFrames" label="&ldb.dumpFrames.label;" accesskey="&ldb.dumpFrames.accesskey;" oncommand="gDebugger.dumpFrames();" />
<menuitem id="menu_dumpViews" label="&ldb.dumpViews.label;" accesskey="&ldb.dumpViews.accesskey;" oncommand="gDebugger.dumpViews();" />
<menuseparator />
<menuitem id="menu_dumpStyleSheets" label="&ldb.dumpStyleSheets.label;" accesskey="&ldb.dumpStyleSheets.accesskey;" oncommand="gDebugger.dumpStyleSheets();" />
<menuitem id="menu_dumpStyleContexts" label="&ldb.dumpStyleContexts.label;" accesskey="&ldb.dumpStyleContexts.accesskey;" oncommand="gDebugger.dumpStyleContexts();" />
<menuseparator />
<menuitem id="menu_dumpReflowStats" label="&ldb.dumpReflowStats.label;" accesskey="&ldb.dumpReflowStats.accesskey;" oncommand="gDebugger.dumpReflowStats();" />
</menupopup>
</menu>
<menu id="tasksMenu"/>
<menu id="windowMenu"/>
<menu id="menu_Help"/>
</menubar>
<toolbar>
<toolbarbutton id="back-button" class="toolbarbutton-1"
label="&ldb.BackButton.label;"
oncommand="gBrowser.goBack();" />
<toolbarbutton id="forward-button" class="toolbarbutton-1"
label="&ldb.ForwardButton.label;"
oncommand="gBrowser.goForward();" />
<toolbarbutton id="reload-button" class="toolbarbutton-1"
label="&ldb.ReloadButton.label;"
oncommand="gBrowser.reload();" />
<toolbarbutton id="stop-button" class="toolbarbutton-1"
label="&ldb.StopButton.label;"
oncommand="gBrowser.stop();" />
<textbox id="urlbar" class="chromeclass-location" flex="1"
onkeypress="if (event.keyCode == 13)
gBrowser.loadURI(this.value);" />
</toolbar>
</toolbox>
<browser flex="1" id="browser" type="content-primary"
homepage="resource:///res/samples/test0.html" />
<hbox>
<description id="status-text" value="" />
</hbox>
</vbox>
</window>

View File

@ -0,0 +1,8 @@
layoutdebug.jar:
content/layoutdebug/contents.rdf (content/contents.rdf)
content/layoutdebug/layoutdebug.xul (content/layoutdebug.xul)
content/layoutdebug/layoutdebug.js (content/layoutdebug.js)
content/layoutdebug/layoutdebug-overlay.xul (content/layoutdebug-overlay.xul)
locale/en-US/layoutdebug/contents.rdf (locale/en-US/contents.rdf)
locale/en-US/layoutdebug/layoutdebug.dtd (locale/en-US/layoutdebug.dtd)
locale/en-US/layoutdebug/layoutdebug-overlay.dtd (locale/en-US/layoutdebug-overlay.dtd)

View File

@ -0,0 +1,60 @@
<?xml version="1.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 The JavaScript Debugger
-
- 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.
-
- Alternatively, the contents of this file may be used under the
- terms of the GNU Public License (the "GPL"), in which case the
- provisions of the GPL are applicable instead of those above.
- If you wish to allow use of your version of this file only
- under the terms of the GPL and not to allow others to use your
- version of this file under the MPL, indicate your decision by
- deleting the provisions above and replace them with the notice
- and other provisions required by the GPL. If you do not delete
- the provisions above, a recipient may use your version of this
- file under either the MPL or the GPL.
-
- Contributor(s):
- Robert Ginda, <rginda@netscape.com>, original author
- L. David Baron, <dbaron@fas.harvard.edu>, modified for Layout Debugger
-
-->
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
<!-- list all the packages being supplied by this jar -->
<RDF:Seq about="urn:mozilla:locale:root">
<RDF:li resource="urn:mozilla:locale:en-US"/>
</RDF:Seq>
<!-- locale information -->
<RDF:Description about="urn:mozilla:locale:en-US"
chrome:displayName="English(US)"
chrome:author="app_author"
chrome:name="en-US"
chrome:previewURL="http://www.mozilla.org/locales/en-US.gif">
<chrome:packages>
<RDF:Seq about="urn:mozilla:locale:en-US:packages">
<RDF:li resource="urn:mozilla:locale:en-US:layoutdebug"/>
</RDF:Seq>
</chrome:packages>
</RDF:Description>
</RDF:RDF>

View File

@ -0,0 +1,38 @@
<!--
-
- 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 JavaScript Debugger
-
- 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.
-
- Alternatively, the contents of this file may be used under the
- terms of the GNU Public License (the "GPL"), in which case the
- provisions of the GPL are applicable instead of those above.
- If you wish to allow use of your version of this file only
- under the terms of the GPL and not to allow others to use your
- version of this file under the MPL, indicate your decision by
- deleting the provisions above and replace them with the notice
- and other provisions required by the GPL. If you do not delete
- the provisions above, a recipient may use your version of this
- file under either the MPL or the GPL.
-
- Contributor(s):
- Robert Ginda, <rginda@netscape.com>, original author
-
-->
<!ENTITY ldbCmd.label "Layout Debugger">
<!ENTITY ldbCmd.accesskey "L">

View File

@ -0,0 +1,101 @@
<!--
-
- 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 JavaScript Debugger
-
- 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.
-
- Alternatively, the contents of this file may be used under the
- terms of the GNU Public License (the "GPL"), in which case the
- provisions of the GPL are applicable instead of those above.
- If you wish to allow use of your version of this file only
- under the terms of the GPL and not to allow others to use your
- version of this file under the MPL, indicate your decision by
- deleting the provisions above and replace them with the notice
- and other provisions required by the GPL. If you do not delete
- the provisions above, a recipient may use your version of this
- file under either the MPL or the GPL.
-
- Contributor(s):
- Robert Ginda, <rginda@netscape.com>, original author
- L. David Baron <dbaron@fas.harvard.edu>, modified for Layout Debugger
-
-->
<!ENTITY app.name.short "layoutdebug">
<!ENTITY app.name.long "Layout Debugger">
<!ENTITY app.version "prototype_a">
<!ENTITY app.author "mozilla.org">
<!ENTITY ldb.MainWindow.title "Layout Debugger">
<!ENTITY ldb.BackButton.label "Back">
<!ENTITY ldb.ForwardButton.label "Forward">
<!ENTITY ldb.ReloadButton.label "Reload">
<!ENTITY ldb.StopButton.label "Stop">
<!ENTITY ldb.RegressionTestMenu.label "Regression-Test">
<!ENTITY ldb.RegressionTestMenu.accesskey "R">
<!ENTITY ldb.RunBaselineMenu.label "Run Baseline">
<!ENTITY ldb.RunBaselineMenu.accesskey "B">
<!ENTITY ldb.RunVerifyMenu.label "Run Verify">
<!ENTITY ldb.RunVerifyMenu.accesskey "V">
<!ENTITY ldb.AddNewList.label "Add New List...">
<!ENTITY ldb.AddNewList.accesskey "A">
<!ENTITY ldb.RemoveListMenu.label "Remove List">
<!ENTITY ldb.RemoveListMenu.accesskey "R">
<!ENTITY ldb.ToggleMenu.label "Toggle">
<!ENTITY ldb.ToggleMenu.accesskey "T">
<!ENTITY ldb.visualDebugging.label "Visual Debugging">
<!ENTITY ldb.visualDebugging.accesskey "V">
<!ENTITY ldb.visualEventDebugging.label "Visual Event Debugging">
<!ENTITY ldb.visualEventDebugging.accesskey "E">
<!ENTITY ldb.paintFlashing.label "Paint Flashing">
<!ENTITY ldb.paintFlashing.accesskey "F">
<!ENTITY ldb.paintDumping.label "Paint Dumping">
<!ENTITY ldb.paintDumping.accesskey "P">
<!ENTITY ldb.invalidateDumping.label "Invalidate Dumping">
<!ENTITY ldb.invalidateDumping.accesskey "I">
<!ENTITY ldb.eventDumping.label "Event Dumping">
<!ENTITY ldb.eventDumping.accesskey "E">
<!ENTITY ldb.motionEventDumping.label "Motion Event Dumping">
<!ENTITY ldb.motionEventDumping.accesskey "M">
<!ENTITY ldb.crossingEventDumping.label "Crossing Event Dumping">
<!ENTITY ldb.crossingEventDumping.accesskey "C">
<!ENTITY ldb.reflowCounts.label "Reflow Counts">
<!ENTITY ldb.reflowCounts.accesskey "R">
<!ENTITY ldb.DumpMenu.label "Dump">
<!ENTITY ldb.DumpMenu.accesskey "D">
<!ENTITY ldb.dumpWebShells.label "Web Shells">
<!ENTITY ldb.dumpWebShells.accesskey "W">
<!ENTITY ldb.dumpContent.label "Content">
<!ENTITY ldb.dumpContent.accesskey "C">
<!ENTITY ldb.dumpFrames.label "Frames">
<!ENTITY ldb.dumpFrames.accesskey "F">
<!ENTITY ldb.dumpViews.label "Views and Widgets">
<!ENTITY ldb.dumpViews.accesskey "V">
<!ENTITY ldb.dumpStyleSheets.label "Style Sheets">
<!ENTITY ldb.dumpStyleSheets.accesskey "S">
<!ENTITY ldb.dumpStyleContexts.label "Style Contexts">
<!ENTITY ldb.dumpStyleContexts.accesskey "x">
<!ENTITY ldb.dumpReflowStats.label "Reflow Statistics">
<!ENTITY ldb.dumpReflowStats.accesskey "R">

View File

@ -7,55 +7,56 @@
<script type="application/x-javascript" language="Javascript">
const nsILayoutRegressionTester = Components.interfaces.nsILayoutRegressionTester;
const nsILayoutDebuggingTools = Components.interfaces.nsILayoutDebuggingTools;
var gDebugTools;
function Init()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
gDebugTools = Components.classes["@mozilla.org/layout-debug/layout-debuggingtools;1"].createInstance(nsILayoutDebuggingTools);
gDebugTools.init(window.frames.pageframe);
}
function SetShowFrameBorders(inShow)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.showFrameBorders = inShow;
gDebugTools.visualDebugging = inShow;
}
function SetShowEventTargetBorders(inShow)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.showEventTargetFrameBorder = inShow;
gDebugTools.visualEventDebugging = inShow;
}
function SetShowReflowStats(theWindow, inShow)
function SetShowReflowStats(inShow)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.setShowReflowStats(theWindow, inShow);
gDebugTools.reflowCounts = inShow;
}
function DumpFrames(inWindow)
function DumpFrames()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.dumpFrames(inWindow, null);
gDebugTools.dumpFrames();
}
function DumpContent(inWindow)
function DumpContent()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.dumpContent(inWindow, null);
gDebugTools.dumpContent();
}
function DumpViews(inWindow)
function DumpViews()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.dumpViews(inWindow, null);
gDebugTools.dumpViews();
}
function DumpWebShells(inWindow)
function DumpWebShells()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.dumpWebShells(inWindow, null);
gDebugTools.dumpWebShells();
}
function InputKey(inEvent)
@ -73,26 +74,19 @@ function IframeLoaded()
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
document.dumpform.urlfield.value = window.frames.pageframe.location.href;
}
function SetShowFrameBorders(inShow)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.showFrameBorders = inShow;
}
</script>
<body>
<body onload="Init()">
<form name="dumpform">
<div style="margin-bottom: 5px">
URL: <input type="text" size="100" name="urlfield" value="http://www.mozilla.org" onkeypress="InputKey(event)"></input>
</div>
<div>
<input type="button" value="Dump Frames" onclick="DumpFrames(window.frames.pageframe)">
<input type="button" value="Dump Content" onclick="DumpContent(window.frames.pageframe)">
<input type="button" value="Dump Views" onclick="DumpViews(window.frames.pageframe)">
<input type="button" value="Dump WebShells" onclick="DumpWebShells(window.frames.pageframe)">
<input type="button" value="Dump Frames" onclick="DumpFrames()">
<input type="button" value="Dump Content" onclick="DumpContent()">
<input type="button" value="Dump Views" onclick="DumpViews()">
<input type="button" value="Dump WebShells" onclick="DumpWebShells()">
<input type="checkbox" id="showBordersCheck" name="showBordersCheck"
onchange="SetShowFrameBorders(document.dumpform.showBordersCheck.checked)"></input>

View File

@ -6,60 +6,61 @@
</head>
<script type="application/x-javascript" language="Javascript">
const nsILayoutRegressionTester = Components.interfaces.nsILayoutRegressionTester;
const nsILayoutDebuggingTools = Components.interfaces.nsILayoutDebuggingTools;
var gDebugTools;
function Init()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
gDebugTools = Components.classes["@mozilla.org/layout-debug/layout-debuggingtools;1"].createInstance(nsILayoutDebuggingTools);
gDebugTools.init(window);
}
function SetShowFrameBorders(inShow)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.showFrameBorders = inShow;
gDebugTools.visualDebugging = inShow;
}
function SetShowEventTargetBorders(inShow)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.showEventTargetFrameBorder = inShow;
gDebugTools.visualEventDebugging = inShow;
}
function SetShowReflowStats(theWindow, inShow)
function SetShowReflowStats(inShow)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.setShowReflowStats(theWindow, inShow);
gDebugTools.reflowCounts = inShow;
}
function DumpFrames()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.dumpFrames(window, null);
gDebugTools.dumpFrames();
}
function DumpContent()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.dumpContent(window, null);
gDebugTools.dumpContent();
}
function DumpViews()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.dumpViews(window, null);
gDebugTools.dumpViews();
}
function DumpWebShells()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
debugObject.dumpWebShells(window, null);
gDebugTools.dumpWebShells();
}
</script>
<body>
<body onload="Init()">
<h1>Layout Debug Utils</h1>
<p>Note that these only work in debug builds</h1>
@ -87,7 +88,7 @@ function DumpWebShells()
<input type="checkbox"
id="showReflowStatsCheck"
name="showReflowStatsCheck"
onchange="SetShowReflowStats(window, document.windowform.showReflowStatsCheck.checked)"></input>
onchange="SetShowReflowStats(document.windowform.showReflowStatsCheck.checked)"></input>
<label for="showReflowStatsCheck">Show Reflow Stats</label>
</form>

View File

@ -320,7 +320,7 @@ function ChooseOutputDirectory(inputElementID)
function CompareFrameDumps(testFileBasename, baselineDir, baselineExt, verifyDir, verifyExt)
{
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
var debugObject = Components.classes["@mozilla.org/layout-debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
var baseFile = baselineDir.clone();
baseFile.append(testFileBasename + baselineExt);
@ -341,7 +341,7 @@ function CompareFrameDumps(testFileBasename, baselineDir, baselineExt, verifyDir
function DumpFrames(testWindow, testFileName, outputDir, outputFileExtension)
{
var debugObject = Components.classes["@mozilla.org/layout_debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
var debugObject = Components.classes["@mozilla.org/layout-debug/regressiontester;1"].createInstance(nsILayoutRegressionTester);
var outputFile = outputDir.clone();
outputFile.append(testFileName.replace(".html", outputFileExtension));