diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/devtools/front_end/ui')
5 files changed, 55 insertions, 40 deletions
diff --git a/chromium/third_party/blink/renderer/devtools/front_end/ui/ShortcutRegistry.js b/chromium/third_party/blink/renderer/devtools/front_end/ui/ShortcutRegistry.js index 0178835dbff..648ca00c381 100644 --- a/chromium/third_party/blink/renderer/devtools/front_end/ui/ShortcutRegistry.js +++ b/chromium/third_party/blink/renderer/devtools/front_end/ui/ShortcutRegistry.js @@ -118,36 +118,18 @@ UI.ShortcutRegistry = class { * @param {string} domKey * @param {!KeyboardEvent=} event */ - handleKey(key, domKey, event) { + async handleKey(key, domKey, event) { const keyModifiers = key >> 8; const actions = this._applicableActions(key); - if (!actions.length) + if (!actions.length || isPossiblyInputKey()) return; - if (UI.Dialog.hasInstance()) { - if (event && !isPossiblyInputKey()) - event.consume(true); + if (event) + event.consume(true); + if (UI.Dialog.hasInstance()) return; - } - - if (!isPossiblyInputKey()) { - if (event) - event.consume(true); - processNextAction.call(this, false); - } else { - this._pendingActionTimer = setTimeout(processNextAction.bind(this, false), 0); - } - - /** - * @param {boolean} handled - * @this {UI.ShortcutRegistry} - */ - function processNextAction(handled) { - delete this._pendingActionTimer; - const action = actions.shift(); - if (!action || handled) + for (const action of actions) { + if (await action.execute()) return; - - action.execute().then(processNextAction.bind(this)); } /** @@ -203,18 +185,10 @@ UI.ShortcutRegistry = class { this._defaultKeyToActions.set(String(descriptor.key), actionId); } - dismissPendingShortcutAction() { - if (this._pendingActionTimer) { - clearTimeout(this._pendingActionTimer); - delete this._pendingActionTimer; - } - } - /** * @param {!Document} document */ _registerBindings(document) { - document.addEventListener('input', this.dismissPendingShortcutAction.bind(this), true); const extensions = self.runtime.extensions('action'); extensions.forEach(registerExtension, this); diff --git a/chromium/third_party/blink/renderer/devtools/front_end/ui/UIUtils.js b/chromium/third_party/blink/renderer/devtools/front_end/ui/UIUtils.js index 9c2761c2ef7..7531b84bb83 100644 --- a/chromium/third_party/blink/renderer/devtools/front_end/ui/UIUtils.js +++ b/chromium/third_party/blink/renderer/devtools/front_end/ui/UIUtils.js @@ -2045,3 +2045,32 @@ UI.createExpandableText = function(text, maxLength) { }); return fragment; }; + +/** + * @interface + */ +UI.Renderer = function() {}; + +UI.Renderer.prototype = { + /** + * @param {!Object} object + * @param {!UI.Renderer.Options=} options + * @return {!Promise<?{node: !Node, tree: ?UI.TreeOutline}>} + */ + render(object, options) {} +}; + +/** + * @param {?Object} object + * @param {!UI.Renderer.Options=} options + * @return {!Promise<?{node: !Node, tree: ?UI.TreeOutline}>} + */ +UI.Renderer.render = async function(object, options) { + if (!object) + throw new Error('Can\'t render ' + object); + const renderer = await self.runtime.extension(UI.Renderer, object).instance(); + return renderer ? renderer.render(object, options || {}) : null; +}; + +/** @typedef {!{title: (string|!Element|undefined), editable: (boolean|undefined) }} */ +UI.Renderer.Options; diff --git a/chromium/third_party/blink/renderer/devtools/front_end/ui/textPrompt.css b/chromium/third_party/blink/renderer/devtools/front_end/ui/textPrompt.css index 7194f1cc897..5fb0dd61738 100644 --- a/chromium/third_party/blink/renderer/devtools/front_end/ui/textPrompt.css +++ b/chromium/third_party/blink/renderer/devtools/front_end/ui/textPrompt.css @@ -61,3 +61,7 @@ .text-prompt-editing ::content br { display: none; } + +:host-context(:not(:focus-within)) ::content ::selection { + background: transparent; +} diff --git a/chromium/third_party/blink/renderer/devtools/front_end/ui/treeoutline.css b/chromium/third_party/blink/renderer/devtools/front_end/ui/treeoutline.css index b83ae08c0b7..d8610f5cc42 100644 --- a/chromium/third_party/blink/renderer/devtools/front_end/ui/treeoutline.css +++ b/chromium/third_party/blink/renderer/devtools/front_end/ui/treeoutline.css @@ -5,7 +5,7 @@ */ :host { - flex: 1 1; + flex: 1 1 auto; padding: 2px 0 0 0; } diff --git a/chromium/third_party/blink/renderer/devtools/front_end/ui/treeoutline.js b/chromium/third_party/blink/renderer/devtools/front_end/ui/treeoutline.js index 3f5c34745ac..cb4ed7cdd78 100644 --- a/chromium/third_party/blink/renderer/devtools/front_end/ui/treeoutline.js +++ b/chromium/third_party/blink/renderer/devtools/front_end/ui/treeoutline.js @@ -43,6 +43,7 @@ UI.TreeOutline = class extends Common.Object { this.contentElement = this._rootElement._childrenListNode; this.contentElement.addEventListener('keydown', this._treeKeyDown.bind(this), false); + this._preventTabOrder = false; this._showSelectionOnKeyboardFocus = false; this._focusable = true; this.setFocusable(this._focusable); @@ -54,9 +55,11 @@ UI.TreeOutline = class extends Common.Object { /** * @param {boolean} show + * @param {boolean=} preventTabOrder */ - setShowSelectionOnKeyboardFocus(show) { + setShowSelectionOnKeyboardFocus(show, preventTabOrder) { this.contentElement.classList.toggle('hide-selection-when-blurred', show); + this._preventTabOrder = !!preventTabOrder; this._showSelectionOnKeyboardFocus = show; } @@ -225,7 +228,7 @@ UI.TreeOutline = class extends Common.Object { /** * @return {boolean} */ - _selectFirst() { + selectFirst() { let first = this.firstChild(); while (first && !first.selectable) first = first.traverseNextTreeElement(true); @@ -276,7 +279,7 @@ UI.TreeOutline = class extends Common.Object { } else if (event.keyCode === UI.KeyboardShortcut.Keys.Space.code) { handled = this.selectedTreeElement.onspace(); } else if (event.key === 'Home') { - handled = this._selectFirst(); + handled = this.selectFirst(); } else if (event.key === 'End') { handled = this._selectLast(); } @@ -936,7 +939,7 @@ UI.TreeElement = class { * @return {boolean} */ collapseOrAscend(altKey) { - if (this.expanded) { + if (this.expanded && this._collapsible) { if (altKey) this.collapseRecursively(); else @@ -1035,8 +1038,11 @@ UI.TreeElement = class { * @return {boolean} */ select(omitFocus, selectedByUser) { - if (!this.treeOutline || !this.selectable || this.selected) + if (!this.treeOutline || !this.selectable || this.selected) { + if (!omitFocus) + this.listItemElement.focus(); return false; + } // Wait to deselect this element so that focus only changes once const lastSelected = this.treeOutline.selectedTreeElement; this.treeOutline.selectedTreeElement = null; @@ -1044,6 +1050,8 @@ UI.TreeElement = class { if (this.treeOutline._rootElement === this) { if (lastSelected) lastSelected.deselect(); + if (!omitFocus) + this.listItemElement.focus(); return false; } @@ -1067,7 +1075,7 @@ UI.TreeElement = class { */ _setFocusable(focusable) { if (focusable) { - this._listItemNode.setAttribute('tabIndex', 0); + this._listItemNode.setAttribute('tabIndex', this.treeOutline && this.treeOutline._preventTabOrder ? -1 : 0); this._listItemNode.addEventListener('focus', this._boundOnFocus, false); this._listItemNode.addEventListener('blur', this._boundOnBlur, false); } else { |