Skip to content

Commit

Permalink
squash 'resources/unpacked/devtools' changes from e189b9c..7f1d79e
Browse files Browse the repository at this point in the history
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
  • Loading branch information
darwin committed Oct 8, 2016
1 parent 61a9afd commit 58697ff
Show file tree
Hide file tree
Showing 61 changed files with 1,036 additions and 832 deletions.
2 changes: 2 additions & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ devtools_core_base_files = [
"front_end/Runtime.js",
]
devtools_common_js_files = [
"front_end/common/CharacterIdMap.js",
"front_end/common/Color.js",
"front_end/common/Console.js",
"front_end/common/ContentProvider.js",
Expand Down Expand Up @@ -533,6 +534,7 @@ devtools_network_js_files = [
"front_end/network/NetworkOverview.js",
"front_end/network/NetworkPanel.js",
"front_end/network/NetworkTimeCalculator.js",
"front_end/network/NetworkTimelineColumn.js",
"front_end/network/RequestCookiesView.js",
"front_end/network/RequestHeadersView.js",
"front_end/network/RequestHTMLView.js",
Expand Down
44 changes: 44 additions & 0 deletions front_end/common/CharacterIdMap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/**
* @constructor
* @template T
*/
WebInspector.CharacterIdMap = function()
{
/** @type {!Map<T, string>} */
this._elementToCharacter = new Map();
/** @type {!Map<string, T>} */
this._characterToElement = new Map();
this._charCode = 33;
}

WebInspector.CharacterIdMap.prototype = {
/**
* @param {T} object
* @return {string}
*/
toChar: function(object)
{
var character = this._elementToCharacter.get(object);
if (!character) {
if (this._charCode >= 0xFFFF)
throw new Error("CharacterIdMap ran out of capacity!");
character = String.fromCharCode(this._charCode++);
this._elementToCharacter.set(object, character);
this._characterToElement.set(character, object);
}
return character;
},

/**
* @param {string} character
* @return {?T}
*/
fromChar: function(character)
{
return this._characterToElement.get(character) || null;
}
}
3 changes: 2 additions & 1 deletion front_end/common/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"Trie.js",
"UIString.js",
"ModuleExtensionInterfaces.js",
"FormatterWorkerPool.js"
"FormatterWorkerPool.js",
"CharacterIdMap.js"
]
}
2 changes: 1 addition & 1 deletion front_end/components/DOMPresentationUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ WebInspector.DOMPresentationUtils.linkifyDeferredNodeReference = function(deferr
var link = shadowRoot.createChild("div", "node-link");
link.createChild("content");
link.addEventListener("click", deferredNode.resolve.bind(deferredNode, onDeferredNodeResolved), false);
link.addEventListener("mousedown", consumeEvent, false);
link.addEventListener("mousedown", (e) => e.consume(), false);

/**
* @param {?WebInspector.DOMNode} node
Expand Down
11 changes: 6 additions & 5 deletions front_end/components/DockController.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ WebInspector.DockController.prototype = {

/**
* @param {string} dockSide
* @suppressGlobalPropertiesCheck
*/
setDockSide: function(dockSide)
{
Expand All @@ -126,7 +127,7 @@ WebInspector.DockController.prototype = {
if (this._dockSide)
this._lastDockStateSetting.set(this._dockSide);

WebInspector.DockController._previousFocusedElement = WebInspector.currentFocusElement();
this._savedFocus = document.deepActiveElement();
var eventData = { from: this._dockSide, to: dockSide };
this.dispatchEventToListeners(WebInspector.DockController.Events.BeforeDockSideChanged, eventData);
console.timeStamp("DockController.setIsDocked");
Expand All @@ -143,10 +144,10 @@ WebInspector.DockController.prototype = {
_setIsDockedResponse: function(eventData)
{
this.dispatchEventToListeners(WebInspector.DockController.Events.AfterDockSideChanged, eventData);

if (WebInspector.DockController._previousFocusedElement)
WebInspector.DockController._previousFocusedElement.focus();
delete WebInspector.DockController._previousFocusedElement;
if (this._savedFocus) {
this._savedFocus.focus();
this._savedFocus = null;
}
},

/**
Expand Down
7 changes: 4 additions & 3 deletions front_end/components/Spectrum.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ WebInspector.Spectrum = function()
WebInspector.VBox.call(this, true);
this.registerRequiredCSS("components/spectrum.css");
this.contentElement.tabIndex = 0;
this.setDefaultFocusedElement(this.contentElement);

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

_focus: function()
{
if (this.isShowing() && WebInspector.currentFocusElement() !== this.contentElement)
WebInspector.setCurrentFocusElement(this.contentElement);
if (this.isShowing())
this.contentElement.focus();
},

/**
Expand Down Expand Up @@ -328,7 +329,7 @@ WebInspector.Spectrum.prototype = {
this._shadesContainer.appendChild(shadeElement);
}

WebInspector.setCurrentFocusElement(this._shadesContainer);
this._shadesContainer.focus();
this._shadesCloseHandler = closeLightnessShades.bind(this, colorElement);
this._shadesContainer.ownerDocument.addEventListener("mousedown", this._shadesCloseHandler, true);
},
Expand Down
1 change: 0 additions & 1 deletion front_end/console/ConsoleView.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ WebInspector.ConsoleView.prototype = {
wasShown: function()
{
this._viewport.refresh();
this.focus();
},

focus: function()
Expand Down
Loading

0 comments on commit 58697ff

Please sign in to comment.