summaryrefslogtreecommitdiffstats
path: root/layout/tools/tests/debug_utils.html
blob: 4c2ba98c5fc770c1d25c52f98e929faf934141f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
	<title>Layout Debug Utilities</title>
</head>
<script type="application/javascript">

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");
  gDebugTools.visualDebugging = inShow;
}

function SetShowEventTargetBorders(inShow)
{
  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
  gDebugTools.visualEventDebugging = inShow;
}

function SetShowReflowStats(inShow)
{
  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
  gDebugTools.reflowCounts = inShow;
}

function DumpFrames()
{
  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
  gDebugTools.dumpFrames();
}

function DumpContent()
{
  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
  gDebugTools.dumpContent();
}

function DumpViews()
{
  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
  gDebugTools.dumpViews();
}

function DumpWebShells()
{
  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
  gDebugTools.dumpWebShells();
}

</script>

<body onload="Init()">
<h1>Layout Debug Utils</h1>

<p>Note that these only work in debug builds</h1>

<h2>Global settings</h2>

<form name="globalsform">
<div>
<input type="checkbox" id="showBordersCheck" name="showBordersCheck"
    onchange="SetShowFrameBorders(document.globalsform.showBordersCheck.checked)"></input>
<label for="showBordersCheck">Show Frame Borders</label>
</div>
<div>
<input type="checkbox"
    id="showEventTargetCheck"
    name="showEventTargetCheck"
    onchange="SetShowEventTargetBorders(document.globalsform.showEventTargetCheck.checked)"></input>
<label for="showEventTargetCheck">Show Event Target Borders</label>
</div>
</form>

<h2>Per-Window settings</h2>

<form name="windowform">
<input type="checkbox"
    id="showReflowStatsCheck"
    name="showReflowStatsCheck"
    onchange="SetShowReflowStats(document.windowform.showReflowStatsCheck.checked)"></input>
<label for="showReflowStatsCheck">Show Reflow Stats</label>
</form>

<h2>Dumping</h2>

<form name="dumpform">
<div>
<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()">
</div>

</form>



</body>
</html>