Skip to content

Commit 6cf61d7

Browse files
author
Chris K
committed
Some style fixes.
1 parent 60f9aa7 commit 6cf61d7

File tree

6 files changed

+102
-40
lines changed

6 files changed

+102
-40
lines changed

src/ecma-debugger/action_handler.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,11 @@ window.eventHandlers.click['set-break-point'] = function(event)
170170
var li = target.get_ancestor("li");
171171
var input = li.querySelector("input");
172172
var line_number = input && Number(input.value);
173+
if (!line_number)
174+
{
175+
var span = li.querySelector(".line-number");
176+
line_number = span && Number(span.textContent);
177+
}
173178
var script_id = window.views.js_source.getCurrentScriptId() ||
174179
Number(target.get_ancestor_attr("data-script-id"));
175180
if (script_id && line_number)

src/ecma-debugger/evlistenertooltip/evlistenertemplates.js

Lines changed: 39 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
this.ev_listeners = function(listener_list, rt_id)
44
{
55
return ["dl", listener_list.map(this._ev_listener.bind(this, rt_id)),
6-
"class", "ev-listener"]; // , this), "class", "ev-listener"];
6+
"class", "ev-listener mono"];
77
};
88

99
this._ev_listener = function(rt_id, listener)
@@ -19,6 +19,8 @@
1919
var LISTENER_OBJECT_ID = 4;
2020
var LISTENER_SCRIPT_DATA = 5;
2121
var ret = [];
22+
var position = listener[POSITION];
23+
2224
ret.push(["dt", listener[EVENT_TYPE], "class", "ev-type"]);
2325
ret.push(["dd", listener[USE_CAPTURE] ? "capturing phase" : "bubbling phase",
2426
"class", "ev-phase"]);
@@ -31,40 +33,21 @@
3133
"data-obj-id", String(listener[LISTENER_OBJECT_ID]),
3234
"data-class-name", "Function",
3335
"class", "ev-origin"]]);
34-
var position = listener[POSITION];
3536
var script_id = position && position[SCRIPT_ID];
3637
var script = window.runtimes.getScript(script_id);
3738
if (script)
3839
{
39-
var script_type = this._script_type_map[script.script_type] ||
40-
script.script_type;
41-
var ctx = [];
42-
if (script.uri)
43-
{
44-
var is_linked = script.script_type == "linked";
45-
ctx.push("span", "added in " + script.filename + ":" + position[LINE_NUMBER], // TODO ui string
46-
"data-tooltip", is_linked && "url-tooltip",
47-
"data-tooltip-text", is_linked && script.uri);
48-
}
49-
else
50-
{
51-
var rt = window.runtimes.getRuntime(script.runtime_id);
52-
if (rt)
53-
ctx.push("span", "added in " + rt.filename, // TODO ui string
54-
"data-tooltip", "url-tooltip",
55-
"data-tooltip-text", rt.uri);
56-
else
57-
opera.postError(ui_strings.S_DRAGONFLY_INFO_MESSAGE +
58-
" missing runtime in _ev_listener template.");
59-
}
6040

61-
if (ctx.length)
41+
var sc_link = this.script_link_with_file_number(script,
42+
position[LINE_NUMBER],
43+
"added in %s"); //TODO ui string
44+
if (sc_link.length)
6245
{
63-
ctx.push("handler", "show-log-entry-source",
64-
"data-scriptid", String(script_id),
65-
"data-scriptline", String(position[LINE_NUMBER]),
66-
"class", "ev-added");
67-
ret.push(["dd", ctx]);
46+
sc_link.push("handler", "show-log-entry-source",
47+
"data-scriptid", String(script_id),
48+
"data-scriptline", String(position[LINE_NUMBER]),
49+
"class", "ev-added");
50+
ret.push(["dd", sc_link]);
6851
}
6952
}
7053
else
@@ -73,4 +56,31 @@
7356
return ret;
7457
};
7558

59+
this.script_link_with_file_number = function(script, line_number, str)
60+
{
61+
str || (str = "%s");
62+
var ret = [];
63+
var script_type = this._script_type_map[script.script_type] ||
64+
script.script_type;
65+
if (script.uri)
66+
{
67+
var is_linked = script.script_type == "linked";
68+
ret.push("span", str.replace("%s", script.filename + ":" + line_number),
69+
"data-tooltip", is_linked && "url-tooltip",
70+
"data-tooltip-text", is_linked && script.uri);
71+
}
72+
else
73+
{
74+
var rt = window.runtimes.getRuntime(script.runtime_id);
75+
if (rt)
76+
ret.push("span", str.replace("%s", rt.filename),
77+
"data-tooltip", "url-tooltip",
78+
"data-tooltip-text", rt.uri);
79+
else
80+
opera.postError(ui_strings.S_DRAGONFLY_INFO_MESSAGE +
81+
" missing runtime in _ev_listener template.");
82+
}
83+
return ret;
84+
}
85+
7686
}).apply(window.templates || (window.templates = {}));

src/ecma-debugger/objectinspection.6.0/prettyprinter.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,16 @@ cls.PrettyPrinter.types[cls.PrettyPrinter.FUNCTION] =
117117
var end_line = ctx.function_definition.end_line;
118118
var line_numbers = ["ul"];
119119
var lines = ["div"];
120+
var head = [];
121+
var sc_link = window.templates.script_link_with_file_number(script, start_line);
122+
if (sc_link)
123+
{
124+
sc_link.push("handler", "show-log-entry-source",
125+
"data-scriptid", String(script.script_id),
126+
"data-scriptline", String(start_line),
127+
"data-script-endline", String(end_line)),
128+
head = ["h2", sc_link, "class", "js-tooltip-title"];
129+
}
120130
for (var i = start_line; i <= end_line; i++)
121131
{
122132
var data = script.get_line(i);
@@ -125,15 +135,18 @@ cls.PrettyPrinter.types[cls.PrettyPrinter.FUNCTION] =
125135
window.templates.highlight_js_source(data, null, start_state, line_tmpl);
126136
lines.push(line_tmpl);
127137
var num_templ = ["li"];
128-
num_templ.push(["input", "value", String(i)]);
129-
num_templ.push(["span", "handler", "set-break-point"]);
138+
num_templ.push(["span", String(i), "class", "line-number"]);
139+
num_templ.push(["span", "handler", "set-break-point", "class", "break-point"]);
130140
line_numbers.push(num_templ);
131141
}
132142
lines.push("class", "js-source-content js-source mono");
133143
line_numbers.push("class", "js-source-line-numbers");
144+
134145
tmpl = ["div",
135-
lines,
136-
line_numbers,
146+
head,
147+
["div",
148+
["div", lines, line_numbers, "class", "position-relative"],
149+
"class", "js-tooltip-examine-container mono"],
137150
"class", "tooltip-function-source",
138151
"data-script-id", String(script.script_id)];
139152
}

src/ui-scripts/tooltip/tooltip.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
color: #000;
1414
background-color: #aac2f2;
1515
box-shadow: 0 0 0 1px #aac2f2;
16+
border-radius: 2px;
1617
}
1718

1819
.basic-tooltip

src/ui-style/debugger_style.css

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -694,11 +694,19 @@ parent-offset
694694
.node-with-ev-listener
695695
{
696696
display: inline-block;
697-
width: 16px;
698-
height: 16px;
699-
background: transparent url("../ui-images/icons/icon_ev_listener.png") no-repeat 0 0;
697+
height: 12px;
698+
line-height: 12px;
700699
vertical-align: middle;
701700
margin-left: 3px;
701+
padding: 0 2px;
702+
background-color: hsl(0, 0% , 70%);
703+
color: #fff;
704+
border-radius: 2px;
705+
}
706+
707+
.node-with-ev-listener::after
708+
{
709+
content: "ev";
702710
}
703711

704712
.css-layout > div > h2:first-child
@@ -1615,19 +1623,42 @@ d
16151623
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
16161624
}
16171625

1626+
.ev-listener
1627+
{
1628+
margin: 0;
1629+
}
1630+
1631+
.ev-type
1632+
{
1633+
font-weight: bold;
1634+
}
1635+
16181636
.ev-added,
16191637
.ev-origin
16201638
{
16211639
border-radius: 2px;
16221640
}
16231641

1624-
.tooltip-function-source
1642+
.tooltip-function-source .js-tooltip-examine-container
16251643
{
1626-
position: relative;
1644+
padding: 0;
1645+
}
1646+
1647+
.tooltip-function-source .js-source-line-numbers
1648+
{
1649+
background-color: hsla(0, 0%, 0%, .03);
1650+
border-radius: 0 0 0 3px;
16271651
}
16281652

16291653
.tooltip-function-source .js-source-content
16301654
{
16311655
margin-left: 40px;
16321656
}
16331657

1658+
.position-relative
1659+
{
1660+
position: relative;
1661+
}
1662+
1663+
1664+

src/ui-style/js-source.css

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
position: relative;
8585
}
8686

87-
.js-source-line-numbers span
87+
.js-source-line-numbers .break-point
8888
{
8989
position: absolute;
9090
left: 0;
@@ -94,7 +94,8 @@
9494
background: transparent url('../ui-images/line-types.png') no-repeat 0 0;
9595
}
9696

97-
.js-source-line-numbers input
97+
.js-source-line-numbers input,
98+
.js-source-line-numbers .line-number
9899
{
99100
width: 37px;
100101
text-align: right;
@@ -108,6 +109,7 @@
108109
font-family: inherit;
109110
vertical-align: middle;
110111
color: #b3b3b3;
112+
display: inline-block;
111113
}
112114

113115
.js-source-line-numbers input:hover

0 commit comments

Comments
 (0)