Skip to content

Commit c3cb2eb

Browse files
committed
squash 'resources/unpacked/devtools' changes from 5708432..0f159bf
0f159bf DevTools: CSSSourceFrame -> CSSPlugin ab85ac7 DevTools: Move default CodeMirror theme into cmdevtools.css ea1ce3b DevTools: fix cursor style and disabled state for TextPrompt e02f8e8 DevTools: do not group JS-source error messages c1c155b DevTools: Show focus outline for checkboxes in devices screen 3f1d0b9 DevTools: Don't have hover state for non-highlightable nodes aac1780 Add space before Milestone token in Console message 6032773 DevTools: align position of console level dropdown 5bc121b Reland "DevTools: Report column number for FunctionCall trace events." 2f03362 DevTools: Disable console context selector when it is empty 7c3ffee Revert "DevTools: automatically migrate http/tests/devtools/tracing/*.html" d9d5f4b [DevTools] prepare frontend for numbers without description git-subtree-dir: resources/unpacked/devtools git-subtree-split: 0f159bf
1 parent 302f9f8 commit c3cb2eb

36 files changed

+356
-375
lines changed

BUILD.gn

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -614,15 +614,14 @@ all_devtools_files = [
614614
"front_end/source_frame/SourceCodeDiff.js",
615615
"front_end/source_frame/SourceFrame.js",
616616
"front_end/source_frame/SourcesTextEditor.js",
617-
"front_end/source_frame/UISourceCodeFrame.js",
618617
"front_end/source_frame/xmlTree.css",
619618
"front_end/source_frame/xmlView.css",
620619
"front_end/source_frame/XMLView.js",
621620
"front_end/sources/AddSourceMapURLDialog.js",
622621
"front_end/sources/AdvancedSearchView.js",
623622
"front_end/sources/callStackSidebarPane.css",
624623
"front_end/sources/CallStackSidebarPane.js",
625-
"front_end/sources/CSSSourceFrame.js",
624+
"front_end/sources/CSSPlugin.js",
626625
"front_end/sources/dialog.css",
627626
"front_end/sources/EditingLocationHistoryManager.js",
628627
"front_end/sources/eventListenerBreakpoints.css",
@@ -660,6 +659,7 @@ all_devtools_files = [
660659
"front_end/sources/SourcesSearchScope.js",
661660
"front_end/sources/sourcesView.css",
662661
"front_end/sources/SourcesView.js",
662+
"front_end/sources/UISourceCodeFrame.js",
663663
"front_end/sources/TabbedEditorContainer.js",
664664
"front_end/sources/threadsSidebarPane.css",
665665
"front_end/sources/ThreadsSidebarPane.js",

front_end/cm/PRESUBMIT.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def _CheckCodeMirrorChanges(input_api, output_api):
3232
"rolls from the upstream (http://codemirror.net). If this is a roll, "
3333
"make sure you mention 'roll CodeMirror' (no quotes) in the change description.\n"
3434
"CodeMirror rolling instructions:\n"
35-
" https://sites.google.com/a/chromium.org/devtools-codemirror-rolling")
35+
" src/third_party/WebKit/Source/devtools/front_end/cm/README.md")
3636
changeDescription = input_api.change.DescriptionText()
3737
errors = []
3838
if not "roll codemirror" in changeDescription.lower():

front_end/cm/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Rolling CodeMirror
2+
3+
## What's this about?
4+
CodeMirror is a third-party library, which supports editing experience in Chrome DevTools. DevTools does not fork CodeMirror, thus all CodeMirror patches should go upstream to http://codemirror.net.
5+
Every once in a while, the CodeMirror dependency (which is located in Source/devtools/front_end/cm/ folder) should be updated to a newer version.
6+
7+
## Updating CodeMirror
8+
This requires the following steps to be done:
9+
1. File `headlesscodemirror.js` is a `runmode-standalone.js` file from CodeMirror distribution, but wrapped in `(function(window) { ... }(this))`
10+
construction. This is needed to support in web workers.
11+
2. File `markselection.js` is a `mark-selection.js` from CodeMirror distribution. The "dash" is removed due to the restriction on the chromium grd generator.
12+
4. File codemirror.css contains both the default theme of CodeMirror and structural css required for it to work. Discard everything in the file up to the word `/* STOP */`.
13+
3. All other files in front_end/cm/ folder should be substituted with their newer versions from the upstream.
14+
15+
## Testing
16+
DevTools wrap CodeMirror via `CodeMirrorTextEditor.js` and `cmdevtools.css` files.
17+
Although there are a couple of automated tests (LayoutTests/inspector/editor/) to verify overall sanity of the setup, a manual testing is mandatory before
18+
landing a roll. Here is a rough testing scenario outline:
19+
1. Create a new snippet and type in a small function with a few nested for-loops. (The author suggests a bubble-sort). Make sure that:
20+
* Words `function`, `for`, `var` are highlighted
21+
* "Smart braces" behavior works
22+
* "Enter" after opening curly brace adds correct indent
23+
* Autocompletion works
24+
* Multiple cursors functionality works as intended - Ctrl+D/Ctrl+U shortcuts
25+
* Set a breakpoint inside a function, select some text and summon a context menu over it.
26+
2. Make sure there are items such as "Add to Watch", "Evaluate in Console" and "Copy/Paste"
27+
Make sure minified jquery opens nicely in the editor (minified jquery could be found as a resource on http://jquery.com)
28+
* Verify `jquery.min.js` is formatted via "Pretty print" action
29+
3. Go to the Elements panel, select a node and verify the "Edit it as HTML" command works.
30+
31+
## Committing
32+
The only changes allowed to front_end/cm/ folder are CodeMirror rolls. There's a presubmit check that enforces this, so make sure you include the phrase "roll CodeMirror" into
33+
your patch description.
34+
35+
## Example
36+
Example CodeMirror roll patchset: https://codereview.chromium.org/273763003

front_end/cm/codemirror.css

Lines changed: 0 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -1,149 +1,3 @@
1-
/* BASICS */
2-
3-
.CodeMirror {
4-
/* Set height, width, borders, and global font properties here */
5-
font-family: monospace;
6-
height: 300px;
7-
color: black;
8-
}
9-
10-
/* PADDING */
11-
12-
.CodeMirror-lines {
13-
padding: 4px 0; /* Vertical padding around content */
14-
}
15-
.CodeMirror pre {
16-
padding: 0 4px; /* Horizontal padding of content */
17-
}
18-
19-
.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
20-
background-color: white; /* The little square between H and V scrollbars */
21-
}
22-
23-
/* GUTTER */
24-
25-
.CodeMirror-gutters {
26-
border-right: 1px solid #ddd;
27-
background-color: #f7f7f7;
28-
white-space: nowrap;
29-
}
30-
.CodeMirror-linenumbers {}
31-
.CodeMirror-linenumber {
32-
padding: 0 3px 0 5px;
33-
min-width: 20px;
34-
text-align: right;
35-
color: #999;
36-
white-space: nowrap;
37-
}
38-
39-
.CodeMirror-guttermarker { color: black; }
40-
.CodeMirror-guttermarker-subtle { color: #999; }
41-
42-
/* CURSOR */
43-
44-
.CodeMirror-cursor {
45-
border-left: 1px solid black;
46-
border-right: none;
47-
width: 0;
48-
}
49-
/* Shown when moving in bi-directional text */
50-
.CodeMirror div.CodeMirror-secondarycursor {
51-
border-left: 1px solid silver;
52-
}
53-
.cm-fat-cursor .CodeMirror-cursor {
54-
width: auto;
55-
border: 0 !important;
56-
background: #7e7;
57-
}
58-
.cm-fat-cursor div.CodeMirror-cursors {
59-
z-index: 1;
60-
}
61-
62-
.cm-animate-fat-cursor {
63-
width: auto;
64-
border: 0;
65-
-webkit-animation: blink 1.06s steps(1) infinite;
66-
-moz-animation: blink 1.06s steps(1) infinite;
67-
animation: blink 1.06s steps(1) infinite;
68-
background-color: #7e7;
69-
}
70-
@-moz-keyframes blink {
71-
0% {}
72-
50% { background-color: transparent; }
73-
100% {}
74-
}
75-
@-webkit-keyframes blink {
76-
0% {}
77-
50% { background-color: transparent; }
78-
100% {}
79-
}
80-
@keyframes blink {
81-
0% {}
82-
50% { background-color: transparent; }
83-
100% {}
84-
}
85-
86-
/* Can style cursor different in overwrite (non-insert) mode */
87-
.CodeMirror-overwrite .CodeMirror-cursor {}
88-
89-
.cm-tab { display: inline-block; text-decoration: inherit; }
90-
91-
.CodeMirror-rulers {
92-
position: absolute;
93-
left: 0; right: 0; top: -50px; bottom: -20px;
94-
overflow: hidden;
95-
}
96-
.CodeMirror-ruler {
97-
border-left: 1px solid #ccc;
98-
top: 0; bottom: 0;
99-
position: absolute;
100-
}
101-
102-
/* DEFAULT THEME */
103-
104-
.cm-s-default .cm-header {color: blue;}
105-
.cm-s-default .cm-quote {color: #090;}
106-
.cm-negative {color: #d44;}
107-
.cm-positive {color: #292;}
108-
.cm-header, .cm-strong {font-weight: bold;}
109-
.cm-em {font-style: italic;}
110-
.cm-link {text-decoration: underline;}
111-
.cm-strikethrough {text-decoration: line-through;}
112-
113-
.cm-s-default .cm-keyword {color: #708;}
114-
.cm-s-default .cm-atom {color: #219;}
115-
.cm-s-default .cm-number {color: #164;}
116-
.cm-s-default .cm-def {color: #00f;}
117-
.cm-s-default .cm-variable,
118-
.cm-s-default .cm-punctuation,
119-
.cm-s-default .cm-property,
120-
.cm-s-default .cm-operator {}
121-
.cm-s-default .cm-variable-2 {color: #05a;}
122-
.cm-s-default .cm-variable-3 {color: #085;}
123-
.cm-s-default .cm-comment {color: #a50;}
124-
.cm-s-default .cm-string {color: #a11;}
125-
.cm-s-default .cm-string-2 {color: #f50;}
126-
.cm-s-default .cm-meta {color: #555;}
127-
.cm-s-default .cm-qualifier {color: #555;}
128-
.cm-s-default .cm-builtin {color: #30a;}
129-
.cm-s-default .cm-bracket {color: #997;}
130-
.cm-s-default .cm-tag {color: #170;}
131-
.cm-s-default .cm-attribute {color: #00c;}
132-
.cm-s-default .cm-hr {color: #999;}
133-
.cm-s-default .cm-link {color: #00c;}
134-
135-
.cm-s-default .cm-error {color: #f00;}
136-
.cm-invalidchar {color: #f00;}
137-
138-
.CodeMirror-composing { border-bottom: 2px solid; }
139-
140-
/* Default styles for common addons */
141-
142-
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
143-
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
144-
.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
145-
.CodeMirror-activeline-background {background: #e8f2ff;}
146-
1471
/* STOP */
1482

1493
/* The rest of this file contains styles related to the mechanics of

front_end/cm_modes/PRESUBMIT.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def _CheckCodeMirrorChanges(input_api, output_api):
88
"rolls from the upstream (http://codemirror.net). If this is a roll, "
99
"make sure you mention 'roll CodeMirror' (no quotes) in the change description.\n"
1010
"CodeMirror rolling instructions:\n"
11-
" https://sites.google.com/a/chromium.org/devtools-codemirror-rolling")
11+
" src/third_party/WebKit/Source/devtools/front_end/cm/README.md")
1212
changeDescription = input_api.change.DescriptionText()
1313
errors = []
1414
if "roll codemirror" not in changeDescription.lower():

front_end/console/ConsoleContextSelector.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ Console.ConsoleContextSelector = class {
1313
this._dropDown = new UI.SoftDropDown(this._items, this);
1414
this._dropDown.setRowHeight(36);
1515
this._toolbarItem = new UI.ToolbarItem(this._dropDown.element);
16+
this._toolbarItem.setEnabled(false);
17+
this._items.addEventListener(
18+
UI.ListModel.Events.ItemsReplaced, () => this._toolbarItem.setEnabled(!!this._items.length));
1619

1720
/** @type {!Map<!SDK.ExecutionContext, !ProductRegistry.BadgePool>} */
1821
this._badgePoolForExecutionContext = new Map();

front_end/console/ConsoleView.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,9 @@ Console.ConsoleViewFilter = class {
12401240
var setting = this._messageLevelFiltersSetting;
12411241
var levels = setting.get();
12421242

1243-
var contextMenu = new UI.ContextMenu(mouseEvent, true);
1243+
var contextMenu = new UI.ContextMenu(
1244+
mouseEvent, true /* useSoftMenu */, this._levelMenuButton.element.totalOffsetLeft(),
1245+
this._levelMenuButton.element.totalOffsetTop() + this._levelMenuButton.element.offsetHeight);
12441246
contextMenu.headerSection().appendItem(
12451247
Common.UIString('Default'), () => setting.set(Console.ConsoleFilter.defaultLevelsFilterValue()));
12461248
for (var level in this._levelLabels) {

front_end/console/ConsoleViewMessage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1385,7 +1385,7 @@ Console.ConsoleViewMessage = class {
13851385
else if (token.type === 'event')
13861386
text = Common.UIString('<some> event');
13871387
else if (token.type === 'milestone')
1388-
text = Common.UIString('M<XX>');
1388+
text = Common.UIString(' M<XX>');
13891389
else if (token.type === 'autofill')
13901390
text = Common.UIString('<attribute>');
13911391
return acc + text;

front_end/console_model/ConsoleModel.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,10 @@ ConsoleModel.ConsoleModel = class extends Common.Object {
249249
call.type === ConsoleModel.ConsoleMessage.MessageType.Log)
250250
level = ConsoleModel.ConsoleMessage.MessageLevel.Info;
251251
var message = '';
252-
if (call.args.length && typeof call.args[0].value === 'string')
253-
message = call.args[0].value;
252+
if (call.args.length && call.args[0].unserializableValue)
253+
message = call.args[0].unserializableValue;
254+
else if (call.args.length && (typeof call.args[0].value !== 'object' || call.args[0].value === null))
255+
message = call.args[0].value + '';
254256
else if (call.args.length && call.args[0].description)
255257
message = call.args[0].description;
256258
var callFrame = call.stackTrace && call.stackTrace.callFrames.length ? call.stackTrace.callFrames[0] : null;
@@ -559,11 +561,13 @@ ConsoleModel.ConsoleMessage = class {
559561
* @return {boolean}
560562
*/
561563
isGroupable() {
564+
var isJSError = this.source === ConsoleModel.ConsoleMessage.MessageSource.JS &&
565+
this.level === ConsoleModel.ConsoleMessage.MessageLevel.Error;
562566
return (
563567
this.source !== ConsoleModel.ConsoleMessage.MessageSource.ConsoleAPI &&
564568
this.type !== ConsoleModel.ConsoleMessage.MessageType.Command &&
565569
this.type !== ConsoleModel.ConsoleMessage.MessageType.Result &&
566-
this.type !== ConsoleModel.ConsoleMessage.MessageType.System);
570+
this.type !== ConsoleModel.ConsoleMessage.MessageType.System && !isJSError);
567571
}
568572

569573
/**

front_end/coverage/CoverageDecorationManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ Coverage.CoverageDecorationManager = class {
263263
Coverage.CoverageDecorationManager._decoratorType = 'coverage';
264264

265265
/**
266-
* @implements {SourceFrame.UISourceCodeFrame.LineDecorator}
266+
* @implements {SourceFrame.LineDecorator}
267267
*/
268268
Coverage.CoverageView.LineDecorator = class {
269269
/**

0 commit comments

Comments
 (0)