Skip to content

Commit 58697ff

Browse files
committed
squash 'resources/unpacked/devtools' changes from e189b9c..7f1d79e
7f1d79e [DevTools] Cleanup DOMExtension.js. 51874ed DevTools: render element tree hover as a block. 9633b79 [Devtools] New network timeline experiment Part 1 3972f98 Timeline: fix sync layout warning in case of microtasks 75330c0 DevTools: introduce WI.CharacterIdMap ab663e4 [DevTools] Rework some focus code. 4ad969d DevTools: Migrate from SourcesTextEditorDelegate to events 493a661 DevTools: minor cleanup of ConsoleViewMessage, use switch for formatters 42daf73 DevTools: disable smoothing and correct nexus device frame dimensions for screenshots 36d8949 [DevTools] Support top/bottom show sidebar button. cb082a9 DevTools: fix sourceMapURL for inline stylesheets git-subtree-dir: resources/unpacked/devtools git-subtree-split: 7f1d79e
1 parent 61a9afd commit 58697ff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1036
-832
lines changed

BUILD.gn

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ devtools_core_base_files = [
2323
"front_end/Runtime.js",
2424
]
2525
devtools_common_js_files = [
26+
"front_end/common/CharacterIdMap.js",
2627
"front_end/common/Color.js",
2728
"front_end/common/Console.js",
2829
"front_end/common/ContentProvider.js",
@@ -533,6 +534,7 @@ devtools_network_js_files = [
533534
"front_end/network/NetworkOverview.js",
534535
"front_end/network/NetworkPanel.js",
535536
"front_end/network/NetworkTimeCalculator.js",
537+
"front_end/network/NetworkTimelineColumn.js",
536538
"front_end/network/RequestCookiesView.js",
537539
"front_end/network/RequestHeadersView.js",
538540
"front_end/network/RequestHTMLView.js",

front_end/common/CharacterIdMap.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Copyright 2016 The Chromium Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
/**
6+
* @constructor
7+
* @template T
8+
*/
9+
WebInspector.CharacterIdMap = function()
10+
{
11+
/** @type {!Map<T, string>} */
12+
this._elementToCharacter = new Map();
13+
/** @type {!Map<string, T>} */
14+
this._characterToElement = new Map();
15+
this._charCode = 33;
16+
}
17+
18+
WebInspector.CharacterIdMap.prototype = {
19+
/**
20+
* @param {T} object
21+
* @return {string}
22+
*/
23+
toChar: function(object)
24+
{
25+
var character = this._elementToCharacter.get(object);
26+
if (!character) {
27+
if (this._charCode >= 0xFFFF)
28+
throw new Error("CharacterIdMap ran out of capacity!");
29+
character = String.fromCharCode(this._charCode++);
30+
this._elementToCharacter.set(object, character);
31+
this._characterToElement.set(character, object);
32+
}
33+
return character;
34+
},
35+
36+
/**
37+
* @param {string} character
38+
* @return {?T}
39+
*/
40+
fromChar: function(character)
41+
{
42+
return this._characterToElement.get(character) || null;
43+
}
44+
}

front_end/common/module.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"Trie.js",
2727
"UIString.js",
2828
"ModuleExtensionInterfaces.js",
29-
"FormatterWorkerPool.js"
29+
"FormatterWorkerPool.js",
30+
"CharacterIdMap.js"
3031
]
3132
}

front_end/components/DOMPresentationUtils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ WebInspector.DOMPresentationUtils.linkifyDeferredNodeReference = function(deferr
137137
var link = shadowRoot.createChild("div", "node-link");
138138
link.createChild("content");
139139
link.addEventListener("click", deferredNode.resolve.bind(deferredNode, onDeferredNodeResolved), false);
140-
link.addEventListener("mousedown", consumeEvent, false);
140+
link.addEventListener("mousedown", (e) => e.consume(), false);
141141

142142
/**
143143
* @param {?WebInspector.DOMNode} node

front_end/components/DockController.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ WebInspector.DockController.prototype = {
114114

115115
/**
116116
* @param {string} dockSide
117+
* @suppressGlobalPropertiesCheck
117118
*/
118119
setDockSide: function(dockSide)
119120
{
@@ -126,7 +127,7 @@ WebInspector.DockController.prototype = {
126127
if (this._dockSide)
127128
this._lastDockStateSetting.set(this._dockSide);
128129

129-
WebInspector.DockController._previousFocusedElement = WebInspector.currentFocusElement();
130+
this._savedFocus = document.deepActiveElement();
130131
var eventData = { from: this._dockSide, to: dockSide };
131132
this.dispatchEventToListeners(WebInspector.DockController.Events.BeforeDockSideChanged, eventData);
132133
console.timeStamp("DockController.setIsDocked");
@@ -143,10 +144,10 @@ WebInspector.DockController.prototype = {
143144
_setIsDockedResponse: function(eventData)
144145
{
145146
this.dispatchEventToListeners(WebInspector.DockController.Events.AfterDockSideChanged, eventData);
146-
147-
if (WebInspector.DockController._previousFocusedElement)
148-
WebInspector.DockController._previousFocusedElement.focus();
149-
delete WebInspector.DockController._previousFocusedElement;
147+
if (this._savedFocus) {
148+
this._savedFocus.focus();
149+
this._savedFocus = null;
150+
}
150151
},
151152

152153
/**

front_end/components/Spectrum.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ WebInspector.Spectrum = function()
4848
WebInspector.VBox.call(this, true);
4949
this.registerRequiredCSS("components/spectrum.css");
5050
this.contentElement.tabIndex = 0;
51+
this.setDefaultFocusedElement(this.contentElement);
5152

5253
this._colorElement = this.contentElement.createChild("div", "spectrum-color");
5354
this._colorDragElement = this._colorElement.createChild("div", "spectrum-sat fill").createChild("div", "spectrum-val fill").createChild("div", "spectrum-dragger");
@@ -228,8 +229,8 @@ WebInspector.Spectrum.prototype = {
228229

229230
_focus: function()
230231
{
231-
if (this.isShowing() && WebInspector.currentFocusElement() !== this.contentElement)
232-
WebInspector.setCurrentFocusElement(this.contentElement);
232+
if (this.isShowing())
233+
this.contentElement.focus();
233234
},
234235

235236
/**
@@ -328,7 +329,7 @@ WebInspector.Spectrum.prototype = {
328329
this._shadesContainer.appendChild(shadeElement);
329330
}
330331

331-
WebInspector.setCurrentFocusElement(this._shadesContainer);
332+
this._shadesContainer.focus();
332333
this._shadesCloseHandler = closeLightnessShades.bind(this, colorElement);
333334
this._shadesContainer.ownerDocument.addEventListener("mousedown", this._shadesCloseHandler, true);
334335
},

front_end/console/ConsoleView.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,6 @@ WebInspector.ConsoleView.prototype = {
332332
wasShown: function()
333333
{
334334
this._viewport.refresh();
335-
this.focus();
336335
},
337336

338337
focus: function()

0 commit comments

Comments
 (0)